[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230906195814.GE28278@noisy.programming.kicks-ass.net>
Date: Wed, 6 Sep 2023 21:58:14 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Song Liu <song@...nel.org>
Cc: linux-kernel@...r.kernel.org, kernel-team@...a.com,
Kees Cook <keescook@...omium.org>, x86@...nel.org
Subject: Re: [PATCH] x86/vmlinux: Fix linker fill bytes for ld.lld
On Wed, Sep 06, 2023 at 10:52:15AM -0700, Song Liu wrote:
> With ":text =0xcccc", ld.lld fills unused text area with 0xcccc0000.
> Example objdump -D output:
>
> ffffffff82b04203: 00 00 add %al,(%rax)
> ffffffff82b04205: cc int3
> ffffffff82b04206: cc int3
> ffffffff82b04207: 00 00 add %al,(%rax)
> ffffffff82b04209: cc int3
> ffffffff82b0420a: cc int3
>
> Replace it with ":text =0xcccccccc", so we get the following instead:
>
> ffffffff82b04203: cc int3
> ffffffff82b04204: cc int3
> ffffffff82b04205: cc int3
> ffffffff82b04206: cc int3
> ffffffff82b04207: cc int3
> ffffffff82b04208: cc int3
>
> gcc/ld doesn't seem to have the same issue. The generated code stays the
> same for gcc/ld.
>
> Cc: Kees Cook <keescook@...omium.org>
> Cc: x86@...nel.org
> Signed-off-by: Song Liu <song@...nel.org>
Please provide a Fixes tag, I'm thinking this (otherwise trivial commit)
wants to be backported for sanity.
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
> arch/x86/kernel/vmlinux.lds.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
> index 83d41c2601d7..41d56fb9bf92 100644
> --- a/arch/x86/kernel/vmlinux.lds.S
> +++ b/arch/x86/kernel/vmlinux.lds.S
> @@ -156,7 +156,7 @@ SECTIONS
> ALIGN_ENTRY_TEXT_END
> *(.gnu.warning)
>
> - } :text =0xcccc
> + } :text =0xcccccccc
>
> /* End of text section, which should occupy whole number of pages */
> _etext = .;
> --
> 2.34.1
>
Powered by blists - more mailing lists