Bug 193370 - ainit creates semaphores and shmem with wrong permissions
ainit creates semaphores and shmem with wrong permissions
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: alsa-lib (Show other bugs)
5
All Linux
medium Severity medium
: ---
: ---
Assigned To: Martin Stransky
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-05-27 17:10 EDT by Roberto Ragusa
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-07-21 04:59:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Roberto Ragusa 2006-05-27 17:10:55 EDT
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 04:59:24 EDT
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.