This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] S/390: Skip extra zeroes when searching auxv
- From: "Andreas Krebbel" <krebbel at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 11 Apr 2011 09:31:44 +0200
- Subject: [PATCH] S/390: Skip extra zeroes when searching auxv
Hi,
the s390 (32 bit) startup code contains a check which matches the
highgprs kernel capability from the auxiliary vector with a flag from
the elf header. In order to read the auxiliary vector the checking
code has to skip over the argument and environment variable vectors.
It assumes that both of them has a single zero ending byte. But this
isn't true anymore with a recent change which removes unsecure
environment variables for setuid programs from the env vector. This
leads to additional zero bytes between the env vector and auxiliary
vector.
With the attached patch additional zero bytes are skipped before
reading the auxiliary vector.
Tested on s390. No regressions.
Please apply if ok.
Bye,
-Andreas-
2011-04-11 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* sysdeps/s390/s390-32/elf/start.S (_start): Skip extra zeroes
between environment variables and auxiliary vector.
--- glibc-2.12.1-4-gfdae809/sysdeps/s390/s390-32/elf/start.S.orig 2011-04-08 23:11:57.408223177 +0200
+++ glibc-2.12.1-4-gfdae809/sysdeps/s390/s390-32/elf/start.S 2011-04-08 23:13:23.698217897 +0200
@@ -75,6 +75,18 @@ _start:
ltr %r5,%r5
jne .L12
+ /* Usually the auxiliary vector can be expected directly after
+ the environment variables. But we have to skip extra zeros
+ because the loader might have removed unsecure variables for
+ setuid programs. */
+
+.L26: l %r5,0(%r6)
+ la %r6,4(%r6)
+ ltr %r5,%r5
+ jz .L26
+
+ ahi %r6,-4
+
/* Obtain the needed values from the auxiliary vector. */
lhi %r7,16 /* AT_HWCAP */