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

oci: use /proc/self/fd/FD to open unix socket #8933

Merged

Conversation

giuseppe
Copy link
Member

instead of opening directly the UNIX socket path, grab a reference to
it through a O_PATH file descriptor and use the fixed size string
"/proc/self/fd/%d" to open the UNIX socket. In this way it won't hit
the 108 chars length limit.

Closes: #8798

Signed-off-by: Giuseppe Scrivano [email protected]

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 11, 2021
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 11, 2021
@rhatdan
Copy link
Member

rhatdan commented Jan 11, 2021

Cool idea, why is it draft?

@giuseppe
Copy link
Member Author

Cool idea, why is it draft?

just to make sure it solves the reported issue before we merge

@rhatdan
Copy link
Member

rhatdan commented Jan 11, 2021

LGTM
@containers/podman-maintainers PTAL

@mheon
Copy link
Member

mheon commented Jan 11, 2021

Change LGTM, but I'd like verification from someone actually seeing the issue.

@haircommander
Copy link
Collaborator

if you run rootless with a UID > like 10000 you run into this issue pretty easily.

I have tested and it fixes the issue for me:

 $ sudo su - hello
Last login: Tue Jan  5 16:06:21 EST 2021 on pts/0
[hello@localhost ~]$ cd ../pehunt/go/src/github.com/containers/libpod/
[hello@localhost libpod]$ ./bin/podman run --rm -ti alpine 
ERRO[0000] The storage 'driver' option must be set in /etc/containers/storage.conf, guarantee proper operation. 
ERRO[0000] The storage 'driver' option must be set in /etc/containers/storage.conf, guarantee proper operation. 
WARN[0000] Failed to add podman to systemd sandbox cgroup: dial unix /run/user/0/bus: connect: permission denied 
/ # exit
[hello@localhost libpod]$ podman run --rm -ti alpine 
Error: failed to connect to container's attach socket: /tmp/run-205013812/libpod/tmp/socket/d023d0895bce04d8b00aa33fe85f96389b2024c8c76e3c88626661e97a6f88c8/attac: dial unixpacket /tmp/run-205013812/libpod/tmp/socket/d023d0895bce04d8b00aa33fe85f96389b2024c8c76e3c88626661e97a6f88c8/attac: connect: no such file or directory
[hello@localhost libpod]$ id
uid=205013812(hello) gid=1002(hello) groups=1002(hello) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[hello@localhost libpod]$

where bin/podman is this fork

@rhatdan
Copy link
Member

rhatdan commented Jan 11, 2021

Ok we can merge once @giuseppe changes this to not draft and it actually passes the tests.

@giuseppe giuseppe marked this pull request as ready for review January 12, 2021 08:31
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 12, 2021
@giuseppe
Copy link
Member Author

ready to merge!

@giuseppe giuseppe force-pushed the use-O_PATH-for-unix-sock branch from cbec4b7 to 70cdb31 Compare January 12, 2021 08:33
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@giuseppe giuseppe force-pushed the use-O_PATH-for-unix-sock branch 2 times, most recently from e8a9677 to 5fa2744 Compare January 12, 2021 09:28
instead of opening directly the UNIX socket path, grab a reference to
it through a O_PATH file descriptor and use the fixed size string
"/proc/self/fd/%d" to open the UNIX socket.  In this way it won't hit
the 108 chars length limit.

Closes: containers#8798

Signed-off-by: Giuseppe Scrivano <[email protected]>
@giuseppe giuseppe force-pushed the use-O_PATH-for-unix-sock branch from 5fa2744 to fdbc278 Compare January 12, 2021 09:38
@rhatdan
Copy link
Member

rhatdan commented Jan 12, 2021

/lgtm
/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 12, 2021
@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 12, 2021
@vrothberg
Copy link
Member

/hold cancel

@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 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Socket truncated with long user names using default $XDG_RUNTIME_DIR
7 participants