Make use of an upcoming GCC feature to mitigate straight-line-speculation for x86: https://gcc.gnu.org/g:53a643f8568067d7700a9f2facc8ba39974973d3 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952 https://bugs.llvm.org/show_bug.cgi?id=52323 It's built tested on x86_64-allyesconfig using GCC-12 and GCC-11. Maintenance overhead of this should be fairly low due to objtool validation. Size overhead of all these additional int3 instructions comes to: text data bss dec hex filename 22267751 6933356 2011368 31212475 1dc43bb defconfig-build/vmlinux 22804126 6933356 1470696 31208178 1dc32f2 defconfig-build/vmlinux.sls Or roughly 2.4% additional text.
Showing the changes to scripts (2 of 10 files). Show all
Unified · Split
| @@ -234,7 +234,8 @@ objtool_args = \ · 233 unmodified lines | |||
| 234 | $(if $(CONFIG_GCOV_KERNEL)$(CONFIG_LTO_CLANG), --no-unreachable)\ | 234 | $(if $(CONFIG_GCOV_KERNEL)$(CONFIG_LTO_CLANG), --no-unreachable)\ |
| 235 | $(if $(CONFIG_RETPOLINE), --retpoline) \ | 235 | $(if $(CONFIG_RETPOLINE), --retpoline) \ |
| 236 | $(if $(CONFIG_X86_SMAP), --uaccess) \ | 236 | $(if $(CONFIG_X86_SMAP), --uaccess) \ |
| 237 | $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) | 237 | $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) \ |
| 238 | $(if $(CONFIG_SLS), --sls) | ||
| 238 | 239 | ||
| 239 | cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool_args) $@) | 240 | cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool_args) $@) |
| 240 | cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd) | 241 | cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd) |
| @@ -139,6 +139,9 @@ objtool_link() · 138 unmodified lines | |||
| 139 | if [ -n "${CONFIG_X86_SMAP}" ]; then | 139 | if [ -n "${CONFIG_X86_SMAP}" ]; then |
| 140 | objtoolopt="${objtoolopt} --uaccess" | 140 | objtoolopt="${objtoolopt} --uaccess" |
| 141 | fi | 141 | fi |
| 142 | if [ -n "${CONFIG_SLS}" ]; then | ||
| 143 | objtoolopt="${objtoolopt} --sls" | ||
| 144 | fi | ||
| 142 | info OBJTOOL ${1} | 145 | info OBJTOOL ${1} |
| 143 | tools/objtool/objtool ${objtoolcmd} ${objtoolopt} ${1} | 146 | tools/objtool/objtool ${objtoolcmd} ${objtoolopt} ${1} |
| 144 | fi | 147 | fi |