Closed Narrat closed 2 years ago
Looking at the whole lo_mount()
function. Isn't there a chance for a race condition?
It checks for loop support and sets TOMBLOOP
. If that succeeds it will mount the loop device with the next free device.
But in the small time window between the two commands something different could grab hold of the one saved in TOMBLOOP
and the actual tomb would be mounted in a different device. But the incorrect one would be saved in TOMBLOOPDEVS
.
Probably not likely to happen, but nevertheless sth that should be avoided at all?
Yes, there can be a race condition as you mention.
If there is no free loop device, the call of loopsetup -f will create one and return it. For this it needs privilege escalation. It doesn't need those, if there is already an used device, but that cannot be guaranteed.
Closes #436
Just readds the logic before the change. Maybe there is a better way to check for loop support?