[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87213fd1-950d-c2d5-4aa0-2f53ea3b505c@suse.cz>
Date: Mon, 8 Jun 2020 19:32:37 +0200
From: Martin Liška <mliska@...e.cz>
To: Marco Elver <elver@...gle.com>, Borislav Petkov <bp@...en8.de>
Cc: Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Paul E. McKenney" <paulmck@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Dmitry Vyukov <dvyukov@...gle.com>, ndesaulniers@...gle.com
Subject: Re: [PATCH v5 00/18] Rework READ_ONCE() to improve codegen
On 6/3/20 9:23 PM, Marco Elver wrote:
>
>
> On Wed, 03 Jun 2020, Borislav Petkov wrote:
>
>> On Thu, May 14, 2020 at 12:05:38PM +0100, Will Deacon wrote:
>>> Talking off-list, Clang >= 7 is pretty reasonable wrt inlining decisions
>>> and the behaviour for __always_inline is:
>>>
>>> * An __always_inline function inlined into a __no_sanitize function is
>>> not instrumented
>>> * An __always_inline function inlined into an instrumented function is
>>> instrumented
>>> * You can't mark a function as both __always_inline __no_sanitize, because
>>> __no_sanitize functions are never inlined
>>>
>>> GCC, on the other hand, may still inline __no_sanitize functions and then
>>> subsequently instrument them.
>>
>> Yeah, about that: I've been looking for a way to trigger this so that
>> I can show preprocessed source to gcc people. So do you guys have a
>> .config or somesuch I can try?
>
> For example take this:
>
> int x;
>
> static inline __attribute__((no_sanitize_thread)) void do_not_sanitize(void) {
> x++;
> }
>
> void sanitize_this(void) {
> do_not_sanitize();
> }
>
> Then
>
> gcc-10 -O3 -fsanitize=thread -o example.o -c example.c
> objdump -D example.o
Hello.
Thank you for the example. It seems to me that Clang does not inline a no_sanitize_* function
into one which is instrumented. Is it a documented behavior ([1] doesn't mention that)?
If so, we can do the same in GCC.
Thanks,
Martin
[1] https://clang.llvm.org/docs/AttributeReference.html#no-sanitize
>
> will show that do_not_sanitize() was inlined into sanitize_this() and is
> instrumented. (With Clang this doesn't happen.)
>
> Hope this is enough.
>
> Thanks,
> -- Marco
>
Powered by blists - more mailing lists