History

objtool: Find unused ENDBR instructions

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.

Peter Zijlstra committed 4 years ago

Commit 89bc8531 parent 08f87a94 files · +78 −2Browse files

Showing the changes to tools/objtool/objtool.c (1 of 4 files). Show all

Unified · Split

tools/objtool/objtool.c+1−0
@@ -128,6 +128,7 @@ struct objtool_file *objtool_open_read(const char *_objname) · 127 unmodified lines
128 INIT_LIST_HEAD(&file.retpoline_call_list);128 INIT_LIST_HEAD(&file.retpoline_call_list);
129 INIT_LIST_HEAD(&file.static_call_list);129 INIT_LIST_HEAD(&file.static_call_list);
130 INIT_LIST_HEAD(&file.mcount_loc_list);130 INIT_LIST_HEAD(&file.mcount_loc_list);
131 INIT_LIST_HEAD(&file.endbr_list);
131 file.c_file = !vmlinux && find_section_by_name(file.elf, ".comment");132 file.c_file = !vmlinux && find_section_by_name(file.elf, ".comment");
132 file.ignore_unreachables = no_unreachable;133 file.ignore_unreachables = no_unreachable;
133 file.hints = false;134 file.hints = false;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t