From: Demi Marie Obenour <demiobenour@gmail.com>
To: Theodore Tso <tytso@mit.edu>
Cc: Zw Tang <shicenci@gmail.com>,
Andreas Dilger <adilger.kernel@dilger.ca>,
libaokun@linux.alibaba.com, jack@suse.cz, ojaswin@linux.ibm.com,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
yi.zhang@huawei.com, syzkaller-bugs@googlegroups.com
Subject: Re: [BUG] ext4: BUG_ON in ext4_write_inline_data (fs/ext4/inline.c:240)
Date: Tue, 28 Apr 2026 16:50:14 -0400 [thread overview]
Message-ID: <5981069b-8c54-4b5b-a808-5ebdc8cd7265@gmail.com> (raw)
In-Reply-To: <20260426032211.GD22489@macsyma-wired.lan>
[-- Attachment #1.1.1: Type: text/plain, Size: 3806 bytes --]
On 4/25/26 23:22, Theodore Tso wrote:
> On Sat, Apr 25, 2026 at 02:00:23PM -0400, Demi Marie Obenour wrote:
>>
>> Changing block devices that are mounted is also reachable via USB.
>> Yes, some distros may disable automount, but users who have stuff to
>> get done will mount USB devices anyway. Telling users "don't do this"
>> very rarely works in practice.
>
> How can an unprivileged user change the contents of a USB device while
> it is mounted?
>
> Are you positing evil USB devices that can return block contents A at
> time t, and block contents B at time t+1?
Correct.
> The threat model that we are using is that if the USB device is set to
> a particular state *before* the file system is mounted, and then the
> KGB scatters the USB device in the parking lot, and then someone picks
> up the USB device in the Raytheon parking lot, and says, "hey, free
> hardware", takes it into the classified machinem room, inserts it into
> the server, and mounts it. This might be considered likely or not
> likely, but speaking as someone who has been in a top secret machine
> room at a defense contractor, they were *way* less protected than what
> I've seen at a financial services company, or at a data center at a
> hyperscaler.
>
> But be that as it may, even *then* you're not modifying the block
> device while it is mounted.
>
>> 2. Harden the kernel filesystem drivers against malicious devices,
>> including TOCTOU.
>
> Malicious devices that have their own microcomputer and can change the
> block contents under the control of the attacker is *just* not
> something I care about. I also don't think it's a particularly
> realistic threat model.
This is an example of a BadUSB attack, which has been known since
at least 2014. USB sticks *do* have their own microcontrollers to
run their firmware. At least in the past this firmware has been
programmable and not been digitally signed. This means that the USB
stick *can* be reprogrammed to perform a TOCTOU attack on a filesystem,
or indeed to implement a completely different kind of USB device.
There are also attacks possible in confidential computing scenarios.
dm-verity protects against both tampering and replay attacks,
but it is read-only. dm-crypt and dm-integrity are writable, but
dm-crypt does not block tampering and dm-verity does not block replay
of a previously stored sector.
Protecting against replay attacks requires a Merkle tree. The only
Linux filesystems that I know have one are ZFS, bcachefs, and BTRFS.
The first two are out of tree and the third is not shipped in RHEL
at least.
If dm-integrity is used, an attacker can return an old value that
was stored at a given block in the past. With only dm-crypt, an
attacker can replace any cipher block (typically 16 bytes) with
either its old contents or garbage the attacker doesn't control.
If this can be used to compromise a confidential VM, this violates
the confidential computing security boundary.
Finally, this can be used to violate kernel lockdown, breaking the
guarantees UEFI secure boot is supposed to provide. Whether that is
worth caring about is a totally different question of course.
Of course, you are free to choose which (if any) of these attacks you
care about. One can that USB sticks should be mounted in userspace,
UEFI secure boot with Microsoft keys is irrelevant as long as
administrator -> kernel isn't a security boundary on Windows, and that
confidential computing only makes sense for stateless workloads (which
can use dm-verity) until there is a way to trust storage devices.
But it's always best to be aware that an attack vector exists,
whether or not one chooses to address it.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-04-28 20:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 11:32 [BUG] ext4: BUG_ON in ext4_write_inline_data (fs/ext4/inline.c:240) Zw Tang
2026-04-21 12:20 ` Theodore Tso
2026-04-25 18:00 ` Demi Marie Obenour
2026-04-26 3:22 ` Theodore Tso
2026-04-28 20:50 ` Demi Marie Obenour [this message]
2026-04-27 11:17 ` Jan Kara
2026-04-21 12:25 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5981069b-8c54-4b5b-a808-5ebdc8cd7265@gmail.com \
--to=demiobenour@gmail.com \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=libaokun@linux.alibaba.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=shicenci@gmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tytso@mit.edu \
--cc=yi.zhang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox