mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	abelvesa@linux.com, Abhishek Sagar <sagar.abhishek@gmail.com>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH] ARM: ftrace: Only set kernel memory back to read-only after boot
Date: Thu, 21 Jun 2018 19:54:10 +0200	[thread overview]
Message-ID: <704c501ac97ff4ca0d469183b293e0b5@agner.ch> (raw)
In-Reply-To: <20180621125025.25b70bb9@gandalf.local.home>

On 21.06.2018 18:50, Steven Rostedt wrote:
> On Thu, 21 Jun 2018 12:47:10 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
> 
>> From: Steven Rostedt (VMware) <rostedt@goodmis.org>
>>
>> Dynamic ftrace requires modifying the code segments that are usually
>> set to read-only. To do this, a per arch function is called both before
>> and after the ftrace modifications are performed. The "before" function
>> will set kernel code text to read-write to allow for ftrace to make the
>> modifications, and the "after" function will set the kernel code text
>> back to "read-only" to keep the kernel code text protected.
>>
>> The issue happens when dynamic ftrace is tested at boot up. The test is
>> done before the kernel code text has been set to read-only. But the
>> "before" and "after" calls are still performed. The "after" call will
>> change the kernel code text to read-only prematurely, and other boot
>> code that expects this code to be read-write will fail.
>>
>> The solution is to add a variable that is set when the kernel code text
>> is expected to be converted to read-only, and make the ftrace "before"
>> and "after" calls do nothing if that variable is not yet set. This is
>> similar to the x86 solution from commit 162396309745 ("ftrace, x86:
>> make kernel text writable only for conversions").
>>
>> Reported-by: Stefan Agner <stefan@agner.ch>
>> Tested-by: Stefan Agner <stefan@agner.ch>
>> Link: http://lkml.kernel.org/r/20180620212906.24b7b66e@vmware.local.home
>> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
>> ---
> 
> Perhaps I should have Cc'd stable too?
> 

As it is self tests only which are broken probably not super important.
But then, the fix is also rather clean and safe IMHO, so why not.

--
Stefan

  reply	other threads:[~2018-06-21 17:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21 16:47 Steven Rostedt
2018-06-21 16:50 ` Steven Rostedt
2018-06-21 17:54   ` Stefan Agner [this message]
2018-07-04 11:30 ` Stefan Agner
2018-07-10  7:24   ` Stefan Agner

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=704c501ac97ff4ca0d469183b293e0b5@agner.ch \
    --to=stefan@agner.ch \
    --cc=abelvesa@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sagar.abhishek@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®