Make sure unveil(2) is properly locked#99
Open
tnias wants to merge 1 commit into
Open
Conversation
This change ensures that unveil always gets locked (by passing two NULL
arguments) and at least one path ("/" with no permissions) got added to
unveil before that.
When no existing paths were registered with unveil(2), the filesystem
access is not restricted by it. Locking it in that state only prevents
us from configuring it further.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change ensures that unveil always gets locked (by passing two NULL arguments) and at least one path ("/" with no permissions) got added to unveil before that.
When no existing paths were registered with unveil(2), the filesystem access is not restricted by it. Locking it in that state only prevents us from configuring it further.
Notes on what I tried out.
Observations
Unveil gets locked, when we pass something via the '-f' flag. But it does not (or
only partially) when we do not.
With custom config and no default config
While
ps -O statereports:81470 I+pU p4 0:00.00 ./endlessh -f empty.config.Notice the
U. (this is good)Quote of
ps(1):Without custom config and no default config
While ps reports:
17997 S+p p4 0:00.00 ./endlessh.Notice no
Uoru. (this is not good)Without custom config and the default config directory
While ps reports:
10140 S+pu p4 0:00.00 ./endlesshNotice only
u. (this is not good)After patch (without default config and no default config)
While ps reports:
83117 S+pU p4 0:00.00 ./endlessh(with theU. yay)