Bug 843631 - SELinux is preventing /usr/bin/bash from using the 'signull' accesses on a process.
Summary: SELinux is preventing /usr/bin/bash from using the 'signull' accesses on a pr...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 17
Hardware: i686
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Eric Paris
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:7eb6957d7b807a564157aaab747...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-26 19:52 UTC by Mikhail
Modified: 2013-08-01 17:03 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-08-01 17:03:05 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Mikhail 2012-07-26 19:52:13 UTC
libreport version: 2.0.10
executable:     /usr/bin/python2.7
hashmarkername: setroubleshoot
kernel:         3.4.6-2.fc17.i686.PAE
time:           Пт. 27 июля 2012 01:52:01

description:
:SELinux is preventing /usr/bin/bash from using the 'signull' accesses on a process.
:
:*****  Plugin catchall (100. confidence) suggests  ***************************
:
:If you believe that bash should be allowed signull access on processes labeled sendmail_t by default.
:Then you should report this as a bug.
:You can generate a local policy module to allow this access.
:Do
:allow this access for now by executing:
:# grep mysqld_safe /var/log/audit/audit.log | audit2allow -M mypol
:# semodule -i mypol.pp
:
:Additional Information:
:Source Context                system_u:system_r:mysqld_safe_t:s0
:Target Context                system_u:system_r:sendmail_t:s0
:Target Objects                 [ process ]
:Source                        mysqld_safe
:Source Path                   /usr/bin/bash
:Port                          <Unknown>
:Host                          (removed)
:Source RPM Packages           bash-4.2.36-1.fc17.i686
:Target RPM Packages           
:Policy RPM                    selinux-policy-3.10.0-137.fc17.noarch
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Enforcing
:Host Name                     (removed)
:Platform                      Linux (removed) 3.4.4-5.fc17.i686.PAE #1 SMP Thu Jul 5
:                              20:09:45 UTC 2012 i686 i686
:Alert Count                   1
:First Seen                    Чт. 19 июля 2012 07:20:10
:Last Seen                     Чт. 19 июля 2012 07:20:10
:Local ID                      05419d7a-aa70-4765-a3e3-1e50f1b8bd5a
:
:Raw Audit Messages
:type=AVC msg=audit(1342660810.870:32): avc:  denied  { signull } for  pid=913 comm="mysqld_safe" scontext=system_u:system_r:mysqld_safe_t:s0 tcontext=system_u:system_r:sendmail_t:s0 tclass=process
:
:
:type=SYSCALL msg=audit(1342660810.870:32): arch=i386 syscall=kill success=no exit=EACCES a0=3d9 a1=0 a2=3d9 a3=9c4d470 items=0 ppid=1 pid=913 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=mysqld_safe exe=/usr/bin/bash subj=system_u:system_r:mysqld_safe_t:s0 key=(null)
:
:Hash: mysqld_safe,mysqld_safe_t,sendmail_t,process,signull
:
:audit2allowunable to open /sys/fs/selinux/policy:  Permission denied
:
:
:audit2allow -Runable to open /sys/fs/selinux/policy:  Permission denied
:
:

Comment 1 Miroslav Grepl 2012-07-27 07:44:45 UTC
Not sure why mysqld_safe is checking sendmail.

Comment 2 Honza Horak 2012-07-27 12:04:41 UTC
I believe this is caused by checking if a process from old mysqld pidfile is still running. In this particular case mysqld daemon probably finished with pidfile let existing and then it was restarted. At that time process sendmail had been started with the same PID as was stored in the old pidfile. mysqld_safe then checked if the process was mysqld_safe, which was false, so the pidfile was removed and start succeeded.

Using this design we probably don't have to care about potential AVC denials, because it doesn't have any bad consequences, since the checking code behaves the same like as if there is no such process.

However, is it possible in SELinux to define that "mysqld_safe can send SIGNULL to all processes"? 

Btw. the check is done by the following code:

# If there exists an old pid file, check if the daemon is already running
# Note: The switches to 'ps' may depend on your operating system
if test -f "$pid_file"
then
  PID=`cat "$pid_file"`
  if /usr/bin/kill -0 $PID > /dev/null 2> /dev/null
  then
    if /bin/ps wwwp $PID | grep -v " grep" | grep -v mysqld_safe | grep -- "$MYSQLD" > /dev/null
    then    # The pid contains a mysqld process
      log_error "A mysqld process already exists"
      exit 1
    fi
  fi
  rm -f "$pid_file"
  if test -f "$pid_file"
  then
    log_error "Fatal error: Can't remove the pid file:
$pid_file
Please remove it manually and start $0 again;
mysqld daemon not started"
    exit 1
  fi
fi

Comment 3 Daniel Walsh 2012-07-27 12:53:30 UTC
I think we should just ignore this, since receiving a signul, could cause an application to do something unexpected.  We could add a dontaudit.

Comment 4 Daniel Walsh 2012-07-27 13:14:26 UTC
Fixed in rawhide.

Comment 5 Tom Lane 2012-07-27 15:58:02 UTC
Hm, it seems unlikely that mysqld is the only thing that would probe for the existence of a process based on finding an old pid file.  It is a mistake to consider this problem as mysql-specific.

What will normally happen for such cases, and what upstream coders would be expecting, is that if the PID now belongs to someone else they would get EPERM on the grounds of the target PID belonging to some other UID.  Perhaps the correct fix is to move the kernel's SELinux check to only occur after that check.

Comment 6 Daniel Walsh 2012-08-02 20:44:01 UTC
Lets see what the kernel guys say.  I have seen something that looks similar from avahi.

Comment 7 Fedora End Of Life 2013-07-04 05:48:40 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Fedora End Of Life 2013-08-01 17:03:13 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.