ainit
The attached patch is needed for correct functionality of ainit with the latest strict policy when running reasonably recent rawhide packages.
Is this really what we want? Having a system process allocate shared memory that can be used by any user processes? Also it seems likely that other sound programs will need to access the shared memory in question.
There are three possible assumptions that we could make:
1) Anyone who is serious about security doesn't use ALSA so such access doesn't matter that much.
2) Sound devices are a channel for communication anyway so it doesn't really grant any new access. NB I don't know enough about sound programming to know whether this assumption is correct. Does ALSA require that a shared memory segment be available to all programs that are accessing the sound device? If so the assumption holds for ALSA. Can an application stuff some data into the sound hardware without using the user-space code from ALSA in such a way that another application can read it?
3) We need to have pam_console launch programs such as ainit in a context determined by the user role.
Option 3 might be the best one long-term.
Signature · 4 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page
program/alsa.te renamed from program/alsa.te.orig +8 -1
@@ -5,13 +5,20 @@ # type alsa_t, domain, privlog, daemon; type alsa_exec_t, file_type, sysadmfile, exec_type; +role system_r types alsa_t; uses_shlib(alsa_t) +read_locale(alsa_t) +dontaudit alsa_t var_t:dir search; allow alsa_t self:sem create_sem_perms; allow alsa_t self:shm create_shm_perms; allow alsa_t self:unix_stream_socket create_stream_socket_perms; +allow alsa_t self:unix_dgram_socket create_socket_perms; type alsa_etc_rw_t, file_type, sysadmfile, usercanread; rw_dir_create_file(alsa_t,alsa_etc_rw_t) -allow alsa_t self:capability { setgid setuid ipc_owner }; +allow alsa_t self:capability { setgid setuid ipc_owner sys_admin }; allow alsa_t devpts_t:chr_file { read write }; allow alsa_t etc_t:file { getattr read }; domain_auto_trans(pam_console_t, alsa_exec_t, alsa_t) + +allow userdomain alsa_t:sem rw_sem_perms; +allow userdomain alsa_t:shm { rw_shm_perms destroy };
Quoted 8 lines · Russell Coker
Is this really what we want? Having a system process allocate shared memory that can be used by any user processes? Also it seems likely that other sound programs will need to access the shared memory in question.
There are three possible assumptions that we could make:
1) Anyone who is serious about security doesn't use ALSA so such access doesn't matter that much.
This isn't the case. ALSA isn't any different then OSS from a SELinux viewpoint. I don't have ainit on any of my Gentoo machines; after a few minutes on Google, it seems that this is a Redhat/Fedora specific program.
Quoted 2 lines
2) Sound devices are a channel for communication anyway so it doesn't really grant any new access.
I don't see any SysV IPC objects on my machines that use ALSA, so it seems that ALSA has an optional feature that uses IPC, but it is not required for playing or recording sound.
Quoted 2 lines
Does ALSA require that a shared memory segment be available to all programs that are accessing the sound device?
This is the important question to ask of this feature.
Quoted 3 lines
Can an application stuff some data into the sound hardware without using the user-space code from ALSA in such a way that another application can read it?
Adding in shared memory access between all user domains is a much easier channel for communication then a sound device is; it doesn't need to go through the hardware since all user domains can read and write the segments.
Quoted 2 lines
3) We need to have
pam_consolelaunch programs such as ainit in a context determined by the user role.
Probably the right answer if the shared memory doesn't have to be shared between all user domains.
Signature · 9 lines
Chris PeBenito Tresys Technology, LLC (410) 290-1411 x150 -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 7 lines · Christopher J. PeBenito
Quoted 6 lines · Russell Coker
Is this really what we want? Having a system process allocate shared memory that can be used by any user processes? Also it seems likely that other sound programs will need to access the shared memory in question.
There are three possible assumptions that we could make:
Quoted 7 lines
Quoted 2 lines
1) Anyone who is serious about security doesn't use ALSA so such access doesn't matter that much.
This isn't the case. ALSA isn't any different then OSS from a SELinux viewpoint. I don't have ainit on any of my Gentoo machines; after a few minutes on Google, it seems that this is a Redhat/Fedora specific program.
At the moment possibly, but I'm sure other systems will want to unbreak their sound eventually too :)
Quoted 2 lines
Probably the right answer if the shared memory doesn't have to be shared between all user domains.
It needs to be accessible to any program that wants to play sound.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 3 lines · Russell Coker
Does ALSA require that a shared
memory segment be available to all programs that are accessing the sound device?
This is a consequence of switching to the ALSA "dmix" device by default, which does transparent sound mixing in userspace via the shared memory. This fixes the extremely user-visible bug of multiple applications not being able to use the sound card at the same time.
Fundamentally though the IPC key doesn't have to be allocated by the system; I wrote some code a while back that would have allocated it as part of the X login, all in the normal user session so there was no "system" part involved. I'm still not sure why our ALSA maintainer chose the ainit/PAM route given that you don't care about sound mixing for any other means of logging in like ssh or virtual terminal. Or at least, I don't think we should care.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 3 lines · --- Russell Coker
1) Anyone who is serious about security doesn't use ALSA so such access
doesn't matter that much.
This is always a bad assumption, regardless
of the facility in question.
Casey Schaufler
[email protected]
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 6 lines · Russell Coker
The attached patch is needed for correct functionality of ainit with the latest strict policy when running reasonably recent rawhide packages.
Is this really what we want? Having a system process allocate shared memory that can be used by any user processes? Also it seems likely that other sound programs will need to access the shared memory in question.
Not a good idea. Look at nscd handling for its shmem interface; we use an attribute to allow certain domains such access, but most domains are limited to the socket IPC-based interface. This program should likewise have some kind of fallback to an IPC-based interface if the shmem interface isn't allowed.
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.