[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202503251238.EE695D3@keescook>
Date: Tue, 25 Mar 2025 12:39:00 -0700
From: Kees Cook <kees@...nel.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>, Miroslav Benes <mbenes@...e.cz>,
Brendan Jackman <jackmanb@...gle.com>,
Nathan Chancellor <nathan@...nel.org>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH 22/22] lkdtm: Obfuscate do_nothing() pointer
On Mon, Mar 24, 2025 at 02:56:12PM -0700, Josh Poimboeuf wrote:
> If execute_location()'s memcpy of do_nothing() gets inlined and unrolled
> by the compiler, it copies one word at a time:
>
> mov 0x0(%rip),%rax R_X86_64_PC32 .text+0x1374
> mov %rax,0x38(%rbx)
> mov 0x0(%rip),%rax R_X86_64_PC32 .text+0x136c
> mov %rax,0x30(%rbx)
> ...
>
> Those .text references point to the middle of the function, causing
> objtool to complain about their lack of ENDBR.
>
> Prevent that by resolving the function pointer at runtime rather than
> build time. This fixes the following warning:
>
> drivers/misc/lkdtm/lkdtm.o: warning: objtool: execute_location+0x23: relocation to !ENDBR: .text+0x1378
>
> Cc: Kees Cook <kees@...nel.org>
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202503191453.uFfxQy5R-lkp@intel.com/
> Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
Thanks!
Reviewed-by: Kees Cook <kees@...nel.org>
--
Kees Cook
Powered by blists - more mailing lists