linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Menglong Dong <menglong8.dong@gmail.com>
Cc: rostedt@goodmis.org, mark.rutland@arm.com,
	alexei.starovoitov@gmail.com, catalin.marinas@arm.com,
	will@kernel.org, mhiramat@kernel.org, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, hpa@zytor.com, mathieu.desnoyers@efficios.com,
	nathan@kernel.org, ndesaulniers@google.com, morbo@google.com,
	justinstitt@google.com, dongml2@chinatelecom.cn,
	akpm@linux-foundation.org, rppt@kernel.org, graf@amazon.com,
	dan.j.williams@intel.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	bpf@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH bpf-next v2] add function metadata support
Date: Fri, 28 Feb 2025 11:26:46 +0100	[thread overview]
Message-ID: <20250228102646.GW11590@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <CADxym3YCZ5dqXMFesNaAF_Z2EWWCj0bJyKQ+BnNw2c=g39CRFA@mail.gmail.com>

On Fri, Feb 28, 2025 at 05:53:07PM +0800, Menglong Dong wrote:

> I tested it a little by enabling CFI_CLANG and the extra 5-bytes
> padding. It works fine, as mostly CFI_CLANG use
> CONFIG_FUNCTION_PADDING_BYTES to find the tags. I'll
> do more testing on CFI_CLANG to make sure everything goes
> well.

I don't think you understand; please read:

arch/x86/kernel/alternative.c:__apply_fineibt() 

and all the code involved with patching FineIBT. I think you'll find it
very broken if you change anything here.

Can you post an actual function preamble from a kernel with
CONFIG_FINEIBT=y with your changes on?

Ex.

$ objdump -wdr build/kernel/futex/core.o

Disassembly of section .text:

0000000000000000 <__cfi_futex_hash>:
       0:       b9 93 0c f9 ad          mov    $0xadf90c93,%ecx

0000000000000005 <.Ltmp0>:
       5:       90                      nop
       6:       90                      nop
       7:       90                      nop
       8:       90                      nop
       9:       90                      nop
       a:       90                      nop
       b:       90                      nop
       c:       90                      nop
       d:       90                      nop
       e:       90                      nop
       f:       90                      nop

0000000000000010 <futex_hash>:
      10:       f3 0f 1e fa             endbr64
      14:       e8 00 00 00 00          call   19 <futex_hash+0x9>      15: R_X86_64_PLT32      __fentry__-0x4
      19:       8b 47 10                mov    0x10(%rdi),%eax


Any change to the layout here *WILL* break the FineIBT code.


If you want to test, make sure your build has FINEIBT=y and boot on an
Intel CPU that has CET-IBT (alderlake and later).

  reply	other threads:[~2025-02-28 10:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 12:15 [PATCH bpf-next v2] add function metadata support Menglong Dong
2025-02-27 15:18 ` kernel test robot
2025-02-27 16:32 ` kernel test robot
2025-02-27 16:53 ` Peter Zijlstra
2025-02-28  9:53   ` Menglong Dong
2025-02-28 10:26     ` Peter Zijlstra [this message]
2025-02-28 10:29       ` Peter Zijlstra
2025-02-28 13:01       ` Menglong Dong
2025-02-27 17:48 ` kernel test robot
2025-02-28  0:43 ` kernel test robot
2025-03-04  6:25 ` kernel test robot

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=20250228102646.GW11590@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dongml2@chinatelecom.cn \
    --cc=graf@amazon.com \
    --cc=hpa@zytor.com \
    --cc=justinstitt@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=menglong8.dong@gmail.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=will@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;
as well as URLs for NNTP newsgroup(s).