Find all ENDBR instructions which are never referenced and stick them in a section such that the kernel can poison them, sealing the functions from ever being an indirect call target. This removes about 1-in-4 ENDBR instructions.
Showing the changes to tools/objtool/objtool.c (1 of 4 files). Show all
Unified · Split
| @@ -128,6 +128,7 @@ struct objtool_file *objtool_open_read(const char *_objname) · 127 unmodified lines | ||
| 128 | 128 | INIT_LIST_HEAD(&file.retpoline_call_list); |
| 129 | 129 | INIT_LIST_HEAD(&file.static_call_list); |
| 130 | 130 | INIT_LIST_HEAD(&file.mcount_loc_list); |
| 131 | + INIT_LIST_HEAD(&file.endbr_list); | |
| 131 | 132 | file.c_file = !vmlinux && find_section_by_name(file.elf, ".comment"); |
| 132 | 133 | file.ignore_unreachables = no_unreachable; |
| 133 | 134 | file.hints = false; |