Re: [kernel-hardening] Re: [PATCH] lkdtm: add test for executing .rodata

From: David Brown
Date: Tue Feb 23 2016 - 15:31:39 EST


On Mon, Feb 22, 2016 at 12:46:28PM -0800, Kees Cook wrote:
On Thu, Feb 18, 2016 at 1:27 PM, PaX Team <pageexec@xxxxxxxxxxx> wrote:
On 18 Feb 2016 at 12:34, Ard Biesheuvel wrote:

However, that does not fix the issue Kees is trying to solve, where a
.rodata section is emitted with the "x" bit set, which causes the
linker to complain:

/tmp/cc50ffWw.s: Assembler messages:
/tmp/cc50ffWw.s:2: Warning: setting incorrect section attributes for
.rodata.text

in that case why not use a top-level asm statement to set the section
and its attributes (and compile the file with fno-toplevel-reorder)?

GCC really wants to declare the section. :(

Why not then just use its mechanism to set the section on the code?

static void do_nothing_rodata(void)
__attribute__((section(".rodata")))
{
return;
}

David