Thread (7 messages) 7 messages, 3 authors, 2014-04-30
DORMANTno replies

[PATCH 0/3] Make kexec work with CONFIG_DEBUG_RODATA enabled

From: Kees Cook <hidden>
Date: 2014-04-30 17:54:58

On Wed, Apr 30, 2014 at 6:19 AM, Nikolay Borisov
[off-list ref] wrote:
quoted
From: Will Deacon [mailto:will.deacon at arm.com]
Hi Nikolay,

On Mon, Apr 28, 2014 at 10:31:44AM +0100, Nikolay Borisov wrote:
quoted
This patch makes kexec work on a kernel that has its .text section
set to read
quoted
only. The main reason of doing it is because there is a patch in the
making
quoted
(http://lists.infradead.org/pipermail/linux-arm-kernel/2014-
April/244779.html)
quoted
which aims to make it possible to flag the kernel's code section as
read-only,
quoted
rendering kexec inoperable.

The first patch does the actual functional changes while the 2nd one
is
quoted
optional and is only to be used in case you have already applied the
aforementioned
quoted
CONFIG_DEBUG_RODATA patch

Patch 3 is also optional and tries to make the assembly code a bit
more "sane"
quoted
by introducing a .struct to describe the parameters for the kernel
relocation
quoted
stub.

Those patches have been tested on linux 3.14 on THUMB-2/non-THUMB-2
host
quoted
kernels.

Patch 1 and 3 apply cleanly on 3.15-rc3 and Patch 2 applies cleanly,
provided
quoted
that Kees' patch is applied as well.

Kees also managed to test that on a QEMU 2.0 based machine.
Wouldn't it be far simpler to set_kernel_text_rw() on a kexec? At this
point, we've committed to replacing our image, so whether we can write
to the .text of the old image before we clobber it entirely seems somewhat
moot to me.
We are poking one of the values in the prepare stage so doing set_kernel_text_rw() there
won't be very clean solution. However, I agree that if the values being poked into the prep
set_kernel_text_rw() is also mm-specific, since the PMD sections are
copied per-mm. I'm not sure if that's as much of a problem here since
the prepare looks to be all in the same thread, but if we can avoid
set_kernel_text_rw() that'll probably make things less surprising if
changes are made later on.

-Kees
stage is stashed in a static variable and then in the kexec_execute function we make the kernel
RW since we are turning the MMO off and nuking the old kernel anyway.
quoted
Will
Regards,
Nikolay

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2548782


-- 
Kees Cook
Chrome OS Security
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help