Bug 193370 - ainit creates semaphores and shmem with wrong permissions
Summary: ainit creates semaphores and shmem with wrong permissions
Alias: None
Product: Fedora
Classification: Fedora
Component: alsa-lib (Show other bugs)
(Show other bugs)
Version: 5
Hardware: All Linux
Target Milestone: ---
Assignee: Martin Stransky
QA Contact:
Depends On:
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:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-07-21 08:59:24 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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):


How reproducible:


Steps to Reproduce:
1. Modify /etc/alsa/dmix.template, changing for example
     ipc_perm 0600
     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.