From: "Arnd Bergmann" <arnd@arndb.de>
To: "Marco Elver" <elver@google.com>, "Arnd Bergmann" <arnd@kernel.org>
Cc: "Josh Poimboeuf" <jpoimboe@kernel.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Borislav Petkov" <bp@suse.de>, "Will Deacon" <will@kernel.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
kasan-dev@googlegroups.com, "Dmitry Vyukov" <dvyukov@google.com>,
"Alexander Potapenko" <glider@google.com>,
"Andrey Ryabinin" <ryabinin.a.a@gmail.com>,
"Vincenzo Frascino" <vincenzo.frascino@arm.com>,
"Andrey Konovalov" <andreyknvl@gmail.com>,
"Miroslav Benes" <mbenes@suse.cz>,
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
"Sathvika Vasireddy" <sv@linux.ibm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] objtool: add UACCESS exceptions for __tsan_volatile_read/write
Date: Wed, 08 Feb 2023 20:53:20 +0100 [thread overview]
Message-ID: <c3da32e0-bfa9-415c-9970-e5506abb1a71@app.fastmail.com> (raw)
In-Reply-To: <CANpmjNN1nmjavBhj=xMMqAD1VScPySkdZbm2sTpWnKN1ZvmJcQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3425 bytes --]
On Wed, Feb 8, 2023, at 17:59, Marco Elver wrote:
> On Wed, 8 Feb 2023 at 17:40, Arnd Bergmann <arnd@kernel.org> wrote:
>>
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> A lot of the tsan helpers are already excempt from the UACCESS warnings,
>> but some more functions were added that need the same thing:
>>
>> kernel/kcsan/core.o: warning: objtool: __tsan_volatile_read16+0x0: call to __tsan_unaligned_read16() with UACCESS enabled
>> kernel/kcsan/core.o: warning: objtool: __tsan_volatile_write16+0x0: call to __tsan_unaligned_write16() with UACCESS enabled
>> vmlinux.o: warning: objtool: __tsan_unaligned_volatile_read16+0x4: call to __tsan_unaligned_read16() with UACCESS enabled
>> vmlinux.o: warning: objtool: __tsan_unaligned_volatile_write16+0x4: call to __tsan_unaligned_write16() with UACCESS enabled
>
> That's odd - this has never been needed, because all __tsan_unaligned
> are aliases for the non-unaligned functions. And all those are in the
> uaccess_safe_builtin list already.
>
> So if suddenly the alias name becomes the symbol that objtool sees, we
> might need to add all the other functions as well.
>
> Is this a special build with a new compiler?
I see this with gcc-12 and gcc-13 but not with clang-{14,15,16}, have
not tried any older versions recently.
What I see in the .s file for one of the affected configs is
.globl __tsan_unaligned_read16
.set __tsan_unaligned_read16,__tsan_read16
.p2align 6
.globl __tsan_volatile_read16
.type __tsan_volatile_read16, @function
__tsan_volatile_read16:
endbr64
jmp __tsan_read16 #
.size __tsan_volatile_read16, .-__tsan_volatile_read16
.globl __tsan_unaligned_volatile_read16
.set __tsan_unaligned_volatile_read16,__tsan_volatile_read16
...
.set __tsan_unaligned_write16,__tsan_write16
.p2align 6
.globl __tsan_volatile_write16
.type __tsan_volatile_write16, @function
__tsan_volatile_write16:
endbr64
jmp __tsan_write16 #
.size __tsan_volatile_write16, .-__tsan_volatile_write16
.globl __tsan_unaligned_volatile_write16
.set __tsan_unaligned_volatile_write16,__tsan_volatile_write16
In the object file that turns into:
0000000000004e80 <__tsan_unaligned_volatile_read16>:
4e80: f3 0f 1e fa endbr64
4e84: e9 b7 fe ff ff jmp 4d40 <__tsan_read16>
...
0000000000005000 <__tsan_unaligned_volatile_write16>:
5000: f3 0f 1e fa endbr64
5004: e9 b7 fe ff ff jmp 4ec0 <__tsan_unaligned_write16>
It appears like it picks randomly between the original name
and the alias here, no idea why. Using the clang integrated assembler
to build the .o file from the gcc generated .s file shows the same
code as
0000000000004e80 <__tsan_unaligned_volatile_read16>:
4e80: f3 0f 1e fa endbr64
4e84: e9 00 00 00 00 jmp 4e89 <__tsan_unaligned_volatile_read16+0x9>
4e85: R_X86_64_PLT32 __tsan_read16-0x4
...
0000000000005000 <__tsan_unaligned_volatile_write16>:
5000: f3 0f 1e fa endbr64
5004: e9 00 00 00 00 jmp 5009 <__tsan_unaligned_volatile_write16+0x9>
5005: R_X86_64_PLT32 __tsan_write16-0x4
Attaching the object file for reference.
Arnd
[-- Attachment #2: core.o.gz --]
[-- Type: application/gzip, Size: 21177 bytes --]
next prev parent reply other threads:[~2023-02-08 19:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 16:39 [PATCH 1/4] kasan: mark addr_has_metadata __always_inline Arnd Bergmann
2023-02-08 16:39 ` [PATCH 2/4] kmsan: disable ftrace in kmsan core code Arnd Bergmann
2023-02-08 17:00 ` Marco Elver
2023-02-08 19:31 ` Arnd Bergmann
2023-02-09 15:42 ` Alexander Potapenko
2023-02-08 16:39 ` [PATCH 3/4] objdump: add UACCESS exception for more stringops Arnd Bergmann
2023-02-08 18:09 ` Peter Zijlstra
2023-02-08 19:27 ` Arnd Bergmann
2023-02-08 16:39 ` [PATCH 4/4] objtool: add UACCESS exceptions for __tsan_volatile_read/write Arnd Bergmann
2023-02-08 16:59 ` Marco Elver
2023-02-08 19:53 ` Arnd Bergmann [this message]
2023-02-08 20:10 ` Marco Elver
2023-02-08 17:01 ` [PATCH 1/4] kasan: mark addr_has_metadata __always_inline Marco Elver
2023-02-08 18:10 ` Peter Zijlstra
2023-02-09 19:26 ` Josh Poimboeuf
2023-02-09 22:21 ` Andrey Konovalov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c3da32e0-bfa9-415c-9970-e5506abb1a71@app.fastmail.com \
--to=arnd@arndb.de \
--cc=andreyknvl@gmail.com \
--cc=arnd@kernel.org \
--cc=bp@suse.de \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=jpoimboe@kernel.org \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=ryabinin.a.a@gmail.com \
--cc=sv@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=vincenzo.frascino@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox