qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stuart Anderson <anderson@netsweng.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Correct setuid behavious in linux-user
Date: Mon, 19 Mar 2007 11:25:29 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0703191122200.12505@trantor.stuart.netsweng.com> (raw)

[-- 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));

                 reply	other threads:[~2007-03-19 15:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Pine.LNX.4.64.0703191122200.12505@trantor.stuart.netsweng.com \
    --to=anderson@netsweng.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).