trifectatechfoundation / sudo-rs

A memory safe implementation of sudo and su.
Other
2.9k stars 79 forks source link

Delay exit as much as possible #643

Closed pvdrz closed 1 year ago

pvdrz commented 1 year ago

Describe the changes done on this pull request This PR replaces all the individual calls to exit for child processes for a single call at the top of the exec module. This will guarantee that any internal value created by the exec module will be properly dropped.

It would be possible to move this call to exit upper so other parts of sudo can properly drop any values that should be dropped according to their internal logic.

It also replaces the calls to exit for _exit for three reasons:

cc @japaric

Pull Request Checklist

github-actions[bot] commented 1 year ago

Number of dependencies and binary size impact report

Metric main PR #643 Delta
Direct dependencies 3 3 -
Total dependencies 4 4 -
Binary size 978.5 KiB 978.6 KiB -
Text size 570.7 KiB 571.1 KiB -
Dependencies diff ```diff └─ sudo-rs [v0.2.0-dev.20230703] ├─ glob [v0.3.1] ├─ libc [v0.2.147] └─ log [v0.4.19] ```
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 51.16% and project coverage change: -10.77 :warning:

Comparison is base (729d1b0) 86.32% compared to head (31b90d5) 75.56%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #643 +/- ## =========================================== - Coverage 86.32% 75.56% -10.77% =========================================== Files 64 58 -6 Lines 8680 5975 -2705 =========================================== - Hits 7493 4515 -2978 - Misses 1187 1460 +273 ``` | [Impacted Files](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/643?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety) | Coverage Δ | | |---|---|---| | [src/exec/use\_pty/monitor.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/643?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvdXNlX3B0eS9tb25pdG9yLnJz) | `0.00% <0.00%> (-52.37%)` | :arrow_down: | | [src/system/mod.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/643?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N5c3RlbS9tb2QucnM=) | `75.06% <0.00%> (-14.50%)` | :arrow_down: | | [src/exec/use\_pty/parent.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/643?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvdXNlX3B0eS9wYXJlbnQucnM=) | `69.49% <23.52%> (-3.89%)` | :arrow_down: | | [src/exec/mod.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/643?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvbW9kLnJz) | `77.27% <83.33%> (-9.77%)` | :arrow_down: | | [src/exec/no\_pty.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/643?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvbm9fcHR5LnJz) | `64.60% <88.88%> (-5.62%)` | :arrow_down: | | [src/sudo/pipeline.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/643?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N1ZG8vcGlwZWxpbmUucnM=) | `84.86% <100.00%> (+0.20%)` | :arrow_up: | ... and [40 files with indirect coverage changes](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/643/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.