From: rostedt@goodmis.org (Steven Rostedt)
To: linux-arm-kernel@lists.infradead.org
Subject: Dynamic ftrace self test broken on ARM
Date: Wed, 20 Jun 2018 21:29:06 -0400 [thread overview]
Message-ID: <20180620212906.24b7b66e@vmware.local.home> (raw)
In-Reply-To: <20180620230734.GO17671@n2100.armlinux.org.uk>
On Thu, 21 Jun 2018 00:07:34 +0100
Russell King - ARM Linux <linux@armlinux.org.uk> wrote:
> > Any input from ARM folks?
>
> The same issues must exist on other architectures as ARM is not the only
> architecture to implement read-only kernel text and dynamic ftrace, so
> surely this problem isn't unique to ARM.
Probably because of the way set_kernel_text_ro() is implemented in
other archs. For example, in x86, we have:
void set_kernel_text_ro(void)
{
unsigned long start = PFN_ALIGN(_text);
unsigned long end = PFN_ALIGN(__stop___ex_table);
if (!kernel_set_to_readonly)
return;
/*
* Set the kernel identity mapping for text RO.
*/
set_memory_ro(start, (end - start) >> PAGE_SHIFT);
}
and arm has:
void set_kernel_text_ro(void)
{
set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), true,
current->active_mm);
}
Where x86's set_kernel_text_ro() is a nop until the
kernel_set_to_readonly is set.
Perhaps this may fix things?
[ Not even compiled tested ]
-- Steve
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index c186474422f3..0cc8e04295a4 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -736,20 +736,29 @@ static int __mark_rodata_ro(void *unused)
return 0;
}
+static int kernel_set_to_readonly __read_mostly;
+
void mark_rodata_ro(void)
{
+ kernel_set_to_readonly = 1;
stop_machine(__mark_rodata_ro, NULL, NULL);
debug_checkwx();
}
void set_kernel_text_rw(void)
{
+ if (!kernel_set_to_readonly)
+ return;
+
set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), false,
current->active_mm);
}
void set_kernel_text_ro(void)
{
+ if (!kernel_set_to_readonly)
+ return;
+
set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), true,
current->active_mm);
}
next prev parent reply other threads:[~2018-06-21 1:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-18 21:09 Dynamic ftrace self test broken on ARM Stefan Agner
2018-06-18 21:54 ` Steven Rostedt
2018-06-19 8:16 ` Stefan Agner
2018-06-19 13:17 ` Steven Rostedt
2018-06-20 13:51 ` Stefan Agner
2018-06-20 14:13 ` Steven Rostedt
2018-06-20 19:06 ` Stefan Agner
2018-06-20 21:32 ` Stefan Agner
2018-06-20 22:45 ` Stefan Agner
2018-06-20 23:07 ` Russell King - ARM Linux
2018-06-21 1:29 ` Steven Rostedt [this message]
2018-06-21 7:25 ` Stefan Agner
2018-06-21 13:51 ` Steven Rostedt
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=20180620212906.24b7b66e@vmware.local.home \
--to=rostedt@goodmis.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).