mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pekka Paalanen <pq@iki.fi>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH] x86_64: fix kernel rodata NX setting
Date: Mon, 21 Apr 2008 21:48:24 +0300	[thread overview]
Message-ID: <20080421214824.0c5dc637@daedalus.pq.iki.fi> (raw)
In-Reply-To: <20080420202533.GA16538@Krystal>

>From 35922163c8054bd8d12df78ebae6a6a603760206 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pq@iki.fi>
Date: Mon, 21 Apr 2008 21:36:09 +0300
Subject: [PATCH] x86_64: fix kernel rodata NX setting

Without CONFIG_DYNAMIC_FTRACE, mark_rodata_ro() would mark a wrong
number of pages as no-execute. The bug was introduced in the patch
"ftrace: dont write protect kernel text". The symptom was machine reboot
after a CPU hotplug.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
---

Is this ok? At least it works for me:

[  294.564032] CPU 1 is now offline
[  294.564359] lockdep: fixing up alternatives.
[  294.565799] SMP alternatives: switching to UP code
[  306.626760] lockdep: fixing up alternatives.
[  306.627080] SMP alternatives: switching to SMP code
[  306.638566] Booting processor 1/1 ip 6000
[  306.653079] Initializing CPU#1
[  306.736556] Calibrating delay using timer specific routine.. 3991.08 BogoMIPS (lpj=6649734)
[  306.739889] CPU: L1 I cache: 32K, L1 D cache: 32K
[  306.739889] CPU: L2 cache: 4096K
[  306.739889] CPU: Physical Processor ID: 0
[  306.739889] CPU: Processor Core ID: 1
[  306.739889] x86: PAT support disabled.
[  306.741127] CPU1: <6>Clockevents: could not switch to one-shot mode: lapic is not functional.
[  306.743865] Could not switch to high resolution mode on CPU 1
[  306.750580] Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz stepping 0a

 arch/x86/mm/init_64.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 7851773..d7ae30a 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -792,7 +792,7 @@ void mark_rodata_ro(void)
 	 * The rodata section (but not the kernel text!) should also be
 	 * not-executable.
 	 */
-	set_memory_nx(rodata_start, (end - start) >> PAGE_SHIFT);
+	set_memory_nx(rodata_start, (end - rodata_start) >> PAGE_SHIFT);
 
 	rodata_test();
 
-- 
1.5.3.7


  reply	other threads:[~2008-04-21 18:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080413224207.4430a09c@daedalus.pq.iki.fi>
2008-04-13 19:48 ` [PATCH] mmiotrace: add user documentation Pekka Paalanen
2008-04-14 15:49   ` Steven Rostedt
2008-04-14 18:20     ` Pekka Paalanen
2008-04-13 20:05 ` [BUG/PATCH] x86 mmiotrace: dynamically disable non-boot CPUs Pekka Paalanen
2008-04-14  6:57   ` Ingo Molnar
2008-04-14 18:02     ` Pekka Paalanen
2008-04-16 11:46       ` Ingo Molnar
2008-04-16 17:59         ` Pekka Paalanen
2008-04-16 18:32           ` Ingo Molnar
2008-04-16 19:07             ` Steven Rostedt
2008-04-16 20:42             ` Pekka Paalanen
2008-04-16 20:47               ` Ingo Molnar
2008-07-24 15:34           ` [Nouveau] " Stephane Marchesin
2008-04-19 15:41     ` [BUG] kmalloc_node(GFP_KERNEL) while smp_alt spinlocked Pekka Paalanen
2008-04-19 16:19       ` [PATCH] Fix SMP alternatives : use mutex instead of spinlock, text_poke is sleepable Mathieu Desnoyers
2008-04-19 21:06         ` Pekka Paalanen
2008-04-19 21:52           ` [BUG] CPU hotplug reboots machine (Re: [PATCH] Fix SMP alternatives : use mutex instead of spinlock, text_poke is sleepable) Pekka Paalanen
2008-04-19 21:58             ` [PATCH] Check for breakpoint in text_poke to eliminate bug_on Mathieu Desnoyers
2008-04-19 22:42               ` Pekka Paalanen
2008-04-20  0:05                 ` Mathieu Desnoyers
2008-04-20  7:14                   ` Pekka Paalanen
2008-04-20 19:44                     ` Mathieu Desnoyers
2008-04-20 20:18                       ` Pekka Paalanen
2008-04-20 20:25                         ` Mathieu Desnoyers
2008-04-21 18:48                           ` Pekka Paalanen [this message]
2008-04-21 18:57                             ` [PATCH] x86_64: fix kernel rodata NX setting Steven Rostedt
2008-04-21 19:03                             ` Ingo Molnar
2008-04-22 18:42         ` [repost PATCH] Fix SMP alternatives : use mutex instead of spinlock, text_poke is sleepable Pekka Paalanen
2008-04-22 19:09           ` Ingo Molnar
2008-04-22 20:22             ` Mathieu Desnoyers
2008-04-24 19:39   ` [PATCH v2] x86 mmiotrace: dynamically disable non-boot CPUs Pekka Paalanen
2008-04-26 11:13     ` Ingo Molnar

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=20080421214824.0c5dc637@daedalus.pq.iki.fi \
    --to=pq@iki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®