Package: qemu
Version: 0.9.0-1netsweng2
Severity: normal
Tags: patch

When working in an environment similar to 
http://wiki.debian.org/QemuUserEmulation
setuid programs such as /bin/su don't work correctly. This can be fixed by 
making
the (statically linked) qemu be setuid, and applying the attached patch. The 
patch
is needed so that the real and effective uid are manged correctly.

Without it, "su - someuser" will give a shell in which the real and effective 
uids
are "someuser", but when running a command from that shell, such as 
/usr/bin/id, the
real uid for that command is "someuser", but the effective uid is "root" 
(becasue
of the setuid of the qemu executable). This patch causes qemu to change it's 
effective
uid to match the real uid in the case where the target executable is not 
setuid. This
is just an else clause for the clock that changes the uid to match the uid on a 
setuid
target executable.

This fix was created on the 0.9.0 package from experimental, but the code is 
that same
in 0.8.2, so the patch should be equally applicable there as well.

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-3-amd64
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages qemu depends on:
ii  bochsbios                     2.3-2      BIOS for the Bochs emulator
ii  openhackware                  0.4.1-2    OpenFirmware emulator for PowerPC
ii  proll                         18-2       JavaStation PROM 2.x compatible re
ii  vgabios                       0.6a-1     VGA BIOS software for the Bochs an

Versions of packages qemu recommends:
ii  debootstrap                   0.3.3.1    Bootstrap a basic Debian system
ii  sharutils                     1:4.2.1-15 shar, unshar, uuencode, uudecode
pn  vde2                          <none>     (no description available)

-- no debconf information
#DPATCHLEVEL=0
--- linux-user/linuxload.c.orig	2007-02-22 08:15:54.000000000 -0500
+++ linux-user/linuxload.c	2007-02-22 08:16:25.000000000 -0500
@@ -78,6 +78,8 @@
 	if(bprm->e_uid != geteuid()) {
 	    id_change = 1;
 	}
+    } else {
+	seteuid(getuid());
     }
 
     /* Set-gid? */

Reply via email to