aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2021-02-02mke2fs.8: fix various formatting issues, and sort the synopsisold-maintBenno Schulenberg1-73/+71
Also, delete the sentence that says that the inode size cannot be changed after creating the file system, as tune2fs acquired the -I option. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-02tune2fs.8: fix various wording and formatting issuesBenno Schulenberg1-85/+88
For example: the argument of -c had a mistaken plural "s", the argument of -o was misformatted, the main description spoke of "options" instead of "parameters" and used a mistaken "i.e." instead of "e.g.", and so on. Also, sort the options in the synopsis alphabetically, to make it easier to find a specific one and to match the order in which they are listed further down. Also, remove some excess spaces, harmonize the style of some decriptions, sort d, w, m in the order of ascending duration, and for consistency use hyphens instead of underscores in option arguments. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-29Update release notes, etc., for the 1.45.7 releasev1.45.7Theodore Ts'o23-498/+685
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-28po: update sr.po (from translationproject.org)Мирослав Николић1-1699/+1429
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-28po: update nl.po (from translationproject.org)Benno Schulenberg1-64/+74
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-28po: update ms.po (from translationproject.org)Sharuzzaman Ahmat Raslan1-274/+242
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-28misc: fix a spelling nit in the mke2fs man pageTheodore Ts'o1-1/+1
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-28Update Makefile dependencies for lib/e2p and lib/ext2fsTheodore Ts'o2-11/+16
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-28AOSP: Add assemble_cvd to com.android.virtJiyong Park2-0/+8
assemble_cvd directly or indirectly depends on these modules. To add assemble_cvd to the com.anroid.virt APEX, these modules are marked as being available to the APEX. Google-Bug-Id: 174639526 Test: m com.android.virt Change-Id: Ibc28d24abd358fb1f8608b3f3d6d06c2746f2d72 From AOSP commit: e70718ecae3cf1e2a26af800734130e003186e7e
2021-01-28AOSP: tune2fs/resize2fs: make vendor_ramdisk_available.Yifan Hong8-0/+8
The vendor_ramdisk variant is dynamic, unlike the ramdisk variant. Test: builds Google-Bug-Id: 173425293 Change-Id: I45547b5ea99aae98727121c038129844b7930ed6 From AOSP commit: 073ede3200afeffd82889cb61a71fa1947314476
2021-01-28AOSP: Make libext2_uuid and e2fsprogs headers vendor_ramdisk_available.David Anderson2-0/+2
This is needed to build snapuserd into the vendor ramdisk. Google-Bug-Id: 173463595 Test: snapuserd builds Change-Id: I05d85357ebf47abd0d82e9c6211e854bdf0d5ae9 From AOSP commit: b28c0ef21cf8ebd172a07cfd09551af38366a5a7
2021-01-27AOSP: Add "product_available" to product available modulesJustin Yun2-0/+2
"vendor_available" modules were available to product modules. However, not all "vendor_available" modules are required to be available to product modules. Some modules want to be available only to product modules but not vendor modules. To cover the requirement, we separate "product_available" from "vendor_available". "vendor_available" will not provide product available module. Google-Bug-Id: 150902910 Test: build Change-Id: I316da0d24bde8b6231114aa80841c59547691152 From AOSP commit: df51b0de40581f52c6515f8775ecd84dc4a50bb0
2021-01-27AOSP: ANDROID: e2fsck: Handle casefolded encryptionDaniel Rosenberg8-30/+181
Adds support for EXT2_HASH_SIPHASH, and reading the hash from disk in that case. We cannot compute the siphash without the key, so we must not modify the names of any encrypted and casefolded directories, which limits some recovery options, and we must assume the hashes stored in dirents are correct. This is in preparation for upcoming kernel support for encryption and casefolding at the same time. Google-Bug-Id: 138322712 Test: Create fs with casefold and encryption enabled via mke2fs and tune2fs, run fsck after creating casefolded + encrypted folder Change-Id: Icca32d7d9dd3c7f52da03d60e4d89273cbec0a7d From AOSP commit: 67eae926bdac1a54dbb8335731c5e1581f93e4bb
2021-01-27AOSP: ANDROID: mke2fs: Support encrypt+casefoldDaniel Rosenberg1-9/+0
In preparation for upcoming kernel changes that will make the kernel support both encryption and casefolding at the same time, allow mke2fs to enable both features at the same time. Signed-off-by: Daniel Rosenberg <drosen@google.com> Google-Bug-Id: 138322712 Test: Create fs with casefold and encryption enabled via mke2fs Change-Id: I4e2350e43e21cffb3d972310cd74df1e662bf87e From AOSP commit: f8fc427df385260f3424e1e9d5485c8640606920
2021-01-27AOSP: ANDROID: tune2fs: Support encrypt+casefoldDaniel Rosenberg1-17/+0
In preparation for upcoming kernel changes that will make the kernel support both encryption and casefolding at the same time, allow tune2fs to enable both features at the same time. Signed-off-by: Daniel Rosenberg <drosen@google.com> Google-Bug-Id: 138322712 Test: Create fs with casefold and encryption enabled via tune2fs Change-Id: I36537a8b6dc5e2997b7016212f9b574c76673067 From AOSP commit: 44ac9dccd9853cc9807f0d6ce952bdcdeb93954a
2021-01-27AOSP: ANDROID: e2fsck: Do not mutate encrypted namesDaniel Rosenberg7-0/+52
We can't mutate a name without the key, as this will at best cause the name to become gibberish, and at worst may introduce invalid characters or even fail to be unique after decoding, so drop duplicates instead. Files lost in this way will be reconnected to lost+found Fixes: dbff534ec685 ("e2fsck: suppress bad name checks for encrypted directories") Signed-off-by: Daniel Rosenberg <drosen@google.com> Google-Bug-Id: 138322712 Test: f_dup_de_crypt Change-Id: I8d6cc3984872868a845fafabc554abdd86351fcc From AOSP commit: 80b85f8a0b2ba7090a927f692ff9d2097ffd8d1f
2021-01-27AOSP: ANDROID: tune2fs: Allow setting the casefold featureDaniel Rosenberg2-7/+119
This allows tune2fs to enable casefolding on an existing filesystem. At the moment, casefolding is incompatible with encryption. Signed-off-by: Daniel Rosenberg <drosen@google.com> Google-Bug-Id: 138322712 Test: Create fs without casefold and enable it via tune2fs Change-Id: Ic9ed63180ef28c36e083cee85ade432e4bfcc654 From AOSP commit: eb5b168decac07058e90ead191350be80c75aff4
2021-01-27AOSP: Make e2fsck depends on badblocksHoward Chen1-0/+1
The e2fsck may invoke the badblocks when -c is specified. Also the badblocks is required by Mediatek devices. Add it for completeness. Test: compile wembley-userdebug Google-Bug-Id: 157393160 Change-Id: I1163129c925e93ef386e86a60c93e9c314397134 From AOSP commit: dffec44dd56175b80810657f95f8e09a7e3ab0bf
2021-01-27e2fsck: declare the size of bh->b_data to be 4096 in jfs_user.hTheodore Ts'o1-1/+1
When allocating buffer_heads in e2fsck and debugfs the actual size of the memory which is requested is based on the file system block size. So the actual size of b_data in struct buffer_head doesn't actually matter, except that it can triggers a UBSAN error when running the e2fsck regression test. So change it to be 4096 to avoid this false positive. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-23Fix clang warningsTheodore Ts'o4-8/+9
Clang gets unhappy when passing an unsigned char to string functions. For better or for worse we use __u8[] in the definition of the superblock. So cast them these to "char *" to prevent clang build-time warnings. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-23libext2fs: use compiler built-in offsetof() if availableTheodore Ts'o3-12/+26
This avoids UBSAN sanitizer warnings, since &(0->member) is technically undefined per the C standard. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-21libext2fs: fix UBSAN warning in ext2fs_mmp_new_seq()Theodore Ts'o1-1/+3
Left shifting the pid by 16 bits can cause a UBSAN warning if the pid is greater than or equal to 2**16. It doesn't matter since we're just using the pid to seed for a pseudo-random number generator, but silence the warning by just swapping the high and low 16 bits of the pid instead. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-21mke2fs.8: Improve valid block size documentationJan Kara1-4/+6
Explain which valid block sizes mke2fs supports in more detail. Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-21build: Add SYSLIBS to e4crypt linkingHauke Mehrtens1-1/+1
The $(SYSLIBS) was missing when linking the e4crypt application. This is available in the e4crypt.profiled variant, so I assume this was just missing in the normal variant and is not left out intentionally. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-21tune2fs: fix resource leak in handle_quota_options()Theodore Ts'o1-2/+4
Addresses-Coverity-Bug: 1467672 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-21debugfs: fix double free in realloc() error path in read_list()Theodore Ts'o1-4/+2
Fixes-Coverity-Bug: 1464575 Fixes-Coverity-Bug: 1464571 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-21libext2fs: fix incorrect negative error return in unix and sparse io managersTheodore Ts'o2-3/+3
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-19mke2fs: Escape double quotes when parsing mke2fs.confLukas Czerner1-0/+1
Currently, when constructing the <default> configuration pseudo-file using the profile-to-c.awk script we will just pass the double quotes as they appear in the mke2fs.conf. This is problematic, because the resulting default_profile.c will either fail to compile because of syntax error, or leave the resulting configuration invalid. It can be reproduced by adding the following line somewhere into mke2fs.conf configuration and forcing mke2fs to use the <default> configuration by specifying nonexistent mke2fs.conf MKE2FS_CONFIG="nonexistent" ./misc/mke2fs -T ext4 /dev/device default_mntopts = "acl,user_xattr" ^ this will fail to compile default_mntopts = "" ^ this will result in invalid config file Syntax error in mke2fs config file (<default>, line #4) Unknown code prof 17 Fix it by escaping the double quotes with a backslash in profile-to-c.awk script. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-19libext2fs: add gnu.translator supportRomain Naour1-0/+1
The support of setting (and reading) of passive translators from GNU/Linux has been added to the Linux kernel by the commit [1]. The name index '10' has been reserved for GNU/Hurd. Hurd passive translators are stored as a xattr value with name "gnu.translator" [2]. If "gnu.translator" xattr value has been set before calling mkfs.ext2, it will segfault since "gnu." is not present in ea_names[]. $ setfattr -n gnu.translator -v "/hurd/exec\0" ${TARGET_DIR}/servers/exec $ mkfs.ext2 -d ${TARGET_DIR} -o hurd -O ext_attr rootfs.ext2 "1G" Adding "gnu." to ea_names[], allow to create ext2 filesystem for GNU/Hurd with passive translator already set. [1] https://git.savannah.gnu.org/cgit/hurd/hurd.git/commit/?id=a04c7bf83172faa7cb080fbe3b6c04a8415ca645 [2] https://lists.gnu.org/archive/html/bug-hurd/2016-08/msg00075.html Signed-off-by: Romain Naour <romain.naour@gmail.com> Cc: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-01-19filefrag: handle invalid st_dev and blksize casesLuis Henriques1-2/+2
It is possible to crash filefrag with a "Floating point exception" in two different scenarios: 1. When fstat() returns a device ID set to 0 2. When FIGETBSZ ioctl returns a blocksize of 0 In both scenarios a divide-by-zero will occur in frag_report() because variable blksize will be set to zero. I've managed to trigger this crash with an old CephFS kernel client, using xfstest generic/519. The first scenario has been fixed by kernel commit 75c9627efb72 ("ceph: map snapid to anonymous bdev ID"). The second scenario is also fixed with commit 8f97d1e99149 ("vfs: fix FIGETBSZ ioctl on an overlayfs file"). However, it is desirable to handle these two scenarios gracefully by checking these conditions explicitly. Signed-off-by: Luis Henriques <lhenriques@suse.de> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-12-15create_inode: set xattrs to the root directory as wellAntoine Tenart1-0/+8
populate_fs do copy the xattrs for all files and directories, but the root directory is skipped and as a result its extended attributes aren't set. This is an issue when using mkfs to build a full system image that can be used with SElinux in enforcing mode without making any runtime fix at first boot. This patch adds logic to set the root directory's extended attributes. Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-27release notes: delete two files that are fully contained within v1.41.txtBenno Schulenberg2-176/+0
They are pure duplicates. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-06debugfs: fix parse_uint for 64-bit fieldsTheodore Ts'o1-5/+5
The logic for handling 64-bit structure elements was reversed, which caused attempts to set fields like kbytes_written to fail: % debugfs -w /tmp/foo.img debugfs 1.45.6 (20-Mar-2020) debugfs: set_super_value kbytes_written 1024 64-bit field kbytes_written has a second 64-bit field defined; BUG?!? https://github.com/tytso/e2fsprogs/issues/36 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-04Define MKDIR_P in the Makefile.in files instead in MCONFIG.inTheodore Ts'o19-1/+18
In the case where mkdir -p is not thread-safe (for example, if the build environment is using busybox's mkdir) the configure script will fall back to the slow (but safe) install-sh script. In that case MKDIR_P will be using a relative pathname; so we can't use speed optimization of defining configure substitutions in MCONFIG.in, since the substitution will be different depending on depth of the subdirectory in the Makefile.in file. https://github.com/tytso/e2fsprogs/issues/51 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-02resize2fs: prevent block group descriptors from overflowing the first bgTheodore Ts'o1-0/+14
For 1k block file systems, resizing a file system larger than 1073610752 blocks will result in the size of the block group descriptors to be so large that it will overlap with the backup superblock in block group #1. This problem can be reproduced via: mke2fs -t ext4 /tmp/foo.img 200M resize2fs /tmp/foo.img 1T e2fsck -f /tmp/foo.img https://github.com/tytso/e2fsprogs/issues/50 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-01AOSP: Fix a trivial type errorYi Kong1-2/+3
Comparing unsigned int with ULONG_MAX is always false. Signed-off-by: Yi Kong <yikong@google.com> Change-Id: Iae02aad1bcb271d3468828977be288ad04333821 From AOSP commit: 757a4d672dae1a15c57f5f0705ba90ed007da7e6
2020-10-01AOSP: Include private/fs_config.h directly when neededTom Cherry1-0/+1
This is no longer a transitive include of android_filesystem_config.h Bug: 149785767 Test: build Change-Id: I954adf7879fa811eb2b290a0983c84d47ecae26c From AOSP commit: 9fa6bed983d5ddd7226af647a0c4c0d922227be4
2020-10-01chattr/lsattr: Support dax attributeXiao Yang4-4/+16
Use the letter 'x' to set/get dax attribute on a directory/file. Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-01mke2fs: fix up check for hardlinks always false if inode > 0xFFFFFFFFHongxu Jia1-1/+1
While file has a large inode number (> 0xFFFFFFFF), mkfs.ext4 could not parse hardlink correctly. Prepare three hardlink files for mkfs.ext4 $ ls -il rootfs_ota/a rootfs_ota/boot/b rootfs_ota/boot/c 11026675846 -rw-r--r-- 3 hjia users 0 Jul 20 17:44 rootfs_ota/a 11026675846 -rw-r--r-- 3 hjia users 0 Jul 20 17:44 rootfs_ota/boot/b 11026675846 -rw-r--r-- 3 hjia users 0 Jul 20 17:44 rootfs_ota/boot/c $ truncate -s 1M rootfs_ota.ext4 $ mkfs.ext4 -F -i 8192 rootfs_ota.ext4 -L otaroot -U fd5f8768-c779-4dc9-adde-165a3d863349 -d rootfs_ota $ mkdir mnt && sudo mount rootfs_ota.ext4 mnt $ ls -il mnt/a mnt/boot/b mnt/boot/c 12 -rw-r--r-- 1 hjia users 0 Jul 20 17:44 mnt/a 14 -rw-r--r-- 1 hjia users 0 Jul 20 17:44 mnt/boot/b 15 -rw-r--r-- 1 hjia users 0 Jul 20 17:44 mnt/boot/c After applying this fix $ ls -il mnt/a mnt/boot/b mnt/boot/c 12 -rw-r--r-- 3 hjia users 0 Jul 20 17:44 mnt/a 12 -rw-r--r-- 3 hjia users 0 Jul 20 17:44 mnt/boot/b 12 -rw-r--r-- 3 hjia users 0 Jul 20 17:44 mnt/boot/c Since commit [382ed4a1 e2fsck: use proper types for variables][1] applied, it used ext2_ino_t instead of ino_t for referencing inode numbers, but the type of is_hardlink's `ino' should not be instead, The ext2_ino_t is 32bit, if inode > 0xFFFFFFFF, its value will be truncated. Add a debug printf to show the value of inode, when it check for hardlink files, it will always return false if inode > 0xFFFFFFFF |--- a/misc/create_inode.c |+++ b/misc/create_inode.c |@@ -605,6 +605,7 @@ static int is_hardlink(struct hdlinks_s *hdlinks, dev_t dev, ext2_ino_t ino) | { | int i; | |+ printf("%s %d, %lX, %lX\n", __FUNCTION__, __LINE__, hdlinks->hdl[i].src_ino, ino); | for (i = 0; i < hdlinks->count; i++) { | if (hdlinks->hdl[i].src_dev == dev && | hdlinks->hdl[i].src_ino == ino) Here is debug message: is_hardlink 608, 2913DB886, 913DB886 The length of ext2_ino_t is 32bit (typedef __u32 __bitwise ext2_ino_t;), and ino_t is 64bit on 64bit system (such as x86-64), recover `ino' to ino_t. [1] https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?id=382ed4a1c2b60acb9db7631e86dda207bde6076e Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-01mke2fs: Warn if fs block size is incompatible with DAXJan Kara2-29/+55
If we are creating filesystem on DAX capable device, warn if set block size is incompatible with DAX to give admin some hint why DAX might not be available. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-01e4crypt: if salt is explicitly provided to add_key, then use itFlorian Schmaus2-5/+17
Providing -S and a path to 'add_key' previously exhibited an unintuitive behavior: instead of using the salt explicitly provided by the user, e4crypt would use the salt obtained via EXT4_IOC_GET_ENCRYPTION_PWSALT on the path. This was because set_policy() was still called with NULL as salt. With this change we now remember the explicitly provided salt (if any) and use it as argument for set_policy(). Eventually e4crypt add_key -S s:my-spicy-salt /foo will now actually use 'my-spicy-salt' and not something else as salt for the policy set on /foo. Signed-off-by: Florian Schmaus <flo@geekplace.eu> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-01tune2fs: reset MMP state on error exitAndreas Dilger5-38/+95
If tune2fs cannot perform the requested change, ensure that the MMP block is reset to the unused state before exiting. Otherwise, the filesystem will be left with mmp_seq = EXT4_MMP_SEQ_FSCK set, which prevents it from being mounted afterward: EXT4-fs warning (device dm-9): ext4_multi_mount_protect:311: fsck is running on the filesystem Add a test to try some failed tune2fs operations and verify that the MMP block is left in a clean state afterward. Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13672 Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-01ext2fs: remove unused variable 'left'Lukas Czerner1-2/+1
Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-01e2fsck: use the right conversion specifier in e2fsck_allocate_memory()Lukas Czerner1-1/+1
Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-01e2fsck: use size_t instead of int in string_copy()Lukas Czerner2-2/+2
len argument in string_copy() is int, but it is used with malloc(), strlen(), strncpy() and some callers use sizeof() to pass value in. So it really ought to be size_t rather than int. Fix it. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-09-30tests: remove unnecessary uncompressed image fileTheodore Ts'o1-0/+0
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-08-26libext2fs: fix potential buffer overrun in __get_dirent_tail()Theodore Ts'o1-2/+1
If the file system is corrupted, there is a potential of a read-only buffer overrun. Fortunately, we don't actually use the result of that pointer dereference, and the overrun is at most 64k. Google-Bug-Id: #158564737 Fixes: eb88b751745b ("libext2fs: make ext2fs_dirent_has_tail() more strict") Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-06-17debugfs: fix building rdebugfs (with READ_ONLY define)Theodore Ts'o4-41/+48
Fix bitrot for building a restricted version of debugfs, which does not require read/write access to the file system, and which only allows access to the file system metadata. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-05-17libext2fs: retry reading superblock on open when checksum is badTheodore Ts'o1-1/+6
When opening a file system which is mounted, it's possible that when ext2fs_open2() is racing with the kernel modifying the orphaned inode list, the superblock's checksum could be incorrect. So retry reading the superblock in the hopes that the problem will self-correct. Google-Bug-Id: 151453112 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-04-25libext2fs: batch calls to ext2fs_zero_blocks2()Theodore Ts'o1-5/+23
When allocating blocks for an indirect block mapped file, accumulate blocks to be zero'ed and then call ext2fs_zero_blocks2() to zero them in large chunks instead of block by block. This significantly speeds up mkfs.ext3 since we don't send a large number of ZERO_RANGE requests to the kernel, and while the kernel does batch write requests, it is not batching ZERO_RANGE requests. It's more efficient to batch in userspace in any case, since it avoids unnecessary system calls. Reported-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-04-13e2fsck: fix off-by-one check when validating depth of an htreeTheodore Ts'o1-1/+1
Fixes: 3f0cf6475399 ("e2fsprogs: add support for 3-level htree") Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-04-13libext2fs: avoid pointer arithmetic on `void *`Michael Forney1-1/+1
The pointer operand to the binary `+` operator must be to a complete object type. Signed-off-by: Michael Forney <mforney@mforney.org> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-23tests: use grep -E for better portability in r_inline_xattrTheodore Ts'o2-6/+6
Since r_inline_xattr is using an extended regexp, we need grep -E on some implementations of grep. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-23e2fsck: fix various gcc -Wall nitsTheodore Ts'o3-5/+5
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-23Use ext2_loff_t instead of loff_tTheodore Ts'o2-6/+6
The loff_t type is a glibc'ism and is not fully portable. Use ext2_loff_t instead. Fixes: 382ed4a1c2b6 ("e2fsck: use proper types for variables") Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reported-by: Matthias Andree <matthias.andree@gmx.de>
2020-03-21Update release notes, etc., for the 1.45.6 releasev1.45.6Theodore Ts'o10-323/+420
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-20AOSP: tune2fs, resize2fs: make ramdisk binaries.Jaegeuk Kim2-18/+39
Bug: 149391799 Change-Id: I5183755915710e28a603e3f718f16813ea9991a0 Signed-off-by: Jaegeuk Kim <jaegeuk@google.com> From AOSP commit: a13a88d0d557a396f63702fb8db008487e2384d7
2020-03-20AOSP: e2fsdroid: Don't skip unusable blocks in BaseFS.David Anderson1-26/+38
Currently, basefs_allocator will iterate through blocks owned by an inode until it finds a block that is free. This effectively ignores the logical to physical block mapping, which can lead to a bigger delta in the final image. An example of how this can happen is if the BaseFS has a deduplicated block (D), that is not deduplicated in the new image: Old image: 1 2 3 D 4 5 New image: 1 2 3 ? 4 5 If the allocator sees that "D" is not usable, and skips to block "4", we will have a non-ideal assignment. Bad image: 1 2 3 4 5 ? This patch refactors get_next_block() to acquire at most one block. It's called a single time, and then only called in a loop if absolutely no blocks can be acquired from anywhere else. In a Virtual A/B simulation, this reduces the COW snapshot size by about 90MB. Bug: 139201772 Test: manual test Change-Id: I354f0dee1ee191dba0e1f90491ed591dba388f7f From AOSP commit: a495b54f89b2ec0e46be8e3564e4852c6434687c
2020-03-20AOSP: e2fsdroid: Fix logical block sequencing in BaseFS.David Anderson2-5/+99
By iterating over blocks to write BaseFS, holes in the extent tree are skipped. This is problematic because the purpose of BaseFS is to preserve the logical to physical block assignment between builds. By not preserving the location of holes, the assignment can be incorrect. For example, consider the following block list for a file: 1 2 3 0 4 5 If this is recorded as: 1 2 3 4 5 If the first block changes to a hole, the intended mapping will not be preserved at all: 0 1 2 0 3 This patch makes two changes to e2fsdroid to fix this. The first change is that holes are now recorded in BaseFS, by iterating over the extent tree rather than the block list, and inserting zeroes where appropriate. The second change is that the block allocator now recognizes when blocks have been skipped (either to deduplication or to holes), and skips the same number of logical blocks in BaseFS as well. In a Virtual A/B simulation, this reduces the COW snapshot size by approximately 100MB. Bug: 139201772 Test: m target-files-package, inspect .map files From AOSP commit: d391f3bf38cbe51718d5c3c0bb3e72b1a9978625
2020-03-20AOSP: e2fsdroid: Properly free the dedup block map.David Anderson1-0/+23
When BaseFS specifies the same block for two files, it gets added to a separate "dedup" bitmap, and removed from the free block bitmap. If the new build does not use every block in this bitmap, there will be an inconsistency: the block bitmap marks blocks as in-use when they are actually free. Although this doesn't matter for AOSP's read-only file systems, it does cause e2fsck to complain, which breaks the build. Fix the inconsistency by properly freeing all unused blocks within the dedup block set. Bug: 139201772 Test: build AOSP using BaseFS Change-Id: I6b6511eb713a56fec932f1d5668f1766d64d9479 From AOSP commit: 346bee6f8b97aefe7714688f738606c116099fbc
2020-03-20AOSP: Build e2freefragAlessio Balsini1-0/+19
Enable the build of e2freefrag to monitor the free space fragmentation in ext2/3/4 filesystems. Bug: 146078546 Test: m + e2freefrag on device Change-Id: Ia56e443a789ae881a03bdaeae1093567e1736c4c Signed-off-by: Alessio Balsini <balsini@google.com> From AOSP commit: ab77f6c79f3dab697cd56ad3b793e7d555ac9415
2020-03-20AOSP: Add -e2fsprogs to the e2fsprogs chattr and lsattr.Elliott Hughes1-2/+2
We want to start shipping the toybox chattr and lsattr on the device all the time, so the build system rightly complains that then we'd have two modules with the same name. I went with a suffix rather than a prefix so that tab completion works for folks still wanting to use the e2fsprogs versions. Bug: http://b/147769529 Test: builds Change-Id: Ib904fa6c709d29ce709302c61e452383c02cb9a3 From AOSP commit: 8525a455e7410461560a99a42feb0dbfabab5c8e
2020-03-20AOSP: Make ramdisk_available.Yifan Hong8-0/+17
Test: pass Bug: 147347110 Change-Id: Ie800ba1b56773dcc1b6563c4f19c27eccb9ffc1a From AOSP commit: f5a8e8fdefd78deae971a475a7fa43734eef205e
2020-03-20AOSP: Change #define to _BLKID_TYPES_HKousik Kumar2-2/+9
blkid_types.h and ext_types.h having the exact same content results in mismatches in remote RBE builds. Given blkid_types.h is actually supposed to be different, changing this to remove the mismatch. Test: Ran a build, and all e2fsprogs mismatches went away between local/remote. Change-Id: I63ab1719ee1d0ccd28907f0bc99531260251fa99 From AOSP commit: ec10b513c283706f984edeec47301b0661f7d283
2020-03-20AOSP: Allow resize2fs to compile with BUILD_HOST_staticDario Freni1-7/+22
Bug: 144477678 Test: BUILD_HOST_static=1 m resize2fs; m resize2fs Change-Id: I0986deccfe496153e662dcc3cc2fb1ffb6973c21 From AOSP commit: 2c767b86591c64cd7b84c5619e8d8b8a0afd557e
2020-03-20AOSP: Allow debugfs_static to be compiled as host tool.Dario Freni1-0/+1
Bug: 144477678 Test: m debugfs_static Change-Id: I7c360a2a381f8508578d14c32bbb280f386dd925 From AOSP commit: 742bb05a401eb2feb6caaee1c8d66fc1c37eef77
2020-03-20po: update ms.po (from translationproject.org)Sharuzzaman Ahmat Raslan1-149/+135
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-20misc: add text describing the impact of an inode size < 128 bytes in man pagesTheodore Ts'o2-8/+11
Addresses-Debian-Bug: #953493 Addresses-Debian-Bug: #953494 Addresses-Debian-Bug: #951808 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-20libe2p: add a thread-safe variant of e2p_feature2stringTheodore Ts'o2-4/+16
This commit adds the function e2p_feature_to_string() which allows the caller to pass in a preallocated buffer. Google-Bug-Id: 16978603 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-20libext2fs: fix the {set_get}_bitmap_range functions when bitmap->start > 7Theodore Ts'o1-2/+2
The bitmap array's set/get bitmap_range functions were not subtracting out bitmap->start. This doesn't matter for normal file systems, since the bitmap->start is zero or one, and the passed-in starting range is a multiple of eight, and the starting range is then divided by 8. But with a non-standard/fuzzed file system, bitmap->start could be significantly larger, and this could then lead to a array out of bounds memory reference. Google-Bug-Id: 147849134 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-20e2fsck: clarify overflow link count error messageJan Kara3-4/+24
When directory link count is set to overflow value (1) but during pass 4 we find out the exact link count would fit, we either silently fix this (which is not great because e2fsck then reports the fs was modified but output doesn't indicate why in any way), or we report that link count is wrong and ask whether we should fix it (in case -n option was specified). The second case is even more misleading because it suggests non-trivial fs corruption which then gets silently fixed on the next run. Similarly to how we fix up other non-problems, just create a new error message for the case directory link count is not overflown anymore and always report it to clarify what is going on. Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu> (cherry picked from commit 4ebce13292f54c96f43dcb1bd1d5b8df5dc8749d)
2020-03-15debian: drop libattr1-dev from the build dependencies listTheodore Ts'o1-1/+1
The libattr has stopped providing attr/xattr.h; we now use sys/xattr.h. So there is no longer any reason to require that the libattr1-dev package be present when building e2fsprogs, so drop it. Addresses-Debian-Bug: #953926 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-15e2fsck: fix "make check" when using static librariesTheodore Ts'o1-2/+2
Fixes: 70303df16ca6 ("e2fsck: consistently use ext2fs_get_mem()") Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-14libext2fs: make ext2fs_dirent_has_tail() more strictTheodore Ts'o4-17/+14
Previously ext2fs_dirent_has_tail() would return true if the directory was corrupted. If the directory is corrupted, then by definition it doesn't have a valid checksum tail. (This fixes a big-endian failure on the master branch.) Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-10misc: fix typos in chattr's man pageSawood Alam1-2/+2
Plural form "directories" should be used along with "files". "id's" should be "ids" (i.e., plural form, not apostrophe). "much" should "must". Signed-off-by: Sawood Alam <ibnesayeed@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-09mke2fs.conf: remove options.fname_encodingPino Toscano1-3/+0
Introduced with commit e7236a9476cd1fa5296fbc4aa573b36426901a08, it was later renamed to encoding, and turned into a fs_type-only option with commit 28887533bb64db318e74c38cd9c0ad6d0bb2ced2. Hence, remove an option that does not exist in the default configuration. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-07libext2fs: check open(O_EXCL) first in ismounted.cLukas Czerner1-15/+27
Currently the ext2fs_check_mount_point() will use the open(O_EXCL) check on linux after all the other checks are done. However it is not necessary to check mntent if open(O_EXCL) succeeds because it means that the device is not mounted. Moreover the commit ea4d53b7 introduced a regression where a following set of commands fails: vgcreate mygroup /dev/sda lvcreate -L 1G -n lvol0 mygroup mkfs.ext4 /dev/mygroup/lvol0 mount /dev/mygroup/lvol0 /mnt lvrename /dev/mygroup/lvol0 /dev/mygroup/lvol1 lvcreate -L 1G -n lvol0 mygroup mkfs.ext4 /dev/mygroup/lvol0 <<<--- This fails It fails because it thinks that /dev/mygroup/lvol0 is mounted because the device name in /proc/mounts is not updated following the lvrename. Move the open(O_EXCL) check before the mntent check and return immediatelly if the device is not busy. Fixes: ea4d53b7 ("libext2fs/ismounted.c: check device id in advance to skip false device names") Signed-off-by: Lukas Czerner <lczerner@redhat.com> Reported-by: Zdenek Kabelac <zkabelac@redhat.com> Reported-by: Karel Zak <kzak@redhat.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-07mke2fs: fix permissions setting with "mke2fs -d /path/files"Theodore Ts'o1-2/+2
Set the directory for directories in cases where the owner permissions is not rwx. This was reported[1] by Robert Yang but we are using a different approach to fixing the issue. [1] https://lore.kernel.org/r/1582542522-97508-1-git-send-email-liezhi.yang@windriver.com Also set the permissions in a more portable way by making a distinction between the host OS's permissions stats and Linux's permissions. We still assume the low 12 bits are the historical Unix assignments, but we don't assume ST_IFMT bits are the same as Linux's. Reported-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-07libext2fs: don't use O_DIRECT for files on tmpfsAndreas Dilger9-86/+14
If a filesystem image is on tmpfs, opening it with O_DIRECT for reading the MMP will fail. This is unnecessary, since the image file can't really be open on another node at this point. If the open with O_DIRECT fails, retry without it when plausible. Remove the special-casing of tmpfs from the mmp test cases. Change-Id: I41f4b31657b06f62f10be8d6e524d303dd36a321 Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-04e2fsck: avoid overflow with very large dirsAndreas Dilger3-49/+81
In alloc_size_dir() it multiples signed ints when allocating the buffer for rehashing an htree-indexed directory. This will overflow when the directory size is above 4GB, which is possible with largedir directories having about 100M entries, assuming an average 3/4 leaf fullness and 24-byte filenames, or fewer with longer filenames. The same problem exisgs in get_next_block(). Similarly, the out_dir struct used a signed int for the number of blocks in the directory, which may result in a negative size if the directory is over 2GB (about 50M entries or fewer). Use appropriate unsigned variables for block counts, and use larger types for calculating the byte count for memory offsets/sizes. Such large directories not been seen yet, but are not too far away. The ext2fs_get_array() function will properly calculate the needed memory allocation, and detect overflow on 32-bit systems. Add ext2fs_resize_array() to do the same for array resize. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-04misc: handle very large files with filefragAndreas Dilger2-14/+26
Avoid overflowing the column-width calc printing files over 4B blocks. Document the [KMG] suffixes for the "-b <blocksize>" option. The blocksize is limited to at most 1GiB blocksize to avoid shifting all extents down to zero GB in size. Even the use of 1GB blocksize is unlikely, but non-ext4 filesystems may use multi-GB extents. Signed-off-by: Andreas Dilger <adilger@dilger.ca> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-03-04e2fsck: consistently use ext2fs_get_mem()Andreas Dilger7-40/+41
Consistently use ext2fs_get_mem() and ext2fs_free_mem() instead of calling malloc() and free() directly in e2fsck. In several places it is possible to use ext2fs_get_memzero() instead of explicitly calling memset() on the memory afterward. This is just a code cleanup, and does not fix any specific bugs. [ Fix up library dependencies in e2fsck/Makefile.in to fix "make check" breakages. -- TYT ] Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-29e2fsck: fix overflow if more than 4B inodesAndreas Dilger4-5/+8
Even though we don't have support for filesystems with over 4B inodes in the current e2fsprogs, this may happen in the future. There are latent overflow bugs when calculating the number of inodes in the filesystem that can trivially be fixed now, rather than waiting for them to be hit at some point in the future. The block number calcs are already correct in this code. Signed-off-by: Andreas Dilger <adilger@dilger.ca> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-29debugfs: print inode numbers as unsignedAndreas Dilger4-14/+14
Print inode numbers as unsigned values, to avoid printing negative numbers for inodes above 2B. Flags should be printed as hex instead of signed decimal values. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-29debugfs: allow comment lines in command fileAndreas Dilger1-0/+4
Allow comment lines with '#' at the start of the line in the command file passed in to debugfs via the "-f" option or from standard input. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-29e2fsck: reduce memory usage for many directoriesAndreas Dilger3-15/+14
Pack struct dx_dir_info and dx_dirblock_info properly in memory, to avoid holes, and fields are not larger than necessary. This reduces the memory needed for each hashed dir, according to pahole(1) from: struct dx_dir_info { /* size: 32, cachelines: 1, members: 6 */ /* sum members: 26, holes: 1, sum holes: 2 */ /* padding: 4 */ }; struct dx_dirblock_info { /* size: 56, cachelines: 1, members: 9 */ /* sum members: 48, holes: 2, sum holes: 8 */ /* last cacheline: 56 bytes */ }; to 8 bytes less for each directory and directory block, and leaves space for future use if needed (e.g. larger numblocks): struct dx_dir_info { /* size: 24, cachelines: 1, members: 6 */ /* sum members: 20, holes: 1, sum holes: 4 */ /* bit holes: 1, sum bit holes: 7 bits */ }; struct dx_dirblock_info { /* size: 48, cachelines: 1, members: 9 */ }; Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-29e2fsck: avoid mallinfo() if over 2GB allocatedAndreas Dilger2-15/+15
Don't use mallinfo() for determining the amount of memory used if it is over 2GB. Otherwise, the signed ints used by this interface can can overflow and return garbage values. This makes the actual amount of memory used by e2fsck misleading and hard to determine. Instead, use brk() to get the total amount of memory allocated, and print this if the more detailed mallinfo() information is not suitable for use. There does not appear to be a mallinfo64() variant of this function. There does appear to be an abomination named malloc_info() that writes XML-formatted malloc stats to a FILE stream that would need to be read and parsed in order to get these stats, but that doesn't seem worthwhile. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Reviewed-by: Shilong Wang <wshilong@ddn.com> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-29e2fsck: use proper types for variablesAndreas Dilger10-33/+38
Use ext2_ino_t instead of ino_t for referencing inode numbers. Use loff_t for for file offsets, and dgrp_t for group numbers. Cast products to ssize_t before multiplication to avoid overflow. Signed-off-by: Andreas Dilger <adilger@dilger.ca> Reviewed-by: Shilong Wang <wshilong@ddn.com> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-29e2fsck: fix e2fsck_allocate_memory() overflowAndreas Dilger6-37/+39
e2fsck_allocate_memory() takes an "unsigned int size" argument, which will overflow for allocations above 4GB. This happens for dir_info and dx_dir_info arrays when there are more than 350M directories in a filesystem, and for the dblist array above 180M directories. There is also a risk of overflow during the binary search in both e2fsck_get_dir_info() and e2fsck_get_dx_dir_info() when the midpoint of the array is calculated, if there would be more than 2B directories in the filesystem and working above the half way point. Also, in some places inode numbers are "int" instead of "ext2_ino_t", which can also cause problems with the array size calculations, and makes it hard to identify where inode numbers are used. Fix e2fsck_allocate_memory() to take an "unsigned long" argument to match ext2fs_get_mem(), so that it can do single memory allocations over 4GB. Fix e2fsck_get_dir_info() and e2fsck_get_dx_dir_info() to temporarily use an unsigned long long value to calculate the midpoint (which will always fit into an ext2_ino_t again afterward). Change variables that hold inode numbers to be ext2_ino_t, and print them as unsigned values instead of printing negative inode numbers. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Reviewed-by: Shilong Wang <wshilong@ddn.com> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13197 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-27tst_libext2fs: Avoid multiple definition of global variablesLukas Czerner3-1/+9
gcc version 10 changed the default from -fcommon to -fno-common and as a result e2fsprogs make check tests fail because tst_libext2fs.c end up with a build error. This is because it defines two global variables debug_prog_name and extra_cmds that are already defined in debugfs/debugfs.c. With -fcommon linker was able to resolve those into the same object, however with -fno-common it's no longer able to do it and we end up with multiple definition errors. Fix the problem by using SKIP_GLOBDEFS macro to skip the variables definition in debugfs.c. Note that debug_prog_name is also defined in lib/ext2fs/extent.c when DEBUG macro is used, but this does not work even with older gcc versions and is never used regardless so I am not going to bother with it. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-24chattr.1: improve attribute formatting with labels and indented paragraphsJeremy Visser1-19/+40
By convention, lists of options in man pages use a label followed by an indented description, such as this example from the Options section: -R Recursively change attributes of directories and their contents. But the Attributes section places the available attributes mid-sentence, which makes it visually more difficult to parse: A file with the 'a' attribute set can only be opened in append mode for writing. [...] When a file with the 'A' attribute set is accessed, its atime record is not modified. [...] This patch places a label beside each attribute description, which (in my opinion) improves readability, especially when visually skimming the list. For example: a A file with the 'a' attribute set can only be opened in append mode for writing. A When a file with the 'A' attribute set is accessed, its atime record is not modified. Signed-off-by: Jeremy Visser <jeremyvisser@google.com> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-15libext2fs: avoid array buffer overruns caused by insane directory blocksTheodore Ts'o1-2/+10
Reported-by: canardo909@gmx.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-12libext2fs: fix potential OOB read check_for_inode_bad_blocks()Theodore Ts'o1-0/+7
If the bad block list has been reset in the middle of an inode scan, it's possible for bb->list[scan->bad_blocks_ptr] to result in an out-of-bounds read access. This is highly unlikely to happen under normal circumstances; in particular, we generally don't use bad block inodes any more. In addition, this would only happen if the bad block inode itself is corrupt so e2fsck needs to wipe it out. This might cause e2fsck to crash, but it will more likely cause a part of the inode table to be wrongly considered invalid, causing file system to be incorrectly fixed. This was reported by TALOS as TALOS-2020-0974 and CVE-2020-6057, but after closer examination, we don't believe this can be used in any way to exploit the system or release information about the system, since all this can do is to cause part of the inode table to be skipped when it shouldn't be, and this can't be leveraged since any information about the ASLR of the process is obsolete once e2fsck exits. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-24mmp: abstract out repeated 'sizeof(buf), buf' usageAndreas Dilger13-70/+53
The printf("%.*s") format requires both the buffer size and buffer pointer to be specified for each use. Since this is repeatedly given as "(int)sizeof(buf), (char *)buf" for mmp_nodename and mmp_bdevname fields, with typecasts to avoid compiler warnings. Add a helper macro EXT2_LEN_STR() to avoid repeated boilerplate code. This can also be used for other superblock buffer fields that may not have NUL-terminated strings (e.g. s_volume_name, s_last_mounted, s_{first,last}_error_func, s_mount_opts) to simplify code and avoid the need for temporary buffers for NUL-termination. Annotate the superblock string fields that may not be NUL-terminated. Signed-off-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-24mmp: don't assume NUL termination for MMP stringsAndreas Dilger6-13/+29
Don't assume that mmp_nodename and mmp_bdevname are NUL terminated, since very long node/device names may completely fill the buffers. Limit string printing to the maximum buffer size for safety, and change the field definitions to __u8 to make it more clear that they are not NUL-terminated strings, as is done with other strings in the superblock that do not have NUL termination. Signed-off-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-16libext2fs: reserve the error code EXT2_ET_NO_GDESCTheodore Ts'o2-0/+6
This is really only needed in the 1.46+ where the EXT2_FLAG_SUPER_ONLY is honored by ext2fs_open to only read the superblock, so that fs->group_desc can be NULL. We define it in the maint branch so that we can be sure the error tables are kept in sync (in the unlikely case that a new error code needs to be assigned in the maint branch). Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-08libcom_err: deal with the fact that the Hurd error messages are not zero-basedTheodore Ts'o2-4/+18
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-06Update release notes, etc., for the 1.45.5 releasev1.45.5Theodore Ts'o10-192/+321
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-06libext2fs: always compile swapfs functions on all architecturesTheodore Ts'o2-3/+13
By only compiling the ext2fs_swap_* functions on big-endian systems, it causes debian/libext2fs2.symbols to need to be different on different little-endian vs big-endian architectures. Including the ext2fS_swap_* functions increases the size of the library by ~6k, which is not a big deal. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-06e2scrub, e2scrub_all: don't sleep unnecessarily in exitcodeTheodore Ts'o2-8/+2
The two second sleep is only needed in e2scrub, and when there is a failure, so that systemd has a chance to gather the log output before e2scrub exits. It's not needed if the script is exiting successfully, and it's never needed for e2scrub_all ever. Addresses-Debian-Bug: #948193 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-06debian: add autopkgtest filesTheodore Ts'o3-0/+75
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-06libext2fs: don't scan /etc/mtab if file system not found in /proc/mountsTheodore Ts'o1-1/+1
Previously we would scan /etc/mtab if the device is not found in /proc/mounts. This is because previously, /etc/mtab would have the filename for a loopback mount, while /proc/mounts would only have something like /dev/loop0. Since on many systems /etc/mtab is now a symlink to /proc/mounts, ismounted.c has a special function, check_loop_mounted. For this reason, it's not necessary to fall back to trying to scan /etc/mtab if a device / filename is not found from scanning /proc/mounts. This also prevents failures if the file /etc/mtab does not exist but /proc/mounts does exist when checking to see if a device is mounted when it isn't. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01e2fsck: don't check for future superblock times if checkinterval == 0Theodore Ts'o1-2/+2
We are no longer enabling periodic file system checks by default in mke2fs. The only reason why we force file system checks if the last mount time or last write time in the superblock is if this might bypass the periodic file systme checks. So if the checkinterval is zero, skip the last mount/write time checks since there's no reason to force a check just because the system clock is incorrect. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01debian: update debhelper compat level to 12Theodore Ts'o1-1/+1
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01config: update config.{guess,sub}Theodore Ts'o2-1322/+1505
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01po: update zh_CN.po (from translationproject.org)Boyuan Yang1-1302/+1348
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01po: update ms.po (from translationproject.org)Sharuzzaman Ahmat Raslan1-95/+64
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01Drop use of -pedantic when doing gcc-wallTheodore Ts'o3-47/+3
With newer versions of gcc -pedantic is *super* pedantic, and generates way too much noise. So we drop it, and thus we don't need util/gcc-wall-cleanup and util/static-analysis-cleanup. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01libext2fs: use ext2fs_file_llseek in inode_io.cTheodore Ts'o1-6/+6
Enable the use of files > 2GB when using the inode_io manager. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01libext2fs: chage ext2_off_t and ext2_off64_t to be signed typesTheodore Ts'o3-4/+7
The ext2_off_t and ext2_off64_t types are used by ext2_file_lseek() and ext2_file_llseek(), and they need to be signed so that it can be a negative offset from the end of the file when EXT2_SEEK_END is used. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01libext2fs: use __u64 instead of ext2_off64_t in qcow.cTheodore Ts'o1-5/+5
The type ext2_off64_t should only be used in the context of the ext2fs library's llseek() and ftruncate() analogs, ext2_file_llseek() and ext2_inode_set_size(). That's because like the POSIX.1's off_t, it needs to be a signed integer value so that SEEK_END will work correctly. qcow.c's use of ext2_off64_t is only internal, and not in any exposed interfaces, so changes nothing; it just prepares us to be able to change the type of ext2_off64_t. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01mke2fs: fix setting bad blocks in the block bitmapLi Dongyang1-1/+1
We mark the bad blocks as used on fs->block_map before allocating group tables. Don't translate the block number to cluster number when doing this, the fs->block_map is still a block-granularity allocation map, it will be coverted later by ext2fs_convert_subcluster_bitmap(). Signed-off-by: Li Dongyang <dongyangli@ddn.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01e2image: remove redundant -fr from man page and usage messageBenno Schulenberg2-7/+6
Also, add a missing dash and two missing brackets and two missing spaces, and remove three excess spaces. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01AOSP: e2fsdroid: Skip Base FS entries that no longer exist.David Anderson3-11/+46
Don't reserve blocks in the base map if the file does not exist in the target image. This can happen if a file is removed or renamed in between two builds. If the removed file is quite large, skipping it is important since otherwise it will prevent blocks from being allocated for new files. Bug: 145316683 Test: e2fsdroid with dynamic partitions Change-Id: I63a9372c58adeaae3e1235fd92fed78a284ed391 From AOSP commit: 2b6646a3d2a7dd9972275cb829239ae033762da5
2020-01-01AOSP: e2fsdroid: Allow re-use of deduplicated blocks.David Anderson1-0/+25
When using a Base FS map, track deduplicated blocks in a separate bitmap. The first inode to request a block from this set will succeed in getting the block. Blocks in the dedup set are not available for libext2fs to allocate; this ensures that previously deduplicated blocks are re-used for their original purpose. Note that deduplication takes priority over block allocation, so that once a block is removed from the dedup set, that does not actually prevent it from being re-used. Similarly, a file that was not previously sharing a block may have its blocks shared in the new image. Bug: 145316683 Test: e2fsdroid with dynamic partitions Change-Id: I73856faa5d294a7b5fb985ccd1a6974a989481ea From AOSP commit: 4e55425ff5d7d7cea27dcf79125766762e2b3529
2020-01-01AOSP: e2fsdroid: Do not allocate invalid blocks from BaseFS.David Anderson1-22/+84
If certain metadata properties change in between builds, such as the inode table size, then block mappings may not be valid from one build to the next. For example, build A could allocate block N for a file. If build B has a larger inode table, block N may no longer be a data block. In this case, we need to remove the block from the BaseFS range list so we do not give it back to libext2fs for writing data. We do this with a new "owned_block_map" bitmap. If a block from the base FS is not in use by the initial image, and is not used by any other file, it is considered owned, and can be claimed by that file. Note that while this produces correct images, it also prevents deduplicated blocks from being re-used. This will be addressed in a follow-up patch. Bug: 145316683 Test: e2fsdroid block mapping with dynamic partitions Change-Id: I3145e45156f7879bdf956384723fab4bd69acb93 Signed-off-by: David Anderson <dvander@google.com> From AOSP commit: b3d1ccdb673772588b7bb14c4581980ef549a0b8
2020-01-01AOSP: e2fsdroid: Refactor basefs allocation.David Anderson1-29/+53
This refactors base_fs_alloc_load() to address two issues. First, the failure cases have been made simpler by factoring out a common helper for freeing a base_fs_allocator. Second, we no longer return EXIT_FAILURE, since this is not an errcode_t. Bug: 145316683 Change-Id: I8b28c684ecf3423b605b550177d7ead4eb2821a4 From AOSP commit: b461ade872a809ab913d7506e9b8ed597d57dc87
2020-01-01AOSP: e2fsdroid: Refactor block_range.David Anderson6-61/+74
block_range is a singly-linked list, but the head/tail links are manually managed all over. Instead, introduce a block_range_list structure and refactor list helpers to operate on this instead. This ensures head/tail are maintained properly (in some cases, like delete_block_range, they were not). Bug: 145316683 Test: manual test Change-Id: Ieec6324549e2c3a71129871f703f4f0a37aeb1fa From AOSP commit: 4220594792297619d2e70a29476667d1698dbd63
2020-01-01AOSP: Add vendor_available: trueJustin Yun2-0/+2
Make libext2-headers and libext2_uuid available to vendor and product. They are required by f2fs-tools which are installed in product partition. Bug: 120954888 Bug: 145580164 Test: set PRODUCT_PRODUCT_VNDK_VERSION := current and build Change-Id: Ibf5678448f9efbcb72c0544a3a50280fbfee2f38 From AOSP commit: 2c79a5f79197c090fc9c9534546f4ab4f7690809
2020-01-01e2fsck: fix use after free in calculate_tree()Wang Shilong1-1/+16
The problem is alloc_blocks() will call get_next_block() which might reallocate outdir->buf, and memory address could be changed after this. To fix this, pointers that point into outdir->buf, such as int_limit and root need to be recaulated based on the new starting address of outdir->buf. [ Changed to correctly recalculate int_limit, and to optimize how we reallocate outdir->buf. -TYT ] Signed-off-by: Wang Shilong <wshilong@ddn.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01e2fsck: fix to return ENOMEM in alloc_size_dir()Wang Shilong1-0/+4
Two memory allocation return check is missed. Signed-off-by: Wang Shilong <wshilong@ddn.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-01-01ext2fs: add ext2fs_get_stat_i_blocks() functionTheodore Ts'o5-31/+28
The function ext2fs_inode_i_blocks() is a bit confusing whether it is returning the inode's i_blocks value, or whether it is returning the value ala the stat(2) system call, which returns i_blocks in units of 512 byte sectors. This caused ext2fs_inode_i_blocks() to be incorrectly used in fuse2fs and the function quota_compute_usage(). To address this, we add a new function, ext2fs_get_stat_i_blocks() which is clearly labelled what it is returning, and use it in fuse2fs and quota_compute_usage(). It's also a bit more convenient to use it in e2fsck, so use it there too. Reported-by: Wang Shilong <wangshilong1991@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-12-20fuse2fs: add support for 32-bit uids and gidsTheodore Ts'o1-12/+23
Previously, uids were truncated at 16 bits because we weren't properly handling i_uid_high and i_gid_high. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-12-20mke2fs: fix "mke2fs -d /path/to/files" to support 32-bit uids and gidsTheodore Ts'o1-0/+2
https://github.com/tytso/e2fsprogs/issues/29 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-12-20e2fsck: don't try to rehash a deleted directoryTheodore Ts'o2-0/+6
If directory has been deleted in pass1[bcd] processing, then we shouldn't try to rehash the directory in pass 3a when we try to rehash/reoptimize directories. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-12-20e2fsck: abort if there is a corrupted directory block when rehashingTheodore Ts'o1-0/+9
In e2fsck pass 3a, when we are rehashing directories, at least in theory, all of the directories should have had corruptions with respect to directory entry structure fixed. However, it's possible (for example, if the user declined a fix) that we can reach this stage of processing with a corrupted directory entries. So check for that case and don't try to process a corrupted directory block so we don't run into trouble in mutate_name() if there is a zero-length file name. Addresses: TALOS-2019-0973 Addresses: CVE-2019-5188 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-12-13e2fsck: optimize away repeated calls to gettext()Theodore Ts'o2-2/+6
Optimize _("getting next inode from scan") so it is not called for each initialized inode in the file system, and make a similar optimization in pass 2 for each directory block. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-12-13e2scrub: fix the 30 second timeout when trying to remove a snapshotTheodore Ts'o1-1/+1
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-22Add a program to test images provided by UBSAN fuzzing reportsTheodore Ts'o2-1/+82
This program calls a few ext2fs library functions used by the current generation of libext2fs fuzzers, and is helpful in reproducing UBSAN failures reported externally. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-22libext2fs: define PATH_MAX if not provided by the system headersTheodore Ts'o1-0/+4
This is needed to compile on Illumos and its derivatives. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-20tune2fs: prohibit toggling uninit_bg on live filesystemsDarrick J. Wong1-0/+12
An internal customer followed an erroneous AskUbuntu article[1] to try to change the UUID of a live ext4 filesystem. The article claims that you can work around tune2fs' "cannot change UUID on live fs" error by disabling uninit_bg, changing the UUID, and re-enabling the feature. This led to metadata corruption because tune2fs' journal descriptor rewrite races with regular filesystem writes. Therefore, prevent administrators from turning on or off uninit_bg on a mounted fs. [1] https://askubuntu.com/questions/132079/how-do-i-change-uuid-of-a-disk-to-whatever-i-want/195839#459097 Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-18chattr.1: say "cleared" instead of "reset"Eric Biggers1-4/+5
Setting a bit to 0 is normally called "clearing", not "resetting"; and chattr.1 already says "clear" in some places. Use "clear" consistently. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-18chattr.1: clarify that ext4 doesn't support tail-merging eitherEric Biggers1-2/+2
This old text was never updated to mention ext4 in addition to ext2 and ext3. Do so now. Also don't bother to mention old unmerged patches. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-18chattr.1: fix some grammatical errorsEric Biggers1-6/+6
- "can only be open" => "can only be opened" - "is not candidate" => "is not a candidate" - "written ... on the disk" => "written ... to the disk" Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-18chattr.1: add casefold attribute to mode stringEric Biggers1-1/+1
When the casefold attribute ('F') was added to the chattr man page, it was forgotten to add it to the mode string. Add it. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-18chattr.1: adjust documentation for encryption attributeEric Biggers1-3/+2
Adjust the documentation for the encryption attribute ('E') to clarify that encryption isn't experimental anymore and isn't restricted to regular files, and that the encryption is done by the filesystem. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-18chattr.1: document the verity attributeEric Biggers1-1/+11
Document the verity file attribute ('V'). Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-13configure: don't fail if /usr/include/sys/mount.h does not existTheodore Ts'o2-44/+0
The AX_CHECK_MOUNT_OPT macro fails if /usr/include/sys/mount.h. Unfortunately, the GNU HURD doesn't have this header file. Drop the requirement, since if it doesn't exist, the macro will assume that given mount options don't exist, which for e2fsprogs is used to test to for the existence of the mount options nosuid and nodev. This is only used for fuse2fs, and HURD doesn't support fuse2fs anyway. Addresses-Debian-Bug: #944649 Reported-by: Svante Signell <svante.signell@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-10libext2fs/ismounted.c: check device id in advance to skip false device namesTheodore Ts'o1-27/+12
If there is a trickster which tries to use device names as the mount device for pseudo-file systems, the resulting /proc/mounts can confuse ext2fs_check_mount_point(). (So far as I can tell, there's no good reason to do this, but sysadmins do the darnest things.) An example of this might be the following /proc/mounts excerpt: /dev/sdb /mnt2 tmpfs rw,relatime 0 0 /dev/sdb /mnt ext4 rw,relatime 0 0 This is created via "mount -t tmpfs /dev/sdb /mnt2" followed via "mount -t ext4 /dev/sdb /mnt". (Normally, a sane mount of tmpfs would use something like "mount -t tmpfs tmpfs /mnt2".) Fix this by double checking the st_rdev of the claimed mountpoint and match it with the dev_t of the device. (Note that the GNU HURD doesn't support st_rdev, so we can't solve this problem for the HURD.) Reported-by: GuiYao <guiyao@huawei.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-10resize2fs: make minimum size estimates more reliable for mounted fsJan Kara1-4/+4
Currently, the estimate of minimum filesystem size is using free blocks counter in the superblock. The counter generally doesn't get updated while the filesystem is mounted and thus the estimate is very unreliable for a mounted filesystem. For some usecases such as automated partitioning proposal to the user it is desirable that the estimate of minimum filesystem size is reasonably accurate even for a mounted filesystem. So use group descriptor counters of free blocks for the estimate of minimum filesystem size. These get updated together with block being allocated and so the resulting estimate is more accurate. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-09e2scrub_all: fix broken stdin redirectionDarrick J. Wong1-4/+10
gregor herrmann reports that the weekly e2scrub cronjob emits these errors: /sbin/e2scrub_all: line 173: /proc/8234/fd/pipe:[90083173]: No such file or directory The root cause of this is that the ls_targets stdout is piped to stdin to the entire ls_targets loop body to prevent the loop body from reading the loop iteration items. Remove all the broken hackery by reading the target list into a bash array and iterating the bash array. Addresses-Debian-Bug: #944033 Reported-by: gregor herrmann <gregoa@debian.org> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-09e2scrub_all: don't even reap if the config file doesn't allow itDarrick J. Wong1-3/+12
Dave Chinner complains that the automated on-boot e2scrub reaping takes a long time (because the lvs command can take a while to run) even though the automated e2scrub is disabled via e2scrub.conf on his systems. We still need the reaping service to kill off stale e2scrub snapshots after a crash, but it's unnecessary to annoy everyone with slow bootup. Because we can look for the e2scrub snapshots in /dev/mapper, let's skip reaping if periodic e2scrub is disabled unless we find evidence of e2scrub snapshots in /dev. Reported-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-08libext2fs: verify the block numbers for the allocation bitmaps are validTheodore Ts'o1-6/+8
This avoids a potential UBsan failure when we multiply an insanely high block number with the block size and we get a multiplication overflow. Google-Bug-Id: 128130353 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-08libext2fs: properly free the bitmaps in read_bitmap()'s error/cleanup pathTheodore Ts'o1-2/+2
Use ext2fs_free_{block,inode}_bitmaps() instead of ext2fs_free_mem() to avoid some memory leaks if there is an error while calling read_bitmaps(). Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-04Fix UBSan when shifting (1LL << 63)Theodore Ts'o2-3/+3
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-04libext2fs: fix UBSan when updating an inline_data fileTheodore Ts'o1-2/+3
What memcpy does when the length is zero is not well-defined. So avoid it. Bug: https://github.com/tytso/e2fsprogs/issues/25 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-11-04libext2fs: fix bug when reading or writing more than 2GB in unix_ioTheodore Ts'o1-2/+2
If count * block_size exceeds 2GB, we will overflow a 32-bit signed integer value. This shouldn't happen in practice except for fuzz-corrupted file systems, but let's fix the code so it's correct. Bug: https://github.com/tytso/e2fsprogs/issues/24 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-10-31AOSP: Link to production releases, not testing releasesEric Biggers1-1/+1
The testing links are not stable and are not guaranteed to exist. Test: After re-generating the generated files, the link works now. Change-Id: I36e73ef74571b3246f470280a75ae1098245eff5 From AOSP commit: 5971f6a5113b12b33d9454229bf27621853e1da7
2019-10-31AOSP: Add new source files to Android.bp filesEric Biggers2-0/+2
Test: see I3781b6d1e55923e9410644e8a7ba834b4d13b733 Change-Id: Ie071b30937dcf73f34df5dc3aa08d23ae30d9c63 From AOSP commit: d2a16e1616b807a6143b9c6232a1c54f90dc06f6
2019-10-03Define the codepoint for the fast_commit compat featureTheodore Ts'o2-0/+4
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23Update release notes, etc., for the 1.45.4 releasev1.45.4Theodore Ts'o9-434/+529
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23tune2fs.8: tweak the documentation for the encrypt featureEric Biggers1-1/+1
Try to make it clearer that enabling 'encrypt' just enables *support* for encryption; it doesn't actually encrypt anything by itself. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23tune2fs.8: document the verity featureEric Biggers1-0/+5
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23ext4.5: tweak the documentation for the encrypt featureEric Biggers1-3/+3
Try to make it clearer that enabling 'encrypt' just enables *support* for encryption; it doesn't actually encrypt anything by itself. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23ext4.5: document the verity featureEric Biggers1-0/+14
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23ext4.5: document first kernel version to support casefold featureEric Biggers1-0/+2
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23ext4.5: move casefold feature to correct positionEric Biggers1-8/+8
The features are listed in alphabetic order, so put the casefold feature in the right place. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23e2scrub_all: make sure fd 3 is closed before running lvm commandsTheodore Ts'o2-5/+11
Some versions of cron leave fd 3 open for some unknown reason. So when e2scrub_all is run by cron (on non-systemd systems) this results in an annoying message from the Cron Daemon because lvm will print warning messages about "leaked file descriptors. So force close fd 3 at the beginning of e2scrub and e2scrub_all. Addresses-Debian-Bug: #940240 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23po: update vi.po (from translationproject.org)Trần Ngọc Quân1-1428/+1323
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23po: update nl.po (from translationproject.org)Benno Schulenberg1-510/+517
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23po: update ms.po (from translationproject.org)Sharuzzaman Ahmat Raslan1-634/+657
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23po: update es.po (from translationproject.org)Antonio Ceballos1-481/+490
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23po: update de.po (from translationproject.org)Mario Blättermann1-484/+493
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-23libsupport: add checks to prevent buffer overrun bugs in quota codeTheodore Ts'o3-24/+76
A maliciously corrupted file systems can trigger buffer overruns in the quota code used by e2fsck. To fix this, add sanity checks to the quota header fields as well as to block number references in the quota tree. Addresses: CVE-2019-5094 Addresses: TALOS-2019-0887 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-03e2fsck: check the validity of the casefold flagTheodore Ts'o4-5/+41
The casefold flag is only allowed on directories and when the casefold feature is enabled. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-02e2fsck: make the low dtime check consistent when using the backup superblockTheodore Ts'o6-6/+14
The backup superblock may have a last mounted time of zero, if it has never been updated since the file system was created. In that case, the low dtime check may get disabled when using the backup superblock, even though subsequent e2fsck runs will end up using the low dtime check. This can cause a failure of ext4/007, since since when e2fsck is run a second time after the file system is mounted, the low dtime check will trigger the e2fsck complaint: Inode NNNN was part of the orphaned inode list. IGNORED. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-02e2fsck: update the quota records when the root directory is recreatedTheodore Ts'o1-3/+9
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-09-02libsupport: remove unnecessary code to set the quota inode sizeTheodore Ts'o2-37/+3
This is done correctly by the fileio routines; and it forces the quota inode's file size to be unnecessarily rounded up to the block size. Also remove the unnecessary double colon in the quota's error messages. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-08-18e2scrub_all: allow scrubbing in vg's whose free space == snapshot sizeTheodore Ts'o1-1/+1
If the volume group's free space is exactly the same as snapshot size, e2scrub_all will skip those logical volumes in those volume groups. Fix this by changing the test from '>' to '>='. Fixes: c120312253 ("e2scrub_all: make sure there's enough free space...") Addresses-Debian-Bug: #935009 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-08-18libuuid: signedness/type fixesMatthias Andree3-4/+5
Signed-off-by: Matthias Andree <matthias.andree@gmx.de> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-08-06debian: add changelog for 1.45.3-4 releaseTheodore Ts'o1-0/+9
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-08-03debian: don't gitignore debian/patchesTheodore Ts'o1-0/+1
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-30libblkid: fix gcc -Wall warningsTheodore Ts'o2-9/+11
Google-Bug-Id: 118836063 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-29debian: stop using LTO (link-time optimization)Theodore Ts'o1-1/+1
LTO breaks reproducible builds, and there is some question as to how reliable LTO's code generator is --- there are some scary stories that it doesn't work well, and the GCC maintainers aren't super-interested in fixing the bugs: https://lists.debian.org/debian-devel/2019/07/msg00610.html Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-27debian: skip running "make check" if DEB_BUILD_OPTIONS contains nocheckTheodore Ts'o1-0/+2
This was done automatically by debhelper, but it got dropped when override_dh_auto_test was added by commit 7f4c3bb120 ("debian: run "make check" with V=1 to keep blhc happy"). Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-25debian: mark more files in e2fsprogs.install as only being present on LinuxTheodore Ts'o1-10/+10
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-25debian: update changelog for 1.45.3-3 releaseTheodore Ts'o1-0/+10
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-24e2fsck: set E2FSCK_TIME correctly on a 32-bit arch with a 64-bit time_tTheodore Ts'o1-1/+1
Addresses-Debian-Bug: #932906 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-24debian: mark logsave as Multi-Arch: foreignTheodore Ts'o1-1/+2
Also fix logsave so it is Architecure: any. It was previously "linux-any kfreebsd-any" due to a cut-and-paste error. Addresses-Debian-Bug: #932876 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-24debian: fix Breaks/Replace dependency for logsaveTheodore Ts'o1-2/+2
Addresses-Debian-Bug: #932874 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-24debian: only install the udev and systemd files to e2fsprogs on Linux systemsTheodore Ts'o2-3/+4
Otherwise it will fail to build on hurd and kfreebsd. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-24debian: run "make check" with V=1 to keep blhc happyTheodore Ts'o1-0/+3
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-24debian: update changelog for 1.45.3-2 releaseTheodore Ts'o1-0/+13
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-24debian: add a hard dependency on logsave to e2fsprogsTheodore Ts'o1-1/+2
The initramfs created by the initramfs-tools package needs logsave and assumes it comes along with e2fsprogs. If it is not present, the result systems which will fail to boot. Fix this by adding the dependency. In the future initramfs-tools will explicitly ask for logsave (tracked in Debian Bug: #932854), but we'll need to keep this dependency until the next stable release of Debian. Addresses-Debian-Bug: #932855 Addresses-Debian-Bug: #932859 Addresses-Debian-Bug: #932861 Addresses-Debian-Bug: #932881 Addresses-Debian-Bug: #932888 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-21po: update fr.po (from translationproject.org)Samuel Thibault1-1629/+1354
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-21debian: update to standards version 4.4.0Theodore Ts'o1-1/+1
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-21e2scrub_all_cron: check to make sure e2scrub_all existsTheodore Ts'o1-0/+1
Since e2scrub_all.cron is marked as a config file, it can hang around after the package is removed, in which case e2scrub_all might not be present. So check to make sure e2scrub_all exists before trying to execute it. Addresses-Debian-Bug: #932622 Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reported-by: Laurent Bigonville <bigon@debian.org>
2019-07-21po: update pt.po (from translationproject.org)Pedro Albuquerque1-482/+491
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-20po: update uk.po (from translationproject.org)Yuri Chornoivan1-481/+490
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-20po: update sv.po (from translationproject.org)Göran Uddeborg1-482/+491
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-20po: update pl.po (from translationproject.org)Jakub Bogusz1-482/+491
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-20po: update de.po (from translationproject.org)Mario Blättermann1-1581/+1375
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-20po: update cs.po (from translationproject.org)Petr Pisar1-482/+492
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-14Final updates to release notes, etc., for the v1.45.3 releasev1.45.3Theodore Ts'o4-7/+28
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-14po: add help text to e2fsprogs.pot explaining ix-nay on positional indicatorsTheodore Ts'o2-3/+17
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-14po: update nl.po (from translationproject.org)Benno Schulenberg1-1509/+1272
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-14po: update cs.po (from translationproject.org)Petr Pisar1-2/+5
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-14fuse2fs: stop using the nonempty option by defaultTheodore Ts'o1-1/+1
The nonempty option isn't supported by fuse3, and so if fusermount is from fuse3, having fuse2fs specify nonempty automatically will prevent fuse2fs from working correctly. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-14fuse2fs: install fuse2fs in /usr/bin instead of /usr/sbinTheodore Ts'o2-3/+3
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-07-14debian: add lintian override to suppress a false positiveTheodore Ts'o1-0/+1
Suppress the false positive: e2fsprogs: package-supports-alternative-init-but-no-init.d-script Signed-off-by: Theodore Ts'o <tytso@mit.edu>