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

segfault with 0.6 and libnetfilter_conntrack 1.0.5 #4

Open
Thermi opened this issue Nov 6, 2015 · 8 comments
Open

segfault with 0.6 and libnetfilter_conntrack 1.0.5 #4

Thermi opened this issue Nov 6, 2015 · 8 comments

Comments

@Thermi
Copy link

Thermi commented Nov 6, 2015

As described in the subject, contrack.catch() segfaults with libnetfilter_conntrack 1.0.5 and version 0.6 of the egg. It occurs with the provided example events.py and conntrack.py, too.

@regit
Copy link
Owner

regit commented Nov 8, 2015

I'm not able to reproduce it using linux 4.2.0 and libnetfilter_conntrack 1.0.5. What version are you using ?

Also could you provide a gdb backtrace to help debugging ?

@Thermi
Copy link
Author

Thermi commented Nov 8, 2015

Linux 4.1.12, pynetfilter_conntrack 0.6, libnetfilter_conntrack 1.0.5.
I run this on Arch.
For a backtrace with debugging information, I'd need to compile the python interpreter as well as libnetfilter_conntrack, with debug information.
Backtrace:

>>> import poc_test                                                                                                                                                                    [5/382]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff4923bc2 in nfct_callback_register () from /usr/lib/libnetfilter_conntrack.so.3
(gdb) bt full
#0  0x00007ffff4923bc2 in nfct_callback_register () from /usr/lib/libnetfilter_conntrack.so.3
No symbol table info available.
#1  0x00007ffff4d4a1f0 in ffi_call_unix64 () from /usr/lib/libffi.so.6
No symbol table info available.
#2  0x00007ffff4d49c58 in ffi_call () from /usr/lib/libffi.so.6
No symbol table info available.
#3  0x00007ffff4fa6d35 in _ctypes_callproc () from /usr/lib/python2.7/lib-dynload/_ctypes.so
No symbol table info available.
#4  0x00007ffff4fa004c in ?? () from /usr/lib/python2.7/lib-dynload/_ctypes.so
No symbol table info available.
#5  0x00007ffff7a53657 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#6  0x00007ffff7af3076 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#7  0x00007ffff7af5f03 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#8  0x00007ffff7af4cac in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#9  0x00007ffff7af4d61 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#10 0x00007ffff7af4d61 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#11 0x00007ffff7af5f03 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#12 0x00007ffff7af603c in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#13 0x00007ffff7b06b14 in PyImport_ExecCodeModuleEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#14 0x00007ffff7b06dad in load_source_module () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#15 0x00007ffff7b07b3c in import_submodule () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#16 0x00007ffff7b07dbf in load_next () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#17 0x00007ffff7b087f8 in PyImport_ImportModuleLevel () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#18 0x00007ffff7aeccfc in builtin___import__ () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#19 0x00007ffff7a53657 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#20 0x00007ffff7aeec3b in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#21 0x00007ffff7af0876 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#22 0x00007ffff7af5f03 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#23 0x00007ffff7af603c in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#24 0x00007ffff7b10b93 in run_mod () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#25 0x00007ffff7b12daa in PyRun_InteractiveOneFlags () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#26 0x00007ffff7b12fb6 in PyRun_InteractiveLoopFlags () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#27 0x00007ffff7b13682 in PyRun_AnyFileExFlags () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#28 0x00007ffff7b26265 in Py_Main () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#29 0x00007ffff7467610 in __libc_start_main () from /usr/lib/libc.so.6
No symbol table info available.
#30 0x0000555555554859 in _start ()
No symbol table info available.
(gdb) 

@regit
Copy link
Owner

regit commented Nov 8, 2015

Thanks a lot, I won't need the python info. Libnetfilter_conntrack info are enough.

@Thermi
Copy link
Author

Thermi commented Nov 8, 2015

#0  0x00007ffff5a60bc4 in nfct_callback_register (h=0x557b7230, type=NFCT_T_ALL, cb=0x7ffff7fb5010, data=0x0) at api.c:248
        container = 0x55555587cca0
        __PRETTY_FUNCTION__ = "nfct_callback_register"
#1  0x00007ffff5e871f0 in ffi_call_unix64 () from /usr/lib/libffi.so.6
No symbol table info available.
#2  0x00007ffff5e86c58 in ffi_call () from /usr/lib/libffi.so.6
No symbol table info available.
#3  0x00007ffff60e3d35 in _ctypes_callproc () from /usr/lib/python2.7/lib-dynload/_ctypes.so
No symbol table info available.
#4  0x00007ffff60dd04c in ?? () from /usr/lib/python2.7/lib-dynload/_ctypes.so
No symbol table info available.
#5  0x00007ffff7a53657 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#6  0x00007ffff7af3076 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#7  0x00007ffff7af5f03 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#8  0x00007ffff7af4cac in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#9  0x00007ffff7af4d61 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#10 0x00007ffff7af4d61 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#11 0x00007ffff7af5f03 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#12 0x00007ffff7af603c in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#13 0x00007ffff7b06b14 in PyImport_ExecCodeModuleEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#14 0x00007ffff7b06dad in load_source_module () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#15 0x00007ffff7b07b3c in import_submodule () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#16 0x00007ffff7b07dbf in load_next () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#17 0x00007ffff7b087f8 in PyImport_ImportModuleLevel () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#18 0x00007ffff7aeccfc in builtin___import__ () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#19 0x00007ffff7a53657 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#20 0x00007ffff7aeec3b in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#21 0x00007ffff7af0876 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#22 0x00007ffff7af5f03 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#23 0x00007ffff7af603c in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#24 0x00007ffff7b10b93 in run_mod () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#25 0x00007ffff7b12daa in PyRun_InteractiveOneFlags () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#26 0x00007ffff7b12fb6 in PyRun_InteractiveLoopFlags () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#27 0x00007ffff7b13682 in PyRun_AnyFileExFlags () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#28 0x00007ffff7b26265 in Py_Main () from /usr/lib/libpython2.7.so.1.0
No symbol table info available.
#29 0x00007ffff7467610 in __libc_start_main () from /usr/lib/libc.so.6
No symbol table info available.
#30 0x0000555555554859 in _start ()
No symbol table info available.
(gdb) 

@regit
Copy link
Owner

regit commented Nov 8, 2015

In 1.0.5 line 248 is

    nfnl_callback_register(h->nfnlssh_ct, 

but the bt seems to show a line with

container =

Could you source be patched or am I reading it wrong ?

@Thermi
Copy link
Author

Thermi commented Nov 8, 2015

I checked the PKGBUILD and it pulls the file from netfilter.org directly.

source=("http://www.netfilter.org/projects/$pkgname/files/$pkgname-$pkgver.tar.bz2"{,.sig})

The PKGBUILD for pynetfilter_conntrack pulls from cheeseshop.python.org

source=(https://cheeseshop.python.org/packages/source/p/${pkgname}/${pkgname}-${pkgver}.tar.gz)

@ptitdoc
Copy link

ptitdoc commented Apr 6, 2016

Same problem here using archlinux 64bits. I traced down the issue to func.py where typing is not strict enough related to the library (int vs uint for values that can have the 31 bit set ...), usage of bytes vs int, pointer sizes in 64 bits systems.
#7

@hatu90
Copy link

hatu90 commented Jul 27, 2016

Hi, Can you add more examples with filter?

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

4 participants