Skip to content

In docker container, second process cannot write to /proc/1/fd/1 #17551

Closed as not planned

Description

@rfay

Bug description

Writing to /proc/1/fd/1 (or /proc/1/fd/2) is a standard idiom for processes inside a docker container to add to the docker logs.

On most platforms, it's possible for processes in addition to process 1 to write to these, but on gitpod it doesn't seem to be possible.

Steps to reproduce

# In first terminal
docker run -it --rm -u 33 --name=junk ubuntu bash
# In second terminal 
docker run -it junk bash
ls >/proc/1/fd/1
bash: /proc/1/fd/1: Permission denied

Workspace affected

All

Expected behavior

  • Permission should not be denied.
  • Output should go to the first terminal

Example repository

No response

Anything else?

No response

Activity

  1. added
    type: bug
    on May 9, 2023
  2. added
    team: workspace
    on May 17, 2023
  3. loujaybee commented on May 17, 2023

    @loujaybee
    Member

    This does look related to the docker implementation in Gitpod.

  4. achille-roussel commented on Jun 26, 2023

    @achille-roussel

    I think I am running into a similar issue, accessing stdio files in /dev is also causing permission errors.

    Here is a simple step to reproduce:

    $ cat /dev/stdout
    cat: /dev/stdout: Permission denied
    

    On a classic linux system, the behavior of this command is to hang because cat attempts to read from its own output, but here we get a permission error.

    A possible reason for the issue is the owner of stdio files in /dev is root, but the shell is running as the gitpod user:

    $ ls -l /dev/
    ...
    lrwxrwxrwx 1 nobody nogroup      15 Jun 26 17:27 stderr -> /proc/self/fd/2
    lrwxrwxrwx 1 nobody nogroup      15 Jun 26 17:27 stdin -> /proc/self/fd/0
    lrwxrwxrwx 1 nobody nogroup      15 Jun 26 17:27 stdout -> /proc/self/fd/1
    ...
    $ ls -l /proc/self/fd/
    total 0
    lrwx------ 1 gitpod gitpod 64 Jun 26 18:15 0 -> /dev/pts/0
    lrwx------ 1 gitpod gitpod 64 Jun 26 18:15 1 -> /dev/pts/0
    lrwx------ 1 gitpod gitpod 64 Jun 26 18:15 2 -> /dev/pts/0
    ...
    $ ls -l /dev/pts/
    total 0
    crw--w---- 1 root   nogroup 136, 0 Jun 26 18:16 0
    ...
    $ whoami
    gitpod
    

    This limitation seems excessive since those are virtual files that are unique to each process, opening them in read/write mode should be allowed.

  5. github-actions commented on May 22, 2024

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  6. added
    meta: stale
    on May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    meta: staleteam: workspacetype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions