Skip to content

RFC x86: Kernel IBT beginnings

Peter Zijlstra lkml llvm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 39 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6x86: Annotate _THIS_IP_arch/x86/include/asm/linkage.h include/linux/instruction_pointer.h+16 -03 replies
2/6x86: Base IBT bitsarch/x86/Kconfig arch/x86/Makefile arch/x86/include/asm/ibt.h+54 -11 reply
3/6x86: Add ENDBR to IRET-to-Selfarch/x86/entry/entry_64.S arch/x86/include/asm/sync_core.h+4 -02 replies
4/6objtool: Read the _THIS_IP_ hintstools/objtool/check.c tools/objtool/include/objtool/check.h+37 -30 replies
5/6x86: Sprinkle ENDBR dustarch/x86/entry/entry_64.S arch/x86/entry/entry_64_compat.S arch/x86/include/asm/idtentry.h +9 more+79 -413 replies
6/6objtool: Add IBT validation / fixupstools/objtool/arch/x86/decode.c tools/objtool/builtin-check.c tools/objtool/check.c +4 more+249 -2326 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC][PATCH 0/6] x86: Kernel IBT beginnings

Hi,

So I hacked this up on Friday night / Saturday morning and spend all of today cleaning it up.

It is the very bare beginnings of kernel IBT support. Since I'm lacking any sort of actual hardware it even lacks fun things like code to write to the MSRs to enable the IBT tracker etc..

However, it should have most of the ENDBR instructions in the right place -- I hope :-) That said; I would *really* like compiler support for this stuff to be improved, the amount of fixups done by objtool is obscene.

The end result still boots on ancient x86-64 hardware, for whatever that's worth (when built with the below turd included that is).

Enjoy!

---

scripts/link-vmlinux.sh +5 -0
index 5cdd9bc5c385..1d180bbe7b28 100755
@@ -142,6 +142,11 @@ objtool_link()
 		info OBJTOOL ${1}
 		tools/objtool/objtool ${objtoolcmd} ${objtoolopt} ${1}
 	fi
+
+	if [ "${CONFIG_X86_IBT}" = "y" ]; then
+		# XXX less ugleh
+		tools/objtool/objtool check --no-fp --retpoline --uaccess --vmlinux --duplicate --ibt --ibt-fix-direct --ibt-seal ${1}
+	fi
 }
 
 # Link of vmlinux