summary: bz1174826 description: "Bug summary: RELRO is not read-only on PowerLE\nBugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1174826\n\ \n/* \ \ \n * Test to exercise PIE and RELRO provided by Roland McGrath .\n\ \ * \ \ \n * Description: \ \ \n * Simple test for RELRO, which happens to be a PIE too,\ \ but that's only \n * because this kind of example has to be in PIC\ \ code to make RELRO relevant, \n * and PIE makes it simpler to write a standalone\ \ one-file test than writing \n * a DSO. \ \ \n * \ \ \n * The \"const\" makes \"\ foo\" .rodata material, and the init to an external symbol\n * reference makes\ \ it require a data relocation. Enabling -z relro for this \n * link puts\ \ that .rodata into a RELRO area. This program will crash because \n * the\ \ page containing \"foo\" has been made read-only when \"main\" runs. \ \ \n * Without RELRO, it would let you modify \"foo\" even though it's supposed\ \ to \n * be const. \ \ \n * \ \ \n * Test with RELRO should fail: \ \ \n * $ gcc -pie -fPIE -g -Wl,-z,relro -o relro\ \ relro.c \n * $ ./relro \ \ \n * Segmentation fault (core\ \ dumped) \n * \ \ \n * Test without\ \ RELRO should pass: \n * $\ \ gcc -pie -fPIE -g -Wl,-z,norelro -o no-relro relro.c \ \ \n * $ ./no-relro \ \ \n * \ \ \n**/\n\n\n" contact: Martin Cermak component: - binutils test: ./runtest.sh framework: beakerlib recommend: - binutils - gcc duration: 5m link: - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1174826 extra-summary: /tools/binutils/Regression/RELRO-protection-effective extra-task: /tools/binutils/Regression/RELRO-protection-effective