ShadowsocksR-Live / shadowsocksr-native

翻墙 从容穿越党国敏感日 ShadowsocksR (SSRoT) native implementation for all platforms, GFW terminator
https://github.com/ShadowsocksR-Live/shadowsocksr-native/wiki
GNU General Public License v3.0
2.74k stars 763 forks source link

Segment fault #30

Closed mia0x75 closed 6 years ago

mia0x75 commented 6 years ago

Latest git version. Fedora 28 Server x86_64 ssr-server crash with segment fault.

mia0x75 commented 6 years ago

config.json

$ cat config.json 
{
    "server": "a.b.c.d",
    "server_port": 10443,
    "method": "aes-128-ctr",
    "password": "password",
    "protocol": "origin",
    "protocol_param": "",
    "obfs": "plain",
    "obfs_param": "",
    "local_address": "127.0.0.1",
    "local_port": 1080,
    "udp": true,
    "timeout": 300
}
# ssr-server -c ssr-config.json 
ssr-server:info: ShadowsocksR native server

ssr-server:info: listen port      10443
ssr-server:info: method           aes-128-ctr
ssr-server:info: password         password
ssr-server:info: protocol         origin
ssr-server:info: obfs             plain
ssr-server:info: udp relay        yes

Segmentation fault (core dumped)
traps: ssr-server[10425] general protection ip:41afc7 sp:7ffeb849e388 error:0 in ssr-server[400000+89000]
ssrlive commented 6 years ago

能告诉我怎么重现吗? 或者使用 debug 编译. 看看崩溃在哪一行.

cmake -DCMAKE_BUILD_TYPE=Debug . && make
mia0x75 commented 6 years ago
# gdb src/ssr-server core.10222
GNU gdb (GDB) Fedora 8.1-23.fc28
Copyright (C) 2018 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-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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 src/ssr-server...done.
[New LWP 10222]
[New LWP 10223]
[New LWP 10224]
[New LWP 10225]
[New LWP 10226]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `src/ssr-server -c server.json'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000000000041fdc5 in _get_read_size (tunnel=0x107faf0, socket=0x1079ed0, suggested_size=32768) at /src/github.com/ShadowsocksR-Live/shadowsocksr-native/src/server/server.c:489
489     frame_size = ctx->_tcp_mss - ctx->_overhead;
[Current thread is 1 (Thread 0x7f032a1570c0 (LWP 10222))]
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.27-30.fc28.x86_64

(gdb) bt
#0  0x000000000041fdc5 in _get_read_size (tunnel=0x107faf0, socket=0x1079ed0, suggested_size=32768) at /src/github.com/ShadowsocksR-Live/shadowsocksr-native/src/server/server.c:489
#1  0x363330316e632e38 in ?? ()
#2  0x430a0d5d302c315b in ?? ()
#3  0x6e6f432d65686361 in ?? ()
#4  0x616d203a6c6f7274 in ?? ()
#5  0x32373d6567612d78 in ?? ()
#6  0x697078450a0d3130 in ?? ()
#7  0x6e6f4d203a736572 in ?? ()
#8  0x6c754a203033202c in ?? ()
#9  0x3830203831303220 in ?? ()
#10 0x472038323a33333a in ?? ()
#11 0x3a6567410a0d544d in ?? ()
#12 0x0a0d353330313120 in ?? ()
#13 0x3a65686361432d58 in ?? ()
#14 0x5043542054494820 in ?? ()
#15 0x5449485f534d495f in ?? ()
#16 0x3a373a6e72696420 in ?? ()
#17 0x3333313435343536 in ?? ()
#18 0x312d3a6e656c6d20 in ?? ()
#19 0x676e696d69540a0d in ?? ()
#20 0x4f2d776f6c6c412d in ?? ()
#21 0x2a203a6e69676972 in ?? ()
#22 0x49656c6761450a0d in ?? ()
#23 0x3137646530203a64 in ?? ()
#24 0x3932333531366137 in ?? ()
#25 0x3935303338343535 in ?? ()
#26 0x0d0a0d6531373336 in ?? ()
#27 0x0000000001079e0a in ?? ()
#28 0x00007fff5b1d2de0 in ?? ()
#29 0x000000000041ed4d in socket_write (c=<error reading variable: Cannot access memory at address 0x31656863616375e8>, data=<error reading variable: Cannot access memory at address 0x31656863616375e0>, 
    len=<error reading variable: Cannot access memory at address 0x31656863616375d8>) at /src/github.com/ShadowsocksR-Live/shadowsocksr-native/src/tunnel.c:470
Backtrace stopped: Cannot access memory at address 0x3165686361637628
mia0x75 commented 6 years ago

Let me know if you need core.dump file, I can send to you via email.

(gdb) bt full

#0  0x000000000041fdc5 in _get_read_size (tunnel=0x107faf0, socket=0x1079ed0, suggested_size=32768) at /src/github.com/ShadowsocksR-Live/shadowsocksr-native/src/server/server.c:489
        ctx = 0x332c305b36333031
        buffer_size = 505
        frame_size = 7017582524928700460
        fd = 1851993653
        tmp = "HTTP/1.1 304 Not Modified\r\nServer: Tengine\r\nContent-Type: application/octet-stream\r\nConnection: keep-alive\r\nDate: Mon, 30 Jul 2018 09:54:08 GMT\r\nETag: \"240\"\r\nLast-Modified: Thu, 19 Jul 2018 01:52:02 G"...
#1  0x363330316e632e38 in ?? ()
No symbol table info available.
#2  0x430a0d5d302c315b in ?? ()
No symbol table info available.
#3  0x6e6f432d65686361 in ?? ()
No symbol table info available.
#4  0x616d203a6c6f7274 in ?? ()
No symbol table info available.
#5  0x32373d6567612d78 in ?? ()
No symbol table info available.
#6  0x697078450a0d3130 in ?? ()
No symbol table info available.
#7  0x6e6f4d203a736572 in ?? ()
No symbol table info available.
#8  0x6c754a203033202c in ?? ()
No symbol table info available.
#9  0x3830203831303220 in ?? ()
No symbol table info available.
#10 0x472038323a33333a in ?? ()
No symbol table info available.
#11 0x3a6567410a0d544d in ?? ()
No symbol table info available.
#12 0x0a0d353330313120 in ?? ()
No symbol table info available.
#13 0x3a65686361432d58 in ?? ()
No symbol table info available.
#14 0x5043542054494820 in ?? ()
No symbol table info available.
#15 0x5449485f534d495f in ?? ()
No symbol table info available.
#16 0x3a373a6e72696420 in ?? ()
No symbol table info available.
#17 0x3333313435343536 in ?? ()
No symbol table info available.
#18 0x312d3a6e656c6d20 in ?? ()
No symbol table info available.
#19 0x676e696d69540a0d in ?? ()
No symbol table info available.
#20 0x4f2d776f6c6c412d in ?? ()
No symbol table info available.
#21 0x2a203a6e69676972 in ?? ()
No symbol table info available.
#22 0x49656c6761450a0d in ?? ()
No symbol table info available.
#23 0x3137646530203a64 in ?? ()
No symbol table info available.
#24 0x3932333531366137 in ?? ()
---Type <return> to continue, or q <return> to quit--- 
No symbol table info available.
#25 0x3935303338343535 in ?? ()
No symbol table info available.
#26 0x0d0a0d6531373336 in ?? ()
No symbol table info available.
#27 0x0000000001079e0a in ?? ()
No symbol table info available.
#28 0x00007fff5b1d2de0 in ?? ()
No symbol table info available.
#29 0x000000000041ed4d in socket_write (c=<error reading variable: Cannot access memory at address 0x31656863616375e8>, data=<error reading variable: Cannot access memory at address 0x31656863616375e0>, 
    len=<error reading variable: Cannot access memory at address 0x31656863616375d8>) at /src/github.com/ShadowsocksR-Live/shadowsocksr-native/src/tunnel.c:470
        buf = <error reading variable buf (Cannot access memory at address 0x31656863616375f0)>
        tunnel = <error reading variable tunnel (Cannot access memory at address 0x3165686361637618)>
        write_buf = <error reading variable write_buf (Cannot access memory at address 0x3165686361637610)>
        req = <error reading variable req (Cannot access memory at address 0x3165686361637608)>
        __PRETTY_FUNCTION__ = "socket_write"
Backtrace stopped: Cannot access memory at address 0x3165686361637628
ssrlive commented 6 years ago

OK . please send to me.

mia0x75 commented 6 years ago

Files sent, please check, thanks.

ssrlive commented 6 years ago

code changed. please test it. i hope the crash fixed.

mia0x75 commented 6 years ago

So far so good.

One more thing, I see a lots of error messages: no buffer space available, is that normal?

$ src/ssr-server -c server.json 
ssr-server:info: ShadowsocksR native server

ssr-server:info: listen port      10443
ssr-server:info: method           aes-128-ctr
ssr-server:info: password         password
ssr-server:info: protocol         origin
ssr-server:info: obfs             plain
ssr-server:info: udp relay        yes

ssr-server:error: recieve data failed about _server_ "log.avlyun.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "qumas.mail.qq.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "m.ximalaya.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "nstool.netease.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "amdc.m.taobao.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "only-375834-113-118-226-11.nstool.netease.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "apilocate.amap.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "apilocate.amap.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "restapi.amap.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "pms.mb.qq.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "pms.mb.qq.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "safe.mzres.com": no buffer space available
ssr-server:error: connect failed about _server_ "223.5.5.5": connection timed out
ssr-server:error: connect failed about _server_ "223.5.5.5": connection timed out
ssr-server:error: connect failed about _server_ "223.5.5.5": connection timed out
ssr-server:error: connect failed about _server_ "223.5.5.5": connection timed out
ssr-server:error: connect failed about _server_ "223.5.5.5": connection timed out
ssr-server:error: connect failed about _server_ "223.5.5.5": connection timed out
ssr-server:error: connect failed about _server_ "223.5.5.5": connection timed out
ssr-server:error: connect failed about _server_ "223.5.5.5": connection timed out
ssr-server:error: recieve data failed about _server_ "amdc.m.taobao.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "ylog.hiido.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "116.31.112.74": no buffer space available
ssr-server:error: recieve data failed about _server_ "httpdns.gslb.yy.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "httpdns.gslb.yy.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "httpdns.gslb.yy.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "httpdns.gslb.yy.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "httpdns.gslb.yy.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "httpdns.gslb.yy.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "httpdns.gslb.yy.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "ylog.hiido.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "ylog.hiido.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "116.31.112.74": no buffer space available
ssr-server:error: recieve data failed about _server_ "httpdns.gslb.yy.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "httpdns.gslb.yy.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "ylog.hiido.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "httpdns.gslb.yy.com": no buffer space available
ssr-server:error: recieve data failed about _server_ "httpdns.gslb.yy.com": no buffer space available
ssrlive commented 6 years ago

搞完