-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use syscall package instead of cgo #630
Conversation
I personally really like this if it works equivalently. In addition to opening up I did a quick search and it appears there was a Golang bug related to multithreading in But we'll see what Emily says. In the meantime, I triggered a build and it is looking green. |
Thanks @micahyoung! I'm hopeful. 🤞
Incidentally, I'm also bumping to 1.16 in #628 for unrelated reasons. |
IIUC the validation for this would involve running a phase like the analyzer a bunch of times as root and then observing if all the threads have the correct user when we drop privileges. @ekcasey I recall you did this validation ages ago, can you remember how many "trials" were sufficient to demonstrate that it was working? |
After speaking with @ekcasey it seems that previously, when we tried to use the syscall package to drop privileges, the issue manifested as failed builds, because files or directories were getting written as the wrong user. To test this, I added the following test to analyzer acceptance:
...and it fails (non-deterministically) when applied to this branch 😭 (but passes on
I'm noticing that this branch still uses go 1.15, so maybe rebasing onto main (with 1.16) will help. I put up a PR to add the mentioned test, hopefully when that is merged it will make this one easier to test. |
Signed-off-by: Jason Hall <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #630 +/- ##
==========================================
+ Coverage 64.92% 66.47% +1.56%
==========================================
Files 52 59 +7
Lines 3634 3829 +195
==========================================
+ Hits 2359 2545 +186
+ Misses 1026 1018 -8
- Partials 249 266 +17
Flags with carried forward coverage won't be shown. Click here to find out more. |
#628 updated CI to use Go 1.15 instead, I've rebased this PR on Thanks for adding the acceptance test! 👍 |
Looks like it's working! I've had 20+ green tests, where before the failure rate was approximately 4 out of 5 🎉 |
The use of cgo was introduced in #268, instead of using golang.org/x/sys/unix. I believe syscall.Setres{g,u}id is the platform-independent equivalent, but I admit I don't know enough about this to be confident this isn't a regression.
If this is acceptable, it could be a step toward unblocking #435
@ekcasey