Opened 11 years ago

Closed 11 years ago

#5548 closed Bugs (worksforme)

Boost interprocess shared memory mutex requires root permissions on Linux

Reported by: habdank@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc:

Description

Programs that uses shared memory, especially shared memory mutex on Linux are working only when super-user permissions are granted. POSIX does not require that, so that is a bug in BOOST IPC implementation to require SU permissions.

Workaround is to create a group that will have a high access rights to /dev/shm and then add all users that may use application to that group, but that is not solving all problems.

Attachments (2)

Makefile (780 bytes ) - added by habdank@… 11 years ago.
shm.cpp (4.4 KB ) - added by habdank@… 11 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by habdank@…, 11 years ago

On Windows it works as expected.

comment:2 by Ion Gaztañaga, 11 years ago

Interprocess uses POSIX calls (shm_open)to implement shared memory. Please review if those calls require SU permissions in your machine. If Interprocess correctly calls POSIX functions, then there is no bug in Interprocess.

by habdank@…, 11 years ago

Attachment: Makefile added

by habdank@…, 11 years ago

Attachment: shm.cpp added

comment:3 by habdank@…, 11 years ago

In the attachments there is an example that is working when the user has admin rights, but when the user has no admin rights (normal OS user) boost part is failing and POSIX is working. OS specification: Ubuntu 10.04 LTS.

comment:4 by Ion Gaztañaga, 11 years ago

Resolution: worksforme
Status: newclosed

As said this is outside interprocess, I think it's a bug in your OS init scripts, as POSIX requires shared memory to be usable from non-root users.

Note: See TracTickets for help on using tickets.