Bug 1222288 - SELinux is preventing gdb from 'write' accesses on the directory /usr/share/gcc-5.1.1/python/libstdcxx/v6.
Summary: SELinux is preventing gdb from 'write' accesses on the directory /usr/share/g...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 26
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:e384fae99b8ba7b6e28254f177f...
Depends On:
Blocks: 1204355
TreeView+ depends on / blocked
 
Reported: 2015-05-17 09:58 UTC by Igor Gnatenko
Modified: 2018-05-29 12:01 UTC (History)
28 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-29 12:01:08 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Igor Gnatenko 2015-05-17 09:58:05 UTC
Description of problem:
SELinux is preventing gdb from 'write' accesses on the directory /usr/share/gcc-5.1.1/python/libstdcxx/v6.

*****  Plugin catchall_labels (83.8 confidence) suggests   *******************

If you want to allow gdb to have write access on the v6 directory
Then you need to change the label on /usr/share/gcc-5.1.1/python/libstdcxx/v6
Do
# semanage fcontext -a -t FILE_TYPE '/usr/share/gcc-5.1.1/python/libstdcxx/v6'
where FILE_TYPE is one of the following: abrt_tmp_t, abrt_upload_watch_tmp_t, abrt_var_cache_t, abrt_var_log_t, abrt_var_run_t, mock_var_lib_t, rpm_var_cache_t, rpm_var_run_t, sosreport_tmp_t, tmp_t, var_log_t, var_run_t, var_spool_t, var_t. 
Then execute: 
restorecon -v '/usr/share/gcc-5.1.1/python/libstdcxx/v6'


*****  Plugin catchall (17.1 confidence) suggests   **************************

If you believe that gdb should be allowed write access on the v6 directory 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 gdb /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:abrt_t:s0-s0:c0.c1023
Target Context                system_u:object_r:usr_t:s0
Target Objects                /usr/share/gcc-5.1.1/python/libstdcxx/v6 [ dir ]
Source                        gdb
Source Path                   gdb
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           libstdc++-5.1.1-1.fc23.x86_64
                              libstdc++-5.1.1-1.fc23.i686
Policy RPM                    selinux-policy-3.13.1-127.fc23.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.1.0-0.rc3.git2.1.fc23.x86_64 #1
                              SMP Wed May 13 14:49:26 UTC 2015 x86_64 x86_64
Alert Count                   38
First Seen                    2015-05-17 12:06:22 MSK
Last Seen                     2015-05-17 12:44:41 MSK
Local ID                      406a1842-f453-4980-9b77-e7b2e089d413

Raw Audit Messages
type=AVC msg=audit(1431855881.814:1688): avc:  denied  { write } for  pid=647 comm="gdb" name="v6" dev="dm-1" ino=139645 scontext=system_u:system_r:abrt_t:s0-s0:c0.c1023 tcontext=system_u:object_r:usr_t:s0 tclass=dir permissive=0


Hash: gdb,abrt_t,usr_t,dir,write

Version-Release number of selected component:
selinux-policy-3.13.1-127.fc23.noarch

Additional info:
reporter:       libreport-2.5.1
hashmarkername: setroubleshoot
kernel:         4.1.0-0.rc3.git2.1.fc23.x86_64
type:           libreport

Potential duplicate: bug 665543

Comment 1 Jan Kratochvil 2015-05-19 07:58:25 UTC
Please report: rpm -V libstdc++

Comment 2 Igor Gnatenko 2015-05-19 09:47:46 UTC
(In reply to Jan Kratochvil from comment #1)
> Please report: rpm -V libstdc++

It returns nothing.

Let me give some info how I got this issue.
I've started 0ad which crashed. It provides opening session in gdb itself, so I tried it.

> OS error = ?
> (C)ontinue, (S)uppress, (B)reak, Launch (D)ebugger, or (E)xit?

I tired press `D`.
> Attaching to process 5103
> ptrace: Operation not permitted.

Comment 3 Jan Kratochvil 2015-05-19 09:52:31 UTC
"ptrace: Operation not permitted." is really unrelated to this Bug.
I have heard new Fedora kernels (F-22+ or Rawhide, not sure) enabled ptrace restriction which can be workarounded/fixed by:
  echo 0 >/proc/sys/kernel/yama/ptrace_scope

This Bug is that occasionally Python wants to rebuild *.pyc and *.pyo files from *.py but if you have intact libstdc++.rpm I do not see a reason why it would do that.  What is your exact version - NVRA: rpm -q libstdc++

Comment 4 Igor Gnatenko 2015-05-20 08:22:24 UTC
libstdc++-5.1.1-1.fc23.x86_64

Comment 5 Jan Kratochvil 2015-05-20 17:26:34 UTC
How should I fix this?

$ strace -o y -q gdb ./vector -ex start -ex c -ex q
mkdir("/lib64/../share/gcc-5.1.1/python/libstdcxx/v6/__pycache__", 0777) = -1 EACCES (Permission denied)

So Python is OK with that, I see no errors, everything works.

And I see no SELinux messages anywhere either.  For example:
[root@localhost ~]# ausearch -m avc 
<no matches>

When I ran GDB as root then it created that __pycache__ but again no SELinux errors anywhere.

Enforcing

gdb-7.9.1-14.fc23.x86_64
python-2.7.9-11.fc23.x86_64
selinux-policy-targeted-3.13.1-127.fc23.noarch
kernel-core-4.1.0-0.rc4.git0.1.fc23.x86_64
libstdc++-5.1.1-1.fc23.x86_64
libstdc++-5.1.1-1.fc23.i686

Comment 6 Jakub Filak 2015-06-29 12:08:53 UTC
The package libstdc++ has to byte compile /usr/share/gcc-5.1.1/python/libstdcxx/v6/*.py files with Python 3 and take ownership of the .pyc files in /usr/share/gcc-5.1.1/python/libstdcxx/v6/__pycache__ [1].

This bug is a dupe of bug #1204355.


1: https://fedoraproject.org/wiki/Packaging:Python#Byte_compiling

Comment 7 Jan Kurik 2015-07-15 14:08:32 UTC
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:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 8 Karel Volný 2015-11-27 16:44:08 UTC
Description of problem:
I don't know how this happened ...

However, I think that gdb really shouldn't try to write to /usr/...


Additional info:
reporter:       libreport-2.6.3
hashmarkername: setroubleshoot
kernel:         4.2.6-301.fc23.x86_64
type:           libreport

Comment 9 Dmitry Tantsur 2015-12-22 20:51:05 UTC
Description of problem:
Happens after audacity crashes due to an unrelated problem


Additional info:
reporter:       libreport-2.6.3
hashmarkername: setroubleshoot
kernel:         4.2.7-300.fc23.x86_64
type:           libreport

Comment 10 Karel Volný 2016-01-03 12:34:48 UTC
Description of problem:
I got some crash after trying to play a video. This report appeared right after that. Obviously, gdb is trying something it shouldn't - bug in gdb, not in selinux. (And I think I've already seen this, this report is probably duplicate.)


Additional info:
reporter:       libreport-2.6.3
hashmarkername: setroubleshoot
kernel:         4.2.8-300.fc23.x86_64
type:           libreport

Comment 11 Daniel Walsh 2016-01-04 13:32:33 UTC
The problem is that some tool (Kernel?) is launching gdb from a confined program when it crashes.  This gdb is launched in the context of the crashed app, which is not allowed to do some of the things that gdb needs to do.  Since we don't want to allow all confined apps that this could happen to, gdb access, we need a way to launch the gdb with a different context.  What tool launches gdb?  Most likely we would need a kernel change for this.

Comment 12 Jakub Filak 2016-01-04 15:06:04 UTC
> The problem is that some tool (Kernel?) is launching gdb from a confined program when it crashes.

abrtd is launching gdb.

> This gdb is launched in the context of the crashed app, which is not allowed to do some of the things that gdb needs to do.

I think that this gdb is launched in the context of abrtd.

> Since we don't want to allow all confined apps that this could happen to, gdb access, we need a way to launch the gdb with a different context

We just need to ship byte compiled Python files. See comment #6

> What tool launches gdb?

abrtd

> Most likely we would need a kernel change for this.

We just need to fix a packaging bug. See comment #6 and bug #1204355

Comment 13 Paul Moore 2016-01-04 16:30:22 UTC
Just to add to Jakub's comments in comment #12, this isn't a kernel issue, but rather some combination of packaging and/or abrtd policy.

Comment 14 Daniel Walsh 2016-01-04 18:22:56 UTC
Yes in this case it is run by abrt, in other cases I have seen gdb running under the context of the crashing application.

Comment 15 Daniel Walsh 2016-01-04 18:26:12 UTC
Googling "selinux preventing gdb site:bugzilla.redhat.com"

Finds the following using contexts other then abrt_t.

https://bugzilla.redhat.com/show_bug.cgi?id=810447
https://bugzilla.redhat.com/show_bug.cgi?id=546380
https://bugzilla.redhat.com/show_bug.cgi?id=834768

Comment 16 Mikhail 2016-01-06 10:32:47 UTC
Description of problem:
Occured during abrt reporting process

Version-Release number of selected component:
selinux-policy-3.13.1-158.fc23.noarch

Additional info:
reporter:       libreport-2.6.3
hashmarkername: setroubleshoot
kernel:         4.2.8-300.fc23.x86_64+debug
type:           libreport

Comment 17 Ben Cardoen 2016-02-05 11:54:20 UTC
Description of problem:
This happened several times, the most recent was after debugging a c++ program. 

Version-Release number of selected component:
selinux-policy-3.13.1-158.fc23.noarch
selinux-policy-3.13.1-158.2.fc23.noarch

Additional info:
reporter:       libreport-2.6.3
hashmarkername: setroubleshoot
kernel:         4.4.1
type:           libreport

Comment 18 Ben Cardoen 2016-02-05 11:59:34 UTC
I'm not sure if it's relevant, but these are my versions of abrt/libstdc++
libstdc++.i686  5.3.1-2.fc23
libstdc++.x86_64 5.3.1-2.fc23

Comment 19 Yann Droneaud 2016-03-15 16:49:18 UTC
Description of problem:
After rhythmbox  crashed, bug #1295183, see https://bugzilla.redhat.com/show_bug.cgi?id=1295183

Version-Release number of selected component:
selinux-policy-3.13.1-158.9.fc23.noarch

Additional info:
reporter:       libreport-2.6.4
hashmarkername: setroubleshoot
kernel:         4.4.4-301.fc23.x86_64
type:           libreport

Comment 20 Igor Gnatenko 2016-08-08 11:52:47 UTC
looks like cant reproduce anymore.

Comment 21 Jakub Filak 2016-08-08 12:08:40 UTC
(In reply to Igor Gnatenko from comment #20)
> looks like cant reproduce anymore.

The bug is not fixed. See bug #1204355 comment #18 and bug #1204355 comment #19.

We can close the bug as WONTFIX but definitely not CURRENTRELEASE. However, in my opinion, the decision is up to gcc maintainers.

Comment 22 Fedora End Of Life 2016-11-24 11:47:58 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. 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 EOL if it remains open with a Fedora  'version'
of '23'.

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.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 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 this bug is closed as described in the policy above.

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 Fedora End Of Life 2016-12-20 13:40:52 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 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. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

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

Comment 24 Fedora End Of Life 2017-02-28 09:43:57 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 25 Fedora End Of Life 2018-05-03 08:50:39 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. 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 EOL if it remains open with a Fedora  'version'
of '26'.

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.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 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 this bug is closed as described in the policy above.

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 26 Fedora End Of Life 2018-05-29 12:01:08 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
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. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

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.