smartdns icon indicating copy to clipboard operation
smartdns copied to clipboard

segment fault issue on https://github.com/pymumu/smartdns/commit/c0f4c72626829ee273e66c911ca1ec7702138ea4

Open GreatMichaelLee opened this issue 2 years ago • 13 comments

Sun Jun 12 17:16:59 2022 kern.info kernel: [ 3177.978629] smartdns[12614]: segfault at 0 ip 00007fb9e0b1f45e sp 00007ffd9163c5c0 error 6 in libc.so[7fb9e0ae1000+4a000] Sun Jun 12 17:16:59 2022 kern.info kernel: [ 3177.980002] Code: f8 03 75 04 0f 05 eb 4f 4d 89 c3 41 51 49 89 d0 48 89 f1 41 53 48 89 fa 48 89 c6 48 8d 7b 3c 4d 89 d1 48 89 c5 e8 07 2e 00 00 <5e> 5f 48 83 f8 fc 75 25 48 83 fd 03 74 1f 8b 43 3c 85 c0 74 11 8a

coredump file attached smartdns.1655025419.12614.11.zip

GreatMichaelLee avatar Jun 12 '22 10:06 GreatMichaelLee

guess that the compilation environment and the runtime environment have different system library (gcc), try to compile it as a static version? bty, what system are you using to compile and run?

PikuZheng avatar Jun 12 '22 11:06 PikuZheng

ubuntu 20.04 compile x86_64 for lede/gcc 9.4

GreatMichaelLee avatar Jun 12 '22 11:06 GreatMichaelLee

this is the log and maybe help you to investigate the core file?

[2022-06-12 17:16:58,258][DEBUG][ dns_client.c:1622] domain: pss.alicdn.com qtype: 28 qclass: 1 [2022-06-12 17:16:58,258][DEBUG][ dns_server.c:2677] query result from server 1.12.12.12:443, type: 3 [2022-06-12 17:16:58,266][DEBUG][ dns_client.c:2199] recv tcp packet from 1.0.0.1, len = 344 [2022-06-12 17:16:58,266][DEBUG][ dns_client.c:1616] qdcount = 1, ancount = 0, nscount = 1, nrcount = 0, len = 122, id = 17606, tc = 0, rd = 1, ra = 1, rcode = 3, payloadsize = 1232 [2022-06-12 17:16:58,266][DEBUG][ dns_client.c:1622] domain: 1.0.0.127.bb.barracudacentral.org qtype: 1 qclass: 1 [2022-06-12 17:16:58,266][DEBUG][ dns_server.c:2677] query result from server 1.0.0.1:443, type: 3 [2022-06-12 17:16:58,266][DEBUG][ dns_server.c:2383] domain: 1.0.0.127.bb.barracudacentral.org, qtype: 1, SOA: mname: not.available, rname: hostmaster.barracudacentral.org, serial: 1655024484, refresh: 600, retry: 600, expire: 432000, minimum: 900 [2022-06-12 17:16:58,269][DEBUG][ dns_client.c:2199] recv tcp packet from 1.1.1.1, len = 470 [2022-06-12 17:16:58,269][DEBUG][ dns.c:1612] opt type 12 [2022-06-12 17:16:58,269][DEBUG][ dns.c:1638] DNS opt type = 12 not supported [2022-06-12 17:16:58,269][DEBUG][ dns_client.c:1616] qdcount = 1, ancount = 0, nscount = 1, nrcount = 0, len = 468, id = 17606, tc = 0, rd = 1, ra = 1, rcode = 3, payloadsize = 1232 [2022-06-12 17:16:58,269][DEBUG][ dns_client.c:1622] domain: 1.0.0.127.bb.barracudacentral.org qtype: 1 qclass: 1 [2022-06-12 17:16:58,269][DEBUG][ dns_server.c:2677] query result from server 1.1.1.1:853, type: 2 [2022-06-12 17:16:58,269][DEBUG][ dns_server.c:2383] domain: 1.0.0.127.bb.barracudacentral.org, qtype: 1, SOA: mname: not.available, rname: hostmaster.barracudacentral.org, serial: 1655024447, refresh: 600, retry: 600, expire: 432000, minimum: 900 [2022-06-12 17:16:58,270][DEBUG][ dns_client.c:2199] recv tcp packet from 1.1.1.1, len = 344 [2022-06-12 17:16:58,270][DEBUG][ dns_client.c:1616] qdcount = 1, ancount = 0, nscount = 1, nrcount = 0, len = 122, id = 17606, tc = 0, rd = 1, ra = 1, rcode = 3, payloadsize = 1232 [2022-06-12 17:16:58,270][DEBUG][ dns_client.c:1622] domain: 1.0.0.127.bb.barracudacentral.org qtype: 1 qclass: 1 [2022-06-12 17:16:58,270][DEBUG][ dns_server.c:2677] query result from server 1.1.1.1:443, type: 3 [2022-06-12 17:16:58,270][DEBUG][ dns_server.c:2383] domain: 1.0.0.127.bb.barracudacentral.org, qtype: 1, SOA: mname: not.available, rname: hostmaster.barracudacentral.org, serial: 1655024457, refresh: 600, retry: 600, expire: 432000, minimum: 900 [2022-06-12 17:16:58,270][DEBUG][ dns_client.c:1400] result: 1.0.0.127.bb.barracudacentral.org, qtype: 1, hasresult: 1, id 17606 [2022-06-12 17:16:58,270][DEBUG][ dns_server.c:1322] reply 1.0.0.127.bb.barracudacentral.org qtype: 1, rcode: 0, reply: 1 [2022-06-12 17:16:58,270][DEBUG][ dns_server.c:714 ] result: 1.0.0.127.bb.barracudacentral.org, qtype: 1, return SOA [2022-06-12 17:16:58,270][ INFO][ dns_server.c:725 ] result 1.0.0.127.bb.barracudacentral.org, qtype: 1, rc-code: 3 [2022-06-12 17:16:58,286][DEBUG][ dns_client.c:2199] recv tcp packet from 120.53.53.53, len = 623 [2022-06-12 17:16:58,286][DEBUG][ dns.c:1612] opt type 12 [2022-06-12 17:16:58,286][DEBUG][ dns.c:1638] DNS opt type = 12 not supported [2022-06-12 17:16:58,286][DEBUG][ dns_client.c:1616] qdcount = 1, ancount = 1, nscount = 0, nrcount = 0, len = 468, id = 17607, tc = 0, rd = 1, ra = 1, rcode = 0, payloadsize = 2048 [2022-06-12 17:16:58,286][DEBUG][ dns_client.c:1622] domain: pss.alicdn.com qtype: 28 qclass: 1 [2022-06-12 17:16:58,286][DEBUG][ dns_server.c:2677] query result from server 120.53.53.53:443, type: 3 [2022-06-12 17:16:58,778][DEBUG][ fast_ping.c:1209] icmp type faild, 3:0 [2022-06-12 17:16:58,778][DEBUG][ fast_ping.c:1285] recv ping packet from 192.168.2.39 failed. [2022-06-12 17:16:58,778][DEBUG][ fast_ping.c:1209] icmp type faild, 3:0 [2022-06-12 17:16:58,778][DEBUG][ fast_ping.c:1285] recv ping packet from 192.168.2.39 failed. [2022-06-12 17:16:58,807][DEBUG][ dns_client.c:1400] result: pss.alicdn.com, qtype: 28, hasresult: 1, id 17607 [2022-06-12 17:16:58,807][DEBUG][ dns_server.c:1322] reply pss.alicdn.com qtype: 28, rcode: 0, reply: 0 [2022-06-12 17:16:58,807][DEBUG][ dns_server.c:714 ] result: pss.alicdn.com, qtype: 28, return SOA [2022-06-12 17:16:58,807][DEBUG][ dns_server.c:924 ] cache pss.alicdn.com qtype:28 ttl: 0 [2022-06-12 17:17:04,155][NOTICE][ smartdns.c:270 ] smartdns starting...(Copyright (C) Nick Peng [email protected], build:Jun 9 2022 15:18:30) [2022-06-12 17:17:04,202][DEBUG][ fast_ping.c:1082] ping 2001::, id = 1 [2022-06-12 17:17:04,202][ERROR][ fast_ping.c:462 ] sendto 2001::, id 1, Permission denied [2022-06-12 17:17:04,202][DEBUG][ fast_ping.c:860 ] from 2001::: error is Permission denied [2022-06-12 17:17:04,202][DEBUG][ fast_ping.c:393 ] ping 2001:: end, id 1 [2022-06-12 17:17:04,202][DEBUG][ fast_ping.c:1082] ping 2001::, id = 2 [2022-06-12 17:17:04,202][DEBUG][ fast_ping.c:860 ] from 2001::: error is Permission denied [2022-06-12 17:17:04,202][DEBUG][ fast_ping.c:393 ] ping 2001:: end, id 2 [2022-06-12 17:17:04,202][ INFO][ dns_server.c:5008] IPV6 is not ready, disable IPV6 features

GreatMichaelLee avatar Jun 12 '22 11:06 GreatMichaelLee

看起来是ptr查询失败后产生的问题 @pymumu

PikuZheng avatar Jun 12 '22 11:06 PikuZheng

最好能gdb打下调用栈,我看不了这个core文件 还有描述下出问题的场景,如能发配置,发下配置

pymumu avatar Jun 12 '22 11:06 pymumu

最好能gdb打下调用栈,我看不了这个core文件 还有描述下出问题的场景,如能发配置,发下配置

openwrt lede,没有gdb,编译没有加-g, addr2line用不了....场景不知道啊,放着没管,回来发现控制台上打core了....

GreatMichaelLee avatar Jun 12 '22 12:06 GreatMichaelLee

发下配置看看

pymumu avatar Jun 12 '22 12:06 pymumu

另外可以装下gdb,吧调用栈打印后删除 我没有x86的openwrt,core文件看不了

pymumu avatar Jun 12 '22 13:06 pymumu

另外可以装下gdb,吧调用栈打印后删除 我没有x86的openwrt,core文件看不了

稍晚一点弄,目前我编的这个固件版本没把gdb编译进去,弄好了我把堆栈贴上来

GreatMichaelLee avatar Jun 12 '22 13:06 GreatMichaelLee

opkg install gdb就应该可以了。

pymumu avatar Jun 12 '22 13:06 pymumu

opkg install gdb

nothign help;

root@OpenWrt:~# gdb /usr/sbin/smartdns /mnt/sda2/smartdns.1655025419.12614.11.core GNU gdb (GDB) 11.2 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-openwrt-linux". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.

For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/sbin/smartdns... (No debugging symbols found in /usr/sbin/smartdns) [New LWP 12614] [New LWP 12872] [New LWP 13003] [New LWP 13007] Core was generated by `/usr/sbin/smartdns -f -c /var/etc/smartdns/smartdns.conf -S'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007fb9e0b1f45e in ?? () [Current thread is 1 (LWP 12614)] (gdb) quit

GreatMichaelLee avatar Jun 13 '22 02:06 GreatMichaelLee

请问崩溃发生时有没有系统日志产生(dmesg

PikuZheng avatar Jun 13 '22 03:06 PikuZheng

请问崩溃发生时有没有系统日志产生(dmesg

就这两行,没别的,这个是从lede系统日志里摘的,内核日志一样的。

Sun Jun 12 17:16:59 2022 kern.info kernel: [ 3177.978629] smartdns[12614]: segfault at 0 ip 00007fb9e0b1f45e sp 00007ffd9163c5c0 error 6 in libc.so[7fb9e0ae1000+4a000] Sun Jun 12 17:16:59 2022 kern.info kernel: [ 3177.980002] Code: f8 03 75 04 0f 05 eb 4f 4d 89 c3 41 51 49 89 d0 48 89 f1 41 53 48 89 fa 48 89 c6 48 8d 7b 3c 4d 89 d1 48 89 c5 e8 07 2e 00 00 <5e> 5f 48 83 f8 fc 75 25 48 83 fd 03 74 1f 8b 43 3c 85 c0 74 11 8a

GreatMichaelLee avatar Jun 13 '22 07:06 GreatMichaelLee

获取最新代码验证。

pymumu avatar Oct 20 '22 12:10 pymumu