matchpathcon crashing in mock chroot

Paul Howarth paul at city-fan.org
Wed Sep 7 09:41:02 UTC 2011


I'm running matchpathcon as part of the libssh2 build to set the file
context of a test script appropriately such that an instance of an
openssh server that's run as part of the test suite transitions
correctly to sshd_t. This has worked OK in the past but I'm now finding
that on my F-15 builder matchpathcon is crashing when doing:

/usr/sbin/matchpathcon -n /etc/rc.d/init.d/sshd

gdb doesn't seem to be much help:

[mockbuild at zion ~]$ /usr/sbin/matchpathcon -n /etc/rc.d/init.d/sshd
Segmentation fault (core dumped)
[mockbuild at zion ~]$ gdb /usr/sbin/matchpathcon 
GNU gdb (GDB) Fedora (7.3.50.20110722-6.fc16)
Copyright (C) 2011 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".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/matchpathcon...Reading symbols from /usr/lib/debug/sbin/matchpathcon.debug...done.
done.
(gdb) run  -n /etc/rc.d/init.d/sshd
Starting program: /usr/sbin/matchpathcon -n /etc/rc.d/init.d/sshd

Program received signal SIGSEGV, Segmentation fault.
__strtok_r_1c (__nextp=read_sleb128: Corrupted DWARF expression.
) at /usr/include/bits/string2.h:1179
1179	  while (*__s == __sep)
(gdb) bt
#0  __strtok_r_1c (__nextp=read_sleb128: Corrupted DWARF expression.
) at /usr/include/bits/string2.h:1179
#1  init (rec=0x602010, opts=0x7ffff7ff3718, n=<optimized out>) at label_file.c:440
#2  0x00007ffff7bc4b3d in selabel_open (backend=0, opts=0x7ffff7ff3718, nopts=5) at label.c:165
#3  0x00007ffff7bc3e16 in matchpathcon_init_prefix_internal (path=0x0, subset=0x0) at matchpathcon.c:321
#4  0x00007ffff7bc40a9 in matchpathcon (path=0x7fffffffe82a "/etc/rc.d/init.d/sshd", mode=0, con=0x7fffffffe418) at matchpathcon.c:406
#5  0x0000000000400fe7 in printmatchpathcon (path=0x7fffffffe82a "/etc/rc.d/init.d/sshd", header=0, mode=<optimized out>) at matchpathcon.c:27
#6  0x0000000000400d41 in main (argc=<optimized out>, argv=<optimized out>) at matchpathcon.c:156
(gdb) 

I was getting an AVC earlier too, fixed by:

allow setfiles_t sysfs_t:filesystem getattr;

but fixing that didn't prevent the crash.

This is with an F-15 host and Rawhide x86_64 target, libselinux-2.1.5-2.fc17.

Any suggestions?

Paul.


More information about the selinux mailing list