diff options
author | Peter Zijlstra <peterz@infradead.org> | 2022-11-14 18:23:45 +0300 |
---|---|---|
committer | Josh Poimboeuf <jpoimboe@kernel.org> | 2023-06-07 19:27:11 +0300 |
commit | 4a03aa34432abe0703abf232f31fc5e2ed8256f6 (patch) | |
tree | bfde124225e6c7cd2eb18dd17e6c197b62d6059c /arch/x86 | |
parent | d49d1666aab51ad3caf79f414aff6b641837a6ea (diff) | |
download | linux-4a03aa34432abe0703abf232f31fc5e2ed8256f6.tar.xz |
lkdtm: Avoid objtool/ibt warning
For certain configs objtool will complain like:
vmlinux.o: warning: objtool: lkdtm_UNSET_SMEP+0x1c3: relocation to !ENDBR: native_write_cr4+0x41
What happens is that GCC optimizes the loop:
insn = (unsigned char *)native_write_cr4;
for (i = 0; i < MOV_CR4_DEPTH; i++)
to read something like:
for (insn = (unsigned char *)native_write_cr4;
insn < (unsigned char *)native_write_cr4 + MOV_CR4_DEPTH;
insn++)
Which then obviously generates the text reference
native_write_cr4+041. Since none of this is a fast path, simply
confuse GCC enough to inhibit this optimization.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/Y3JdgbXRV0MNZ+9h@hirez.programming.kicks-ass.net
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'arch/x86')
0 files changed, 0 insertions, 0 deletions