trifectatechfoundation / sudo-rs

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

Use a single socket to handle signals #620

Closed pvdrz closed 1 year ago

pvdrz commented 1 year ago

Describe the changes done on this pull request This PR merges the SignalHandler and SignalManager types so that a single socket pair can be used to stream the signal information when a signal arrives. This reduces considerable the number of file descriptors opened by sudo.

Pull Request Checklist

github-actions[bot] commented 1 year ago

Number of dependencies and binary size impact report

Metric main PR #620 Delta
Direct dependencies 5 5 -
Total dependencies 10 10 -
Binary size 985.4 KiB 1 MiB +8.3%
Text size 569.7 KiB 626.8 KiB +10.0%
Dependencies diff ```diff └─ sudo-rs [v0.2.0-dev.20230627] ├─ glob [v0.3.1] ├─ libc [v0.2.147] ├─ log [v0.4.19] ├─ signal-hook [v0.3.15] | ├─ libc [v0.2.147] | ├─ signal-hook-registry [v1.4.1] | | └─ libc [v0.2.147] | └─ cc [v1.0.79] └─ signal-hook-registry [v1.4.1] ```
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 91.03% and project coverage change: +0.06 :tada:

Comparison is base (6916363) 86.25% compared to head (03dcfbd) 86.31%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #620 +/- ## ========================================== + Coverage 86.25% 86.31% +0.06% ========================================== Files 62 61 -1 Lines 8440 8427 -13 ========================================== - Hits 7280 7274 -6 + Misses 1160 1153 -7 ``` | [Impacted Files](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety) | Coverage Δ | | |---|---|---| | [src/exec/mod.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvbW9kLnJz) | `79.62% <ø> (ø)` | | | [src/exec/use\_pty/parent.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvdXNlX3B0eS9wYXJlbnQucnM=) | `74.82% <86.20%> (+0.65%)` | :arrow_up: | | [src/exec/use\_pty/monitor.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvdXNlX3B0eS9tb25pdG9yLnJz) | `55.42% <88.23%> (+0.91%)` | :arrow_up: | | [src/system/signal.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N5c3RlbS9zaWduYWwucnM=) | `90.90% <92.77%> (+3.87%)` | :arrow_up: | | [src/exec/no\_pty.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/620?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvbm9fcHR5LnJz) | `69.71% <93.75%> (-0.71%)` | :arrow_down: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/620/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.