irrdnet / irrd-legacy

the Internet Routing Registry daemon
http://irrd.net/
Other
36 stars 25 forks source link

segfault on show config with access-list #46

Closed guzzim closed 1 year ago

guzzim commented 6 years ago

When you use the uii and issue a 'show config', irrd segfaults if your config contains access-list statements.

$ telnet 127.0.0.1 5674 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. IRRd version 3.0.9rc2-42-g983b

User Access Verification

localhost Password: **** localhost IRRd# config
localhost Config> show
#####################################################################

MRTd -- MRT version 3.0.9rc2-42-g983b

##################################################################### # debug all stdout # localhost Config> access-list 9 permit 127.0.0.1/32 localhost localhost Config> show Connection closed by foreign host.

strace

rt_sigtimedwait([HUP INT PIPE ALRM], NULL, NULL, 8Oct 18 13:44:36 [2104424192] IRRD unlocking select Oct 18 13:44:36 [2104424192] IRRD unlocking select Oct 18 13:44:44 [2104424192] IRRD accept (6) -> 8 in user.c at 246 Oct 18 13:44:44 [2104424192] IRRD SELECT: uii_accept_connection enabled on 6 mask 0x1 Oct 18 13:44:44 [2104424192] UII accepting connection from 127.0.0.1 Oct 18 13:44:44 [2104424192] IRRD thread UII 127.0.0.1 id 139713087203072 created Oct 18 13:44:44 [2104424192] IRRD unlocking select Oct 18 13:44:44 [2096031488] UII set tty to 70 Oct 18 13:44:48 [2096031488] UII command config Oct 18 13:44:51 [2096031488] UII command show config Oct 18 13:45:04 [2096031488] UII command access-list %d (permit|deny) %m %S Oct 18 13:45:06 [2096031488] UII command show config <unfinished ...> +++ killed by SIGSEGV +++ Segmentation fault

guzzim commented 6 years ago

strace -f .... forgot about threads. Hopefully this is more helpful.

[pid 9496] write(1, "Oct 18 15:44:34 [184467440724318"..., 84Oct 18 15:44:34 [18446744072431888128] UII command access-list %d (permit|deny) all ) = 84 [pid 9496] sendto(8, "localhost Config> ", 18, 0, NULL, 0) = 18 [pid 9496] select(9, [8], NULL, NULL, {300, 0}) = 1 (in [8], left {299, 303467}) [pid 9496] recvfrom(8, "s", 1023, 0, NULL, NULL) = 1 [pid 9496] sendto(8, "s", 1, 0, NULL, 0) = 1 [pid 9496] select(9, [8], NULL, NULL, {300, 0}) = 1 (in [8], left {299, 919227}) [pid 9496] recvfrom(8, "h", 1023, 0, NULL, NULL) = 1 [pid 9496] sendto(8, "h", 1, 0, NULL, 0) = 1 [pid 9496] select(9, [8], NULL, NULL, {300, 0}) = 1 (in [8], left {299, 955676}) [pid 9496] recvfrom(8, "o", 1023, 0, NULL, NULL) = 1 [pid 9496] sendto(8, "o", 1, 0, NULL, 0) = 1 [pid 9496] select(9, [8], NULL, NULL, {300, 0}) = 1 (in [8], left {299, 876306}) [pid 9496] recvfrom(8, "w", 1023, 0, NULL, NULL) = 1 [pid 9496] sendto(8, "w", 1, 0, NULL, 0) = 1 [pid 9496] select(9, [8], NULL, NULL, {300, 0} ) = 1 (in [8], left {285, 223699}) [pid 9496] recvfrom(8, "\r\0", 1023, 0, NULL, NULL) = 2 [pid 9496] sendto(8, "", 0, 0, NULL, 0) = 0 [pid 9496] sendto(8, "\r\n", 2, 0, NULL, 0) = 2 [pid 9496] sendto(8, "", 0, 0, NULL, 0) = 0 [pid 9496] write(1, "Oct 18 15:44:50 [184467440724318"..., 63Oct 18 15:44:50 [18446744072431888128] UII command show config ) = 63 [pid 9496] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xfffffffd9f2756e0} --- [pid 9496] +++ killed by SIGSEGV +++ [pid 9493] +++ killed by SIGSEGV +++ +++ killed by SIGSEGV +++ Segmentation fault

Output from gdb [New Thread 0x7ffff6671700 (LWP 9663)] Oct 18 16:25:05 [18446744073556928256] IRRD thread UII ::1 id 140737327339264 created Oct 18 16:25:05 [18446744073556928256] IRRD unlocking select Oct 18 16:25:05 [18446744073548535552] UII set tty to 70 Oct 18 16:25:08 [18446744073548535552] UII command config Oct 18 16:25:15 [18446744073548535552] UII command access-list %d (permit|deny) all Oct 18 16:25:21 [18446744073548535552] UII command show config

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff6671700 (LWP 9663)] access_list_out (num=-161020820, fn=0x41d950 ) at alist.c:176 176 if (access_list[num] == NULL)