Bug 232229

Summary: [LSPP] Python segfaults with 'getfilecon' in i386
Product: Red Hat Enterprise Linux 5 Reporter: Klaus Kiwi (Old account no longer used) <klaus>
Component: libselinuxAssignee: Daniel Walsh <dwalsh>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 5.0CC: iboverma, linda.knippers, mmalik, sgrubb
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0541 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-07 16:37:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 224041    

Description Klaus Kiwi (Old account no longer used) 2007-03-14 14:41:28 UTC
Description of problem:
In i386, if I try to 'getfilecon' a file which SELinux prohibits access, python
dies with 'segfault':

[testuser/user_r/SystemLow@rhel5 ~]$ id
uid=501(testuser) gid=501(testuser) groups=501(testuser)
context=testuser_u:user_r:user_t:SystemLow-SystemHigh
[testuser/user_r/SystemLow@rhel5 ~]$ python
Python 2.4.3 (#1, Dec 11 2006, 11:38:52)
[GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import selinux
>>> selinux.getfilecon('/dev/usb/lp0')
Segmentation fault
[testuser/user_r/SystemLow@rhel5 ~]$ python
Python 2.4.3 (#1, Dec 11 2006, 11:38:52)
[GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import selinux
>>> selinux.getfilecon('/root/.ssh')
Segmentation fault
[testuser/user_r/SystemLow@rhel5 ~]$ 


== Relevant(?) audit messages: ==
type=SYSCALL msg=audit(1173896641.831:624): arch=40000003 syscall=229 success=no
exit=-13 a0=b7ec78a4 a1=4612b3 a2=9d16498 a3=ff items=1 ppid=14687 pid=14716
auid=501 uid=501 gid=501 euid=501 suid=501 fsuid=501 egid=501 sgid=501 fsgid=501
tty=pts0 comm="python" exe="/usr/bin/python"
subj=testuser_u:user_r:user_t:s0-s15:c0.c1023 key=(null)
type=CWD msg=audit(1173896641.831:624):  cwd="/home/testuser"
type=PATH msg=audit(1173896641.831:624): item=0 name="/dev/usb/lp0" inode=5662
dev=00:10 mode=020660 ouid=0 ogid=7 rdev=b4:00
obj=system_u:object_r:printer_device_t:s0




Version-Release number of selected component (if applicable):
libselinux-python-1.33.4-2.el5

How reproducible:
always

Steps to Reproduce:
See Description
  
Actual results:
Segfault

Expected results:
something like [-1, '']

Additional info:
The strange thing is that I could only reproduce this on i386
x86_64 and ppc64 seems fine:

[testuser/user_r/SystemLow@zaphod ~]$ python
Python 2.4.3 (#1, Dec 11 2006, 11:40:12)
[GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import selinux
>>> selinux.getfilecon('/root/.ssh')
[-1, '']
>>>   

Although i386 is not in the LSPP evaluation, this bug is causing impact on test
development

I can to debug further if the relevant debuginfo files are made available

Comment 1 Daniel Walsh 2007-03-19 14:33:25 UTC
Fixed in libselinux-1.33.4-4.el5.i386.rpm

Comment 7 errata-xmlrpc 2007-11-07 16:37:31 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0541.html