On Wed, Feb 28, 2018 at 3:23 PM, Segher Boessenkool <seg...@kernel.crashing.org> wrote: > On Wed, Feb 28, 2018 at 01:46:33PM -0800, Kees Cook wrote: >> On Tue, Feb 27, 2018 at 2:01 PM, Segher Boessenkool >> <seg...@kernel.crashing.org> wrote: >> > This adds a new option -mreadonly-in-sdata (on by default) that >> > controls whether readonly data can be put in sdata. (For EABI this >> > does nothing, readonly data is put in sdata2 as usual). >> >> Cool! Thanks for working on this. >> >> > Kees, could you try this out with your use case? Add the flag >> > -mno-readonly-in-sdata in your build scripts. The patch is against >> > GCC trunk. >> >> I'm struggling to create a ppc cross compiler, otherwise I would be >> happy to test this. :) > > For compiling kernels you can use > <http://git.infradead.org/users/segher/buildall.git>
Hah, yes, I had just asked around privately about cross building tools and was aimed there only to discover you're the author. ;) >> If you're able to build a ppc kernel and remove the "static" from >> mm/rodata_test_data.c's rodata_test_data and see the rodata_test_data >> variable not in .sdata, that should be sufficient. The case reported >> was here: >> https://lkml.org/lkml/2017/9/21/156 >> >> I'll continue trying to solve my cross build issue... > > I'm trying to figure out how to get that file to build at all :-) This works for me with my distro cross compiler: $ git diff diff --git a/mm/rodata_test.c b/mm/rodata_test.c index d908c8769b48..6bb4deb12e78 100644 --- a/mm/rodata_test.c +++ b/mm/rodata_test.c @@ -14,7 +14,7 @@ #include <linux/uaccess.h> #include <asm/sections.h> -static const int rodata_test_data = 0xC3; +const int rodata_test_data = 0xC3; void rodata_test(void) { $ CROSS_COMPILE=powerpc-linux-gnu- ARCH=powerpc make wii_defconfig $ for i in CONFIG_STRICT_KERNEL_RWX \ CONFIG_DEBUG_KERNEL \ CONFIG_DEBUG_RODATA_TEST ; do CROSS_COMPILE=powerpc-linux-gnu- ARCH=powerpc ./scripts/config -e $i done $ CROSS_COMPILE=powerpc-linux-gnu- ARCH=powerpc make -j... ... $ objdump -t mm/rodata_test.o | grep rodata_test_data 00000000 g O .sdata 00000004 rodata_test_data -Kees -- Kees Cook Pixel Security