Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 210846 - problem in chroot if all environment variables are passed over
Summary: problem in chroot if all environment variables are passed over
Status: VERIFIED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-20 08:25 UTC by Ilya Dmitrichenko
Modified: 2008-02-20 15:20 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Dmitrichenko 2008-02-20 08:25:57 UTC
this becomes an obvious issue if you have CFLAGS in the environment.
so having CFLAGS="-march=athlon64", for instance, and going into the 32bit chroot with that, might probably result unxpectedly ..

here is my /usr/bin/x86-chroot:

#!/bin/bash
source /etc/conf.d/x86-chroot
which xhost &>/dev/null && xhost local:localhost &>/dev/null
env -i env TERM=$TERM linux32 chroot ${CHROOT_LOCATION} /bin/bash -l

it's quick and dirty (because of two env's), well but it works totaly fine.
i had it without TERM presrvation bit at first, but found some actuall problems when ran emerge ..


if someone has a better idea what could happend  if we compile with -march=k8 in the chroot which is dedicated to be 32bit, please tell more about it!
i had actully compiled one or two apps before i noticed that the CFLAGS aren't right ..
is gcc just gonna make a 64bit binary?
or it's gonna just assume cpu flags as for the given -march ?

i think gcc fails if there is -march=k8 and -m32 together, i can't remember exactly however.

another suggestion could be to put some if()'s into the script, so if there CFLAGS, CPPFLAGS, CXX.. and such - just unset them.

but i suspect there might be some other potentially dengerous vars in the env,
so could be a good idea to set all to the most basic kind ..
and may be give an option in /etc/conf.d/x86-chroot to turn this feature on or off; may be even let the user supply the flags he/she wiosh to keep.






Reproducible: Always
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2008-02-20 08:31:07 UTC
If you need support, use a proper place fir this; bugzilla is not one of them. Thanks.

http://www.gentoo.org/main/en/support.xml
Comment 2 Ilya Dmitrichenko 2008-02-20 15:12:07 UTC
(In reply to comment #1)
> If you need support, use a proper place fir this; bugzilla is not one of them.
> Thanks.
> 
> http://www.gentoo.org/main/en/support.xml
> 

i did not mean that need support.
i was suggesting a bug fix, and added some consideration ..reasoning why we need it.
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2008-02-20 15:19:21 UTC
1/ x86-chroot ebuild is pending removal

2/ There's nothing to fix - you should *never* stick -m[32|64] into your make.conf yourself, that's taken care of by the appropriate profiles (which would be x86 ones in your chroot).

3/ -march=k8 or whatever similar works perfectly fine on 32bit userland, see man gcc.

If you have more questions, see http://www.gentoo.org/main/en/support.xml; this doesn't belong here.