All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Nixon <alex.nixon@citrix.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Jeremy Fitzhardinge <Jeremy.Fitzhardinge@citrix.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] change init_gdt to update the gdt via write_gdt, rather than a direct write.
Date: Fri, 15 Aug 2008 17:21:14 +0100	[thread overview]
Message-ID: <48A5ACFA.7040906@citrix.com> (raw)

From: Alex Nixon <alex.nixon@citrix.com>
Date: Fri, 15 Aug 2008 11:21:56 +0100
Subject: [PATCH] change init_gdt to update the gdt via write_gdt, rather than a direct write.

By writing directly, a memory access violation can occur whilst hotplugging a CPU if the entry was previously marked read-only.

Signed-off-by: Alex Nixon <alex.nixon@citrix.com>
---
 arch/x86/kernel/smpcommon.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/smpcommon.c b/arch/x86/kernel/smpcommon.c
index 99941b3..29f8bf0 100644
--- a/arch/x86/kernel/smpcommon.c
+++ b/arch/x86/kernel/smpcommon.c
@@ -13,13 +13,13 @@ EXPORT_PER_CPU_SYMBOL(this_cpu_off);
    secondary which will soon come up. */
 __cpuinit void init_gdt(int cpu)
 {
-	struct desc_struct *gdt = get_cpu_gdt_table(cpu);
+	struct desc_struct gdt;
 
-	pack_descriptor(&gdt[GDT_ENTRY_PERCPU],
-			__per_cpu_offset[cpu], 0xFFFFF,
+	pack_descriptor(&gdt, __per_cpu_offset[cpu], 0xFFFFF,
 			0x2 | DESCTYPE_S, 0x8);
+	gdt.s = 1;
 
-	gdt[GDT_ENTRY_PERCPU].s = 1;
+	write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S);
 
 	per_cpu(this_cpu_off, cpu) = __per_cpu_offset[cpu];
 	per_cpu(cpu_number, cpu) = cpu;
-- 
1.5.4.3


             reply	other threads:[~2008-08-15 16:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-15 16:21 Alex Nixon [this message]
2008-08-15 16:58 ` [PATCH] change init_gdt to update the gdt via write_gdt, rather than a direct write 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=48A5ACFA.7040906@citrix.com \
    --to=alex.nixon@citrix.com \
    --cc=Jeremy.Fitzhardinge@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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.