All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Matthias Reichl <hias@horus.com>
Cc: Kees Cook <keescook@chromium.org>,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	Stefan Wahren <stefan.wahren@i2se.com>,
	Eric Anholt <eric@anholt.net>, Phil Elwell <phil@raspberrypi.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-rpi-kernel@lists.infradead.org,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] Arm: mm: ftrace: Only set text back to ro after kernel has been marked ro
Date: Fri, 29 Jun 2018 11:16:58 -0400	[thread overview]
Message-ID: <20180629111658.02bfcc11@gandalf.local.home> (raw)
In-Reply-To: <20180629144714.hkvwqzpikweyihmo@camel2.lan>

On Fri, 29 Jun 2018 16:47:14 +0200
Matthias Reichl <hias@horus.com> wrote:

> On Tue, Dec 05, 2017 at 12:14:46PM -0800, Kees Cook wrote:
> > On Tue, Dec 5, 2017 at 12:09 PM, Russell King - ARM Linux
> > <linux@armlinux.org.uk> wrote:  
> > > On Tue, Dec 05, 2017 at 11:35:59AM -0800, Kees Cook wrote:  
> > >> We don't _need_ to, but they're all contiguous, so the ro_perms array
> > >> used by set_kernel_text_*() is actually only a single entry:
> > >>
> > >> static struct section_perm ro_perms[] = {
> > >>         /* Make kernel code and rodata RX (set RO). */
> > >>         {
> > >>                 .name   = "text/rodata RO",
> > >>                 .start  = (unsigned long)_stext,
> > >>                 .end    = (unsigned long)__init_begin,
> > >> ...  
> > >
> > > Well, they may not be contiguous - it depends on DEBUG_ALIGN_RODATA.  
> > 
> > Maybe I'm picking a slightly wrong word. I guess I meant adjacent. The
> > range _stext to __init_begin is all read-only, though there may be
> > padding (controlled by DEBUG_ALIGN_RODATA), to allow a split for NX
> > markings on rodata.
> >   
> > > Either way, we have __start_rodata_section_aligned, which is either
> > > the start of the read-only data section, or the start of the first
> > > section beyond __start_rodata if DEBUG_ALIGN_RODATA is not set.
> > >
> > > Given that __start_rodata_section_aligned will always be less than
> > > __init_begin, is there any reason not to make the above end at
> > > __start_rodata_section_aligned, thereby allowing more of the read-only
> > > data (in the case of DEBUG_ALIGN_RODATA=n) or all of the read-only
> > > data (in the case of DEBUG_ALIGN_RODATA=y) to remain write-protected?  
> > 
> > Sure, there's no reason not to split this into two entries. It'll
> > require some reworking of the function calls to get it right,
> > obviously.  
> 
> Gentle ping, arm is still oopsing when the function tracer is
> enabled at boot time.
> 

I take it that my patch never got applied:

 http://lkml.kernel.org/r/20180621124710.453ee0ae@gandalf.local.home

-- Steve


> Tested on bcm2835 (RPiB+) with current mainline tree
> (githash 90368a37fbbe) and bcm2835_defconfig.
> 
> arm64 seems to be fine, tested on bcm2837 (RPi3) with same tree and
> arm64 defconfig plus function tracer enabled.


WARNING: multiple messages have this Message-ID (diff)
From: rostedt@goodmis.org (Steven Rostedt)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] Arm: mm: ftrace: Only set text back to ro after kernel has been marked ro
Date: Fri, 29 Jun 2018 11:16:58 -0400	[thread overview]
Message-ID: <20180629111658.02bfcc11@gandalf.local.home> (raw)
In-Reply-To: <20180629144714.hkvwqzpikweyihmo@camel2.lan>

On Fri, 29 Jun 2018 16:47:14 +0200
Matthias Reichl <hias@horus.com> wrote:

> On Tue, Dec 05, 2017 at 12:14:46PM -0800, Kees Cook wrote:
> > On Tue, Dec 5, 2017 at 12:09 PM, Russell King - ARM Linux
> > <linux@armlinux.org.uk> wrote:  
> > > On Tue, Dec 05, 2017 at 11:35:59AM -0800, Kees Cook wrote:  
> > >> We don't _need_ to, but they're all contiguous, so the ro_perms array
> > >> used by set_kernel_text_*() is actually only a single entry:
> > >>
> > >> static struct section_perm ro_perms[] = {
> > >>         /* Make kernel code and rodata RX (set RO). */
> > >>         {
> > >>                 .name   = "text/rodata RO",
> > >>                 .start  = (unsigned long)_stext,
> > >>                 .end    = (unsigned long)__init_begin,
> > >> ...  
> > >
> > > Well, they may not be contiguous - it depends on DEBUG_ALIGN_RODATA.  
> > 
> > Maybe I'm picking a slightly wrong word. I guess I meant adjacent. The
> > range _stext to __init_begin is all read-only, though there may be
> > padding (controlled by DEBUG_ALIGN_RODATA), to allow a split for NX
> > markings on rodata.
> >   
> > > Either way, we have __start_rodata_section_aligned, which is either
> > > the start of the read-only data section, or the start of the first
> > > section beyond __start_rodata if DEBUG_ALIGN_RODATA is not set.
> > >
> > > Given that __start_rodata_section_aligned will always be less than
> > > __init_begin, is there any reason not to make the above end at
> > > __start_rodata_section_aligned, thereby allowing more of the read-only
> > > data (in the case of DEBUG_ALIGN_RODATA=n) or all of the read-only
> > > data (in the case of DEBUG_ALIGN_RODATA=y) to remain write-protected?  
> > 
> > Sure, there's no reason not to split this into two entries. It'll
> > require some reworking of the function calls to get it right,
> > obviously.  
> 
> Gentle ping, arm is still oopsing when the function tracer is
> enabled at boot time.
> 

I take it that my patch never got applied:

 http://lkml.kernel.org/r/20180621124710.453ee0ae at gandalf.local.home

-- Steve


> Tested on bcm2835 (RPiB+) with current mainline tree
> (githash 90368a37fbbe) and bcm2835_defconfig.
> 
> arm64 seems to be fine, tested on bcm2837 (RPi3) with same tree and
> arm64 defconfig plus function tracer enabled.

  reply	other threads:[~2018-06-29 15:17 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 17:58 [PATCH] Arm: mm: ftrace: Only set text back to ro after kernel has been marked ro Steven Rostedt
2017-08-23 17:58 ` Steven Rostedt
2017-08-23 18:20 ` Matthias Reichl
2017-08-23 18:20   ` Matthias Reichl
2017-08-23 18:48 ` Kees Cook
2017-08-23 18:48   ` Kees Cook
2017-08-23 19:03   ` Steven Rostedt
2017-08-23 19:03     ` Steven Rostedt
2017-12-05 11:47     ` Matthias Reichl
2017-12-05 11:47       ` Matthias Reichl
2017-12-05 13:14       ` Russell King - ARM Linux
2017-12-05 13:14         ` Russell King - ARM Linux
2017-12-05 13:23         ` Matthias Reichl
2017-12-05 13:23           ` Matthias Reichl
2017-12-05 13:30           ` Phil Elwell
2017-12-05 13:30             ` Phil Elwell
2017-12-05 13:36             ` Russell King - ARM Linux
2017-12-05 13:36               ` Russell King - ARM Linux
2017-12-05 19:35               ` Kees Cook
2017-12-05 19:35                 ` Kees Cook
2017-12-05 20:09                 ` Russell King - ARM Linux
2017-12-05 20:09                   ` Russell King - ARM Linux
2017-12-05 20:14                   ` Kees Cook
2017-12-05 20:14                     ` Kees Cook
2018-06-29 14:47                     ` Matthias Reichl
2018-06-29 14:47                       ` Matthias Reichl
2018-06-29 15:16                       ` Steven Rostedt [this message]
2018-06-29 15:16                         ` Steven Rostedt
2018-06-29 17:29                         ` Matthias Reichl
2018-06-29 17:29                           ` Matthias Reichl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180629111658.02bfcc11@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=eric@anholt.net \
    --cc=hias@horus.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=phil@raspberrypi.org \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.