checkpoint-restore / criu

Checkpoint/Restore tool
criu.org
Other
2.93k stars 585 forks source link

apparmor: fix incorrect usage of sizeof on char ptr #2235

Closed ancientmodern closed 1 year ago

ancientmodern commented 1 year ago

This makes the apparmor replace file path on riscv64 (#2234) zdtm/static/apparmor_stacking appear as /sys/kernel/security/apparmor/policy/namespaces/criu_stacking_test/.replac, where the final e is missing and leads to an error on open(). Although here sizeof(path) - offset - my_offset should be automatically converted to a quite large unsigned int, and the return value is still 9. Maybe it's due to different glibc implementation? 🤔

As paths are always declared as char path[PATH_MAX] when calling this function, I think it's okay to directly use PATH_MAX rather than introducing a new argument like size?

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.26% :tada:

Comparison is base (88249fe) 70.38% compared to head (6ec8aa4) 70.65%.

:exclamation: Current head 6ec8aa4 differs from pull request most recent head 1c7af5e. Consider uploading reports for the commit 1c7af5e to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## criu-dev #2235 +/- ## ============================================ + Coverage 70.38% 70.65% +0.26% ============================================ Files 134 133 -1 Lines 34044 33321 -723 ============================================ - Hits 23963 23544 -419 + Misses 10081 9777 -304 ``` | [Files Changed](https://app.codecov.io/gh/checkpoint-restore/criu/pull/2235?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [criu/apparmor.c](https://app.codecov.io/gh/checkpoint-restore/criu/pull/2235?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y3JpdS9hcHBhcm1vci5j) | `54.01% <100.00%> (ø)` | | ... and [14 files with indirect coverage changes](https://app.codecov.io/gh/checkpoint-restore/criu/pull/2235/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.