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

conmon: chmod std files pipes #112

Merged
merged 1 commit into from
Jan 7, 2020
Merged

Conversation

giuseppe
Copy link
Member

@giuseppe giuseppe commented Jan 7, 2020

make sure every user inside of the container can use the standard
files. Without the chmod, only root in the container would be able to
print to stdout.

It went unnoticed with runc, as runc itself corrects these permissions
but it should not be the OCI runtime responsibility since conmon is
creating these files.

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

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

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

LGTM

src/conmon.c Outdated

if (slavefd_stderr < 0)
slavefd_stderr = slavefd_stdout;
if (dup2(slavefd_stderr, STDERR_FILENO) < 0)
pexit("Failed to dup over stderr");
if (fchmod(STDERR_FILENO, 0777) < 0)
nwarn("Failed to chown stdout");

Choose a reason for hiding this comment

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

Likely copy-paste error, shouldn't the error message read "Failed to chown stderr"?

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 noticing it! Yeah it was a copy-paste error

make sure every user inside of the container can use the standard
files.  Without the chmod, only root in the container would be able to
print to stdout.

It went unnoticed with runc, as runc itself corrects these permissions
but it should not be the OCI runtime responsibility since conmon is
creating these files.

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

Signed-off-by: Giuseppe Scrivano <[email protected]>
@haircommander
Copy link
Collaborator

LGTM

1 similar comment
@rhatdan
Copy link
Member

rhatdan commented Jan 7, 2020

LGTM

@rhatdan rhatdan merged commit 26f6817 into containers:master Jan 7, 2020
@rhatdan
Copy link
Member

rhatdan commented Jan 7, 2020

Can we get a new conmon release?

afazekas added a commit to afazekas/conmon that referenced this pull request Jun 7, 2023
Since containers#112 the anonymous pipes are supposed to be
more permissive. Restroing the permissive state.

Close containers#429
afazekas added a commit to afazekas/conmon that referenced this pull request Jun 7, 2023
Since containers#112 the anonymous pipes are supposed to be
more permissive. Restoring the permissive state.

Close containers#429
afazekas added a commit to afazekas/conmon that referenced this pull request Jun 7, 2023
Since containers#112 the anonymous pipes are supposed to be
more permissive. Restoring the permissive state.

Close containers#429

Signed-off-by: Attila Fazekas <[email protected]>
afazekas added a commit to afazekas/conmon that referenced this pull request Jun 7, 2023
Since containers#112 the anonymous pipes are supposed to be
more permissive. Restoring the permissive state.

Close containers#429

Signed-off-by: Attila Fazekas <[email protected]>
afazekas added a commit to afazekas/conmon that referenced this pull request Jun 7, 2023
Since containers#112 the anonymous pipes are supposed to be
more permissive. Restoring the permissive state.

Close containers#429

Signed-off-by: afazekas <[email protected]>
afazekas added a commit to afazekas/conmon that referenced this pull request Jun 8, 2023
Since containers#112 the anonymous pipes are supposed to be
more permissive. Restoring the permissive state by default.
32816bd introduced the tty check
for FreeBSD, assuming it is needed there.

Close containers#429

Signed-off-by: afazekas <[email protected]>
afazekas added a commit to afazekas/conmon that referenced this pull request Jun 8, 2023
Since containers#112 the anonymous pipes are supposed to be
more permissive. Restoring the permissive state by default.
32816bd introduced the tty check
for FreeBSD, assuming it is needed there.

Close containers#429

Signed-off-by: afazekas <[email protected]>
afazekas added a commit to afazekas/conmon that referenced this pull request Jun 9, 2023
Since containers#112 the anonymous pipes are supposed to be
more permissive. Restoring the permissive state by default.
32816bd introduced a tty check
assuming it was introduced to avoid
too many warning logs on platfroms where several types are not supported.

Instead of tty check using EINVAL check per the review comment.

Close containers#429

Signed-off-by: afazekas <[email protected]>
afazekas added a commit to afazekas/conmon that referenced this pull request Jun 9, 2023
Since containers#112 the anonymous pipes are supposed to be
more permissive. Restoring the permissive state by default.
32816bd introduced a tty check
assuming it was introduced to avoid
too many warning logs on platfroms where several types are not supported.

Instead of tty check using EINVAL check per the review comment.

Close containers#429

Signed-off-by: afazekas <[email protected]>
afazekas added a commit to afazekas/conmon that referenced this pull request Jun 9, 2023
Since containers#112 the anonymous pipes are supposed to be
more permissive. Restoring the permissive state by default.

Platforms which has a documented EINVAL usage for fchmod(2)
indicates the fd in context is not supporting fchmod(2).
In order to not have annoying logs in those cases the warning
is omitted.

Close containers#429

Signed-off-by: afazekas <[email protected]>
afazekas added a commit to afazekas/conmon that referenced this pull request Jun 9, 2023
Since containers#112 the anonymous pipes are supposed to be
more permissive. Restoring the permissive state by default.
32816bd introduced a tty check
assming it was introduced to avoid
too many warning logs on platfroms where several types are not supported.

Instead of tty check using error code check per review.

Close containers#429

Signed-off-by: afazekas <[email protected]>
haircommander pushed a commit that referenced this pull request Jun 13, 2023
Since #112 the anonymous pipes are supposed to be
more permissive. Restoring the permissive state by default.

Platforms which has a documented EINVAL usage for fchmod(2)
indicates the fd in context is not supporting fchmod(2).
In order to not have annoying logs in those cases the warning
is omitted.

Close #429

Signed-off-by: afazekas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants