cgroup: errno can be clobbered by free()
- Dominant language
- C
- Stars
- 4.1k
- Forks
- 444
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 43
Description
Inspired by @jnovy [comment](https://github.com/containers/crun/pull/2126#discussion_r3688992026) quote:
_"errno can be clobbered by free()"_
I searched for some more
```
% git grep -B1 -P 'crun_make_error.*errno' | grep -A1 release
libcrun/cgroup.c- crun_error_release (err);
libcrun/cgroup.c: return crun_make_error (err, errno, "error when using statfs on `%s`", CGROUP_ROOT "/freezer");
```
In other words, here is another one:
https://github.com/containers/crun/blob/96c7f155a9bcdd2417972f1eb61110d8fb76188c/src/libcrun/cgroup.c#L164-L165
Contributor guide
Research direction
Start in libcrun/cgroup.c at the crun_error_release and crun_make_error call around the statfs error mentioned in the issue, then inspect nearby cgroup error paths for the same pattern. Done means errno is preserved when constructing the error and the relevant cgroup tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100