[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250304053853.GA7099@noisy.programming.kicks-ass.net>
Date: Tue, 4 Mar 2025 06:38:53 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Menglong Dong <menglong8.dong@...il.com>
Cc: rostedt@...dmis.org, mark.rutland@....com, alexei.starovoitov@...il.com,
catalin.marinas@....com, will@...nel.org, mhiramat@...nel.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
martin.lau@...ux.dev, eddyz87@...il.com, yonghong.song@...ux.dev,
john.fastabend@...il.com, kpsingh@...nel.org, sdf@...ichev.me,
jolsa@...nel.org, davem@...emloft.net, dsahern@...nel.org,
mathieu.desnoyers@...icios.com, nathan@...nel.org,
nick.desaulniers+lkml@...il.com, morbo@...gle.com,
samitolvanen@...gle.com, kees@...nel.org, dongml2@...natelecom.cn,
akpm@...ux-foundation.org, riel@...riel.com, rppt@...nel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, bpf@...r.kernel.org,
netdev@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v4 1/4] x86/ibt: factor out cfi and fineibt offset
On Tue, Mar 04, 2025 at 09:10:12AM +0800, Menglong Dong wrote:
> Hello, sorry that I forgot to add something to the changelog. In fact,
> I don't add extra 5-bytes anymore, which you can see in the 3rd patch.
>
> The thing is that we can't add extra 5-bytes if CFI is enabled. Without
> CFI, we can make the padding space any value, such as 5-bytes, and
> the layout will be like this:
>
> __align:
> nop
> nop
> nop
> nop
> nop
> foo: -- __align +5
>
> However, the CFI will always make the cfi insn 16-bytes aligned. When
> we set the FUNCTION_PADDING_BYTES to (11 + 5), the layout will be
> like this:
>
> __cfi_foo:
> nop (11)
> mov $0x12345678, %reg
> nop (16)
> foo:
>
> and the padding space is 32-bytes actually. So, we can just select
> FUNCTION_ALIGNMENT_32B instead, which makes the padding
> space 32-bytes too, and have the following layout:
>
> __cfi_foo:
> mov $0x12345678, %reg
> nop (27)
> foo:
*blink*, wtf is clang smoking.
I mean, you're right, this is what it is doing, but that is somewhat
unexpected. Let me go look at clang source, this is insane.
Powered by blists - more mailing lists