Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1320749

Re: [PATCH] arm64: make CONFIG_DEBUG_RODATA non-optional

From Mark Rutland <mark.rutland@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH] arm64: make CONFIG_DEBUG_RODATA non-optional
Date 2016-01-28 16:00 +0100
Message-ID <qVWdc-4Sp-3@gated-at.bofh.it> (permalink)
References (2 earlier) <qVFFn-1hk-9@gated-at.bofh.it> <qVFFn-1hk-7@gated-at.bofh.it> <qVIjU-3hE-7@gated-at.bofh.it> <qVSCC-2xh-1@gated-at.bofh.it> <qVVqN-4wq-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jan 28, 2016 at 06:06:53AM -0800, Kees Cook wrote:
> On Thu, Jan 28, 2016 at 3:06 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> > One thing I would like to do is to avoid the need for fixup_executable
> > entirely, by mapping the kernel text RO from the outset. However, that
> > requires rework of the alternatives patching (to use a temporary RW
> > alias), and I haven't had the time to look into that yet.
> 
> This makes perfect sense for the rodata section, but the (future)
> postinit_rodata section we'll still want to mark RO after init
> finishes. x86 and ARM cheat by marking both RO after init, and they
> don't have to pad sections. parisc will need to solve this too.

Depending on how many postinit_rodata variables there are, we might be
able to drop those in .rodata, have them RO always, and initialise them
via a temporary RW alias (e.g. something in the vmalloc area).

The only requirement for that is that we use a helper to initialise any
__postinit_ro variables via a temporary RW alias, e.g.

#define SET_POST_INIT_RO(ptr, v) ({ 		\\
	typeof(ptr) __ptr_rw = (ptr)		\\
	BUG_ON(initcalls_done);			\\
	__ptr_rw = create_rw_alias(__ptr);	\\
	__ptr_rw = v;				\\
	destroy_rw_alias(__ptr_rw);		\\
})

...

__postinit_ro void *thing;

void __init some_init_func(void) {
	void *__thing = some_ranodomized_allocator();
	SET_POSTINIT_RO(thing, thing);
}


Mark.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] arm64: make CONFIG_DEBUG_RODATA non-optional David Brown <david.brown@linaro.org> - 2016-01-28 01:10 +0100
  Re: [PATCH] arm64: make CONFIG_DEBUG_RODATA non-optional Kees Cook <keescook@chromium.org> - 2016-01-28 01:20 +0100
    Re: [PATCH] arm64: make CONFIG_DEBUG_RODATA non-optional Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-28 09:30 +0100
  Re: [PATCH] arm64: make CONFIG_DEBUG_RODATA non-optional Mark Rutland <mark.rutland@arm.com> - 2016-01-28 12:10 +0100
    Re: [PATCH] arm64: make CONFIG_DEBUG_RODATA non-optional Kees Cook <keescook@chromium.org> - 2016-01-28 15:10 +0100
      Re: [PATCH] arm64: make CONFIG_DEBUG_RODATA non-optional Mark Rutland <mark.rutland@arm.com> - 2016-01-28 16:00 +0100
        Re: [PATCH] arm64: make CONFIG_DEBUG_RODATA non-optional Kees Cook <keescook@chromium.org> - 2016-01-28 16:20 +0100

csiph-web