Red Hat Bugzilla – Bug 308851
matchpathcon dereferences NULL in case there's no file_contexts file
Last modified: 2011-02-14 09:42:27 EST
Description of problem:
matchpathcon needs /etc/selinux/targeted/contexts/files/file_contexts from
selinux-policy-targeted package to work. When it's not present, it fails, and
crashes when dereferencing the handle it failed to initialize before.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. ensure that you don't have selinux-policy-targeted package
2. matchpathcon /dev/null
= -1 ENOENT (No such file or directory)
write(2, "matchpathcon(/mnt) failed: No su"..., 53matchpathcon(/mnt) failed: No
such file or directory
) = 53
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV (core dumped) +++
I attach the patch to prevent the segfault. Additionaly, maybe it would be a
good idea if libselinux depended on selinux-policy-targeted.
Created attachment 208381 [details]
Fix to matchpathcon NULL pointer dereference
Applied fix to libselinux-2.0.35-2
Daniel: what about the dependency on selinux-policy-targeted?
Not sure what you mean. This is a fix in the shared libraries, All apps that
use the library will inherit the fix.