lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 5 May 2020 11:38:40 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Rasmus Villemoes <linux@...musvillemoes.dk>
Cc:     x86@...nel.org, linux-kernel@...r.kernel.org, rostedt@...dmis.org,
        mhiramat@...nel.org, bristot@...hat.com, jbaron@...mai.com,
        torvalds@...ux-foundation.org, tglx@...utronix.de,
        mingo@...nel.org, namit@...are.com, hpa@...or.com, luto@...nel.org,
        ard.biesheuvel@...aro.org, jpoimboe@...hat.com,
        pbonzini@...hat.com, mathieu.desnoyers@...icios.com
Subject: Re: [PATCH v4 14/18] static_call: Add static_cond_call()

On Tue, May 05, 2020 at 09:50:26AM +0200, Rasmus Villemoes wrote:
> On 04/05/2020 22.14, Peter Zijlstra wrote:

> Anyway, it's hard to judge what version of the !HAVE_STATIC_CALL
> implementation is best when there's no !HAVE_STATIC_CALL use cases to
> look at. I just want to ensure that whatever limitations or gotchas
> (e.g., "arguments are evaluated regardless of NULLness of func", or
> alternatively "arguments must not have side effects") it ends up with
> get documented.

I can certainly try and write a better comment for it.

> > #define __static_cond_call(name) \
> > ({ \
> > 	void *func = READ_ONCE(name.func); \
> > 	if (!func) \
> > 		func = &__static_call_nop; \
> > 	(typeof(__SCT__##name)*)func; \
> > })
> 
> I think you can just make it
> 
> #define __static_cond_call(name) \
> ( \
> (typeof(__SCT__##name)*) ((void *)name.func ? : (void *)__static_call_nop) \
> )

I _think_ the compiler sees the two as exactly the same, but then, I've
not seen the inside of a modern compiler.

> but that simplification is not enough to make gcc change its mind about
> how to compile it :( But I'm guessing that various sanitizers or static
> checkers might complain about the UB.

Yeah, we'll see.

Powered by blists - more mailing lists