Bug 735855 - Glance, why oh why do you exec tmp files?
Summary: Glance, why oh why do you exec tmp files?
Alias: None
Product: Fedora
Classification: Fedora
Component: openstack-glance
Version: 16
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Mark McLoughlin
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2011-09-05 18:11 UTC by Mark McLoughlin
Modified: 2013-02-14 02:54 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2013-02-14 02:54:00 UTC

Attachments (Terms of Use)

Description Mark McLoughlin 2011-09-05 18:11:57 UTC
dwalsh asks in bug #732699:

> I do have a concern about api using /tmp and creating a file which it later
> executes.  The policy allows this but I would like to know why?  

i.e. why do we need this in the policy:

  can_exec(glance_api_t, glance_tmp_t)

Comment 1 Mark McLoughlin 2011-09-06 07:18:01 UTC
dwalsh, I rebuilt selinux-policy without the can_exec rule and tried re-installing glance and running it and I didn't see any AVC denials

Any more details?

Comment 2 Mark McLoughlin 2011-09-06 11:58:50 UTC
Sorry, I was being dumb - I see the denials now

avc:  denied  { getattr } for  pid=21188 comm="glance-api" name="/" dev=dm-1 ino=2 scontext=system_u:system_r:glance_api_t:s0 tcontext=system_u:object_r:fs_t:s0 tclass=filesystem
avc:  denied  { execute } for  pid=21188 comm="glance-api" path=2F746D702F666669345655464134202864656C6574656429 dev=dm-1 ino=2627565 scontext=system_u:system_r:glance_api_t:s0 tcontext=system_u:object_r:glance_tmp_t:s0 tclass=file

From strace:

[pid 23557] statfs("/selinux", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=12901535, f_bfree=9835419, f_bavail=9180059, f_files=3276800, f_ffree=2992405, f_fsid={-1974149950, 73777858}, f_namelen=255, f_frsize=4096}) = 0
[pid 23557] open("/proc/mounts", O_RDONLY) = 8
[pid 23557] fstat(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid 23557] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f669a512000
[pid 23557] read(8, "rootfs / rootfs rw 0 0\nproc /pro"..., 1024) = 1024
[pid 23557] close(8)                    = 0
[pid 23557] munmap(0x7f669a512000, 4096) = 0
[pid 23557] open("/tmp/ffiRNtpCL", O_RDWR|O_CREAT|O_EXCL, 0600) = 8
[pid 23557] unlink("/tmp/ffiRNtpCL")    = 0
[pid 23557] ftruncate(8, 4096)          = 0
[pid 23557] mmap(NULL, 4096, PROT_READ|PROT_EXEC, MAP_SHARED, 8, 0) = 0x7f669a512000
[pid 23557] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 8, 0) = 0x7f669a511000

This looks very similar to bug #522731

Anything we can reasonably do about this, or just leave can_exec(glance_api_t, glance_tmp_t) in the policy?

Comment 3 Daniel Walsh 2011-09-06 15:24:37 UTC
What UID is glance running as?

Comment 4 Mark McLoughlin 2011-09-06 15:40:20 UTC
(In reply to comment #3)
> What UID is glance running as?

glance:glance which I've just noticed is 994:987 on my test machine but should be 161:161 now that we have a statically allocated uidgid

Comment 5 Daniel Walsh 2011-09-06 15:58:43 UTC
Ok just wanted to make sure it was not running as root.  I would still prefer it to have its tmp file under /run, but I will allow this access.


Comment 6 Fedora End Of Life 2013-01-17 01:48:03 UTC
This message is a reminder that Fedora 16 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 16. 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 '16'.

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 16'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 16 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 to click on 
"Clone This Bug" and open it against that version of Fedora.

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.

The process we are following is described here: 

Comment 7 Fedora End Of Life 2013-02-14 02:54:04 UTC
Fedora 16 changed to end-of-life (EOL) status on 2013-02-12. Fedora 16 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.