On 27 Feb 2015 01:06, Mike Frysinger wrote:
> i'll look into the ppc/sparc ipc_sem failures.  i suspect it's a 
> kernel/system 
> config thing we need to test for and SKIP.

in both cases it's a 32bit prog running under a 64bit kernel.  i suspect the 
kernel is broken but no one noticed because who cares about ipc :).  the same 
ppc system passes tests with a 64bit userland.  i don't have sparc 64bit 
userland to check.

i tried messing with setarch and passing in -XBIST3LZR, and now running ipc_sem 
has created an unkillable process :D.  which makes me think even more that 
there's a kernel mismatch here.

maybe we should use errno==EFAULT as a marker ?  a non-fatal ERROR would be 
nice, but the test framework doesn't support such a thing.  you can't do 
XFAIL/PASS dynamically with the automake framework.  maybe something like the
attached patch ?


here is the ppc one:
$ strace ./ipc_sem
execve("./ipc_sem", ["./ipc_sem"], [/* 27 vars */]) = 0
brk(0)                                  = 0x10012000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xf7f4d000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=15865, ...}) = 0
mmap(NULL, 15865, PROT_READ, MAP_PRIVATE, 3, 0) = 0xf7f49000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, 
"\177ELF\1\2\1\3\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\2\35\254\0\0\0004"..., 512) 
= 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1471360, ...}) = 0
mmap(0xfe77000, 1541424, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) 
= 0xfe77000
mprotect(0xffd8000, 65536, PROT_NONE)   = 0
mmap(0xffe8000, 20480, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x161000) = 0xffe8000
mmap(0xffed000, 9520, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffed000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xf7f48000
mprotect(0xffe8000, 16384, PROT_READ)   = 0
mprotect(0x10010000, 4096, PROT_READ)   = 0
mprotect(0xf7f4e000, 4096, PROT_READ)   = 0
munmap(0xf7f49000, 15865)               = 0
semget(IPC_PRIVATE, 1, 0600)            = 2752514
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xf7f4c000
write(1, "semget\\(IPC_PRIVATE, 1, 0600\\) +"..., 42semget\(IPC_PRIVATE, 1, 
0600\) += 2752514
) = 42
semctl(2752514, 0, IPC_64|IPC_STAT, 0xffce4e3c) = 0
write(1, "semctl\\(2752514, 0, IPC_STAT, 0x"..., 48semctl\(2752514, 0, 
IPC_STAT, 0xffce4ec0\) += 0
) = 48
semctl(0, 0, SEM_INFO, 0xffce4e3c)      = -1 EFAULT (Bad address)
semctl(2752514, 0, IPC_RMID, 0xffce4e3c) = 0
write(1, "semctl\\(2752514, 0, IPC_RMID, 0\\"..., 39semctl\(2752514, 0, 
IPC_RMID, 0\) += 0
) = 39
exit_group(1)                           = ?
+++ exited with 1 +++


sparc one looks largely the same:
$ strace ./ipc_sem
execve("./ipc_sem", ["./ipc_sem"], [/* 45 vars */]) = 0
brk(0)                                  = 0x24000
uname({sys="Linux", node="bender", ...}) = 0
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=21673, ...}) = 0
mmap(NULL, 21673, PROT_READ, MAP_PRIVATE, 3, 0) = 0xf798c000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\22\0\0\0\1\0\2\2@\0\0\0004"..., 
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1481056, ...}) = 0
mmap(NULL, 1555224, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0xf77e8000
mprotect(0xf7950000, 57344, PROT_NONE)  = 0
mmap(0xf795e000, 16384, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x166000) = 0xf795e000
mmap(0xf7962000, 6936, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xf7962000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xf798a000
mprotect(0xf795e000, 8192, PROT_READ)   = 0
mprotect(0x20000, 8192, PROT_READ)      = 0
mprotect(0xf7992000, 8192, PROT_READ)   = 0
munmap(0xf798c000, 21673)               = 0
semget(IPC_PRIVATE, 1, 0600)            = 294912
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xf7990000
write(1, "semget\\(IPC_PRIVATE, 1, 0600\\) +"..., 41semget\(IPC_PRIVATE, 1, 
0600\) += 294912
) = 41
semctl(294912, 0, IPC_64|IPC_STAT, 0xffdb7138) = -1 EFAULT (Bad address)
semctl(294912, 0, IPC_64|IPC_RMID, 0xffdb7138) = 0
write(1, "semctl\\(294912, 0, IPC_RMID, 0\\)"..., 38semctl\(294912, 0, 
IPC_RMID, 0\) += 0
) = 38
exit_group(1)                           = ?
+++ exited with 1 +++
-mike
From e85573dfed6f936baa6a6e295d7c2ef584bde33d Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vap...@gentoo.org>
Date: Fri, 27 Feb 2015 01:39:25 -0500
Subject: [PATCH] ipc_sem: detect broken kernels

When running 32bit ipc tests on ppc/sparc with a 64bit kernel, the ipc
logic wrongly returns errors.  Detect that and throw an error.

* tests/ipc_sem.c: Return 99 when errno is EFAULT.
* tests/ipc_sem.test: Save output to $OUT and show it when failing.
Handle exit status 99 to throw an ERROR.
---
 tests/ipc_sem.c    |  2 +-
 tests/ipc_sem.test | 19 +++++++++++++++----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/tests/ipc_sem.c b/tests/ipc_sem.c
index 115221b..3f2fbe7 100644
--- a/tests/ipc_sem.c
+++ b/tests/ipc_sem.c
@@ -44,6 +44,6 @@ done:
 	return rc;
 
 fail:
-	rc = 1;
+	rc = errno == EFAULT ? 99 : 1;
 	goto done;
 }
diff --git a/tests/ipc_sem.test b/tests/ipc_sem.test
index df9a9bb..49182e2 100755
--- a/tests/ipc_sem.test
+++ b/tests/ipc_sem.test
@@ -8,12 +8,23 @@ check_prog grep
 
 OUT="$LOG.out"
 
-./ipc_sem > /dev/null || {
-	if [ $? -eq 77 ]; then
+./ipc_sem > "$OUT" || {
+	case $? in
+	77)
+		rm -f "$OUT"
 		framework_skip_ 'ipc semget/semctl syscalls do not behave as expected'
-	else
+		;;
+	99)
+		cat "$OUT"
+		rm -f "$OUT"
+		framework_failure_ 'broken kernel detected'
+		;;
+	*)
+		cat "$OUT"
+		rm -f "$OUT"
 		fail_ 'ipc_sem failed'
-	fi
+		;;
+	esac
 }
 
 args="-eipc ./ipc_sem $f"
-- 
2.3.0

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to