On Thu, Dec 06, 2007 at 02:05:57PM -0500, Nils Nieuwejaar wrote:
> I'm not sure why CentOS 5 is listed as 'working' on the Linux 2.6 page.  As
> far as I can tell, that's simply not possible.  Ed, any idea how CentOS 5
> earned a reputation for working here?
>

---8<---
root at mcescher$ zonecfg -z centos5x_new
centos5x_new: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:centos5x_new> create -t SUNWlx26
zonecfg:centos5x_new> set zonepath=/export/zones/centos5x_new
zonecfg:centos5x_new> exit
root at mcescher$ zoneadm -z centos5x_new install -d
/export/install/lx/centos5.tar.bz2
A ZFS file system has been created for this zone.
Installing zone 'centos5x_new' at root directory
'/export/zones/centos5x_new'
from archive '/export/install/lx/centos5.tar.bz2'

This process may take several minutes.

Setting up the initial lx brand environment.
System configuration modifications complete.
Setting up the initial lx brand environment.
System configuration modifications complete.

Installation of zone 'centos5x_new' completed successfully.

Details saved to log file:
    "/export/zones/centos5x_new/root/var/log/centos5x_new.install.386848.log"

root at mcescher$ zlogin -C centos5x_new
[Connected to zone 'centos5x_new' console]

[NOTICE: Zone booting up]
INIT: version 2.86 booting
                Welcome to  CentOS release 5 (Final)
                Press 'I' to enter interactive startup.
hwclock is unable to get I/O port access:  the iopl(3) call failed.
Setting clock  (utc): Thu Dec  6 13:04:52 PST 2007 [  OK  ]
Setting hostname centos5x_new:  [  OK  ]
raidautorun: unable to autocreate /dev/md0
awk: cmd. line:1: fatal: cannot open file `/proc/misc' for reading (No
such file or directory)
Checking filesystems
Checking all file systems.
[  OK  ]
Mounting local filesystems:  [  OK  ]
Enabling local filesystem quotas:  quotaon: Warning: No quota format
detected in the kernel.
[  OK  ]
/etc/rc.d/rc.sysinit: line 756: /dev/urandom: Permission denied
Enabling /etc/fstab swaps:  [  OK  ]
INIT: Entering runlevel: 3
Entering non-interactive startup
Starting background readahead: [  OK  ]
Starting auditd: [FAILED]
Starting system logger: [  OK  ]
Starting kernel logger: [  OK  ]
Starting system message bus: [  OK  ]
Can't open RFCOMM control socket: Address family not supported by
protocol

Starting PC/SC smart card daemon (pcscd): [  OK  ]
Starting hidd: Can't open HIDP control socket: Address family not
supported by protocol
[FAILED]
Starting autofs:  Loading autofs4: [FAILED]
[FAILED]
...

CentOS release 5 (Final)
Kernel 2.6.18 on an i686

centos5x_new login: ~.
[Connection to zone 'centos5x_new' console closed]
root at mcescher$ zlogin centos5x_new
[Connected to zone 'centos5x_new' pts/24]
Last login: Wed Jun  6 23:04:02 from netinstall-75.sfbay.sun.com
Welcome to your shiny new Linux zone.

...
        - To enable networking goodness, see
          /etc/sysconfig/network.example.

        - This message is in /etc/motd.  Feel free to change it.

For anything more complicated, see:
        http://opensolaris.org/os/community/brandz/

[root at centos5x_new ~]# uname -a
Linux centos5x_new 2.6.18 BrandZ fake linux i686 athlon i386 GNU/Linux
[root at centos5x_new ~]# /bin/ksh
# uname -a
Linux centos5x_new 2.6.18 BrandZ fake linux i686
#
---8<---

> The gory details: Solaris allocates the stack with the top at 0x8048000.
> Luckily for us, on CentOS 3, binaries are built to be installed at
> 0x8048000 - right after the stack.  In CentOS 4 and 5, it looks like most
> binaries are built to be loaded at 0x8047000.  So, the process's stack is
> clobbered by the first page of the binary.
>
> For whatever reason, the ksh in CentOS 5 was built to be loaded at
> 0x8050000 - which is safely above the stack.   (use 'elfdump' on the
> binary if this is at all interesting to you. :)
>

iirc, these are relocatable elf file, so that address is just a
suggestion.  we can actually load the executable at any address we want.
see:
http://docs.sun.com/app/docs/doc/819-0690/6n33n7fde?l=it&a=view
---8<---
Base Address
...
To compute the base address, you determine the memory address that are
associated with the lowest p_vaddr value for a PT_LOAD segment. You then
obtain the base address by truncating the memory address to the nearest
multiple of the maximum page size. Depending on the kind of file being
loaded into memory, the memory address might not match the p_vaddr
values.
---8<---

---8<---
root at mcescher$ elfdump /export/zones/centos5x_new/root/sbin/init | grep
0x8048 | head -2
    p_vaddr:      0x8048034   p_flags:    [ PF_X PF_R ]
    p_paddr:      0x8048034   p_type:     [ PT_PHDR ]
---8<---

this was fixed by:
6308191 mapelfexec() may fail with ENOMEM if a non-zero p_vaddr is specified 
for an ET_DYN binary

which looks at all of the p_vaddr values in a program, and subtracts
out the lowest value.  so when we load the elf object we can load
it at any address we want as long as we keep the relative offsets
between p_vaddr values correct.

for all the really gory details look in mapelfexec() for the following
comment:
                /*
                 * Calculate the minimum vaddr so it can be subtracted out.
                 * According to the ELF specification, since PT_LOAD sections
                 * must be sorted by increasing p_vaddr values, this is
                 * guaranteed to be the first PT_LOAD section.
                 */


> I don't have an Ubuntu zone handy, but since I've heard multiple success
> stories, I assume their binaries go someplace less hazardous.
>
> I'm trying to figure out a clean way to solve this problem now.
>

i'm not so sure that this really is a problem...
what am i missing?

ed

Reply via email to