linux emulation: Preliminary support for more auxvec's [patch]
Marcin Cieslak
saper at system.pl
Mon Jul 14 10:23:34 UTC 2008
Alexander Leidinger wrote:
> Quoting Marcin Cieslak <saper at system.pl> (from Fri, 11 Jul 2008 21:55:36
> +0200):
>
>> The patch is here:
>>
>> http://akson.sgh.waw.pl/~saper/FreeBSD/linux/auxvec.diff
>
>
> -#define AT_COUNT 15 /* Count of defined aux entry types. */
> +#define AT_COUNT 18 /* Count of defined aux entry types. */
> ---snip---
>
> I would expect that count is 24, not 18. But what happens if we increase
> it to 24, is it expected to have some valid data by some automatism
> based upon AT_COUNT then? What's in 18-22?
Well, the count is the count - it's number of slots in the table. It is
used for the allocation of the structure space.
As Kostik Belousov pointed, rtld uses this (incorrectly) in
libexec/rtld-elf/rtld.c in _rtld() an array of AT_COUNT elements is
created and only items with values (0..AT_COUNT) are included in the table.
This should be probably be changed to something in similar to
lib/libc/gen/tls.c (see _init_tls() at the very end).
Solaris sys/auxv.h comments explain the 18-22 shift (Linux collided
with PPC ABI values):
http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/sys/auxv.h
You can also here that Solaris defines quite large AT_* values, so an
approach taken by rtld is not practical in the long term.
I think in the long term (upstream, not in the linuxolator) we should
allow ELF stack fixup routine to dynamically allocate user stack and get
rid of AT_COUNT completely. I guess this could be done by extending
(struct sysentvec *) and changing the code around 457 of kern_exec.c to
separate "copy out strings" and "separate stack base" functions.
This work-in-progress patch
(http://people.freebsd.org/~kib/misc/rtld-origin.1.patch) also requires
some allocation on the user stack.
--Marcin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 273 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-emulation/attachments/20080714/8c5c9abe/signature.pgp
More information about the freebsd-emulation
mailing list