Open
Description
The xrootd/drop_privilege_test.go
tests have a race condition. I think what's meant to happen is:
- Main thread sends a command
- Child thread receives command
- Main thread closes socket pair
However, there's no synchronization between steps (2) and (3). The main thread is free to exit and fire its defer
function before the goroutine in (2) tries to read from its socket. I observed this race condition at least once in the GitHub Actions although it seems to not be particularly prevalent currently.
In general, it doesn't look like this test really tests all that much -- it kinda looks half-written to me:
- It prepares a new CA bundle but doesn't seem to check anything about it.
- It has code paths for both cache and origin testing but only the origin code paths are reachable.
- It has a function named
receiveFD
which suggests it is receiving a file descriptor (the point of one of the drop privilege commands). However, there's no receiving of file descriptors in the code!