BSD mountinfo implementation is unsound
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go
- Domain
- operating-systems
Research direction
Start by locating the BSD mountinfo implementation and its use of getmntinfo and reflect.SliceHeader. Review the SliceHeader documentation and the getfsstat(2) interface, then verify the result with the existing tests or mountinfo checks. Done means avoiding SliceHeader access and preventing concurrent iteration over a shared mountinfo structure.
Written by the indexing model from the issue text.
Description
There are two problems:
-
According to the documentation of
reflect.SliceHeaderit's never safe to modify or otherwise make use of the contents ofSliceHeader:SliceHeader is the runtime representation of a slice. It cannot be used safely or portably and its representation may change in a later release. Moreover, the Data field is not sufficient to guarantee the data it references will not be garbage collected, so programs must keep a separate, correctly typed pointer to the underlying data.
I'm sure that this is more of a CYA statement than anything else, but it does mean that technically our usage of this is unsound -- and ultimately the fix is just to switch to a C-style loop over the pointers.
-
getmntinfomodifies a global variable, which means that if multiple goroutines try to get mountinfo at the same time we will end up potentially modifying the global structure during iteration. We could work around this by mutexing it or something, but a simpler solution would be to just usegetfsstat(2)which allows us to pass our own allocated array.
- Dominant language
- Go
- Stars
- 100
- Forks
- 61
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 3
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from moby/sys
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
[userns-remap] Bug: ToHost incorrectly maps non-root container UID to root when it collides with RootPairPossibly taken @okhowang claimed this 61 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Similar issues
-
seccomp: goToNative values for loong64 and mipsle have no matching nativeToSeccomp keyPossibly taken @ricardobranco777 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
native-convergence self-host
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
JakeChampion/lang#11408 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
JuliusBrussee/caveman#1183 · 1 comment ·
Maintainers usually reply within 1 day
-
agent-review-finding chore
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
jordansmall/spindrift#4432 ·
Maintainers usually reply within 1 day
-
accepted bug wg/router-models-inference-runtime
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
vllm-project/semantic-router#4524 · 1 comment ·
Maintainers usually reply within 1 day