Skip to content
Commit 4a03aa34 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Josh Poimboeuf
Browse files

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: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/Y3JdgbXRV0MNZ+9h@hirez.programming.kicks-ass.net


Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
parent d49d1666
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment