Bug 802072 - SELinux deny_ptrace: Do not restrict PTRACE_TRACEME
SELinux deny_ptrace: Do not restrict PTRACE_TRACEME
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
Unspecified Linux
medium Severity medium
: ---
: ---
Assigned To: Lukas Vrabec
Fedora Extras Quality Assurance
: Reopened
: 802065 (view as bug list)
Depends On: 786876 786878
Blocks: 810973
  Show dependency treegraph
Reported: 2012-03-10 14:47 EST by Jan Kratochvil
Modified: 2016-09-27 11:03 EDT (History)
28 users (show)

See Also:
Fixed In Version: kernel-3.3.2-1.fc17
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 786878
Last Closed: 2012-04-22 00:14:49 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jan Kratochvil 2012-03-10 14:47:44 EST
+++ This bug was initially created as a clone of Bug #786878 +++

New feature coming in Fedora 17  will allow users to disable ptrace and sys_ptrace access on an SELinux system.



--- Additional comment from eparis@redhat.com on 2012-03-07 00:13:27 CET ---
Jan is right, it would make more sense to allow one to trace their children.  But such permissions will require a kernel change.  I assume that's what you meant.  We can probably steal the similar logic from YAMA...

Note to self for implementation:
Requires a new policy capability so we check old ptrace permission if policy doesn't yet support the new PTRACE_CHILD permission.  The allow/deny unknown work is only adequate when restricting thing further (aka new permission) instead of changing the semantics of or reducing the scope of current permissions.
--- Additional comment from sds@tycho.nsa.gov on 2012-03-07 14:12:14 CET ---
It would be significantly simpler to just change the existing selinux_ptrace_traceme() hook to use a different permission (if the corresponding policy capability was defined) so that it can be distinguished in policy.  That seems to be all they need, not the general ability to PTRACE_ATTACH to an arbitrary descendant.
Comment 1 Josh Boyer 2012-03-12 09:38:27 EDT
*** Bug 802065 has been marked as a duplicate of this bug. ***
Comment 2 Niels de Vos 2012-04-11 06:26:25 EDT
A proposed patch seems to get included in Rawhide (http://lists.fedoraproject.org/pipermail/kernel/2012-April/003732.html). No confirmation on F-17 yet?
Comment 3 Josh Boyer 2012-04-11 08:23:07 EDT
(In reply to comment #2)
> A proposed patch seems to get included in Rawhide
> (http://lists.fedoraproject.org/pipermail/kernel/2012-April/003732.html). No
> confirmation on F-17 yet?

There now.  Will be in the next F17 update.  Bodhi will leave a comment in the bug when it's available in a repo.
Comment 4 Fedora Update System 2012-04-16 15:10:13 EDT
kernel-3.3.2-1.fc17 has been submitted as an update for Fedora 17.
Comment 5 Fedora Update System 2012-04-16 17:56:49 EDT
Package kernel-3.3.2-1.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing kernel-3.3.2-1.fc17'
as soon as you are able to, then reboot.
Please go to the following url:
then log in and leave karma (feedback).
Comment 6 Jan Kratochvil 2012-04-17 07:40:54 EDT
[root@f17 ~]# cat /proc/version 
Linux version 3.3.2-1.fc17.x86_64 (mockbuild@x86-01.phx2.fedoraproject.org) (gcc version 4.7.0 20120322 (Red Hat 4.7.0-1) (GCC) ) #1 SMP Fri Apr 13 20:23:49 UTC 2012
[root@f17 ~]# getsebool deny_ptrace
deny_ptrace --> on
[root@f17 ~]# gdb -q true -ex run
Reading symbols from /usr/bin/true...(no debugging symbols found)...done.
Starting program: /usr/bin/true 
Cannot create process: Permission denied
warning: the SELinux boolean 'deny_ptrace' is enabled, you can disable this process attach protection by: (gdb) shell sudo setsebool deny_ptrace=0
During startup program exited with code 127.
Missing separate debuginfos, use: debuginfo-install coreutils-8.15-6.fc17.x86_64
(gdb) q
Comment 7 Josh Boyer 2012-04-17 10:27:50 EDT
Eric, any thoughts on Jan's issues?
Comment 8 Eric Paris 2012-04-17 11:02:31 EDT
Needs a policy update to make use of the kernel change.  Dan, do we want to try it?
Comment 9 Fedora Update System 2012-04-22 00:14:49 EDT
kernel-3.3.2-1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 10 Jan Kratochvil 2012-04-22 15:28:22 EDT
It is not yet CLOSED as discussed here.
Comment 11 Josh Boyer 2012-04-23 10:13:19 EDT
The kernel part is done at least.  Reassigning to selinux-policy per comment #8.
Comment 12 Jan Kratochvil 2012-05-03 14:05:38 EDT
Comment 13 Daniel Walsh 2012-05-04 09:16:02 EDT
Still working on it, waiting for F17 to be released.
Comment 14 Jan Kratochvil 2012-05-04 09:23:12 EDT
I expected the goal is to fix bugs _before_ a Fedora release.
Comment 15 Josh Boyer 2012-05-04 09:30:36 EDT
(In reply to comment #14)
> I expected the goal is to fix bugs _before_ a Fedora release.

Technically, it's not going to be a bug that anyone hits by default.  The deny_ptrace stuff defaults to off at this point in the release.
Comment 16 Daniel Walsh 2012-05-04 09:35:49 EDT
First we are in freeze, and I consider this an enhancement not a bug.  The deny_ptrace it turned off by default. Since the definition of deny_ptrace was to disable all ptrace this is not a bug. We have to figure out what the best mechanism for allowing a user to secure his machine.  We need a three way mechanism to setup the system.

Don't deny user ptrace (Same default as F16).
Deny ptrace of processes but allow ptrace of children.
Deny all Ptrace.

If I as the administrator decide I want no ptrace on my machine, I should be able to state this.  I am thinking about adding another boolean which would allow ptrace child.
Comment 17 Kevin Kofler 2012-05-04 15:45:36 EDT
> Deny ptrace of processes but allow ptrace of children.

"of children" is not sufficient. As explained on the mailing list, you need to also support the YAMA registration API for DrKonqi, WINE etc. to work.
Comment 18 Daniel Walsh 2012-05-04 16:09:03 EDT
Once the kernel supports it we will support it.
Comment 19 Josh Boyer 2012-05-04 16:39:05 EDT
We're not going to enable YAMA.
Comment 20 Kevin Kofler 2012-05-04 18:20:37 EDT
You need to support something equivalent or deny_ptrace is just plain not usable.
Comment 21 Kevin Kofler 2012-05-04 18:21:14 EDT
(and I don't care whether it's implemented by reusing YAMA or by doing your own thing in the SELinux code)
Comment 22 Fedora End Of Life 2013-07-04 02:17:01 EDT
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 23 Jan Kurik 2015-07-15 11:10:53 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
Comment 24 Warren Lewis 2015-08-30 17:35:33 EDT
Just a ping too see if ptrace child was implemented, I'm trying to get chrome running properly with my user set to staff_u and it wanting sys_ptrace (hopefully only on it's child processes).
Comment 25 Paul Moore 2016-03-27 21:13:58 EDT
The ptrace_child code has been removed from the kernel and we should probably remove the process:ptrace_child permission from policy - Miroslav?
Comment 26 Jan Kurik 2016-07-26 00:44:37 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.
Comment 27 Fedora Admin XMLRPC Client 2016-09-27 11:03:09 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

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