The modified test none/tests/sem crashes with a SEGV when valgrind is compiled
with lto on various amd64 platforms (debian/gcc 6.3, RHEL7/gcc 6.4,
Ubuntu/gcc 7.2)
The problem is that the vki_semid_ds buf is not what is expected by the kernel:
the kernel expects a bigger structure vki_semid64_ds (at least on
these platforms).
Getting the sem_nsems seems to work by chance, as sem_nsems is at
the same offset in both vki_semid_ds and vki_semid64_ds.
However, e.g. the ctime was not set properly after syscall return,
and 2 words after sem_nsems were set to 0 by the kernel, causing
the SEGV, as a spilled register became 0.
Fix consists in using the 64 bit version for __NR_semctl.
Tested on debian/amd64 and s390x.
The test succeeds on amd64, but fails on x86, with the following diff:
+Syscall param semctl(arg) points to uninitialised byte(s)
+ at 0x........: semctl@@GLIBC_2.2 (semctl.c:109)
+ by 0x........: main (sem.c:36)
+ Address 0x........ is on thread 1's stack
+
+Syscall param semctl(arg) points to uninitialised byte(s)
+ at 0x........: semctl@@GLIBC_2.2 (semctl.c:109)
+ by 0x........: main (sem.c:43)
+ Address 0x........ is on thread 1's stack
+
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13073