Stephen Hines [Fri, 27 Oct 2017 18:44:15 +0000 (11:44 -0700)]
AOSP: Suppress use of ASan on e2fsdroid temporarily.
There is a heap buffer overflow that the next toolchain detects on
e2fsdroid. In order to expedite deploying that toolchain, which has been
validated on all of our other targets, we are going to suppress
host sanitization of this executable until we can resolve the actual
bug.
Bug: http://b/68387795
Test: ASAN_OPTIONS=detect_leaks=0 SANITIZE_HOST=address m -j48
Change-Id: I35126c25a65304e53a18031d99334cc57e21a6a5
From AOSP commit: 4705e518c65bf38d876188f28b65fd4815c716d7
Jin Qian [Thu, 10 Aug 2017 18:11:09 +0000 (11:11 -0700)]
AOSP: misc: fix resource leak in populate_fs
Contributed-By: Ivan Maidanski <i.maidanski@samsung.com>
Change-Id: Ibffdeea347d993c97f86ff7bfc5e78024048afce
From AOSP commit: 978002e04483ddab12187f2e08b28996657bc818
Theodore Ts'o [Sun, 25 Feb 2018 01:23:24 +0000 (20:23 -0500)]
tune2fs: if turning off csum_seed and the UUID has changed, require fsck
In the case where the UUID has changed and the user wants to turn off
the csum_seed feature, it's important that file system be freshly
checked. That's also the only case when it's necessary to recalculate
all of the metadata file systems.
Theodore Ts'o [Sat, 24 Feb 2018 23:11:19 +0000 (18:11 -0500)]
tune2fs/fuse2fs/debugfs: after replaying the journal, fix up s_lastcheck
If the file system needs to have the journal replayed, but definition
it can't be freshly checked. So if the time when the file system was
last checked (s_lastcheck) is before the time it was last mounted
(s_mtime), force s_lastcheck to be before s_mtime.
This is necessary to make sure some of tune2fs's safety checks work
correctly after replaying the journal, since some of tune2fs's
operations really require that the file system be self-consistent or
grave damage can result.
Theodore Ts'o [Sat, 24 Feb 2018 23:07:44 +0000 (18:07 -0500)]
tune2fs: move the journal recovery before we try to modify the superblock
Also change the t_replay_and_set test so that we do something more
innocuous, such as setting the file system label, instead of something
much more dangerous such as removing metadata_csum feature (which
requires rewriting the metadat checksums, and this will fail
catastrophically after the test corrupts the inode bitmaps and we
perform the journal replay correctly).
NeilBrown [Sat, 24 Feb 2018 19:56:06 +0000 (14:56 -0500)]
tune2fs: don't recover journal if device is busy.
tune2fs currently replays the journal if it needs
recovery and the filesystem isn't mounted.
The test for "is the filesystem mounted" isn't completely robust.
Lustre makes use of ext4 filesystems in a way that they are mounted
without being visible in /proc/mounts or similar.
This usage can easily be detected by attempting to open the device
with O_EXCL. tune2fs already does this and the EXT2_MF_BUSY flag
is set if open(O_EXCL) fails.
Several uses other than lustre mounts could cause O_EXCL to fail,
but in any case it seems unwise to recover the journal when something
else is keeping the device busy.
So add an extra test to avoid journal recovery when the device
is busy. This fixes some problems with lustre usage.
Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Theodore Ts'o [Thu, 4 Jan 2018 00:28:43 +0000 (19:28 -0500)]
debian: remove -dbg packages from the control file
It looks like Debian's upload automation will reject a control file
that has packages that it doesn't recognize, even if they are not
built in the default build profile. (e.g., the expectation is that
build profiles will *disable* packages, but not *add* new binary
packages not normally built.)
So move the offending lines into debian/control.legacy-dbg which is
tacked onto the debian/control file via "./debian/rules debian-files"
and then removed via "./debian/rules mrproper". It's a hack, but it's
only needed when building backports for Debian Jessie.
Theodore Ts'o [Wed, 3 Jan 2018 21:05:44 +0000 (16:05 -0500)]
debian: convert to use build profile rules exclusively
This commit drops support for the debian/rules.custom file, and only
relies on build profiles.
This means we no longer need to build the control file from
control.in, which simplifies this; developers can now build a debian
package immediately after checking out the tree from git. This also
implies that we are dropping support for Debian 7 (wheezy) and Ubuntu
Trusty (14.04LTS) and older releases. (People who want to backport to
these older distributions will have to make manual adjustments to the
debian/control and debian/rules files.)
Instead of using SKIP_E2FSCK_STATIC in debian/rules.custom, use the
new build profile: pkg.e2fsprogs.no-static-e2fsck
Support for the old-style *-dbg files used in Debian Jessie (which did
not support dbgsym packages) is completely automated. The system will
auto-detect systems which do not support dbgsym and automatically set
the pkg.e2fsprogs.legacy-pkg build profile.
Palmer Dabbelt [Fri, 29 Dec 2017 18:19:51 +0000 (10:19 -0800)]
misc: rename copy_file_range to copy_file_chunk
As of 2.27, glibc will have a copy_file_range library call to wrap the
new copy_file_range system call. This conflicts with the function in
misc/create_inode.c, which this patch renames _copy_file_range.
Theodore Ts'o [Mon, 1 Jan 2018 23:59:16 +0000 (18:59 -0500)]
libext2fs: when writing bitmaps mark the fs as dirty if necessary
If any checksum fields are updated in the block group descriptors, we
need to set the EXT2_FLAG_DIRTY flag so that the block group
descriptors are written to disk.
Tyson Nottingham [Thu, 14 Dec 2017 07:13:12 +0000 (23:13 -0800)]
Add missing information to various man pages and usage texts
badblocks.c: Add -B and -X to usage text.
chattr.1.in: Add P to list of settable attributes.
e2image.8.in, e2image.c: Remove superfluous mention of -r option.
e2undo.8.in, e2undo.c: Add description for -z to man page and add -o and
-z to synopsis and usage text.
e4crypt.8.in: Add -p pad option to relevant command descriptions.
lsattr.1.in: Fix typo.
mke2fs.8.in: Add -C to synopsis. Add MKE2FS_DEVICE_PHYS_SECTSIZE
description and update MKE2FS_DEVICE_SECTSIZE description.
mke2fs.conf.5.in: Add devices stanza summary. Remove base_features and
default_features descriptions from defaults section, as they are
already described in fs_types section. Move enable_periodic_fsck and
force_undo to fs_types section, as they can be set per filesystem
type. Add missing lazy_journal_init and hugefiles_dir descriptions.
tune2fs.8.in: Remove unsupported -p option and deprecated -s option.
Add 64bit, ea_inode, large_dir, and metadata_csum_seed descriptions.
tune2fs.c: Remove unsupported -p option from usage text.
Add mmp_update_interval to extended option usage text.
Tyson Nottingham [Thu, 14 Dec 2017 07:13:11 +0000 (23:13 -0800)]
Add missing information to debugfs man pages and usage texts
Add descriptions for dump_unused, get_quota, list_quota,
set_current_time, show_debugfs_params, and supported_features
commands to debugfs man page. Add various missing command
arguments and correct a few typos in man page and usage texts.
Tyson Nottingham [Thu, 14 Dec 2017 07:13:09 +0000 (23:13 -0800)]
Add missing features and mount options to ext4 man page
Add descriptions for the metadata_csum and metadata_csum_seed
features, as well as nombcache and prjquota mount options. Also,
update a couple of descriptions.
Add swabbing for these missing fields. Reorder the swabbing
on other fields so that they are in struct order, and add
comments for fields that do not need swabbing, so it is easier
to see that all fields are being handled.
Since this seems to be a fairly common occurrence, add compile
time checks to ext2fs_swap_super(), ext2fs_swap_inode_large(),
and ext2fs_swap_group_desc2() via a new EXT2FS_BUILD_BUG_ON()
macro to cause a compile warning if fields are used from these
structs without a corresponding change to the swab functions.
Qian Yingjin [Wed, 13 Dec 2017 15:59:39 +0000 (10:59 -0500)]
debugfs: fix ncheck program output
Fix the bug that print the inode number not the program name
when reporting bad inode name during checking in ncheck.
Minor bug fix: it should reduce iw->inodes_left when found
matched inode number.
Dmitry V. Levin [Wed, 13 Dec 2017 04:05:45 +0000 (23:05 -0500)]
Fix -Wunused-variable compilation warnings
Fix the following compilation warnings:
sha256.c: In function 'main':
sha256.c:238:20: warning: unused variable 'md' [-Wunused-variable]
sha512.c: In function 'main':
sha512.c:286:20: warning: unused variable 'md' [-Wunused-variable]
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Dmitry V. Levin [Thu, 18 May 2017 17:46:49 +0000 (17:46 +0000)]
Fix compilation warnings about functions declared in sys/xattr.h
attr commit v2.4.47-34-g7921157 removes <attr/xattr.h>
and syscall wrappers with the following wording:
"The xattr syscalls are provided by glibc since ages [...]
This removes the need for the <attr/xattr.h> header;
use <sys/xattr.h> instead."
Check for <sys/xattr.h> and include it to fix the following compilation
warnings:
create_inode.c: In function 'set_inode_xattr':
create_inode.c:136:9: warning: implicit declaration of function 'llistxattr' [-Wimplicit-function-declaration]
create_inode.c:172:16: warning: implicit declaration of function 'lgetxattr' [-Wimplicit-function-declaration]
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 13 Dec 2017 02:46:36 +0000 (21:46 -0500)]
e2fsck: fix potential Floating Point Exception in show_stats()
If the free inodes count in the superblock is equal to the inodes
count in the superblock (which is not possible with a valid file
system and will be fixed by e2fsck unless it is prevented by, for
example, e2fsck -n), it is possible for e2fsck to crash due to a
divide by zero error.
Kazuya Mio [Tue, 5 Dec 2017 00:15:38 +0000 (00:15 +0000)]
e2freefrag: print 64bit free blocks count
e2freefrag prints incorrect free blocks count when the number of free blocks
is larger than 2^32.
To fix this problem, e2freefrag uses ext2fs_free_blocks_count(),
not fs->super->s_free_blocks_count.
Theodore Ts'o [Mon, 16 Oct 2017 04:38:00 +0000 (00:38 -0400)]
debian: fix FTBFS regression caused by debhelper/10.9
The problem is caused by obsolete packages referenced in the rules
file. The latest version of debhelper is no longer forgiving about
non-existing packages being referenced in debhelper commands.
Theodore Ts'o [Mon, 16 Oct 2017 04:28:45 +0000 (00:28 -0400)]
libext2fs: fix potential memory access overrun in ext2fs_inode_csum()
If the superblock has a revision level of 0, then s_inode_size is
undefined, and the actual inode size is 128 bytes. This is handled by
the EXT2_INODE_SIZE() helper macro. If s_inode_size is maliciously
set to a large value, and the s_rev_level is 0, then this could result
in an illegal memory pointer dereference.
Addresses-Debian-Bug: #878104 Reported-by: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Sun, 15 Oct 2017 20:23:24 +0000 (16:23 -0400)]
tests: shorten test descriptions to fit in 80 columns
While not critical to functionality, it is easier to see the pass/fail
status of each test if they are not wrapped onto the next line.
Shorten test descriptions so the name+description fit in 80 columns.
Signed-off-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 15 Oct 2017 20:19:04 +0000 (16:19 -0400)]
tests: fix d_inline_dump and f_mke2fs_baddisk from leaving behind temp files
These two tests could leave an temp file behind if the test is
skipped. In general test script files should avoid using 'exit',
since this bypasses the test cleanup scripting.
Andreas Dilger [Tue, 10 Oct 2017 22:39:52 +0000 (16:39 -0600)]
tests: don't leave temporary files at end of test
Don't leave temp files around after test has completed successfully.
Some test scripts were creating their own temporary files, and in
some cases test_one was skipping a test completely (e.g. slow) after
the temp file had been created.
Signed-off-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 15 Oct 2017 04:22:20 +0000 (00:22 -0400)]
misc: clean up error handling for ext2fs_run_ext3_journal()
The ext2fs_run_ext3_journal() function is in debugfs/journal.c, and in
some error conditions cases may close the passed-in file system handle.
Clean up the both the function so that it reliably clears the file
system handle if it has been freed, and its callers so that they do
not crash by dereferencing a null pointer if it has been freed.
Reported-by: Erkki Ruohtula <eru@netti.fi> Signed-off-by: Theodore Ts'o <tytso@mit.edu>