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

attach: fix attach when cuid is too long #1704

Merged

Conversation

giuseppe
Copy link
Member

conmon creates a symlink to avoid using a too long UNIX path.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1641800

There is still one issue when the path length of the symlink has the
same length of the attach socket parent directory since conmon fails
to create the symlink, but that must be addressed in conmon first.

Signed-off-by: Giuseppe Scrivano gscrivan@redhat.com

@baude
Copy link
Member

baude commented Oct 23, 2018

LGTM

@baude
Copy link
Member

baude commented Oct 23, 2018

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: baude

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 Oct 23, 2018
@giuseppe giuseppe force-pushed the attach-cuid-too-long branch 2 times, most recently from f90c6be to 8144a3f Compare October 23, 2018 11:06
Copy link
Member

@TomSweeneyRedHat TomSweeneyRedHat left a comment

Choose a reason for hiding this comment

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

LGTM assuming happy tests.

@rhatdan
Copy link
Member

rhatdan commented Oct 23, 2018

Should this patch be in a separate Unix/Linux only code path?

@giuseppe
Copy link
Member Author

Should this patch be in a separate Unix/Linux only code path?

not sure, do we support anything else than Unix?

@giuseppe
Copy link
Member Author

also I am still unsure how to fix conmon (and then again in podman) when the substring gives a path that is already existing. It is a corner case but still can happen

@giuseppe giuseppe force-pushed the attach-cuid-too-long branch 2 times, most recently from 12d4b63 to 4aab5ee Compare October 25, 2018 12:10
@giuseppe
Copy link
Member Author

and patch for conmon to fix the symlink length corner case: cri-o/cri-o#1875

@mheon
Copy link
Member

mheon commented Oct 25, 2018

I am really concerned about what happens during collisions - if we start a few hundred to a thousand containers, do we start hitting this frequently?

We should try and make sure that a sizable portion of the UUID makes it in there. If we manually specify a libpod run path long enough, we could end up generating completely unusable attach paths like this (cut off everything except part of the path to the attach sockets directory)

@giuseppe
Copy link
Member Author

I am really concerned about what happens during collisions - if we start a few hundred to a thousand containers, do we start hitting this frequently?

I think we should just error out and not accept any runroot that is longer than 40-50 characters so that we have enough room for the UUID and avoid such kind of issues. What do you think? I can add another patch to this PR if you like the idea.

@mheon
Copy link
Member

mheon commented Oct 26, 2018 via email

@giuseppe
Copy link
Member Author

/retest

socketPath = socketPath[0:maxUnixLength]
}

logrus.Debug("connecting to socket ", socketPath)
Copy link
Member

Choose a reason for hiding this comment

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

I think that should be Debugf("... %v", socketPath).

Copy link
Member

Choose a reason for hiding this comment

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

+1, I'm surprised gofmt or govet didn't ping on this.

@giuseppe
Copy link
Member Author

tests are passing and I've added the additional check

@vrothberg
Copy link
Member

LGTM but I prefer to wait for @mheon's final ack.


maxUnixLength := int(C.unix_path_length())
if maxUnixLength < len(socketPath)-1 {
socketPath = socketPath[0:maxUnixLength]
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to subtract one from maxUnixLength here to account for a trailing null?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks for catching it. No it is not needed, I've tried both versions and I am surprised it doesn't crash. I've dropped the -1 and pushed a new version

@mheon
Copy link
Member

mheon commented Oct 30, 2018

One question on a possible off-by-one. Could just be me seeing things that aren't there, coffee isn't working yet

conmon creates a symlink to avoid using a too long UNIX path.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1641800

There is still one issue when the path length of the symlink has the
same length of the attach socket parent directory since conmon fails
to create the symlink, but that must be addressed in conmon first.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@baude
Copy link
Member

baude commented Oct 30, 2018

LGTM, @mheon you're it

@mheon
Copy link
Member

mheon commented Oct 30, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 30, 2018
@openshift-merge-robot openshift-merge-robot merged commit ee513cc into containers:master Oct 30, 2018
@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 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 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.

None yet

8 participants