Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfaults when some programs in program_noproxy don't exist #5

Closed
lilydjwg opened this issue Jun 26, 2020 · 6 comments
Closed

Segfaults when some programs in program_noproxy don't exist #5

lilydjwg opened this issue Jun 26, 2020 · 6 comments

Comments

@lilydjwg
Copy link

lilydjwg commented Jun 26, 2020

#0  0x00007f528955f624 in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007f528955f624 in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6
#1  0x000055de16f04738 in std::char_traits<char>::copy (__n=<optimized out>, __s2=0x7ffccb644a80 "", __s1=<optimized out>)
    at /usr/include/c++/10.1.0/bits/char_traits.h:395
#2  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy (__n=<optimized out>, 
    __s=0x7ffccb644a80 "", __d=<optimized out>) at /usr/include/c++/10.1.0/bits/basic_string.h:351
#3  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy (__n=<optimized out>, 
    __s=0x7ffccb644a80 "", __d=<optimized out>) at /usr/include/c++/10.1.0/bits/basic_string.h:346
#4  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator= (__str=..., this=0x7ffccb644a50)
    at /usr/include/c++/10.1.0/bits/basic_string.h:722
#5  getRealExistPath (name=<error: Cannot access memory at address 0x7671206863696800>) at /usr/src/debug/cgproxy/src/common.cpp:89
#6  0x000055de16f19f09 in CGPROXY::CONFIG::Config::toRealProgramPath (this=<optimized out>, 
    v=std::vector of length 2, capacity 2 = {...}) at /usr/src/debug/cgproxy/src/config.cpp:147
#7  0x000055de16f1c250 in CGPROXY::CONFIG::Config::loadFromJsonStr (this=0x7ffccb645170, js=...)
    at /usr/src/debug/cgproxy/src/config.cpp:94
#8  0x000055de16f1c893 in CGPROXY::CONFIG::Config::loadFromFile (this=0x7ffccb645170, f=...)
    at /usr/include/c++/10.1.0/bits/basic_string.h:907
#9  0x000055de16ef3b22 in CGPROXY::CGPROXYD::cgproxyd::start (this=0x7ffccb645160) at /usr/include/c++/10.1.0/bits/char_traits.h:322
#10 0x000055de16eeb218 in CGPROXY::CGPROXYD::main (argc=<optimized out>, argv=<optimized out>)
    at /usr/src/debug/cgproxy/src/cgproxyd.hpp:362
#11 0x000055de16eeb5e0 in main (argc=<optimized out>, argv=0x7ffccb645348) at /usr/src/debug/cgproxy/src/main.cpp:14

PS: it still didn't work at all after I fixed this. I'll try another way than this.
PPS: it deleted my own route to make my own TPROXY stop working....

@lilydjwg lilydjwg changed the title Segfaults when program_noproxy doesn't exist Segfaults when some programs in program_noproxy don't exist Jun 26, 2020
@springzfx
Copy link
Owner

  1. Confirmed segfaults. I will fix this later.

  2. Maybe there are some route tables conflict?

    cgproxy/cgroup-tproxy.sh

    Lines 64 to 66 in 46fb9ba

    table=100
    fwmark=0x01
    make_newin=0x02

    cgproxy/cgroup-tproxy.sh

    Lines 93 to 96 in 46fb9ba

    ip rule delete fwmark $fwmark lookup $table
    ip route flush table $table
    ip -6 rule delete fwmark $fwmark lookup $table
    ip -6 route flush table $table

@lilydjwg
Copy link
Author

Maybe there are some route tables conflict?

Yes...I'm also using route table 100. Maybe you can check the number before use?

@springzfx springzfx reopened this Jun 27, 2020
@springzfx
Copy link
Owner

Maybe there are some route tables conflict?

Yes...I'm also using route table 100. Maybe you can check the number before use?

Yes, it should be this way. However with dynamic table, status have to saved between running this script. So I changed it to a more uncommon number for now.

cgproxy/cgroup-tproxy.sh

Lines 72 to 74 in a4628cf

table=10007 # just a prime number
fwmark=0x9973
make_newin=0x9967

@lilydjwg
Copy link
Author

Maybe you can put them in the config file so every one will have a look at them before starting.

@springzfx
Copy link
Owner

Maybe you can put them in the config file so every one will have a look at them before starting.

Now table, fwmark, and mark_newin are exposed to config
0d2725d

@springzfx
Copy link
Owner

The config looks like this. All options are optional.

{
    "port": 12345,
    "program_noproxy": ["v2ray", "qv2ray"],
    "program_proxy": [],
    "cgroup_noproxy": ["/system.slice/v2ray.service"],
    "cgroup_proxy": [],
    "enable_gateway": false,
    "enable_dns": true,
    "enable_udp": true,
    "enable_tcp": true,
    "enable_ipv4": true,
    "enable_ipv6": true,
    "table": 10007,
    "fwmark": 39283,
    "mark_newin": 39271
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants