From 9a49a528dcf3c2022ff89f700d5d0345b9abf288 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Mon, 22 Feb 2016 14:09:29 -0800 Subject: lkdtm: add function for testing .rodata section This adds a function that lives in the .rodata section. The section flags are corrected using objcopy since there is no way with gcc to declare section flags in an architecture-agnostic way. Signed-off-by: Kees Cook --- drivers/misc/lkdtm_rodata.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 drivers/misc/lkdtm_rodata.c (limited to 'drivers/misc/lkdtm_rodata.c') diff --git a/drivers/misc/lkdtm_rodata.c b/drivers/misc/lkdtm_rodata.c new file mode 100644 index 000000000000..4d0d851f02b9 --- /dev/null +++ b/drivers/misc/lkdtm_rodata.c @@ -0,0 +1,10 @@ +/* + * This includes functions that are meant to live entirely in .rodata + * (via objcopy tricks), to validate the non-executability of .rodata. + */ +#include + +void lkdtm_rodata_do_nothing(void) +{ + /* Does nothing. We just want an architecture agnostic "return". */ +} -- cgit v1.2.3