[gnutls-devel] gnutls-3.3.10 SIGBUS on Solaris 10 in gettime()
Thomas Thorberger
thor at dbteam.de
Wed Nov 12 16:06:44 CET 2014
Hello!
I found a bug on Solaris which crashes all applications using libgnutls
with a SIGBUS in the function gettime() called by _rnd_get_event()
[lib/nettle/rnd-common.c].
Environment:
Solaris 10 (Oracle Solaris 10 1/13 s10s_u11wos_24a SPARC)
Compiler: gcc (GCC) 4.9.2 (using Sun AS/LD)
The compiler was generating code for the 64-bit environment.
GDB Output:
Program terminated with signal SIGBUS, Bus error.
(gdb) bt
#0 0xffffffff7d3dcedc in __clock_gettime () from /lib/64/libc.so.1
#1 0xffffffff7f011e34 in _rnd_get_event ()
from /var/local/rpm/src/BUILD/gnutls-3.3.10/lib/.libs/libgnutls.so.28
#2 0xffffffff7f0125cc in wrap_nettle_rnd_init ()
from /var/local/rpm/src/BUILD/gnutls-3.3.10/lib/.libs/libgnutls.so.28
#3 0xffffffff7ef6d968 in _gnutls_rnd_init ()
from /var/local/rpm/src/BUILD/gnutls-3.3.10/lib/.libs/libgnutls.so.28
#4 0xffffffff7ef60120 in gnutls_global_init ()
from /var/local/rpm/src/BUILD/gnutls-3.3.10/lib/.libs/libgnutls.so.28
#5 0xffffffff7ef60548 in lib_init ()
from /var/local/rpm/src/BUILD/gnutls-3.3.10/lib/.libs/libgnutls.so.28
#6 0xffffffff7f012ebc in _init ()
from /var/local/rpm/src/BUILD/gnutls-3.3.10/lib/.libs/libgnutls.so.28
#7 0xffffffff7f61831c in call_init () from /lib/sparcv9/ld.so.1
#8 0xffffffff7f617608 in setup () from /lib/sparcv9/ld.so.1
#9 0xffffffff7f629f04 in _setup () from /lib/sparcv9/ld.so.1
#10 0xffffffff7f60850c in _alias_start () from /lib/sparcv9/ld.so.1
The bug is triggered by the "__attribute__((packed))" in the structure
definition of "struct event_st" in lib/nettle/rnd-common.h. If the
"packed" attribute is active all references to the substructure "struct
timespec" generate a SIGBUS. I guess that the alignment for a 64bit long
falls below the minimum required alignment when using "packed" with
"struct timespec".
I cannot tell you if this is specific to my environment or if it affects
all Solaris Systems with the recent GCC generating a 64-bit version of
libgnutls.
I attached the patch I used to get gnutls working again.
Regards,
Thomas Thorberger
--- gnutls-3.3.10/lib/nettle/rnd-common.h.orig 2014-11-12
13:37:43.916658427 +0100
+++ gnutls-3.3.10/lib/nettle/rnd-common.h 2014-11-12
13:40:56.636814380 +0100
@@ -42,7 +42,7 @@
unsigned count; /* a running counter */
unsigned err; /* the last errno */
}
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__sun)
__attribute__((packed))
#endif
;
More information about the Gnutls-devel
mailing list