Andy Polyakov via RT a écrit :
>>>> I see a very strange bug in crypto/sparcv9cap.c. OpenSSL 1.0.0d checks
>>>> sparc capabilities with SIGILL signal. On sparc64 (both Linux and
>>>> solaris, with UltraSPARC III+ and T1 CPU's), SIGILL handler is called
>>>> and program terminates with SIGILL in _sparcv9_fmadd_probe:
>>>>
>>>> 00000001002a32d0<_sparcv9_fmadd_probe>:
>>>> 1002a32d0: 81 b0 0d 80 impdep1 108, %f0, %f0, %f0
>>>> 1002a32d4: 85 b0 8d 82 impdep1 108, %f2, %f2, %f2
>>>> 1002a32d8: 81 c3 e0 08 retl
>>>> 1002a32dc: 81 b8 04 40 impdep2 34, %f0, %f0, %f0<= here
Question : if sparc processor cannot execute impdep2 instruction,
SIGILL is caught and program has to jump to signal handler.
>>>> If I add printf() in signal handler, I see that it is called, and that
>>>> siglongjmp() works. With my printf(), my program doesn't abort with
>>>> SIGILL anymore but with SIGBUS (?!).
>>> Could you 'truss -v sigaction,sigprocmask apps/openssl version' and
>>> submit output?
>>
>> I cannot. My server doesn't run Solaris but Linux/sparc. I just have
>> seen the same bug a long time ago on Solaris but I don't have any
>> solaris server anymore.
>
> Then run 'strace -v apps/openssl version'.
Output is attached.
Regards,
JKB
execve("apps/openssl", ["apps/openssl", "version"],
["NNTPSERVER=news.nerim.net", "TERM=xterm", "SHELL=/bin/bash",
"XDG_SESSION_COOKIE=22b98fd860dcc"..., "SSH_CLIENT=192.168.0.4 56019 22",
"SSH_TTY=/dev/pts/8", "USER=bertrand", "USERNAME=bertrand",
"MAIL=/var/mail/bertrand", "PATH=/import/home/bertrand/bin:/"...,
"PWD=/import/home/bertrand/gopher"..., "EDITOR=vim", "LANG=fr_FR.UTF-8",
"SHLVL=1", "HOME=/import/home/bertrand", "BASH_ENV=/import/home/bertrand/."...,
"LOGNAME=bertrand", "SSH_CONNECTION=192.168.0.4 56019"...,
"DISPLAY=localhost:11.0", "_=/usr/bin/strace",
"OLDPWD=/import/home/bertrand/gop"...]) = 0
brk(0) = 0x1f0000
uname({sysname="Linux", nodename="rayleigh", release="2.6.36.2", version="#1
SMP Sun Jan 2 11:50:13 CET 2011", machine="sparc64"}) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xf7ff0000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_dev=makedev(9, 1), st_ino=208843, st_mode=S_IFREG|0644,
st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=296, st_size=146907,
st_atime=2011/07/19-14:25:20, st_mtime=2011/07/19-14:25:18,
st_ctime=2011/07/19-14:25:19}) = 0
mmap(NULL, 146907, PROT_READ, MAP_PRIVATE, 3, 0) = 0xf7f98000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/sparc-linux-gnu/libdl.so.2", O_RDONLY) = 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\0\v\340\0\0\0004"..., 512)
= 512
fstat64(3, {st_dev=makedev(9, 1), st_ino=202436, st_mode=S_IFREG|0644,
st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=40, st_size=18316,
st_atime=2011/07/19-13:30:01, st_mtime=2011/06/13-03:46:26,
st_ctime=2011/06/26-13:27:57}) = 0
mmap(NULL, 82424, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0xf7f80000
mprotect(0xf7f84000, 57344, PROT_NONE) = 0
mmap(0xf7f92000, 16384, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0xf7f92000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/sparc-linux-gnu/libc.so.6", O_RDONLY) = 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\n\240\0\0\0004"..., 512)
= 512
fstat64(3, {st_dev=makedev(9, 1), st_ino=202432, st_mode=S_IFREG|0755,
st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=2952,
st_size=1505436, st_atime=2011/07/19-13:30:01, st_mtime=2011/06/13-03:46:26,
st_ctime=2011/06/26-13:27:57}) = 0
mmap(NULL, 1580552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0xf7dfc000
mprotect(0xf7f66000, 65536, PROT_NONE) = 0
mmap(0xf7f76000, 24576, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16a000) = 0xf7f76000
mmap(0xf7f7c000, 7688, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xf7f7c000
close(3) = 0
mprotect(0xf7f76000, 8192, PROT_READ) = 0
mprotect(0xf7f92000, 8192, PROT_READ) = 0
mprotect(0xf7fec000, 8192, PROT_READ) = 0
munmap(0xf7f98000, 146907) = 0
rt_sigprocmask(SIG_SETMASK, ~[ILL TRAP EMT FPE BUS SEGV RT_0 RT_1], [], 8) = 0
rt_sigaction(SIGILL, {0x14afc0, ~[ILL TRAP EMT FPE BUS SEGV RT_0 RT_1], 0},
{SIG_DFL, [], 0}, 0xf7e34318, 4294967295) = 0
rt_sigaction(SIGBUS, {0x14afc0, ~[ILL TRAP EMT FPE BUS SEGV RT_0 RT_1], 0},
{SIG_DFL, [], 0}, 0xf7e34318, 4294967295) = 0
rt_sigprocmask(SIG_BLOCK, NULL, ~[ILL TRAP EMT FPE KILL BUS SEGV STOP RT_0
RT_1], 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, ~[ILL TRAP EMT FPE KILL BUS SEGV STOP RT_0
RT_1], 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, ~[ILL TRAP EMT FPE KILL BUS SEGV STOP RT_0
RT_1], 8) = 0
--- SIGILL (Illegal instruction) @ 0 (0) ---
rt_sigprocmask(SIG_SETMASK, ~[ILL TRAP EMT FPE KILL BUS SEGV STOP RT_0 RT_1],
NULL, 8) = 0
rt_sigaction(SIGBUS, {SIG_DFL, [], 0}, NULL, 0xf7e34318, 4294967295) = 0
rt_sigaction(SIGILL, {SIG_DFL, [], 0}, NULL, 0xf7e34318, 4294967295) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
brk(0) = 0x1f0000
brk(0x212000) = 0x212000
rt_sigaction(SIGPIPE, {SIG_IGN, [PIPE], SA_RESTART}, {SIG_DFL, [], 0},
0xf7e34318, 4294967295) = 0
open("/usr/local/ssl/openssl.cnf", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory)
write(2, "WARNING: can't open config file:"..., 60WARNING: can't open config
file: /usr/local/ssl/openssl.cnf
) = 60
open("/proc/meminfo", O_RDONLY) = 3
fstat64(3, {st_dev=makedev(0, 3), st_ino=4026531938, st_mode=S_IFREG|0444,
st_nlink=1, st_uid=0, st_gid=0, st_blksize=1024, st_blocks=0, st_size=0,
st_atime=2011/07/20-10:00:40, st_mtime=2011/07/20-10:00:40,
st_ctime=2011/07/20-10:00:40}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xf7fea000
read(3, "MemTotal: 2072560 kB\nMemF"..., 1024) = 1024
close(3) = 0
munmap(0xf7fea000, 8192) = 0
rt_sigaction(SIGPIPE, {SIG_IGN, [PIPE], SA_RESTART}, {SIG_IGN, [PIPE],
SA_RESTART}, 0xf7e34318, 4294967295) = 0
fstat64(1, {st_dev=makedev(9, 7), st_ino=27987282, st_mode=S_IFREG|0644,
st_nlink=1, st_uid=1000, st_gid=1000, st_blksize=4096, st_blocks=16,
st_size=5240, st_atime=2011/07/20-10:00:37, st_mtime=2011/07/20-10:00:41,
st_ctime=2011/07/20-10:00:41}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xf7fea000
write(1, "OpenSSL 1.0.0d 8 Feb 2011\n", 26OpenSSL 1.0.0d 8 Feb 2011
) = 26
exit_group(0) = ?