Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 56665 - PORTAGE_TMPDIR gets sgid, preventing suid binaries
Summary: PORTAGE_TMPDIR gets sgid, preventing suid binaries
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2004-07-11 03:25 UTC by Andreas Hofer
Modified: 2004-08-04 21:30 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
my host.def (host.def,4.64 KB, text/plain)
2004-07-13 01:14 UTC, Mr. Bones. (RETIRED)
Details
unpack output. (xfree.unpack,15.56 KB, text/plain)
2004-07-13 01:15 UTC, Mr. Bones. (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Hofer 2004-07-11 03:25:30 UTC
After upgrading to xfree-4.3.0-r6 normal users cannot start X anymore.
The server stops with the error message
'Cannot open log file "/var/log/XFree86.0.log"
root CAN start X. Removing the old logs does not help.

Reproducible: Always
Steps to Reproduce:
1.Log in as user, not as root!
2.Type "X" (or "startx" or "startxfce" or ...), press Enter
3.
Actual Results:  
X does not start if logged in as user, with the above error message

Expected Results:  
The X server should start

emerge info yields:

Portage 2.0.50-r8 (default-x86-2004.0, gcc-3.3.3, glibc-2.3.3.20040420-r0, 
2.6.7-gentoo-r8)
=================================================================
System uname: 2.6.7-gentoo-r8 i586 Mobile Pentium MMX
Gentoo Base System version 1.4.16
Autoconf: sys-devel/autoconf-2.59-r3
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium-mmx -fomit-frame-pointer"
CHOST="i586-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/s
hare/config /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/
dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/c
onfig/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium-mmx -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ 
ftp://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ 
http://ftp.gentoo.skynet.be/pub/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/leffe/usr/gentoo/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X alsa apm avi berkdb crypt cups encode foomaticdb gdbm gif gpm imlib java 
jpeg libg++ libwww mad mikmod mmx mpeg ncurses nls oggvorbis opengl oss pam 
pdflib perl png python quicktime readline sdl slang spell ssl svga tcpd tetex 
truetype x86 xml2 xmms xv zlib"
Comment 1 Donnie Berkholz (RETIRED) gentoo-dev 2004-07-11 21:45:18 UTC
The best temporary, and perhaps permanent, solution for you would be to switch to xorg-x11. It was marked stable on x86 last night.

Could you do `ls -l /usr/X11R6/bin/X*`? Sounds like you don't have correct ownership and permissions.
Comment 2 Andreas Hofer 2004-07-11 22:58:45 UTC
In fact I started to work with xorg -- until I came across one or two ebuilds (unfortunately don't remember which) which insisted on xfree, which I am using now. If these dependency problems were solved I had no problem in switching back to xorg.

Ok, this is the output of ls -l /usr/X11R6/bin/X* on my machine:

lrwxrwxrwx  1 root root       8  7. Jul 20:05 /usr/X11R6/bin/X -> Xwrapper
-rwxr-xr-x  1 root root 1679768  7. Jul 19:58 /usr/X11R6/bin/XFree86
-rwxr-xr-x  1 root root   27494  7. Jul 19:58 /usr/X11R6/bin/Xmark
-rwxr-xr-x  1 root root 3525692  7. Jul 19:58 /usr/X11R6/bin/Xnest
-rwxr-xr-x  1 root root 2213580  7. Jul 19:58 /usr/X11R6/bin/Xprt
-rwxr-xr-x  1 root root 3826052  7. Jul 19:58 /usr/X11R6/bin/Xvfb
-rwx--x--x  1 root root   10888  7. Jul 19:58 /usr/X11R6/bin/Xwrapper
Comment 3 Donnie Berkholz (RETIRED) gentoo-dev 2004-07-11 23:54:25 UTC
Xwrapper should be suid. Try chmod 4711 /usr/X11R6/bin/Xwrapper.

Those xfree deps should be resolved at this point.
Comment 4 Andreas Hofer 2004-07-12 12:43:32 UTC
Guess what - it helps. Thanks for this one. If I had compared the permissions with my other gentoo box I would have noticed the difference. The open question is though why updating xfree to version 4.3.0-r6 breaks the permissions of Xwrapper. I really did nothing more than a 'emerge sync; emerge --update world'. IMHO this should be fixed (if it is not already done) before closing the bug.

Concerning your comment on xorg I would like to add that I emerged mc-4.6.0-r7 on a freshly installed machine and it installed xfree as a dependancy. Since I used Debian for years and converted to Gentoo only two weeks ago, maybe I just overlooked something in the docs about how to tell portage to prefer xorg over xfree. USE="xorg" does not work in my case. What do I have to do to define globally that portage should let ebuilds depend on xorg rather than on xfree?
Comment 5 Donnie Berkholz (RETIRED) gentoo-dev 2004-07-12 15:15:46 UTC
Try a file /etc/portage/virtuals containing:

virtual/x11			x11-base/xorg-x11
virtual/opengl			x11-base/xorg-x11
virtual/glu			x11-base/xorg-x11
virtual/xft			x11-base/xorg-x11


Gentoo installations 2004.1 and earlier default to xfree rather than xorg-x11 for these virtuals.

You can optionally save yourself that work and wait for the 2004.2 profile to show up. It will exist at /usr/portage/profiles/default-x86-2004.2, and you'll need to symlink /etc/make.profile to that directory.

I'll take a look at the suid problem.
Comment 6 Donnie Berkholz (RETIRED) gentoo-dev 2004-07-12 23:42:17 UTC
-rws--x--x  1 root root   11127 Jul 13 02:36 /usr/X11R6/bin/Xwrapper

Works here.

Mr_Bones_ is working to reproduce.
Comment 7 Mr. Bones. (RETIRED) gentoo-dev 2004-07-13 01:14:07 UTC
Created attachment 35293 [details]
my host.def

Here's the host.def from the build.
Comment 8 Mr. Bones. (RETIRED) gentoo-dev 2004-07-13 01:15:09 UTC
Created attachment 35294 [details]
unpack output.

Did FEATURES="-cvs" ebuild ./xfree-4.3.0-r6.ebuild clean unpack >
/tmp/xfree.unpack
Comment 9 Mr. Bones. (RETIRED) gentoo-dev 2004-07-13 01:15:54 UTC
emerge -vp output

[ebuild   R   ] x11-base/xfree-4.3.0-r6  -3dfx +3dnow -bindist -cjk -debug -doc -ipv6 +mmx -nls +pam -sdk +sse -static +truetype +xml2  17,413 kB
Comment 10 Mr. Bones. (RETIRED) gentoo-dev 2004-07-13 01:18:03 UTC
Portage 2.0.50-r9 (default-x86-2004.0, gcc-3.3.3, glibc-2.3.3.20040420-r0, 2.4.26)
=================================================================
System uname: 2.4.26 i686 AMD Athlon(tm) processor
Gentoo Base System version 1.4.16
distcc 2.13 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r3
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-mcpu=i686 -O3 -pipe -Wall"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/X11/app-defaults /etc/X11/rstart /etc/X11/serverconfig /etc/X11/starthere /etc/X11/xdm /etc/bash_completion /etc/gconf /etc/pango /etc/sound/events /etc/ssmtp /etc/terminfo /usr/X11R6/lib/X11/xkb /etc/env.d"
CXXFLAGS="-mcpu=i686 -O3 -pipe -Wall -Wno-deprecated"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache cvs distcc sandbox"
GENTOO_MIRRORS="http://gentoo.chem.wisc.edu/gentoo/"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/home/msterret/gentoo-x86"
PORTDIR_OVERLAY="/home/msterret/src/portage-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow X apm arts avi berkdb cdr crypt cscope cups dvd encode esd foomaticdb gdbm gif gnome gpm gtk gtk2 guile java jpeg libg++ libwww mad mikmod mmx mozilla moznocompose moznoirc moznomail mpeg nas ncurses noreiserfs oggvorbis opengl oss pam pcre pdflib perl png ppds python quicktime readline sdl spell sse ssl tcpd tiff truetype x86 xml2 xmms xv zlib"
Comment 11 Andreas Hofer 2004-07-13 10:21:33 UTC
I cannot reproduce the bug anymore at the moment just by reemerging xfree.  Maybe the bug should be closed now. I could be reopened if it happens again? I am not the one to decide this but for me it would be ok to close this one since I have no idea how to reproduce it.

Andreas
Comment 12 Mr. Bones. (RETIRED) gentoo-dev 2004-07-13 18:23:43 UTC
Ok, I believe I have found the problem for me.  For some reason, /var/tmp/portage was g+s.  This caused problems with both beep and xfree wrt setuid programs.
After removing the +s bit everything worked normally.
Comment 13 Donnie Berkholz (RETIRED) gentoo-dev 2004-07-13 18:34:14 UTC
Not an X bug, I'd guess it's portage.
Comment 14 Mr. Bones. (RETIRED) gentoo-dev 2004-07-13 18:38:58 UTC
Oh, and this seems to have been possibly caused by a very briefly used portage
version or something.  It certainly doesn't appear to be an issue with the
latest stable portage.  I'm ok with having this bug closed and I guess so
is the original reporter so... up to the portage team to close it out.
Comment 15 Nicholas Jones (RETIRED) gentoo-dev 2004-07-31 20:38:45 UTC
Which portage version are you refering to that caused a problem with the g+s?
If it's no longer repeatable, closing it is fine.
Comment 16 Mr. Bones. (RETIRED) gentoo-dev 2004-07-31 20:45:12 UTC
Because this causes such hard-to-track-down failures, please add a check for this on startup in portage.
Comment 17 Brian Harring (RETIRED) gentoo-dev 2004-08-04 21:30:35 UTC
pre16 is being released now.