From: Jeff Dike <jdike@addtoit.com>
To: stable@kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
uml-devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: [uml-devel] [PATCH] UML - arch_prctl should set thread fs
Date: Fri, 16 Mar 2007 12:10:15 -0400 [thread overview]
Message-ID: <20070316161015.GA7948@c2.user-mode-linux.org> (raw)
[ This missed getting into -stable the first time I sent it ]
In my previous x86_64 thread fix, I forgot to initialize
thread.arch.fs in arch_prctl. A process calling arch_prctl to set %fs
would lose it on the next context switch.
It also turns out that you can switch to a process which is in the
process of exiting and which has lost its mm. In this case, it's
worse than useless to try to call arch_prctl on the host process.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
--
arch/um/sys-x86_64/syscalls.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: linux-2.6.17/arch/um/sys-x86_64/syscalls.c
===================================================================
--- linux-2.6.17.orig/arch/um/sys-x86_64/syscalls.c 2007-03-07 12:18:38.000000000 -0500
+++ linux-2.6.17/arch/um/sys-x86_64/syscalls.c 2007-03-16 12:04:40.000000000 -0400
@@ -103,6 +103,9 @@ long arch_prctl_skas(struct task_struct
switch(code){
case ARCH_SET_FS:
+ current->thread.arch.fs = (unsigned long) ptr;
+ save_registers(pid, ¤t->thread.regs.regs);
+ break;
case ARCH_SET_GS:
save_registers(pid, ¤t->thread.regs.regs);
break;
@@ -140,9 +143,8 @@ long sys_clone(unsigned long clone_flags
void arch_switch_to_skas(struct task_struct *from, struct task_struct *to)
{
- if(to->thread.arch.fs == 0)
+ if((to->thread.arch.fs == 0) || (to->mm == NULL))
return;
arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs);
}
-
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jeff Dike <jdike@addtoit.com>
To: stable@kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
uml-devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: [PATCH] UML - arch_prctl should set thread fs
Date: Fri, 16 Mar 2007 12:10:15 -0400 [thread overview]
Message-ID: <20070316161015.GA7948@c2.user-mode-linux.org> (raw)
[ This missed getting into -stable the first time I sent it ]
In my previous x86_64 thread fix, I forgot to initialize
thread.arch.fs in arch_prctl. A process calling arch_prctl to set %fs
would lose it on the next context switch.
It also turns out that you can switch to a process which is in the
process of exiting and which has lost its mm. In this case, it's
worse than useless to try to call arch_prctl on the host process.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
--
arch/um/sys-x86_64/syscalls.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: linux-2.6.17/arch/um/sys-x86_64/syscalls.c
===================================================================
--- linux-2.6.17.orig/arch/um/sys-x86_64/syscalls.c 2007-03-07 12:18:38.000000000 -0500
+++ linux-2.6.17/arch/um/sys-x86_64/syscalls.c 2007-03-16 12:04:40.000000000 -0400
@@ -103,6 +103,9 @@ long arch_prctl_skas(struct task_struct
switch(code){
case ARCH_SET_FS:
+ current->thread.arch.fs = (unsigned long) ptr;
+ save_registers(pid, ¤t->thread.regs.regs);
+ break;
case ARCH_SET_GS:
save_registers(pid, ¤t->thread.regs.regs);
break;
@@ -140,9 +143,8 @@ long sys_clone(unsigned long clone_flags
void arch_switch_to_skas(struct task_struct *from, struct task_struct *to)
{
- if(to->thread.arch.fs == 0)
+ if((to->thread.arch.fs == 0) || (to->mm == NULL))
return;
arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs);
}
-
next reply other threads:[~2007-03-16 17:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-16 16:10 Jeff Dike [this message]
2007-03-16 16:10 ` [PATCH] UML - arch_prctl should set thread fs Jeff Dike
2007-03-16 23:00 ` [uml-devel] [stable] " Greg KH
2007-03-16 23:00 ` Greg KH
2007-03-19 20:12 ` [uml-devel] " Jeff Dike
2007-03-19 20:12 ` Jeff Dike
2007-03-19 21:23 ` [uml-devel] patch uml-arch_prctl-should-set-thread-fs.patch queued to -stable tree gregkh
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=20070316161015.GA7948@c2.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@kernel.org \
--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 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.