x86/module: Detect and skip invalid relocations
There have been some cases where external tooling (e.g., kpatch-build)
creates a corrupt relocation which targets the wrong address. This is a
silent failure which can corrupt memory in unexpected places.
On x86, the bytes of data being overwritten by relocations are always
initialized to zero beforehand. Use that knowledge to add sanity checks
to detect such cases before they corrupt memory.
Signed-off-by: Josh Poimboeuf <firstname.lastname@example.org>
Cc: Linus Torvalds <email@example.com>
Cc: Peter Zijlstra <firstname.lastname@example.org>
Cc: Thomas Gleixner <email@example.com>
[ Restructured the messages, as it's unclear whether the relocation or the target is corrupted. ]
Signed-off-by: Ingo Molnar <firstname.lastname@example.org>
1 file changed