Bug 505202 - SELinux is preventing maxima from loading /usr/lib64/maxima/5.17.1/binary-gcl/maxima which requires text relocation.
Summary: SELinux is preventing maxima from loading /usr/lib64/maxima/5.17.1/binary-gcl...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 11
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-06-10 23:49 UTC by Jonathan Underwood
Modified: 2009-09-07 00:30 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-04 15:43:01 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jonathan Underwood 2009-06-10 23:49:53 UTC
Description of problem:

Summary:

SELinux is preventing maxima from loading
/usr/lib64/maxima/5.17.1/binary-gcl/maxima which requires text relocation.

Detailed Description:

The maxima application attempted to load
/usr/lib64/maxima/5.17.1/binary-gcl/maxima which requires text relocation. This
is a potential security problem. Most libraries do not need this permission.
Libraries are sometimes coded incorrectly and request this permission. The
SELinux Memory Protection Tests
(http://people.redhat.com/drepper/selinux-mem.html) web page explains how to
remove this requirement. You can configure SELinux temporarily to allow
/usr/lib64/maxima/5.17.1/binary-gcl/maxima to use relocation as a workaround,
until the library is fixed. Please file a bug report
(http://bugzilla.redhat.com/bugzilla/enter_bug.cgi) against this package.

Allowing Access:

If you trust /usr/lib64/maxima/5.17.1/binary-gcl/maxima to run correctly, you
can change the file context to textrel_shlib_t. "chcon -t textrel_shlib_t
'/usr/lib64/maxima/5.17.1/binary-gcl/maxima'" You must also change the default
file context files on the system in order to preserve them even on a full
relabel. "semanage fcontext -a -t textrel_shlib_t
'/usr/lib64/maxima/5.17.1/binary-gcl/maxima'"

Fix Command:

chcon -t textrel_shlib_t '/usr/lib64/maxima/5.17.1/binary-gcl/maxima'

Additional Information:

Source Context                unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1
                              023
Target Context                system_u:object_r:lib_t:s0
Target Objects                /usr/lib64/maxima/5.17.1/binary-gcl/maxima [ file
                              ]
Source                        maxima
Source Path                   /usr/lib64/maxima/5.17.1/binary-gcl/maxima
Port                          <Unknown>
Host                          m1210.jgu
Source RPM Packages           maxima-runtime-gcl-5.17.1-7.fc11
Target RPM Packages           maxima-runtime-gcl-5.17.1-7.fc11
Policy RPM                    selinux-policy-3.6.12-39.fc11
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   allow_execmod
Host Name                     m1210.jgu
Platform                      Linux m1210.jgu 2.6.29.4-167.fc11.x86_64 #1 SMP
                              Wed May 27 17:27:08 EDT 2009 x86_64 x86_64
Alert Count                   2
First Seen                    Thu 11 Jun 2009 00:46:28 BST
Last Seen                     Thu 11 Jun 2009 00:46:28 BST
Local ID                      cfd08eba-d1e7-4fd2-ac62-bd3ae10c4515
Line Numbers                  

Raw Audit Messages            

node=m1210.jgu type=AVC msg=audit(1244677588.684:26018): avc:  denied  { execmod } for  pid=4490 comm="maxima" path="/usr/lib64/maxima/5.17.1/binary-gcl/maxima" dev=dm-2 ino=151358 scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=system_u:object_r:lib_t:s0 tclass=file

node=m1210.jgu type=SYSCALL msg=audit(1244677588.684:26018): arch=c000003e syscall=10 per=40000 success=no exit=-13 a0=f59000 a1=272c000 a2=7 a3=7fffffffe350 items=0 ppid=4485 pid=4490 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=(none) ses=2 comm="maxima" exe="/usr/lib64/maxima/5.17.1/binary-gcl/maxima" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null)




Version-Release number of selected component (if applicable):
maxima-5.17.1-7.fc11.x86_64
maxima-runtime-gcl-5.17.1-7.fc11.x86_64
libselinux-2.0.80-1.fc11.i586
libselinux-python-2.0.80-1.fc11.x86_64
libselinux-utils-2.0.80-1.fc11.x86_64
selinux-policy-targeted-3.6.12-39.fc11.noarch
libselinux-2.0.80-1.fc11.x86_64
selinux-policy-3.6.12-39.fc11.noarch


How reproducible:
Everytime

Steps to Reproduce:
1.Install maxima and wxMaxima
2.Start wxMaxima, and see the SElinux avc
3.

Comment 1 Jonathan Underwood 2009-06-10 23:56:58 UTC
And also, when running with SElinux in permissive mode I get a slightly different AVC:


Summary:

SELinux is preventing maxima from changing the access protection of memory on
the heap.

Detailed Description:

[SELinux is in permissive mode, the operation would have been denied but was
permitted due to permissive mode.]

The maxima application attempted to change the access protection of memory on
the heap (e.g., allocated using malloc). This is a potential security problem.
Applications should not be doing this. Applications are sometimes coded
incorrectly and request this permission. The SELinux Memory Protection Tests
(http://people.redhat.com/drepper/selinux-mem.html) web page explains how to
remove this requirement. If maxima does not work and you need it to work, you
can configure SELinux temporarily to allow this access until the application is
fixed. Please file a bug report
(http://bugzilla.redhat.com/bugzilla/enter_bug.cgi) against this package.

Allowing Access:

If you want maxima to continue, you must turn on the allow_execheap boolean.
Note: This boolean will affect all applications on the system.

Fix Command:

setsebool -P allow_execheap=1

Additional Information:

Source Context                unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1
                              023
Target Context                unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1
                              023
Target Objects                None [ process ]
Source                        maxima
Source Path                   /usr/lib64/maxima/5.17.1/binary-gcl/maxima
Port                          <Unknown>
Host                          m1210.jgu
Source RPM Packages           maxima-runtime-gcl-5.17.1-7.fc11
Target RPM Packages           
Policy RPM                    selinux-policy-3.6.12-39.fc11
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Permissive
Plugin Name                   allow_execheap
Host Name                     m1210.jgu
Platform                      Linux m1210.jgu 2.6.29.4-167.fc11.x86_64 #1 SMP
                              Wed May 27 17:27:08 EDT 2009 x86_64 x86_64
Alert Count                   1
First Seen                    Thu 11 Jun 2009 00:55:30 BST
Last Seen                     Thu 11 Jun 2009 00:55:30 BST
Local ID                      5e734581-f333-40c2-9c83-e14c9efeb6cc
Line Numbers                  

Raw Audit Messages            

node=m1210.jgu type=AVC msg=audit(1244678130.788:26029): avc:  denied  { execheap } for  pid=4598 comm="maxima" scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=process

node=m1210.jgu type=SYSCALL msg=audit(1244678130.788:26029): arch=c000003e syscall=10 per=40000 success=yes exit=0 a0=3685000 a1=8f5a000 a2=7 a3=7fffffffe380 items=0 ppid=4593 pid=4598 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=(none) ses=2 comm="maxima" exe="/usr/lib64/maxima/5.17.1/binary-gcl/maxima" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null)

Comment 2 Daniel Walsh 2009-06-12 11:50:15 UTC
What kind of tool is maxima? 

THese errors are explained here

http://people.redhat.com/~drepper/selinux-mem.html

These errors are extremely rare, you can allow them all by executing

setsebool -P allow_execheap=1  allow_execmod=1

I have never seen and executable that needed these privs.

Comment 3 Jonathan Underwood 2009-06-12 12:04:12 UTC
Maxima is a gcl program for symbolic algebra. Actually, I just found that this issue came up before, and the selinux policy fixed - see BZ #287761

Comment 4 Daniel Walsh 2009-06-12 13:01:53 UTC
Does chcon -t textrel_shlib_t work for you?

Comment 5 Jonathan Underwood 2009-06-12 13:34:40 UTC
I'll get back to you on that shortly - am presently away from the machine in question.

Comment 6 Jonathan Underwood 2009-06-13 14:28:18 UTC
1) chcon -t textrel_shlib_t '/usr/lib64/maxima/5.17.1/binary-gcl/maxima' stopped the AVC reported in the very first report only, i.e. the AVC in comment #1 persists.

2) I tried setsebool -P allow_execheap=1 and the AVC in comment #1 persists

3) I tried setsebool -P allow_execheap=1  allow_execmod=1 and the AVC in comment #1 persists.

Comment 7 Daniel Walsh 2009-06-15 18:32:22 UTC
setsebool -P allow_execmod=1
Does this fix it?

ls -lZ /usr/lib64/maxima/5.17.1/binary-gcl/maxima

Comment 8 Jonathan Underwood 2009-06-15 18:43:47 UTC
(In reply to comment #7)
> setsebool -P allow_execmod=1
> Does this fix it?
> 

Yes, it does.

> ls -lZ /usr/lib64/maxima/5.17.1/binary-gcl/maxima  

-rwxr-xr-x. root root system_u:object_r:textrel_shlib_t:s0 /usr/lib64/maxima/5.17.1/binary-gcl/maxima

Comment 9 Jonathan Underwood 2009-06-15 18:55:15 UTC
Is there any way to allow allow_execheap and  allow_execmod on a per file basis rather than system wide? Seems to me that allowing these system wide could open up vulnerabilities?

Comment 10 Daniel Walsh 2009-06-15 19:49:10 UTC
I do not see the maxima package in F11 but I do see it in F12. (Rawhide)

How do you trigger the AVC.

When I just run maxima I do not see a problem with it labeled textrel_shlib_t.

Comment 11 Jonathan Underwood 2009-06-15 21:55:18 UTC
(In reply to comment #10)
> I do not see the maxima package in F11 but I do see it in F12. (Rawhide)
> 

It is there in F-11, I promise. You can do simply yum install wxMaxima, which will pull in maxima as well (wxMaxima is a gui front end to maxima).

> How do you trigger the AVC.
> 

As mentioned in the initial report, simply start wxMaxima from the menu entry - wxMaxima starts maxima in some sort of server/daemon mode.

> When I just run maxima I do not see a problem with it labeled textrel_shlib_t.  

Yes, I didn't see it just running from maxima the command line - it has something to do with the way that wxMaxima is starting maxima, but I haven't yet figured out what is different.

Comment 12 Daniel Walsh 2009-06-16 13:37:13 UTC
Sorry I am an idiot, I had the fedora repo turned off and just updates turned on.

If I 
 chcon -t execmem_exec_t /usr/lib64/maxima/5.17.1/binary-gcl/maxima  

I still get the execmod error but it seems to work fine in enforcing mode.  Well at least start.  Could you play around with it in this mode and see if everything works.

I can allow execmod on a execmem_exec_t file.

Comment 13 Jonathan Underwood 2009-09-07 00:30:27 UTC
Sorry for not getting back to this, it skipped my mind. 

I can confirm that with the following packages, maxima functions properly:


$ rpm -qa | grep maxima
maxima-runtime-sbcl-5.18.1-6.fc11.x86_64
maxima-5.18.1-6.fc11.x86_64

$ rpm -qa | grep selinux
libselinux-2.0.80-1.fc11.i586
selinux-policy-3.6.12-80.fc11.noarch
libselinux-python-2.0.80-1.fc11.x86_64
libselinux-utils-2.0.80-1.fc11.x86_64
selinux-policy-targeted-3.6.12-80.fc11.noarch
libselinux-2.0.80-1.fc11.x86_64


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