From: Peter Zijlstra <peterz@infradead.org>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
Ard Biesheuvel <ardb@kernel.org>
Subject: Re: [PATCH] objtool: Detect non-relocated text references
Date: Fri, 4 Oct 2024 10:21:17 +0200 [thread overview]
Message-ID: <20241004082117.GH18071@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <05fd690797ea4e1ee798b7fa497857519ae840d4.1728001850.git.jpoimboe@kernel.org>
On Thu, Oct 03, 2024 at 05:31:10PM -0700, Josh Poimboeuf wrote:
> When kernel IBT is enabled, objtool detects all text references in order
> to determine which functions can be indirectly branched to.
>
> In text, such references look like one of the following:
>
> mov $0x0,%rax R_X86_64_32S .init.text+0x7e0a0
> lea 0x0(%rip),%rax R_X86_64_PC32 autoremove_wake_function-0x4
>
> Either way the function pointer is denoted by a relocation, so objtool
> just reads that.
>
> However there are some "lea xxx(%rip)" cases which don't use relocations
> because they're referencing code in the same translation unit. Objtool
> doesn't have visibility to those.
>
> The only currently known instances of that are a few hand-coded asm text
> references which don't actually need ENDBR. So it's not actually a
> problem at the moment.
>
> However if we enable -fpie, the compiler would start generating them and
> there would definitely be bugs in the IBT sealing.
>
> Detect non-relocated text references and handle them appropriately.
>
> [ Note: I removed the manual static_call_tramp check -- that should
> already be handled by the noendbr check. ]
>
> Reported-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> ---
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
prev parent reply other threads:[~2024-10-04 8:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 0:31 Josh Poimboeuf
2024-10-04 6:54 ` Ard Biesheuvel
2024-10-04 7:28 ` Josh Poimboeuf
2024-10-04 7:59 ` Ard Biesheuvel
2024-10-04 8:20 ` Peter Zijlstra
2024-10-04 16:46 ` Josh Poimboeuf
2024-10-04 8:21 ` Peter Zijlstra [this message]
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=20241004082117.GH18071@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=ardb@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@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
all inboxes | Powered by JetHome®