shm_open() fails with EACCESS for root user

Bug #1890168 reported by Radek Krejci
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

In Ubuntu 20.04 I'm having problem with accessing shared memory segments by different users. The associated files are created using shm_open() with the combination of O_CREAT and O_RDWR flags and placed in /dev/shm. The example of such a code is in the enclosed source file.

When I run it for the first time, it works as expected and /dev/shm/testshm is created:

$ ls -la /dev/shm
total 0
drwxrwxrwt 2 root root 60 Aug 3 16:34 .
drwxr-xr-x 18 root root 4580 Aug 3 12:41 ..
-rw-rw-r-- 1 krejci krejci 0 Aug 3 14:37 testshm

Then running program again under the same user works fine, but when I try to run the program as root (or any other user), I'm getting "Permission denied":

# id
uid=0(root) gid=0(root) groups=0(root)
# ./test
return value -1
result 13: Permission denied

The example program works as expected on previous Ubuntu (18.04, 19.10) releases as well as on other linux distros - other users has access according to the set permissions (root is always able to access it).

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: libc6 2.31-0ubuntu9
ProcVersionSignature: Ubuntu 5.4.0-42.46-generic 5.4.44
Uname: Linux 5.4.0-42-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.4
Architecture: amd64
CasperMD5CheckResult: skip
Date: Mon Aug 3 17:35:07 2020
InstallationDate: Installed on 2020-08-03 (0 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
SourcePackage: glibc
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Radek Krejci (radekkrejci) wrote :
affects: ubuntu → glibc (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in glibc (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.