-
Notifications
You must be signed in to change notification settings - Fork 16
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
pam/go/exec: Code cleanup #822
Open
3v1n0
wants to merge
7
commits into
ubuntu:main
Choose a base branch
from
3v1n0:exec-cleanups
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #822 +/- ##
==========================================
- Coverage 83.43% 78.97% -4.47%
==========================================
Files 83 102 +19
Lines 8689 10414 +1725
Branches 74 75 +1
==========================================
+ Hits 7250 8224 +974
- Misses 1111 1725 +614
- Partials 328 465 +137 ☔ View full report in Codecov by Sentry. |
We may end up modifying it while calling `g_debug` so make sure we're actually using the real errno on return.
We can safely call g_connection_close multiple times on a valid connection, while we already have code handling the connection disposal in action_module_data_cleanup(). At the same time here there's no risk that we're accessing to a disposed connection in the thread, because at this point the wait-child thread is running while the action-thread is waiting for it, before disposing the connection.
Since the pointer is shared through different threads it's safer to always read and set it atomically, even if there are no races here but the API makes it more explicit.
Also no need to set the exit code in such cases, as it's just a system failure from the PAM side.
5dacb53
to
eda4f14
Compare
When the child receives signals should ignore them and just return a generic PAM system error, but still we need to check that they're properly handled
Sadly some signals such as SIGABRT or SIGSEGV are handled by go and in the wrong way because it never redirects them as expected, so in such cases we just fail with a normal exit error instead of because of a signal. Reported this upstream and adding comments about. See: golang/go#72084
It's nice to increase coverage... :)
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.
Some random cleanups on the exec module, see commits for datails
UDENG-6256