From: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
To: Jeff Dike <jdike@addtoit.com>, BlaisorBlade <blaisorblade_spam@yahoo.it>
Cc: user-mode-linux devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: [uml-devel] UML running on a SMP host: bug in SKAS3 patch
Date: Wed, 26 Jan 2005 17:46:27 +0100 [thread overview]
Message-ID: <41F7C963.9080704@fujitsu-siemens.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 30 bytes --]
Description: see patch.
Bodo
[-- Attachment #2: host-2.6.9-skas3.v7-smp-fix-ldt.patch --]
[-- Type: text/x-diff, Size: 2549 bytes --]
From: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
The SKAS3 host patch isn't smp-safe.
The wrong part is the implementation of PTRACE_LDT.
If the ptraced child runs on an other processor than its parent,
and the child's mm still is the active_mm, the changed LDT
isn't flushed out.
The problem occurs in alloc_ldt, but to fix this, I had to
change the params of copy_ldt, too.
---
--- a/arch/i386/kernel/ldt.c 2005-01-26 15:35:44.000000000 +0100
+++ b/arch/i386/kernel/ldt.c 2005-01-26 16:57:54.000000000 +0100
@@ -28,11 +28,12 @@ static void flush_ldt(void *null)
}
#endif
-static int alloc_ldt(mm_context_t *pc, int mincount, int reload)
+static int alloc_ldt(struct mm_struct *mm, int mincount, int reload)
{
void *oldldt;
void *newldt;
int oldsize;
+ mm_context_t * pc = &mm->context;
if (mincount <= pc->size)
return 0;
@@ -55,17 +56,19 @@ static int alloc_ldt(mm_context_t *pc, i
pc->size = mincount;
wmb();
- if (reload && (¤t->active_mm->context == pc)) {
+ if (reload) {
#ifdef CONFIG_SMP
cpumask_t mask;
preempt_disable();
- load_LDT(pc);
+ if (¤t->active_mm->context == pc)
+ load_LDT(pc);
mask = cpumask_of_cpu(smp_processor_id());
- if (!cpus_equal(current->mm->cpu_vm_mask, mask))
+ if (!cpus_equal(mm->cpu_vm_mask, mask))
smp_call_function(flush_ldt, NULL, 1, 1);
preempt_enable();
#else
- load_LDT(pc);
+ if (¤t->active_mm->context == pc)
+ load_LDT(pc);
#endif
}
if (oldsize) {
@@ -77,12 +80,12 @@ static int alloc_ldt(mm_context_t *pc, i
return 0;
}
-static inline int copy_ldt(mm_context_t *new, mm_context_t *old)
+static inline int copy_ldt(struct mm_struct *new, struct mm_struct *old)
{
- int err = alloc_ldt(new, old->size, 0);
+ int err = alloc_ldt(new, old->context.size, 0);
if (err < 0)
return err;
- memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE);
+ memcpy(new->context.ldt, old->context.ldt, old->context.size*LDT_ENTRY_SIZE);
return 0;
}
@@ -96,7 +99,7 @@ int copy_context(struct mm_struct *mm, s
if (old_mm && old_mm->context.size > 0) {
down(&old_mm->context.sem);
- retval = copy_ldt(&mm->context, &old_mm->context);
+ retval = copy_ldt(mm, old_mm);
up(&old_mm->context.sem);
}
return retval;
@@ -202,7 +205,7 @@ static int write_ldt(struct mm_struct *
down(&mm->context.sem);
if (ldt_info.entry_number >= mm->context.size) {
- error = alloc_ldt(&mm->context, ldt_info.entry_number+1, 1);
+ error = alloc_ldt(mm, ldt_info.entry_number+1, 1);
if (error < 0)
goto out_unlock;
}
next reply other threads:[~2005-01-26 16:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-26 16:46 Bodo Stroesser [this message]
2005-01-26 21:13 ` [uml-devel] Re: UML running on a SMP host: bug in SKAS3 patch Blaisorblade
2005-01-27 12:42 ` Bodo Stroesser
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=41F7C963.9080704@fujitsu-siemens.com \
--to=bstroesser@fujitsu-siemens.com \
--cc=blaisorblade_spam@yahoo.it \
--cc=jdike@addtoit.com \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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