Unbelievable, just lost 6h of my life to Linux fs API "misdesign". So let's say you have a disk image file with an ext4 fs, it's read-only, you want to mount it read-only. So you read-only attach it to a loopback device (i.e. O_RDONLY open + LO_FLAGS_READ_ONLY). Because you are…
…extra careful you even check with BLKROGET and yes, it tells you: this block device is read-only. So you go on, and mount it read-only, i.e. mount() with MS_RDONLY. One would assume because everything in this chain was explicitly done read-only frickin' ext4 wouldn't modify…
… the original file. Ha, you are so naive, of course it does! All these read-only flags don't matter a thing, ext4 writes whenever it wants to. Read-only access is for wussies, real kernel code doesn't care about explicitly specified flags on every level. ext4 doesn't, …
… the block layer doesn't, the loopback device doesn't, and the backing file system doesn't either. Apparently you have to explicitly specifiy "noload" as mount option too, which is ext4 specific. Only then read-only means read-only. xfs apparently has a different option even…
… and other file systems don't have either. So if you actually care about immutable systems, you must maintain a table of extra flags to specify for each fs, to actually get read-only behaviour. Does this matter? Yes, I think it does very much, because mounting the same file…
…multiple times is typically assumed to be safe, as long as it is all done read-only. Except that it currently almost never actually is. #ragetweet

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Lennart Poettering

Lennart Poettering Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @pid_eins

4 Apr 19
So, there appears to be a free software project called "suckless". As I understand it's a group of people who don't like systemd very much. Which is totally fine. What is a bit questionable though is that they keep spamming me with unsolicited invites to their confs, … 1/4
… but I guess that's their kind of humour, and I can certainly tune my spam filter to match this kind of spam, too. What totally isn't fine though, is that these mails originate from a host called "wolfsschanze" (paste.fedoraproject.org/paste/3udw8~w6…), which appears to be the laptop a … 2/4
certain Laslo Hunhold works from (their conf organizer?). Don't they understand that adopting such a form of Nazi symbolism just makes it easier to discount their work? (BTW, just to mention this in this context since it fits into the milieu: … 3/4
Read 4 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!