Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rootless podman run --privileged fails if there is an inaccessible /dev subdirectory #3919

Closed
QazerLab opened this issue Aug 31, 2019 · 5 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@QazerLab
Copy link
Contributor

QazerLab commented Aug 31, 2019

/kind bug

Description

Current implementation of privileged containers uses libcontainer's HostDevices() function to obtain the list of host devices. This function returns any error arising when accessing the subdirectories in /dev. This means, that having some inaccessible (by current user) subdirectory in /dev makes rootless podman run --privileged crash, e.g.:

$ podman run --privileged alpine
Error: open /dev/vboxusb: permission denied

Dir permissions are:

$ stat /dev/vboxusb/
...
Access: (0750/drwxr-x---)  Uid: (    0/    root)   Gid: (  108/vboxusers)

Steps to reproduce the issue:

  1. Create a subdirectory in /dev which is not accessible to ordinary users: sudo mkdir -m 0700 /dev/kaboom
  2. Run privileged rootless container: podman run --privileged alpine

Describe the results you received:

podman crashes with the permission denied error.

Describe the results you expected:

Inaccessible directory is ignored.

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 31, 2019
@mheon
Copy link
Member

mheon commented Aug 31, 2019

@giuseppe Probably related to the code added to add devices to privileged rootless containers?

@giuseppe
Copy link
Member

since I already have a PR that changes the code to handle devices when rootless, I've added a patch to take care of this issue as well: #3909

@carbolymer
Copy link

I think I'm experiencing this exact issue on 4.1.0:

% podman run --rm --privileged bash
Error: crun: error stat'ing file `/dev/vboxusb/001/002`: Permission denied: OCI permission denied
% podman --version                 
podman version 4.1.0
% /usr/bin/ls -al /dev/vboxusb/001
total 0
drwxr-x--- 2 root vboxusers     80 May 18 08:14 .
drwxr-x--- 4 root vboxusers     80 May 18 08:14 ..
crw-rw---- 1 root vboxusers 189, 1 May 18 08:14 002
crw-rw---- 1 root vboxusers 189, 2 May 18 08:14 003

@rhatdan
Copy link
Member

rhatdan commented May 18, 2022

This looks likely to be a different issue, please open a new one. This could be something that crun is causing. Are you running in rootless mode?

@carbolymer
Copy link

Rootless. Opened #14284.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

6 participants