lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <YMBFXi22cilZTPUk@localhost>
Date:   Tue, 8 Jun 2021 21:36:46 -0700
From:   Josh Triplett <josh@...htriplett.org>
To:     linux-ext4@...r.kernel.org
Cc:     tytso@....edu, adilger.kernel@...ger.ca
Subject: mke2fs with size limit and default discard will discard data after
 size limit

mke2fs with a specified size and the default-enabled "discard" option
will discard data after that specified size. If using the size (and
potentially offset) to write a partition within a disk or disk image,
this will zero part of the following partition.

Steps to reproduce:

# Make a 128M disk filled with 0x0a, to see which bytes get written
yes '' | dd iflag=fullblock of=test.img bs=1M count=128
# Show the disk filled with 0x0a
hd test.img
# Make a 1M filesystem, which shouldn't touch the remaining 127M
mkfs.ext4 -b 4096 -I 256 test.img 1M
# Show the disk, which has had data discarded to the 16M boundary
hd test.img

This also applies if you pass an offset; for instance, passing
offset=4096 will discard data from 4096 to 16M+4096 before writing the
filesystem.

Passing -E nodiscard works around this; the remainder of e2fsprogs does
seem to avoid writing outside the bounds.

(Discovered via some debugging adventures with disk image building. Also
reported to Debian as https://bugs.debian.org/989630 since I first
encountered it there, but sending to linux-ext4 as a more appropriate
place for e2fsprogs bug reports.)

- Josh Triplett

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ