[PATCH 0/7] Detect future mis-uses of __ex_table section.
From: Quentin Casasnovas
Date: Tue Mar 17 2015 - 08:38:31 EST
Hi,
This patch-set adds some sanity checks on the __ex_table section so that it
makes it much harder to introduce wrong entries in there. It works by
checking every relocation in __ex_table and making sure it points to an
executable section and does not point to a list of black-listed sections,
like .altinstr_replacement. Patch 6 adds a new script, check_extable.sh,
so it can be used to get more human readable diagnostics on where the wrong
ex_table entry was added in the code. Here's a truncated example output
from v4.0-rc2:
Error: found a reference to .altinstr_replacement in __ex_table:
xrstor_state at /home/quentin/linux-2.6/./arch/x86/include/asm/xsave.h:179
(inlined by) fpu_xrstor_checking at /home/quentin/linux-2.6/./arch/x86/include/asm/xsave.h:207
(inlined by) fpu_restore_checking at /home/quentin/linux-2.6/./arch/x86/include/asm/fpu-internal.h:284
(inlined by) kvm_load_guest_fpu at /home/quentin/linux-2.6/arch/x86/kvm/x86.c:6986
This is to prevent future misuses of the __ex_table entry like there was
for xsaves/xrstors for example, see upstream commit 06e5801b
("x86/fpu/xsaves: Fix improper uses of __ex_table").
This will potentially break the build for other architectures (tested on
x86-64 and sparc), since there might be exotic sections in there that I
don't know about.
Quentin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/