[Toybox] [PATCH] losetup: fix the race.
Rob Landley
rob at landley.net
Thu Aug 8 06:10:12 PDT 2019
On 8/7/19 10:59 AM, enh wrote:
> and if the next stage in your personal "surely this can't be true?"
> journey is the same as mine, the answer i got from our init maintainer
> for the "why?" is that the kernel doesn't want to have an opinion on
> permissions etc. (they pointed out that Android's setup actually
> reduces the size of the window compared to the desktop.)
I remember the lwn.net argument, but I thought they _did_ merge default
permissions in? (I remember the argument but not the resolution...)
Looks like permissions went in: https://lwn.net/Articles/353849/
Ah, I see what happened to ownership:
https://lwn.net/Articles/546464/
It was submitted to the kernel by a bad messenger:
https://www.theregister.co.uk/2014/04/05/torvalds_sievers_dust_up/
(Who of course went on to become one of the core devs of systemd. Which is why
I'm using devuan.)
What the kernel devs probably _really_ wanted was some way the system init
script could echo "123:456" > /sys/class/misc/loop-control/owner" (before
mounting devtmpfs) and then the kernel would remember the ownership it should
create the devices with and do so without a race at runtime, BUT it would have
been provided by userspace rather than hardwired into the kernel.
> iirc, the adb maintainer has similar problems where when you first
> connect an Android device to a Linux host, it shows up but with the
> wrong permissions which then fix themselves if you wait+retry. which
> for my money is even worse. (but maybe not. there are pros and cons
> either way, and neither is ideal. and i'm guessing that Ryan's mention
> of EACCES means that he's seen that problem with losetup too.)
Alas back when half the linux devs were in the pay of IBM they intentionally
sabotaged a lot of the non-hotplug ways of doing things. That's why /dev/hda got
deprecated and there's no /dev/usb0 devices but instead they throw everything
into /dev/sd* and give it a big stir so it's all asynchronously mounted in
heisenberg order that can differ from boot to boot.
The theory was to force the Linux workstation users to solve the device naming
problems the S390 guys were having. In practice nothing was ever solved (when
Ingo Molnar switched jobs they let usb devices reliably always come after sata
devices due to stable driver load order and the ability to disable asynchronous
probing, which solved 80% of it), but it did push Linux on the Desktop back
another 5 years until the "windows vista _really_ sucks, isn't there _anything_
else?" window had closed.
*shrug* I was kind of angry about it at the time. Now I'm expecting Linux to age
out and a new OS to replace it someday...
> anyway, ping on the patch (which is actually for a completely
> different EBUSY race condition)?
I'm still catching up from unexpectedly buying my first ssd. (Well, first in my
laptop. I don't trust any technology that self-destructs from overuse, but at
least this one has a 3 year manufacturer's warantee so that's when I can expect
to schedule its replacement I guess. I _regularly_ throw my laptop into
swap-thrashing and if I can't _tell_ I'm doing it, but that usage pattern will
burn out the ssd in 3 months...)
> i'll see if i can reproduce this EACCES/ENOENT race condition when i
> have some spare time, now i understand the difference...
Rob
More information about the Toybox
mailing list