Preparing for the next release: call for testing

Mike Frysinger vapier at gentoo.org
Sun Mar 1 07:56:41 UTC 2015


On 27 Feb 2015 01:06, Mike Frysinger wrote:
> vFAIL: test; s390/32-bit/MSB linux-3.18.1 kernel-headers-3.16.0 glibc-2.19 gcc-4.8.3
> FAIL: uid
> FAIL: uid16

these tests fail because:
 - s390 is old enough to have "real" 16bit uid syscalls
 - the tests are using 32bit values (int instead of short)
 - little endian arches will pass anyways, but big endian fails:
	int uid = 8282;  // 0x205a
	short *puid = &uid;
	*puid = 8282;
	/* uid is now 542777434 which is 0x205a205a */

uid16 is easy to fix:
--- a/tests/uid16.c
+++ b/tests/uid16.c
@@ -33,7 +33,7 @@ main(void)
  && __NR_chown != __NR_chown32 \
  && __NR_getgroups != __NR_getgroups32 \
  /**/
-	int r, e, s;
+	short r, e, s;
 	int size;
 	int *list = 0;
 

but uid is not as easy because __NR_getuid might operate on 32bits in which case 
you'd corrupt vars on the stack.  you could work around it by doing:
--- a/tests/uid.c
+++ b/tests/uid.c
@@ -16,15 +16,19 @@ main(void)
  && defined(__NR_setresuid) \
  && defined(__NR_chown) \
  && defined(__NR_getgroups)
-	int r, e, s;
+	/* The kernel API might be 16bit or 32bit */
+	union {
+		int u32;
+		short u16;
+	} r, e, s;
 	int size;
 	int *list = 0;
 
-	e = syscall(__NR_getuid);
-	assert(syscall(__NR_setuid, e) == 0);
-	assert(syscall(__NR_getresuid, &r, &e, &s) == 0);
+	e.u16 = syscall(__NR_getuid);
+	assert(syscall(__NR_setuid, e.u16) == 0);
+	assert(syscall(__NR_getresuid, &r.u16, &e.u16, &s.u16) == 0);
 	assert(syscall(__NR_setreuid, -1, -1L) == 0);
-	assert(syscall(__NR_setresuid, -1, e, -1L) == 0);
+	assert(syscall(__NR_setresuid, -1, e.u16, -1L) == 0);
 	assert(syscall(__NR_chown, ".", -1, -1L) == 0);
 	assert((size = syscall(__NR_getgroups, 0, list)) >= 0);
 	assert(list = calloc(size + 1, sizeof(*list)));

this will fail if your uid is actually larger than 16bits and you're on an arch 
that only has 32bit syscalls.  but maybe that case is unusual enough to not care 
about ?  or at least, that is testable:
	int uid = syscall(__NR_getuid);
	if (uid >= (short)-1)
		return 77;
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150301/f4c14f07/attachment.bin>


More information about the Strace-devel mailing list