Subject: Re: [vserver] sigbus test fails
From: Gordan Bobic <gordan@bobich.net>
Date: Tue, 22 Feb 2011 11:46:24 +0000

Here's a retest using pre2935.

The strace comes out pretty much identical:

# ensc_use_expensive_tests="no" ensc_test_debug="no" 
srctestsuitedir=./src/testsuite 
libinternaltestsuitedir=./lib_internal/testsuite strace 
lib_internal/testsuite/sigbus
execve("lib_internal/testsuite/sigbus", 
["lib_internal/testsuite/sigbus"], [/* 30 vars */]) = 0
open("/dev/urandom", O_RDONLY)          = 3
read(3, "`\213\344\0", 4)               = 4
open("/tmp/sigbus.0r29e0", O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0600) = 4
close(3)                                = 0
open("/dev/urandom", O_RDONLY)          = 3
read(3, "\3750\223\276", 4)             = 4
open("/tmp/sigbus.t7c69v", O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0600) = 5
close(3)                                = 0
write(4, 
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
73728) = 73728
close(4)                                = 0
close(5)                                = 0
unlink("/tmp/sigbus.t7c69v")            = 0
stat64("/tmp/sigbus.0r29e0", {st_mode=S_IFREG|0600, st_size=73728, ...}) = 0
open("/tmp/sigbus.0r29e0", 
O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_NOFOLLOW) = 3
open("/tmp/sigbus.t7c69v", O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_LARGEFILE, 
0200) = 4
fstat64(3, {st_mode=S_IFREG|0600, st_size=73728, ...}) = 0
rt_sigaction(SIGBUS, {0x85f8, [BUS], SA_NODEFER}, {SIG_DFL, [], 0}, 8) = 0
_llseek(3, 0, [73728], SEEK_END)        = 0
ftruncate64(4, 316659348799488)         = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
mmap2(NULL, 73728, PROT_READ, MAP_SHARED, 3, 0) = 0x400d3000
mmap2(NULL, 73728, PROT_WRITE, MAP_SHARED, 4, 0) = 0x401e3000
madvise(0x400d3000, 73728, MADV_SEQUENTIAL) = 0
madvise(0x401e3000, 73728, MADV_SEQUENTIAL) = 0
munmap(0x401e3000, 73728)               = 0
munmap(0x400d3000, 73728)               = 0
rt_sigaction(SIGBUS, {SIG_DFL, [BUS], SA_NODEFER}, {0x85f8, [BUS], 
SA_NODEFER}, 8) = 0
close(4)                                = 0
close(3)                                = 0
socketpair(PF_FILE, SOCK_STREAM, 0, [3, 4]) = 0
rt_sigaction(SIGCHLD, {SIG_IGN, [CHLD], SA_NODEFER}, {SIG_DFL, [], 0}, 
8) = 0
fork()                                  = 12885
unlink("/tmp/sigbus.t7c69v")            = 0
open("/tmp/sigbus.0r29e0", 
O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_NOFOLLOW) = 5
open("/tmp/sigbus.t7c69v", O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_LARGEFILE, 
0200) = 6
fstat64(5, {st_mode=S_IFREG|0600, st_size=73728, ...}) = 0
rt_sigaction(SIGBUS, {0x85f8, [BUS], SA_NODEFER}, {SIG_DFL, [BUS], 
SA_NODEFER}, 8) = 0
_llseek(5, 0, [73728], SEEK_END)        = 0
ftruncate64(6, 316659348799488)         = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
mmap2(NULL, 73728, PROT_READ, MAP_SHARED, 5, 0) = 0x40069000
mmap2(NULL, 73728, PROT_WRITE, MAP_SHARED, 6, 0) = 0x400b5000
madvise(0x40069000, 73728, MADV_SEQUENTIAL) = 0
madvise(0x400b5000, 73728, MADV_SEQUENTIAL) = 0
send(4, ".", 1, 0)                      = 1
recv(4, ".", 1, 0)                      = 1
--- SIGBUS (Bus error) @ 0 (0) ---
munmap(0x400b5000, 73728)               = 0
munmap(0x40069000, 73728)               = 0
rt_sigaction(SIGBUS, {SIG_DFL, [BUS], SA_NODEFER}, {0x85f8, [BUS], 
SA_NODEFER}, 8) = 0
close(6)                                = 0
close(5)                                = 0
fork()                                  = 12886
unlink("/tmp/sigbus.t7c69v")            = 0
open("/tmp/sigbus.0r29e0", 
O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_NOFOLLOW) = 5
open("/tmp/sigbus.t7c69v", O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_LARGEFILE, 
0200) = 6
fstat64(5, {st_mode=S_IFREG|0600, st_size=36864, ...}) = 0
rt_sigaction(SIGBUS, {0x85f8, [BUS], SA_NODEFER}, {SIG_DFL, [BUS], 
SA_NODEFER}, 8) = 0
_llseek(5, 0, [36864], SEEK_END)        = 0
ftruncate64(6, 158329674399744)         = 0
rt_sigprocmask(SIG_BLOCK, NULL, [BUS], 8) = 0
mmap2(NULL, 36864, PROT_READ, MAP_SHARED, 5, 0) = 0x40089000
mmap2(NULL, 36864, PROT_WRITE, MAP_SHARED, 6, 0) = 0x400f3000
madvise(0x40089000, 36864, MADV_SEQUENTIAL) = 0
madvise(0x400f3000, 36864, MADV_SEQUENTIAL) = 0
send(4, ".", 1, 0)                      = 1
recv(4, ".", 1, 0)                      = 1
--- SIGBUS (Bus error) @ 0 (0) ---
+++ killed by SIGBUS +++
Bus error

The backtrace looks the same, too:

# gdb --quiet sigbus core.14491
Reading symbols from 
/usr/src/redhat/BUILD/util-vserver-0.30.216-pre2935/lib_internal/testsuite/sigbus...done.
[New Thread 14491]
Core was generated by `lib_internal/testsuite/sigbus'.
Program terminated with signal 7, Bus error.
#0  copyMem (in_fd=0, out_fd=0) at lib_internal/testsuite/../unify-copy.c:95
95	    if (*src != 0) *dst = *src;
(gdb) backtrace
#0  copyMem (in_fd=0, out_fd=0) at lib_internal/testsuite/../unify-copy.c:95
#1  copyMMap (in_fd=0, out_fd=0) at 
lib_internal/testsuite/../unify-copy.c:146
#2  0x00008578 in copyReg (src=<value optimized out>, src_stat=<value 
optimized out>, dst=<value optimized out>)
     at lib_internal/testsuite/../unify-copy.c:186
#3  0x000086e4 in checkTrunc (src=0xbeae1618 "/tmp/sigbus.oejsqt", 
dst=0xbeae1604 "/tmp/sigbus.p1dovd", st=0xbeae1598, pos=9029)
     at lib_internal/testsuite/sigbus.c:76
#4  0x0000886c in main () at lib_internal/testsuite/sigbus.c:105


Looking at where the the *src and *dst come from in #0, it seems they 
are mmap-ed and madvised in in unify-copy.c:copyMMap()

So I'm guessing that it could be related to a bug in one of those libc 
functions. Does anyone agree/disagree on this?

Gordan