WSL2-Linux-Kernel/arch/x86/tools
Kristen Carlson Accardi a54c401ae6 x86/tools/relocs: Support >64K section headers
While the relocs tool already supports finding the total number of
section headers if vmlinux exceeds 64K sections, it fails to read the
extended symbol table to get section header indexes for symbols, causing
incorrect symbol table indexes to be used when there are > 64K symbols.

Parse the ELF file to read the extended symbol table info, and then
replace all direct references to st_shndx with calls to sym_index(),
which will determine whether the value can be read directly or whether
the value should be pulled out of the extended table.

This is needed for future FGKASLR support, which uses a separate section
per function.

Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Tested-by: Tony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/r/20211013175742.1197608-2-keescook@chromium.org
2021-10-27 11:07:58 +02:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Makefile x86/tools: Use tools headers for instruction decoder selftests 2021-01-13 18:13:11 -06:00
chkobjdump.awk x86/tools: Fix objdump version check again 2021-08-12 17:17:25 +02:00
gen-insn-attr-x86.awk x86/insn: Make inat-tables.c suitable for pre-decompression code 2020-09-07 19:45:24 +02:00
insn_decoder_test.c x86/tools/insn_decoder_test: Convert to insn_decode() 2021-03-15 12:09:09 +01:00
insn_sanity.c x86/tools/insn_sanity: Convert to insn_decode() 2021-03-15 12:21:11 +01:00
objdump_reformat.awk x86/tools: Rename distill.awk to objdump_reformat.awk 2017-12-12 13:27:47 +01:00
relocs.c x86/tools/relocs: Support >64K section headers 2021-10-27 11:07:58 +02:00
relocs.h x86/tools/relocs: Mark die() with the printf function attr format 2021-08-23 05:58:02 +02:00
relocs_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
relocs_64.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
relocs_common.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00