-
Bug
-
Resolution: Duplicate
-
Blocker
-
None
-
rhel-8.9.0
-
None
-
None
-
Critical
-
rhel-pt-gcc
-
ssg_platform_tools
-
None
-
False
-
False
-
-
None
-
Red Hat Enterprise Linux
-
None
-
None
-
None
-
x86_64
-
None
What were you trying to do that didn't work?
scl enable gcc-toolset-13 'gcc -fsanitize=address main.c'
// main.c
#include <stddef.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>int main() {
struct addrinfo *servinfo = NULL;
struct addrinfo hints = {0};
const char* hostname = "www.ibm.com";
const char* ip_address = NULL; hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;
hints.ai_protocol = IPPROTO_TCP; int rc = getaddrinfo(hostname, NULL, &hints, &servinfo);
printf("getaddrinfo -> %d\n", rc);
if (rc == 0) {
struct sockaddr_in *ipv4 = (struct sockaddr_in *)servinfo->ai_addr;
ip_address = inet_ntoa(ipv4->sin_addr);
printf("%s resolves to %s\n", hostname, ip_address);
}}}{{ freeaddrinfo(servinfo); return 0;
}
Please provide the package NVR for which bug is seen:
How reproducible:
reproduced on two different RHEL 8.9 machines.
Steps to reproduce
- scl enable gcc-toolset-13 'gcc -fsanitize=address main.c' && ./a.out
Expected results
$ ./a.out }}{{getaddrinfo -> 0
www.ibm.com resolves to 184.26.226.231
Actual results
{{{{#0 0x0000000000000000 in ?? ()
#1 0x00007ffff759c480 in _interceptor__dn_expand (base=<optimized out>, end=<optimized out>, src=<optimized out>, dest=0x7fffffffa9d0 "\020", space=<optimized out>) at ../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:2570
#2 0x00007ffff32e7a5b in getanswer_r (ctx=ctx@entry=0x604000000010, answer=<optimized out>, anslen=<optimized out>, qname=<optimized out>, qname@entry=0x402060 "www.ibm.com", qtype=qtype@entry=0x1, result=result@entry=0x7fffffffb960, buffer=<optimized out>, buflen=<optimized out>, errnop=<optimized out>, h_errnop=<optimized out>, map=<optimized out>, ttlp=<optimized out>, canonp=<optimized out>) at nss_dns/dns-host.c:838
#3 0x00007ffff32e857f in gethostbyname3_context (ctx=ctx@entry=0x604000000010, name=name@entry=0x402060 "www.ibm.com", af=af@entry=0x2, result=result@entry=0x7fffffffb960, buffer=buffer@entry=0x7fffffffbbe0 "", buflen=buflen@entry=0x400, errnop=<optimized out>, h_errnop=<optimized out>, ttlp=<optimized out>, canonp=<optimized out>) at nss_dns/dns-host.c:277
#4 0x00007ffff32e8e0c in _nss_dns_gethostbyname3_r (name=name@entry=0x402060 "www.ibm.com", af=af@entry=0x2, result=result@entry=0x7fffffffb960, buffer=buffer@entry=0x7fffffffbbe0 "", buflen=buflen@entry=0x400, errnop=errnop@entry=0x7ffff7fdf3e0, h_errnop=0x7ffff7fdf44c, ttlp=0x0, canonp=0x0) at nss_dns/dns-host.c:172
#5 0x00007ffff32e8ec2 in _nss_dns_gethostbyname2_r (name=0x402060 "www.ibm.com", af=0x2, result=0x7fffffffb960, buffer=0x7fffffffbbe0 "", buflen=0x400, errnop=0x7ffff7fdf3e0, h_errnop=0x7ffff7fdf44c) at nss_dns/dns-host.c:305
#6 0x00007ffff72a6c0d in __gethostbyname2_r (name=name@entry=0x402060 "www.ibm.com", af=af@entry=0x2, resbuf=resbuf@entry=0x7fffffffb960, buffer=<optimized out>, buflen=0x400, result=result@entry=0x7fffffffb958, h_errnop=<optimized out>) at ../nss/getXXbyYY_r.c:315
#7 0x00007ffff727f8d1 in gaih_inet (name=name@entry=0x402060 "www.ibm.com", service=service@entry=0x0, req=req@entry=0x7ffff3e00050, pai=pai@entry=0x7fffffffbb68, naddrs=naddrs@entry=0x7fffffffbb64, tmpbuf=tmpbuf@entry=0x7fffffffbbd0) at ../sysdeps/posix/getaddrinfo.c:605
#8 0x00007ffff728061b in __GI_getaddrinfo (name=<optimized out>, service=<optimized out>, hints=0x7ffff3e00050, pai=0x7ffff3e00030) at ../sysdeps/posix/getaddrinfo.c:2318
#9 0x00007ffff75e2fc5 in __interceptor_getaddrinfo (node=0x402060 "www.ibm.com", service=0x0, hints=<optimized out>, out=0x7ffff3e00030) at ../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:2824
#10 0x000000000040133d in main ()}}}}
{{{{AddressSanitizer:DEADLYSIGNAL
=================================================================
==118466==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000000000 bp 0x7ffe8774f9c0 sp 0x7ffe8774f138 T0)
==118466==Hint: pc points to the zero page.
==118466==The signal is caused by a READ memory access.
==118466==Hint: address points to the zero page.
#0 0x0 (<unknown module>)
#1 0x7f493c9e7a5a in getanswer_r nss_dns/dns-host.c:838}}}}