[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202309061102.DB794AD295@keescook>
Date: Wed, 6 Sep 2023 11:06:02 -0700
From: Kees Cook <keescook@...omium.org>
To: Song Liu <song@...nel.org>, Fangrui Song <maskray@...gle.com>
Cc: linux-kernel@...r.kernel.org, kernel-team@...a.com, x86@...nel.org,
clang-built-linux <llvm@...ts.linux.dev>,
linux-hardening@...r.kernel.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>
Ah! Thanks for the catch... I wonder if ld.lld should be fixed too? My
understanding was that ":text =...." was defined as being explicitly
u16?
Reviewed-by: Kees Cook <keescook@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists