Commit Graph

2237 Commits (ee01079a17bfecd17292ccd60058056fb3a8ba6c)

Author SHA1 Message Date
Theodore Ts'o ee01079a17 libext2fs: Add checks to prevent integer overflows passed to malloc()
This addresses a potential security vulnerability where an untrusted
filesystem can be corrupted in such a way that a program using
libext2fs will allocate a buffer which is far too small.  This can
lead to either a crash or potentially a heap-based buffer overflow
crash.  No known exploits exist, but main concern is where an
untrusted user who possesses privileged access in a guest Xen
environment could corrupt a filesystem which is then accessed by the
pygrub program, running as root in the dom0 host environment, thus
allowing the untrusted user to gain privileged access in the host OS.

Thanks to the McAfee AVERT Research group for reporting this issue.

Addresses CVE-2007-5497.

Signed-off-by: Rafal Wojtczuk <rafal_wojtczuk@mcafee.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-05 21:01:35 -05:00
Theodore Ts'o 7ce238977a Add Ubuntu-specific e2fsck.conf file to work around Ubuntu issues
Ubuntu has init script and installer issues which cause them to have
significant problems with time zones.  This is compounded with a
relatively inexperienced user base who want to dual boot with Windows
and so have their hardware clocks tick localtime.

Addresses-Ubuntu-Bug: #131201

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-05 21:01:22 -05:00
Theodore Ts'o 04aa4727e6 Update Debian policy compliance to version 3.7.3.0
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-05 20:46:12 -05:00
Theodore Ts'o e42dead874 gen-tarball: Ignore the Meta directory when creating the release tarballs
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-05 20:14:43 -05:00
Theodore Ts'o 7527ef1ea8 Update Spanish translation and e2fsprogs.pot file for 1.40.3 release
Addresses-Debian-Bug: #411562

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-05 19:35:20 -05:00
Theodore Ts'o 1113bf706f libss: Fix parallel build failure
A missing dependency on ss_err.h meant that std_rqs.o could fail when
e2fsprogs was being built using make -j.

Thanks to Robert Kerr for reporting this bug.

Addresses-Sourceforge-Bug: #1842331

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-02 05:52:40 -05:00
Eric Sandeen 38361bbbb5 e2fsprogs: fix blkid whole-disk scanning heuristics
The heuristics in blkid/devname.c probe_all() for scanning whole disks
with no partitions assume that a device name with no digit on the end
will always be present as a delineator, i.e.:

sda
sda1
sdb
sdc

In this case, when sdc is seen, it's the clue to go back and scan sdb.
However, for something like:

sda
sda1
sdb
loop0

this falls down, and sdb is never scanned.
(thanks to Karel Zak for pointing this out).

Addresses-Red-Hat-Bugzilla: #400321

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-02 05:25:30 -05:00
Theodore Ts'o 7e5a86a660 libext2fs: Fix a corner case bug in ext2fs_unlink
We cannot merge a removed directory entry to just arbitrary previous
directory entry. The previous entry must be in the same block.  So
really bad things can happen when are deleting the first directory
entry in a block where the last directory entry in the previous
directory block is not in use.  We fix this bug by checking to see if
the current entry is not the first one in the block before trying to
merge it to the previous entry.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-02 05:25:30 -05:00
Andreas Dilger 8cdd6a6f34 fix check_mntent_file() to pass mode for open(O_CREAT)
On my FC8 install, ismounted.c fails to build because open(O_CREAT) is
used without passing a mode.  The following trivial patch fixes it.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2007-12-02 05:25:30 -05:00
Theodore Ts'o 33b92836cd Fix errors in test_ss.c so it can be an example application and test case
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-02 05:25:23 -05:00
Arun Thomas 20abd3ea2a e2image in raw-mode appends an extra byte to image-file
In raw mode (-r), e2image appends an extra byte to the image-file's
end if the last block requires a sparse write. Consequently, the
resulting image-file is one byte larger than the original in
size. This patch fixes the problem by seeking to one less than the
given offset, so that the byte write does not overflow into the next
block.

This problem can be reproduced by doing an e2image -r dev image-file
and comparing the original and resulting image sizes. This assumes the
image is sparse at the end. For my tests, I created a 100MB sparse
image with two files.

Signed-off-by: Arun Thomas <thomasar@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-11-26 06:26:31 -05:00
Theodore Ts'o 3eaf8627b0 Fix typo in the summary section of the blkid man page
Addresses-SourceForge-Bug: #1821333

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-11-01 01:19:32 -04:00
Theodore Ts'o f305918cc7 mke2fs: Change usage message to use -E instead -R, which is deprecated
The -R option is only used for backwards compatibility, and -E is
preferred, so change the usage message accordingly.

Signed-off-by: Coly Li <coyli@suse.de>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-10-15 16:23:40 -04:00
Eric Sandeen f493d4e0ac libblkid: recognize squashfs filesystems on BE systems.
squashfs has no uuid or labels, so all we need is the magic
(for big-endian too!)

Addresses-Red-Hat-Bugzilla: #305151

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
2007-10-15 16:23:39 -04:00
Eric Sandeen 5845efd123 libblkid: detect squashfs
libblkid: recognize squashfs filesystems

squashfs has no uuid or labels, so all we need is the magic.

Addresses-Red-Hat-Bugzilla: #305151

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
2007-10-14 10:11:52 -04:00
Theodore Ts'o 0c37f456d9 e2fsck: backup superblocks if key constants have changed
If the primary superblock differs from the backup superblock in
certain key respects, force a full check (if e2fsck was invoked in
preen mode).  If the filesystem check passes cleanly, and the
filesystem was opened in read/write mode, then write the primary
superblock to all of the backups.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-10-06 12:39:57 -04:00
Theodore Ts'o 0cfce7f749 e2fsck: update the backup superblocks if the feature bitmasks are changed
If e2fsck adds or deletes any of the feature bitmasks, clear
EXT2_FLAG_MASTER_SB_ONLY so the backup superblocks are updated when
e2fsck finishes.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-10-06 12:39:57 -04:00
Theodore Ts'o f6341e9c70 ext2fs_dblist_dir_iterate: Fix ABORT propagation logic
ext2fs_dblist_dir_iterate() calls ext2fs_dblist_iterate(), which calls
ext2fs_process_dir_block(), which in turn calls the helper function
db_dir_proc() which calls callback function passed into
ext2fs_dblist_dir_iterate().  At each stage the conventions for
signalling requests to abort the iteration or to signal errors
changes, db_dir_proc() was not properly mapping the abort request back
to ext2fs_dblist_iterate().

Currently db_dir_proc() is ignoring errors (i/o errors or directory
block corrupt errors) from ext2fs_process_dir_block(), since the main
user of ext2fs_dblist_dir_iterate() is e2fsck, for which this is the
correct behavior.  In the future ext2fs_dblist_dir_iterate() could
take a flag which would cause it to abort if
ext2fs_process_dir_block() returns an error; however, it's not clear
how useful this would be since we don't have a way of signalling the
exact nature of which block had the error, and the caller wouldn't
have a good way of knowing what percentage of the directory block list
had been processed.  Ultimately this may not be the best interface for
applications that need that level of error reporting.

Thanks to Vladimir V. Saveliev <vs@clusterfs.com> for pointing out
this problem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-23 11:39:24 -04:00
Theodore Ts'o 846be6db81 libblkid: Add more magic numbers that might mean there is a FAT filesystem
The FAT filesystem doesn't have its superblock with a set of magic
strings in a fixed location.  Therefore, we must also check for the
FAT filesystem if it looks like we have an MBR at the beginning of the
partition.  We previously checked if the first byte was a jump
instruction but that missed some USB disks with only one bootable
partition.  Now we check for the MBR signature (0x55AA at offset 510)
as well as any partition where byte 0 is \351 or \353.

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-23 09:50:11 -04:00
Theodore Ts'o d006b8cee7 e2fsck: Don't mark the filesystem invalid because of time errors
If superblock mount time or last write time is in the future, and the
user refuses to fix the problem, don't mark the filesystem as being
invalid and needing to be checked.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-23 08:20:51 -04:00
Theodore Ts'o 60702c267d Work around lame Ubuntu init scripts / installer bugs
The Ubuntu init scripts don't properly set the system time correctly
from hardware clock if the hardware clock is configured to tick local
time instead of GMT time.

Work around this as best as we can by providing an option in
/etc/e2fsck.conf which can be set on Ubuntu systems:

[options]
	buggy_init_scripts = 1

Addresses-Debian-Bug: #441093
Addresses-Ubuntu-Bug: #131201

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-22 20:43:11 -04:00
Theodore Ts'o ed773a2638 fsck: Ignore /etc/fstab entries for bind mounts
If a user specifies a bind mount with a non-zero fsck pass number, for
example:

/foo    /bar    ext3    bind,defaults   1 3

print a warning and ignore the fstab entry.

Addresses-Red-Hat-Bugzilla: #151533

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-20 15:06:35 -04:00
Theodore Ts'o 29cf185826 Add test for the case where s_inode_size is zero
Older e2fsck's would crash; e2fsck should now automatically retry
using the backup superblock if it is present.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-07 17:06:25 -04:00
Theodore Ts'o cc8fb0e69d Delete the test.img file after running the resize2fs tests
The resize2fs tests, r_move_itable and r_resize_inode, were not
deleting the test.img tmpfile after completing the test.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-07 17:03:48 -04:00
Theodore Ts'o cd538080ab e2fsck: If the superblock is corrupt, automatically retry with the backup sb
E2fsck currently only retries with the backup superblock if the
primary superblock is missing (e.g., overwritten with garbage).  If
the superblock is just corrupted enough that it looks like ext2/3/4
superblock, but it is corrupt enough that ext2fs_open2() returns an
error, e2fsck stops without retrying.  Let's fix this oversight.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-07 16:54:11 -04:00
Theodore Ts'o ba9d929d91 Don't crash if s_inode_size is zero
Any attempt to open a filesystem with s_inode_size set to zero causes
a floating point exception.  This is true for e2fsck, dumpe2fs,
e2image, etc.  Fix ext2fs_open2() so that it returns the error code
EXT2_ET_CORRUPT_SUPERBLOCK instead of crashing.

Thanks to Dean Bender for reporting this bug.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-07 16:40:25 -04:00
Theodore Ts'o 5845caa464 Use sscanf instead of atoi when parsing e2fsck options
atoi() does not check for errors so it shouldn't be used for human
input.  For example, if the user enters the command "e2fsck -C -n" and
forgets that -C requires an argument, the -n will be used as the
argument to -C, and not parsed as an option.  When using sscanf(),
this error case can be detected.

Addresses-Debian-Bug: #435381

Signed-off-by: Bernd Schubert <bs@q-leap.de>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-20 22:55:33 -04:00
Theodore Ts'o 3524625321 Update Dutch translation file from the Translation Project
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-20 22:14:36 -04:00
Theodore Ts'o 3b302c2c0b Fix typo and clarify the uuidgen man page
Thanks to Matt Kraai for noticing the misplaced sentence inserted into
the description section.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-20 21:46:19 -04:00
Theodore Ts'o 01ff329edc Update Swedish translation file from the Translation Project
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-03 22:25:25 -04:00
Theodore Ts'o 7c8e9ac7f8 Make sure $prefix/etc is created before installing mke2fs.conf
Fix up $(root_sysconfdir) handling misc/Makefile.in so that
make install and make uninstall works correctly when $prefix != /.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-03 22:13:38 -04:00
Theodore Ts'o 9f0288d3bb e2fsck: Allow i_size to be rounded up to the size of a VM page
Allow files to be preallocated on-disk up to the next multiple of the
system's page size without complaining about extra blocks.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-03 20:43:37 -04:00
Theodore Ts'o c5ca71df14 Add "make check" to the RPM spec file
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
2007-08-03 20:12:32 -04:00
Theodore Ts'o 4764a579b4 Fix mke2fs tests to avoid needing any significant ^M (CR) characters
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-22 16:36:51 -04:00
Eric Sandeen bd828a27e2 Fix test in ext2fs_check_desc() for inode table within block group
The test in ext2fs_check_desc() is off by one; if the inode table
goes all the way to the last block of the block group, it will
falsely assert that it has extended past it.  The last block
of a range is start + len -1, not start + len.

You can create (valid) filesystems that will cause e2fsck to complain
via one of the following mkfs commands:

mkfs.ext3 -F -b 1024 /dev/sdb1 2046000000
mke2fs -j -F -b 4096 -m 0 -N 5217280 /mnt/test/fsfile2 327680
mkfs.ext2 -F -b 1024 -m 0 -g 256 -N 3744 fsfile 1024

Addresses-Red-Hat-Bugzilla: #214765

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-22 16:00:43 -04:00
Theodore Ts'o 5a92a627f1 Properly calculate overhead in ext2fs_initialize()
For some odd geometries*, mkfs will try to allocate inode tables off
the end of the block group and fail, rather than warning that too
many inodes have been requested.

This is because when ext2fs_initialize calculates metadata overhead,
it is only adding in group descriptor blocks and the superblock
if the *last* bg contains them - but the first bg also has all of
the various metadata bits taking up space.

We need to calculate the overhead both for the first block group and
the last block groups separately, since the two different tests need
to know what the overheads are for those two cases, which may be
different.

*for example "mke2fs  -b 1024 -m 0 -g 256 -N 3745 fsfile 1024"

(Note, the test here is a little funky; the expected output is
actually a mkfs failure - but a proper failure instead of the
allocator catching the problem at the last minute)

Addresses-Red-Hat-Bugzilla: #241767

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-22 15:14:38 -04:00
Theodore Ts'o f54176369e Add Catalan translation from the Translation Project
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-18 12:28:43 -04:00
Eric Sandeen db9097caca Fix big-endian byte-swapping bug in ext2fs_swap_inode_full()
We need to set t->i_file_acl before we test it in
ext2fs_inode_data_blocks()

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-18 11:49:47 -04:00
Theodore Ts'o d2dc78aed4 Update ChangeLog, README, RELEASE-NOTES for 1.40.2 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-14 09:03:17 -04:00
Theodore Ts'o febac23c12 Update tune2fs man page to include more discussion of reserved blocks
Addresses-Launchpad-bug: #47817

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-11 23:20:17 -04:00
Theodore Ts'o c4b5c45a84 Update Dutch and Vietnamese PO files from the Translation Project
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-11 20:22:52 -04:00
Theodore Ts'o 5e9ba85c26 Fix e2fsck segfault on very badly damaged filesystems
A recent change to e2fsck_add_dir_info() to use tdb files to check
filesystems with a very large number of filesystems had a typo which
caused us to resize the wrong data structure.  This would cause a
array overrun leading to malloc pointer corruptions.  Since we
normally can very accurately predict how big the the dirinfo array
needs to be, this bug only got triggered on very badly corrupted
filesystems.

Thanks to Andreas Dilger for submitting the test case which discovered
this problem, and to Kalpak Shah for writing a random testing script
which created the test case.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-11 13:42:43 -04:00
Theodore Ts'o d46ce70486 Update Polish translation from the Translation Project
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-10 09:45:47 -04:00
Kalpak Shah 575307cc63 e2fsck: Fix salvage_directory when the last entry's rec_len is too big
Recently, one of our customers found this message in pass2 of e2fsck
  while doing some regression testing:

  "Entry '4, 0x695a, 0x81ff, 0x0040, 0x8320, 0xa192, 0x0021' in ??? (136554) has
  rec_len of 14200, should be 26908."

  Both the displayed rec_len and the "should be" value are bogus. The
  reason is that salvage_directory sets a offset beyond blocksize
  leading to bogus messages.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-10 07:28:35 -04:00
Theodore Ts'o 48b0ea4140 Update Turkish translation from Translation Project
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-09 13:13:35 -04:00
Theodore Ts'o 23edf9b467 Fix typo'ed version number in the release notes
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-08 23:24:19 -04:00
Theodore Ts'o b1c2a3e564 Fix debian/control file to use ${binary:Version} instead of ${Source-Version}
This is a Lintian-requested cleanup so that e2fsprogs will be
correctly built with binaryNMU's.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-08 21:36:59 -04:00
Theodore Ts'o a648ea60ee Fix up Lintain complaint about the "make distclean" ignoring errors
This is a Debian-specific debian/rules change, just to clean up the
packaging script.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-08 21:36:43 -04:00
Theodore Ts'o 58b3df7e3d Update ChangeLog, README, RELEASE-NOTES for 1.40.1 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-08 20:54:51 -04:00
Theodore Ts'o 0225face1b Add debugging printf to blkid's probe routine when original fs type failed
This particular bit of code has caused problems before, so make it
easier to debug problems caused by the probe verification looping
forever here.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-08 20:17:31 -04:00