[erlang-bugs] Unaligned memory access on sparc64

David Coppa <>
Mon Jun 27 11:37:32 CEST 2011


Hi all, 

There's an unaligned memory access into lib/erl_interface/src/connect/ei_resolve.c that causes a SIGBUS
crash on sparc64.

The following backtrace is from R13B04, but the code has not changed, so this bug is still present.

$ gdb erl_call /usr/ports/pobj/rabbitmq-2.5.0/rabbitmq-server-2.5.0/erl_call.core
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc64-unknown-openbsd4.9"...
Core was generated by `erl_call'.
Program terminated with signal 10, Bus error.
Reading symbols from /usr/lib/libpthread.so.13.1...done.
Loaded symbols for /usr/lib/libpthread.so.13.1
Reading symbols from /usr/lib/libc.so.58.3...done.
Loaded symbols for /usr/lib/libc.so.58.3
Reading symbols from /usr/libexec/ld.so...done.
Loaded symbols for /usr/libexec/ld.so
#0  0x000000000010d32c in copy_hostent (dest=0xfffffffffffce780, src=0x20fc2d8c0, buffer=0xfffffffffffce9ac "", buflen=996) at connect/ei_resolve.c:224
224	    *pptr = src_aliases;
(gdb) bt
#0  0x000000000010d32c in copy_hostent (dest=0xfffffffffffce780, src=0x20fc2d8c0, buffer=0xfffffffffffce9ac "", buflen=996) at connect/ei_resolve.c:224
#1  0x000000000010d790 in my_gethostbyname_r (name=0xfffffffffffcfa1f "vulcan", hostp=0xfffffffffffce950, buffer=0xfffffffffffce990 "vulcan.*****.*******.***", buflen=1024, h_errnop=0xfffffffffffce98c) at connect/ei_resolve.c:319
#2  0x000000000010db18 in ei_gethostbyname_r (name=0xfffffffffffcfa1f "vulcan", hostp=0xfffffffffffce950, buffer=0xfffffffffffce990 "vulcan.*****.*******.***", buflen=1024, h_errnop=0xfffffffffffce98c) at connect/ei_resolve.c:629
#3  0x0000000000108580 in ei_connect_tmo (ec=0xfffffffffffcf4fc, nodename=0xfffffffffffcfa10 "", ms=0) at connect/ei_connect.c:604
#4  0x00000000001087e8 in ei_connect (ec=0xfffffffffffcf4fc, nodename=0xfffffffffffcfa10 "") at connect/ei_connect.c:659
#5  0x00000000001046e8 in main (argc=5, argv=0xfffffffffffcfc88) at prog/erl_call.c:384
(gdb) thread apply all bt full

Thread 1 (process 26785):
#0  0x000000000010d32c in copy_hostent (dest=0xfffffffffffce780, src=0x20fc2d8c0, buffer=0xfffffffffffce9ac "", buflen=996) at connect/ei_resolve.c:224
	pptr = (char **) 0xfffffffffffce9ac
	len = 24
	src_aliases = (char **) 0x20fc2d8e0
	src_addr_list = (char **) 0x0
#1  0x000000000010d790 in my_gethostbyname_r (name=0xfffffffffffcfa1f "vulcan", hostp=0xfffffffffffce950, buffer=0xfffffffffffce990 "vulcan.*****.*******.***", buflen=1024, h_errnop=0xfffffffffffce98c) at connect/ei_resolve.c:319
	dest = {h_name = 0xfffffffffffce990 "vulcan.*****.*******.***", h_aliases = 0xfffffffffffce9ac, h_addrtype = 2, h_length = 4, h_addr_list = 0x21fb20}
	src = (struct hostent *) 0x20fc2d8c0
	rval = (struct hostent *) 0x0
#2  0x000000000010db18 in ei_gethostbyname_r (name=0xfffffffffffcfa1f "vulcan", hostp=0xfffffffffffce950, buffer=0xfffffffffffce990 "vulcan.*****.*******.***", buflen=1024, h_errnop=0xfffffffffffce98c) at connect/ei_resolve.c:629
No locals.
#3  0x0000000000108580 in ei_connect_tmo (ec=0xfffffffffffcf4fc, nodename=0xfffffffffffcfa10 "", ms=0) at connect/ei_connect.c:604
	hostname = 0xfffffffffffcfa1f "vulcan"
	alivename = "rabbitmq-check\000\000?????????\r\027?\205?qqeck/.erlang.cookie", '\0' <repeats 11 times>, "\200\000\005???????!?\r\027?\207\003\035?\000\000\000\002\rq\001@", '\0' <repeats 21 times>, "r7\210\000\000\000\000\000\000\001E\000\000\000\000\000\000\000\003\000\000\000\000\000\000\000\001\000\000\000\000\000\000*?\000\000\000\000\000\000??\000\000\000\002\017?E\000\000\000\000\002\017?\024?\000\000\000\002\017q!\020\000\000\000\002\017??????????x", '\0' <repeats 11 times>, "\002\017????????"...
	hp = (struct hostent *) 0x20f550000
	host = {h_name = 0x20dfe3408 "", h_aliases = 0x200000000, h_addrtype = 2, h_length = 257275424, h_addr_list = 0x20f550000}
	buffer = "vulcan.*****.*******.***\000\000\000\000\000=*?\000\000\000\001\000\000\002=???????@\000\000\000\000N\003zm", '\0' <repeats 12 times>, "N\003zm\000\000\000\000\000\001?\017", '\0' <repeats 11 times>, "\002\017U\000\000\000\000\000\000\000\020/\200", '\0' <repeats 14 times>, "\004?\000\000\000\002\rP?", '\0' <repeats 12 times>, "\002\017?E", '\0' <repeats 12 times>, "\002\017?\026P\000\000\000\000\000\000\002\000\000\000\000\002\017?\026P\000\000\000\002\rP?\000\000\000\000\000\000\"\0050???????1?\r\027?\205?i????"...
	ei_h_errno = -202726
#4  0x00000000001087e8 in ei_connect (ec=0xfffffffffffcf4fc, nodename=0xfffffffffffcfa10 "") at connect/ei_connect.c:659
No locals.
#5  0x00000000001046e8 in main (argc=5, argv=0xfffffffffffcfc88) at prog/erl_call.c:384
	i = 17
	fd = 80
	creation = 1
	hp = (struct hostent *) 0x20fc2d8c0
	host_name = "vulcan\000\030\000\000\000\000\0002 \000???????A?\r\027?\212??5\000\000\000\a\000\000\000\f???????8\000\000\000\002\rP\000\000\000\000\000\000\000\000\000\000"
	nodename = "\000??\000\000\000\000\000\000\000\000???????\201?\r\027?\212??\005???????\201?\r\027?\212??\005", '\0' <repeats 21 times>, "/??", '\0' <repeats 11 times>, "\002\r???\000\000\000\002\r???\000\000\000\000\000\"`\000\000\000\000\000\000\000 \000"
	p = 0x0
	ct = 0x20fc2da0d ".*****.*******.***"
	modsize = 0
	host = 0xfffffffffffcfae0 "vulcan"
	module = 0x0
	modname = 0x0
	flags = {startp = 0, cookiep = 0, modp = 0, evalp = 1, randomp = 0, use_long_name = 0, debugp = 0, verbosep = 0, haltp = 1, cookie = 0x0, node = 0x20d7107c0 "rabbitmq-check", hidden = 0x20d710f70 "c17", apply = 0x0, script = 0x0}
	progname = 0xfffffffffffcfe78 "erl_call"
	ec = {
  thishostname = "vulcan\000\000\000\000\000\000\000\000\000\002\r??\000\000\000\000\000\000/??\000\000\000\000\0001?\200\000\000\000\000\000\000\000\214\000\000\000\000\000\000\a\020\000\000\000\002\016_?8\000\000\000\002\016", 
  thisnodename = "\000?\r\027?\207??U???????\221?\r\027?\207\002?\005\000\000\000\000\000\000\000\034??????? ???????\f", '\0' <repeats 11 times>, "\002\rP\026", '\0' <repeats 12 times>, "\002\rP0\000\000\000\000\000\rP0\000\000\000\000\002\rP0\000\000\000\000\000\rP0", '\0' <repeats 12 times>, "\002\016\037", 
  thisalivename = "c17\000\000\002\rP?\000\000\000\000\002\016\037?\030\000\000\000\000\000\000\002\000\000\000\000\002\016O? ", '\0' <repeats 15 times>, "\002\000\000\000\002\r?u@\000\000\000\000\000", 
  ei_connect_cookie = "OZMRLUAHORQAALOCKXDN\000????Q?\r\027?\207\002?i\000\000\000\a\000/??\000\000\000\000\0001??\000\000\000\000\000\000\000\004\000\000\000\000\000\000 ", '\0' <repeats 11 times>, "\a?\000\000\b\000\000\000\000\002\016\037?\034\000\000\000\002\016\037? \000\000\000\002\016`5?\000\000\000\000\000\000\001?\000\000\000\002\016`5?", '\0' <repeats 19 times>, "\002\016O? \000\000\000\000\000r5\200\000\000\000\002\016\037? \000\000\000\002\016`5?\000\000\000\000\000\000\001?\000\000\000\002\016`5?", '\0' <repeats 19 times>, "\002\017?E\000\000\000\000\002\017\201?@", '\0' <repeats 40 times>..., creation = 1, self = {
    node = "\000?\000\000\000\000\000/??\000\000\000\000\000\000\001?\000\000\000\002\017UP?\000\000\000\002\017U\000\000\000\000\000\002\017WA0\000\000\000\002\017U\000\000????????\000\000\000\002\017V0J\000\000\000\000\000\000\000\003\000\000\000\002\r??\000\000\000\000\000\000/?P\000\000\000\000\000<??\000\000\000\000\000\000\000\177\000\000\000\002\017W^?\000\000\000\000\000/?P\000\000\000\000\000\000\000\000?????????\r\027?\207??U", '\0' <repeats 16 times>, "????????\000\000\000\002\r???", '\0' <repeats 16 times>, "????????"..., num = 0, serial = 0, creation = 1}}

Cheers! 
David Coppa



More information about the erlang-bugs mailing list