Bug 194452 - Grub fails with execmem AVC denied
Summary: Grub fails with execmem AVC denied
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-06-08 10:24 UTC by Mark McLoughlin
Modified: 2007-11-30 22:11 UTC (History)
3 users (show)

Fixed In Version: Current
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-08-22 14:14:39 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Mark McLoughlin 2006-06-08 10:24:02 UTC
Doing the following:

    $> cat > grubscript.tmp << EOF
    root (hd1,0)
    install /grub/stage1 d (hd1) /grub/stage2 p /grub/grub.conf
    EOF
    $> grub --batch --no-floppy --device-map=device.map < grubscript.tmp
    grub: asmstub.c:214: grub_stage2: Assertion `simstack_alloc_base != ((void
*) -1)' failed.
    Aborted

Fails with this AVC denied:

    avc:  denied  { execmem } for  pid=3093 comm="grub"
scontext=root:system_r:unconfined_t:s0-s0:c0.c255
tcontext=root:system_r:unconfined_t:s0-s0:c0.c255 tclass=process

Running with allow_execmem set to 1 makes it work.

Best I can make out is that our grub simulates an executable stack my mmaping a
chunk of memory and marking it executable ... presumably so grub can be built
without an executable stack.

CVS log of the patch:

    $> cvs log grub-0.95-nxstack.patch
    date: 2005/02/11 08:16:53;  author: pjones;  state: Exp;
    vroomfondel:~$ eu-readelf -l /sbin/grub | grep STACK
      GNU_STACK      0x000000 0x00000000 0x00000000 0x000000 0x000000 RW  0x4
                                                                    ^ yay

    This may be one of the worst atrocities I've ever committed to disk.

:-)

Do we need to modify the policy to allow_execmem for grub?

Comment 1 Daniel Walsh 2006-06-08 14:47:18 UTC
Is this required by grub?  IE Is there another way to do this.  We can define a
context of uncofined_execmem_exec_t for grub which would allow this.

chcon -t uncofined_execmem_exec_t /sbin/grub

Comment 2 Daniel Walsh 2006-06-16 01:29:20 UTC
Fixed in 2.2.47-3


Comment 3 Piete Brooks 2006-07-07 05:48:20 UTC
I still see this problem on FC6 T1

Vigor14:~: rpm -q selinux-policy-targeted 
selinux-policy-targeted-2.3.1-1
Vigor14:~: 

audit(1152250446.486:6): avc:  denied  { execmem } for  pid=2177 comm="grub"
scontext=system_u:system_r:unconfined_t:s0
tcontext=system_u:system_r:unconfined_t:s0 tclass=process

Comment 4 Daniel Walsh 2006-07-11 13:38:01 UTC
Fixed in selinux-policy-targeted-2.3.2-2

Comment 5 Daniel Walsh 2007-08-22 14:14:39 UTC
Should be fixed in the current release



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