Bug 193370 - ainit creates semaphores and shmem with wrong permissions
Summary: ainit creates semaphores and shmem with wrong permissions
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: alsa-lib
Version: 5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Martin Stransky
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-05-27 21:10 UTC by Roberto Ragusa
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2006-07-21 08:59:24 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Roberto Ragusa 2006-05-27 21:10:55 UTC
Description of problem:

The ipc_perm parameter in dmix.template and dsnoop_template
has no effect, because ainit always uses 0600 as permission.


Version-Release number of selected component (if applicable):

alsa-utils-1.0.11-4.rc2


How reproducible:

100%


Steps to Reproduce:
1. Modify /etc/alsa/dmix.template, changing for example
     ipc_perm 0600
   into
     ipc_perm 0666
2. ainit <name_of_the_user> start
3. ipcs -a
  
Actual results:

The shared memory segments and the semaphore arrays have
been created with permission 0600 and not 0666.


Expected results:

Permission should be respected.


Additional info:

I want to mix audio from many users, so I tried to set ipc_perm
to 0666 in /etc/alsa/dmix.template and /etc/alsa/dsnoop.template
(in addition to 0666 permission on the devices).
This doesn't work well, because when ainit creates
/etc/alsa/dmix.conf and /etc/alsa/dsnoop.conf it allocates
ipc_key and ipc_semaphore using an hardcoded permission of 0600.
The generated *.conf files do contain the "ipc_perm 0666" line,
but the keys and the semaphore have already been incorrectly created.

The problem is here (hardcoded 0600):

/* Checking if IPC key/semaphore already exist
*/
int check_ipc_key(key_t key)
{
  int shm_id = shmget(key, 1, IPC_CREAT | IPC_EXCL | 0600);
  return (shm_id >= 0);
}

int check_ipc_semaphore(key_t key)
{
  int shm_id = semget(key, 1, IPC_CREAT | IPC_EXCL | 0600);
  return (shm_id >= 0);
}

Comment 1 Martin Stransky 2006-07-21 08:59:24 UTC
fixed in rawhide, I removed all ainit stuffs, they're not needed any more in the
latest upstream.


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