mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-19 12:44:32 +00:00
ded385d377
Currently this Python program triggers a segmentation fault in libselinux SWIG wrapper: import selinux selinux.get_ordered_context_list() gdb shows that the segmentation fault occurs when freeing some memory: Reading symbols from python...(no debugging symbols found)...done. Starting program: /usr/bin/python -c import\ selinux\;selinux.get_ordered_context_list\(\) [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. 0x00007ffff789a304 in free () from /usr/lib/libc.so.6 (gdb) bt #0 0x00007ffff789a304 in free () from /usr/lib/libc.so.6 #1 0x00007ffff6011499 in freeconary (con=0x7ffff6ac5d00) at freeconary.c:14 #2 0x00007ffff6296899 in _wrap_get_ordered_context_list (self=<optimized out>, args=<optimized out>) at selinuxswig_wrap.c:6185 #3 0x00007ffff741891f in _PyCFunction_FastCallDict () from /usr/lib/libpython3.6m.so.1.0 ... SWIG generated the following code for _wrap_get_ordered_context_list(): char ***arg3 = (char ***) 0 ; char **temp3 ; arg3 = &temp3; if (!PyArg_ParseTuple(args, "OO:get_ordered_context_list",&obj0,&obj1)) SWIG_fail; /* ... */ fail: if (*arg3) freeconary(*arg3); If PyArg_ParseTuple fails, freeconary() is called on the value of "temp3", which has not been initialized. Fix this by initializing temp to NULL in the SWIG template. A similar issue exists with security_get_boolean_names(). Fix it too. This issue has been found using clang's static analyzer, on a system which uses SWIG 3.0.12. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org> |
||
---|---|---|
checkpolicy | ||
dbus | ||
gui | ||
libselinux | ||
libsemanage | ||
libsepol | ||
mcstrans | ||
policycoreutils | ||
python | ||
restorecond | ||
sandbox | ||
scripts | ||
secilc | ||
semodule-utils | ||
.gitignore | ||
.travis.yml | ||
CleanSpec.mk | ||
Makefile | ||
README |
Please submit all bug reports and patches to selinux@tycho.nsa.gov. Subscribe via selinux-join@tycho.nsa.gov. Build dependencies on Fedora: yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-devel flex-static glib2-devel libcap-devel libcap-ng-devel pam-devel pcre-devel python-devel setools-devel swig xmlto redhat-rpm-config To build and install everything under a private directory, run: make DESTDIR=~/obj install install-pywrap To install as the default system libraries and binaries (overwriting any previously installed ones - dangerous!), on x86_64, run: make LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel or on x86 (32-bit), run: make install install-pywrap relabel This may render your system unusable if the upstream SELinux userspace lacks library functions or other dependencies relied upon by your distribution. If it breaks, you get to keep both pieces. To install libsepol on macOS (mainly for policy analysis): cd libsepol; make DESTDIR=/usr/local PREFIX=/usr/local install This requires GNU coreutils (brew install coreutils).