All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Correct setuid behavious in linux-user
@ 2007-03-19 15:25 Stuart Anderson
  0 siblings, 0 replies; only message in thread
From: Stuart Anderson @ 2007-03-19 15:25 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 601 bytes --]


The attached patch is needed to correctly emulate setuid executables.
With this change, and by making qemu be setuid root (and assumming all
of the risks and responsibilites of doing so), executables such as
/bin/su will be able to create the correct environment.


                                 Stuart

Stuart R. Anderson                               anderson@netsweng.com
Network & Software Engineering                   http://www.netsweng.com/
1024D/37A79149:                                  0791 D3B8 9A4C 2CDC A31F
                                                  BD03 0A62 E534 37A7 9149

[-- Attachment #2: setuid fix --]
[-- Type: TEXT/PLAIN, Size: 653 bytes --]

Index: linux-user/linuxload.c
===================================================================
RCS file: /sources/qemu/qemu/linux-user/linuxload.c,v
retrieving revision 1.2
diff -u -r1.2 linuxload.c
--- linux-user/linuxload.c	19 Nov 2006 20:29:35 -0000	1.2
+++ linux-user/linuxload.c	19 Mar 2007 15:09:50 -0000
@@ -78,6 +78,8 @@
 	if(bprm->e_uid != geteuid()) {
 	    id_change = 1;
 	}
+    } else {
+      seteuid(getuid());
     }
 
     /* Set-gid? */
@@ -91,6 +93,8 @@
 	if (!in_group_p(bprm->e_gid)) {
 		id_change = 1;
 	}
+    } else {
+      setegid(getgid());
     }
 
     memset(bprm->buf, 0, sizeof(bprm->buf));

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-03-19 15:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-19 15:25 [Qemu-devel] [PATCH] Correct setuid behavious in linux-user Stuart Anderson

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.