]> git.ipfire.org Git - thirdparty/e2fsprogs.git/log
thirdparty/e2fsprogs.git
6 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 14 Aug 2017 02:40:15 +0000 (22:40 -0400)] 
Merge branch 'maint' into next

6 years agomke2fs: fix UI problem caused by fuzzy translations
Theodore Ts'o [Mon, 14 Aug 2017 01:07:21 +0000 (21:07 -0400)] 
mke2fs: fix UI problem caused by fuzzy translations

When the original message was changed from "(y, n)" to "(y, N)", this
caused the translations to be marked as "fuzzy".  For those
translations that use a different characters for yes and no --- for
example, German, which uses j and n for "ja" and "nein" --- not having
the translation can cause user confusion since the user will type 'y',
and it will be interpreted as "No", since mke2fs is expecting that the
user will type some other character, such as 'j' or 'J' for "Ja" in
the German locale.

Addresses-Debian-Bug: #856586

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoAdd options to gzip and tar to create reproducible artificats
Theodore Ts'o [Sun, 13 Aug 2017 23:54:30 +0000 (19:54 -0400)] 
Add options to gzip and tar to create reproducible artificats

Also remove some long-unused rules from resize2fs's Makefile.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotests: disable use of the BLKID cache while running regression tests
Theodore Ts'o [Sun, 13 Aug 2017 21:52:20 +0000 (17:52 -0400)] 
tests: disable use of the BLKID cache while running regression tests

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibsupport: fix 32-bit quota test failures
Theodore Ts'o [Sun, 13 Aug 2017 18:45:27 +0000 (14:45 -0400)] 
libsupport: fix 32-bit quota test failures

On 32-bit platform some of the util_dqblk structures have a type of
long long.  So we need to use %lld and casts to make sure the right
thing happens on both 32-bit and 64-bit platforms.

Fixes: 968c1c2fe472ddc4a467aaff71305e83cdb0308f
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoMerge branch 'maint' into next
Theodore Ts'o [Fri, 4 Aug 2017 16:30:01 +0000 (12:30 -0400)] 
Merge branch 'maint' into next

6 years agoUpdate release notes, etc., for the 1.43.5 release v1.43.5
Theodore Ts'o [Fri, 4 Aug 2017 16:20:53 +0000 (12:20 -0400)] 
Update release notes, etc., for the 1.43.5 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoAdd new symbol to debian/e2fslibs.symbols
Theodore Ts'o [Fri, 4 Aug 2017 16:19:47 +0000 (12:19 -0400)] 
Add new symbol to debian/e2fslibs.symbols

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agodebian: update policy conformance to standards version 4.0
Theodore Ts'o [Fri, 4 Aug 2017 15:27:15 +0000 (11:27 -0400)] 
debian: update policy conformance to standards version 4.0

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agodebian/rules: update config.{guess,sub} before running configure, not after
Theodore Ts'o [Fri, 4 Aug 2017 15:26:39 +0000 (11:26 -0400)] 
debian/rules: update config.{guess,sub} before running configure, not after

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoRemove special mips libraries from Debian build
Theodore Ts'o [Fri, 4 Aug 2017 06:01:43 +0000 (02:01 -0400)] 
Remove special mips libraries from Debian build

These libraries were needed to support arcboot, which is obsolete and
no longer part of Debian.  So drop these non-standard, legacy special
libraries that were only built on the mips platform.

Addresses-Debian-Bug: #864144

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoRemove obsolete Conflicts/Replaces headers in Debian control file
Theodore Ts'o [Fri, 4 Aug 2017 05:54:55 +0000 (01:54 -0400)] 
Remove obsolete Conflicts/Replaces headers in Debian control file

Addresses-Debian-Bug: #866623

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoRemove spaces at the end of man pages
Theodore Ts'o [Fri, 4 Aug 2017 05:51:50 +0000 (01:51 -0400)] 
Remove spaces at the end of man pages

Addresses-Debian-Bug: #865584

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoClarify description of the the commit mount option in the ext4 man page
Theodore Ts'o [Fri, 4 Aug 2017 05:47:29 +0000 (01:47 -0400)] 
Clarify description of the the commit mount option in the ext4 man page

Addresses-Debian-Bug: #867895

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoUpdate translation template for 1.43.5 release
Theodore Ts'o [Fri, 4 Aug 2017 05:30:54 +0000 (01:30 -0400)] 
Update translation template for 1.43.5 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoUpdate lib/e2p/Makefile.in using "make depend"
Theodore Ts'o [Fri, 4 Aug 2017 05:27:48 +0000 (01:27 -0400)] 
Update lib/e2p/Makefile.in using "make depend"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agopo: update vi.po (from translationproject.org)
Trần Ngọc Quân [Fri, 4 Aug 2017 05:08:46 +0000 (01:08 -0400)] 
po: update vi.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agopo: update sr.po (from translationproject.org)
Мирослав Николић [Fri, 4 Aug 2017 05:08:46 +0000 (01:08 -0400)] 
po: update sr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agopo: update hu.po (from translationproject.org)
Balázs Úr [Fri, 4 Aug 2017 05:08:46 +0000 (01:08 -0400)] 
po: update hu.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agopo: update da.po (from translationproject.org)
Joe Hansen [Fri, 4 Aug 2017 05:08:46 +0000 (01:08 -0400)] 
po: update da.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agopo: update cs.po (from translationproject.org)
Petr Pisar [Fri, 4 Aug 2017 05:08:46 +0000 (01:08 -0400)] 
po: update cs.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: fix e2fsck -D for encrypted directories
Theodore Ts'o [Tue, 1 Aug 2017 14:26:11 +0000 (10:26 -0400)] 
e2fsck: fix e2fsck -D for encrypted directories

If the directory entry is encrypted there may be embedded NUL
characters; hence, we should use memcmp instead of strncmp when
comparing strings.  Otherwise, e2fsck can erroneously report that a
directory have duplicant entries when doing an e2fsck -D check.

Reported-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoMerge branch 'maint' into next
Theodore Ts'o [Fri, 28 Jul 2017 00:07:22 +0000 (20:07 -0400)] 
Merge branch 'maint' into next

6 years agoFix build when configured with --disable-threads
Theodore Ts'o [Thu, 27 Jul 2017 23:43:00 +0000 (19:43 -0400)] 
Fix build when configured with --disable-threads

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoFix build when configured with --enable-profile
Theodore Ts'o [Thu, 27 Jul 2017 23:42:23 +0000 (19:42 -0400)] 
Fix build when configured with --enable-profile

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: fix error handling for ext2fs_sync_device()
Theodore Ts'o [Thu, 27 Jul 2017 23:41:22 +0000 (19:41 -0400)] 
libext2fs: fix error handling for ext2fs_sync_device()

Return the proper error code instead of -1.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoFurther cleanups of the dir_link documentation in the ext4 man page
Theodore Ts'o [Thu, 27 Jul 2017 22:31:04 +0000 (18:31 -0400)] 
Further cleanups of the dir_link documentation in the ext4 man page

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibsupport: fix error handling in quota_write_inode
zhangyi (F) [Mon, 24 Jul 2017 07:01:26 +0000 (15:01 +0800)] 
libsupport: fix error handling in quota_write_inode

The error return value of quota_file_create() is no longer < 0,
and the error handling in quota_write_inode() is incorrect,
fix these. This also fix a tune2fs segfault that currently
occurs when we add project and quota features to an inode
exhaustion ext4 filesystem.

Fixes: a701823a3150("libsupport: fix gcc -Wall nits")
Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agodebugfs: fix "ls -p" to avoid printing garbage after the file name
Theodore Ts'o [Mon, 24 Jul 2017 17:11:16 +0000 (13:11 -0400)] 
debugfs: fix "ls -p" to avoid printing garbage after the file name

In commit 68a1de3df3 (debugfs: pretty print encrypted filenames in the
ls command), a change was introduced in debugfs/ls.c which instead of
copying dirent->name and 0-terminating it, dirent->name is used
directly in printf.

However, instead of using the precision to limit the number of
characters output, the code uses the field width. As a result,
characters are output until a 0 is read, which results in garbage
after the file name.

Also fix two other instances of this in debugging messages that aren't
used, but fixing them will avoid potential future copypasta bugs.

Reported-by: Christian Gabriel <ch_gabriel@web.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: eliminate bad update link count attempt
Tahsin Erdogan [Mon, 24 Jul 2017 04:11:30 +0000 (00:11 -0400)] 
e2fsck: eliminate bad update link count attempt

Extended attribute inodes have a link count of 1 but they are not
attached to any directories. When an xattr inode with zero ea
references is found, the remedy is to reconnect it to lost+found dir.
Since reconnect operation increments the link count, it would normally
become 2 but to avoid that, check_ea_inode() sets the link count to
zero in anticipation of reconnect operation. And it does it even when
e2fsck is invoked with -n option which causes a fatal e2fsck failure
as can be demonstrated with the following test script:

  mke2fs -b 4096 -I 256 -F -O extent,ea_inode /dev/sdb 1G
  mount /dev/sdb /mnt/sdb
  touch /mnt/sdb/x
  setfattr -n user.ie1 -v $(python -c "print 'v'*5000") /mnt/sdb/x
  umount /dev/sdb
  debugfs -w -R 'rm x' /dev/sdb
  e2fsck -f -n /dev/sdb

In this case, e2fsck fails with the following error:

  e2fsck 1.43.5-WIP (17-Feb-2017)
  Pass 1: Checking inodes, blocks, and sizes
  Pass 2: Checking directory structure
  Pass 3: Checking directory connectivity
  Pass 4: Checking reference counts
  ext2fs_write_inode: Attempt to write to filesystem opened read-only
  while writing inode 13 in check_ea_inode
  e2fsck: aborted

Setting link count to zero is not really required because e2fsck will
detect the discrepancy in link count and offer to fix it.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoresize2fs: add support for resizing filesystems with ea_inode feature
Tahsin Erdogan [Mon, 24 Jul 2017 03:42:43 +0000 (23:42 -0400)] 
resize2fs: add support for resizing filesystems with ea_inode feature

Resizing filesystems with ea_inode feature was disallowed so far
because the code for updating the ea entries was missing. This patch
adds that support.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: add ea_inode support to set xattr
Tahsin Erdogan [Mon, 24 Jul 2017 02:54:58 +0000 (22:54 -0400)] 
libext2fs: add ea_inode support to set xattr

This patch is a major update to how we decide where to put extended
attributes.  The main motivation is to enable creating values in
extended attribute inodes.  While doing this, we want to implement a
behavior that is as close to kernel as possible.

Existing set ea code deviates from kernel behavior which makes it harder
to implement ea_inode feature:

 - kernel only sorts ea entries in xattr block, e2fsprogs implementation
   sorts all entries on every update.

 - e2fsprogs implementation shuffled things on every update so the order
   of updates does not matter. Kernel does not reshuffle things.

 - e2fsprogs could evacuate entries from inode body to xattr block and
   vice versa. This behavior does not exist in kernel.

Such differences could lead to inconsistent behavior between fuse2fs and
a kernel mount.

With ea_inode feature, we also need to decide whether to put a value
in an inode or keep it 'inline'.  In kernel implementation this
depends on current placement of entries.

To close the behavioral gap, ext2fs_xattr_set() now takes over the
decision about where to place ea values.  This also allows it to raise
errors early instead of delaying them to a separate
ext2fs_xattrs_write() call later.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: eliminate empty element holes in ext2_xattr_handle->attrs
Tahsin Erdogan [Mon, 24 Jul 2017 02:47:05 +0000 (22:47 -0400)] 
libext2fs: eliminate empty element holes in ext2_xattr_handle->attrs

When an extended attribute is removed, its array element is emptied.
This creates holes in the array so various places that want to walk
filled elements have to do an empty element check.

Have remove operation shift remaining filled elements to the left.
This allows a simple iteration up to ext2_xattr_handle->count to walk
all filled entries, and so empty element checks become unnecessary.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: rename ext2_xattr_handle->length to capacity
Tahsin Erdogan [Mon, 24 Jul 2017 01:25:32 +0000 (21:25 -0400)] 
libext2fs: rename ext2_xattr_handle->length to capacity

ext2_xattr_handle has two fields 'count' and 'length' which
represent number of filled elements vs total element count.
They have close meanings so are easy to confuse, thus make code less
readable. Rename length to capacity.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: update quota inode accounting for ea_inode feature
Tahsin Erdogan [Mon, 24 Jul 2017 01:20:41 +0000 (21:20 -0400)] 
e2fsck: update quota inode accounting for ea_inode feature

Extended attribute inodes are charged to all referencing inodes.
Update e2fsck so that it can correctly track inode quota charges.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoClarify how the description of the dir_nlink feature in the ext4 man page
Theodore Ts'o [Sun, 23 Jul 2017 22:51:22 +0000 (18:51 -0400)] 
Clarify how the description of the dir_nlink feature in the ext4 man page

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotune2fs: edit dire warning about check intervals
Eric Sandeen [Sun, 23 Jul 2017 22:34:57 +0000 (18:34 -0400)] 
tune2fs: edit dire warning about check intervals

Time & mount-count based checks have been off by default for quite some
time now, but the dire warning about disabling them remains in the
tune2fs manpage, which is confusing.  We did "strongly consider
the consequences" and disabled it by default, no need to scare the
user about it now.  Inform the user of the consequences in a more
measured tone.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoresize2fs: sanity check the free blocks and inode counts
Theodore Ts'o [Sun, 23 Jul 2017 04:46:36 +0000 (00:46 -0400)] 
resize2fs: sanity check the free blocks and inode counts

If the free block or free inodes count are larger than the number of
blocks or inodes in the system, request that the file system be
checked.  Otherwise it's possible for calcuate_minimum_resize_size()
to hang in an infinite loop.

This problem was found using American Fuzzy Lop.

Reported-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agodebugfs: add sanity checking to the string_to_inode() utility function
Theodore Ts'o [Sun, 23 Jul 2017 04:45:05 +0000 (00:45 -0400)] 
debugfs: add sanity checking to the string_to_inode() utility function

Otherwise it's possible for a corrupt file system or bad user input to
cause debugfs to crash if the resulting inode number is insanely
large.

This problem was found using American Fuzzy Lop.

Reported-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: add stricter checks on the inode size in ext2fs_open2()
Theodore Ts'o [Sun, 23 Jul 2017 04:26:44 +0000 (00:26 -0400)] 
libext2fs: add stricter checks on the inode size in ext2fs_open2()

An inode size larger than the block size can cause userspace programs
to crash.

This problem was found using American Fuzzy Lop.

Reported-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: don't restart after a critical metadata collision in e2fsck -n mode
Theodore Ts'o [Sun, 23 Jul 2017 04:08:18 +0000 (00:08 -0400)] 
e2fsck: don't restart after a critical metadata collision in e2fsck -n mode

If the file system isn't going to be changed, there's no point
restarting; it will just cause e2fsck to loop forever.

This problem was found using American Fuzzy Lop.

Reported-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: quiet some harmless bitmap warnings
Theodore Ts'o [Sun, 23 Jul 2017 02:50:22 +0000 (22:50 -0400)] 
e2fsck: quiet some harmless bitmap warnings

E2fsck checks block numbers against the block_metadata_map before it
checks to see whether or not the block numbers are valid.  So suppress
these harmless warnings.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotests: dumpe2fs against an image with bad os_type
Adam Buchbinder [Sat, 22 Jul 2017 21:52:53 +0000 (17:52 -0400)] 
tests: dumpe2fs against an image with bad os_type

The os_type here is large enough to be negative when interpreted as a
signed integer.

This test case was generated by american fuzzy lop, starting from a
base filesystem image from files.fuzzing-project.org.

Signed-off-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2p: fix segfault in e2p_os2string
Adam Buchbinder [Sat, 22 Jul 2017 21:52:24 +0000 (17:52 -0400)] 
e2p: fix segfault in e2p_os2string

Passing in a negative integer would lead to a segfault, and
a crafted filesystem image could trigger that.

Signed-off-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: check for invalid quota inode numbers
Theodore Ts'o [Sat, 22 Jul 2017 20:08:25 +0000 (16:08 -0400)] 
e2fsck: check for invalid quota inode numbers

If the superblock has invalid inode numbers for the user, group, or
project quota inodes, e2fsck should notice and offer to fix things by
zeroing out the invalid superblock field.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: add support for printing the quota type in problem reports using %U
Theodore Ts'o [Sat, 22 Jul 2017 18:51:28 +0000 (14:51 -0400)] 
e2fsck: add support for printing the quota type in problem reports using %U

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: fix the s_log_block_size check in ext2fs_open()
Theodore Ts'o [Mon, 17 Jul 2017 23:55:39 +0000 (19:55 -0400)] 
libext2fs: fix the s_log_block_size check in ext2fs_open()

The s_log_block_check can fail to detect an invalid value if it is
between UINT_MAX-9 and UINT_MAX, which can lead to ext2fs_open()
crashing with a division by zero error.

This bug was found using American Fuzzy Lop: http://lcamtuf.coredump.cx/afl/

Addresses-Debian-Bug: #868489

Reported-by: jwilk@jwilk.net
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoMerge branch 'maint' into next
Theodore Ts'o [Tue, 11 Jul 2017 02:15:05 +0000 (22:15 -0400)] 
Merge branch 'maint' into next

6 years agoAOSP: blkid: Resolve to the exFAT uuid change on reboot.
liminghao [Mon, 10 Apr 2017 01:48:51 +0000 (09:48 +0800)] 
AOSP: blkid: Resolve to the exFAT uuid change on reboot.

The volume_serial into exFAT super block is uuid but
not standard uuid, it's just volume serial number.

Change-Id: I376ed9fe1ba1b7f3d367d78cc5e2bb8ea9cc2d13
Signed-off-by: liminghao <liminghao@xiaomi.com>
From AOSP commit: 91e756e829362c66265334e2e20fb3604586ce8b

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoAOSP: blkid: add support to recognize exfat to blkid.
liminghao [Wed, 1 Mar 2017 09:54:42 +0000 (17:54 +0800)] 
AOSP: blkid: add support to recognize exfat to blkid.

we can now identify exfat filesystem.

Change-Id: I870e59a14b6bcd8b45562cdd02c2502d60a9eeff
Signed-off-by: liminghao <liminghao@xiaomi.com>
From AOSP commit: 1206f6d8c5ed47ba19cfc30a19dba51fcd2cd5cb

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: remove #ifdef EXT2_NO_64_TYPE blocks
Tahsin Erdogan [Wed, 5 Jul 2017 04:08:07 +0000 (00:08 -0400)] 
e2fsck: remove #ifdef EXT2_NO_64_TYPE blocks

EXT2_NO_64_TYPE is not defined anywhere. It appears to be a
historical artifact.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoUse i_size to determine whether a symlink is a fast symlink
Tahsin Erdogan [Fri, 30 Jun 2017 01:31:59 +0000 (18:31 -0700)] 
Use i_size to determine whether a symlink is a fast symlink

Current way of determining whether a symlink is in fast symlink
format is to call ext2fs_inode_data_blocks2(). If number of data
blocks is zero and EXT4_INLINE_DATA_FL flag is not set, then symlink
data must be in inode->i_block.

This heuristic is becoming increasingly hard to maintain because
inode->i_blocks count can also be incremented for blocks used by
extended attributes. Before ea_inode feature, extra block could come
from xattr block, now more blocks can be added because of xattr
inodes.

To address the issue, add a ext2fs_is_fast_symlink() function that
gives a direct answer based on inode->i_size field. This is
equivalent to kernel's ext4_inode_is_fast_symlink() function.

This patch also fixes a few issues related to fast symlink handling:

  - Both rdump_symlink() and follow_link() interpreted symlinks with
    0 data blocks to always mean fast symlinks. This is incorrect
    because symlinks that are stored as inline data also have
    0 data blocks. Thus, they try to read everything from
    inode->i_block and miss the symlink suffix in inode extra area.

  - e2fsck_pass1_check_symlink() had code to handle inode with
    EXT4_INLINE_DATA_FL flag twice. The first if block always returns
    from the function so the second one is unreachable code.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoresize2fs: moving xattr inodes is not supported
Tahsin Erdogan [Wed, 5 Jul 2017 03:53:59 +0000 (23:53 -0400)] 
resize2fs: moving xattr inodes is not supported

In some cases, resize2fs needs to move inodes because their inode
number is greater than the maximum allowed. Moving extended attribute
inodes would require updating all the references to them. This
is currently not supported.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agomke2fs: ea_inode is not supported for hurd
Tahsin Erdogan [Wed, 5 Jul 2017 03:53:59 +0000 (23:53 -0400)] 
mke2fs: ea_inode is not supported for hurd

Extended attribute inodes store their refcount in inode.l_i_version
field which is not available for Hurd. Fail mke2fs for this
combination.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agofuse2fs: refuse to mount fs with ea_inode feature
Tahsin Erdogan [Wed, 5 Jul 2017 03:53:59 +0000 (23:53 -0400)] 
fuse2fs: refuse to mount fs with ea_inode feature

ext2fs_xattr_set() currently does not support creating xattr inodes,
so allowing fuse2fs to mount a filesystem with ea_inode feature could
lead to corruption. Refuse to mount if the ea_inode feature is set.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotune2fs: update ea_inode hashes when fs uuid changes
Tahsin Erdogan [Wed, 5 Jul 2017 03:53:59 +0000 (23:53 -0400)] 
tune2fs: update ea_inode hashes when fs uuid changes

Extended attribute inodes maintain a crc32c hash that is used for
deduplication. The crc seed derives from uuid so ea_inode hashes
must be updated when uuid changes.

The ea_inode hash is also incorporated into the xattr entry e_hash
so the entries that reference the inode also must be updated.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: add test for ea_inode feature
Tahsin Erdogan [Wed, 5 Jul 2017 03:53:59 +0000 (23:53 -0400)] 
e2fsck: add test for ea_inode feature

f_ea_inode test covers the following scenarios:

- a file that contains old Lustre-style valid ea_inode references
  in inode body and xattr block

- a file that contains new style valid ea_inode references in inode
  body and xattr block

- a file with an extended attribute that references an invalid inode
  number (e_value_inum > s_inodes_count)

- an ea entry with bad e_hash and points to an inode that does not
  have EA_INODE flag set

- an ea entry with bad e_hash but points to a valid ea_inode

- an ea entry with valid e_hash that points to an inode that is
  missing EA_INODE flag

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: track ea_inode references
Tahsin Erdogan [Wed, 5 Jul 2017 03:53:59 +0000 (23:53 -0400)] 
e2fsck: track ea_inode references

An extended attribute inode has a ref count to track how many entries
point to it. Update e2fsck to verify that the stored ref count is
correct.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: update i_blocks accounting for ea_inode feature
Tahsin Erdogan [Wed, 5 Jul 2017 03:53:59 +0000 (23:53 -0400)] 
e2fsck: update i_blocks accounting for ea_inode feature

With ea_inode feature, i_blocks include the disk space used by
referenced xattr inodes. Make e2fsck aware of that.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: generalize ea_refcount
Tahsin Erdogan [Wed, 5 Jul 2017 03:53:59 +0000 (23:53 -0400)] 
e2fsck: generalize ea_refcount

Currently ea_refcount is only used to track ea block refcounts. By
generalizing it, we could use it for ea quota tracking and also
ea_inode refcounts.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: do not early terminate extra space check
Tahsin Erdogan [Wed, 5 Jul 2017 03:53:59 +0000 (23:53 -0400)] 
e2fsck: do not early terminate extra space check

When check_inode_extra_space() detects a problem with the value of
i_extra_isize, it adjusts it and then returns without further validation
of contents in the inode body. Change this so that it will proceed to
check inline extended attributes.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: ea_inode hash validation
Tahsin Erdogan [Wed, 5 Jul 2017 03:53:59 +0000 (23:53 -0400)] 
e2fsck: ea_inode hash validation

In original implementation of ea_inode feature, each xattr inode had
a single parent. Child inode tracked the parent by storing its inode
number in i_mtime field. Also, child's i_generation matched parent's
i_generation.

With deduplication support, xattr inodes can now be shared so a single
backpointer is not sufficient to achieve strong binding. This is now
replaced by hash validation.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotune2fs: do not allow disabling ea_inode feature
Tahsin Erdogan [Wed, 5 Jul 2017 03:53:59 +0000 (23:53 -0400)] 
tune2fs: do not allow disabling ea_inode feature

Disabling ea_inode feature would require inlining all the existing
xattr values that are currently stored in external inodes. This is
not always possible. Just disallow it.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: add support for large xattrs in external inodes
Andreas Dilger [Wed, 5 Jul 2017 03:53:59 +0000 (23:53 -0400)] 
e2fsck: add support for large xattrs in external inodes

Add support for the INCOMPAT_EA_INODE feature, which stores large
extended attributes into an external inode instead of data blocks.
The inode is referenced by the e_value_inum field (formerly the
unused e_value_block field) from the extent header, and stores the
xattr data starting at byte offset 0 in the inode data block.

The xattr inode stores the referring inode number in its i_mtime,
and the parent i_generation in its own i_generation, so that there
is a solid linkage between the two that e2fsck can verify.  The
xattr inode is itself marked with EXT4_EA_INODE_FL as well.

Signed-off-by: Kalpak Shah <kalpak.shah@sun.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoMerge branch 'maint' into next
Theodore Ts'o [Wed, 5 Jul 2017 03:53:11 +0000 (23:53 -0400)] 
Merge branch 'maint' into next

6 years agolibext2fs: fix compile errors/warnings
Tahsin Erdogan [Fri, 30 Jun 2017 04:19:32 +0000 (21:19 -0700)] 
libext2fs: fix compile errors/warnings

Defining DEBUG_QUOTA reveals a few compile errors. Fix these.
Also fix format string type mismatches in a couple of log_debug()
calls.

Fixes: 2d2d799c7261 ("Clean up codes for adding new quota type")
Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoFix warnings found using UBSAN
Theodore Ts'o [Tue, 4 Jul 2017 22:00:46 +0000 (18:00 -0400)] 
Fix warnings found using UBSAN

Compiling with -fsanitize=undefined -fsanitize=address causes some
warnings of C code that has undefined behavior according to the C
standard bugs.  None of the warnings should cause e2fsprogs
malfunction given a sane compiler running on architectures that Linux
can support.  Still, it's better to clean up to code than not.

To fix up a complaint of a negative shift in hash function, update the
very dated hash we had been using for the revoke table with the
current generic hash used by the kernel.

Other fixes are fairly self-explanatory.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotests: add j_recover_csum3_64bit
Theodore Ts'o [Tue, 4 Jul 2017 21:51:48 +0000 (17:51 -0400)] 
tests: add j_recover_csum3_64bit

Add a test to make sure we are correctly recovering 64-bit journals
using the v3 checksum format.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: fix build issue for on Windows/Cygwin systems
Theodore Ts'o [Tue, 4 Jul 2017 01:28:53 +0000 (21:28 -0400)] 
libext2fs: fix build issue for on Windows/Cygwin systems

Provide ext2fs_get_device_size2() for Windows/Cygwin systems, so
builds can succeed.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe4defrag: fix GCC7.x compiler warning
Marc Thomas [Mon, 26 Jun 2017 15:40:39 +0000 (16:40 +0100)] 
e4defrag: fix GCC7.x compiler warning

../../misc/e4defrag.c:1821:8: warning: statement will never be executed
[-Wswitch-unreachable]
    int mount_dir_len = 0;

Also fix a typo in a few comments.

Signed-off-by: Marc Thomas <marc@dragonfly.plus.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agofilefrag: fix GCC7.x compiler warning
Marc Thomas [Mon, 26 Jun 2017 15:39:47 +0000 (16:39 +0100)] 
filefrag: fix GCC7.x compiler warning

../../misc/filefrag.c:591:33: warning: comparison between pointer and
zero character constant [-Wpointer-compare]
  for (cpp = argv + optind; *cpp != '\0'; cpp++) {

Signed-off-by: Marc Thomas <marc@dragonfly.plus.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoMerge branch 'maint' into next
Theodore Ts'o [Fri, 23 Jun 2017 22:26:31 +0000 (18:26 -0400)] 
Merge branch 'maint' into next

6 years agoe4defrag: display the e2fsprogs version number
Marc Thomas [Fri, 9 Jun 2017 12:58:32 +0000 (13:58 +0100)] 
e4defrag: display the e2fsprogs version number

Signed-off-by: Marc Thomas <marc@dragonfly.plus.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotests: add new test f_del_dup_quota
Eric Whitney [Fri, 23 Jun 2017 21:28:12 +0000 (17:28 -0400)] 
tests: add new test f_del_dup_quota

Add a test to validate the changes in commit b0f5fa880c36: "e2fsck:
fix multiply-claimed block quota accounting when deleting files".

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agomke2fs: fix hugefile creation so the hugefile(s) are contiguous
Theodore Ts'o [Mon, 19 Jun 2017 22:39:55 +0000 (18:39 -0400)] 
mke2fs: fix hugefile creation so the hugefile(s) are contiguous

Commit 4f868703f6f2: "libext2fs: use fallocate for creating journals
and hugefiles" introduced a regression for the mke2fs hugefile
feature.  The problem is that the fallocate library function
intersperses the extent tree metadata blocks with the data blocks, and
this violates the hugefile guarantee that the created files should be
physically contiguous on disk.

Unfortuantely the m_hugefile regression test was flawed, and didn't
pick up the regression.

This commit fixes the regression test so that it detects the problem
before fixing mke2fs, and also fixes the mke2fs hugefile by reverting
the mke2fs hugefile portion of commit 4f868703f6f2.

Google-Bug-Id: 62791459

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: fix fsync(2) detection
Jan Kara [Wed, 7 Jun 2017 13:31:14 +0000 (15:31 +0200)] 
libext2fs: fix fsync(2) detection

For some reason lib/config.h.in was missing a definition of HAVE_FSYNC
and as a result lib/config.h never had HAVE_FSYNC defined. As a result
we never called fsync(2) for example from
lib/ext2fs/unix_io.c:unix_flush() when we finished creating filesystem
and could miss IO errors happening during creating of the filesystem.
Test generic/405 exposes this problem.

Fix the problem by defining HAVE_FSYNC in lib/config.h.in.

Fixes: f47f31958578
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: fix build warning on Big Endian systems in closefs.c
Theodore Ts'o [Sun, 4 Jun 2017 23:28:35 +0000 (19:28 -0400)] 
libext2fs: fix build warning on Big Endian systems in closefs.c

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: correctly write up the backup superblocks in big endian systems
Theodore Ts'o [Sun, 4 Jun 2017 22:37:31 +0000 (18:37 -0400)] 
libext2fs: correctly write up the backup superblocks in big endian systems

This bug has been around since we added support for metadata
checksums, but it was unmasked by commit bf9f3b6d5b ("e2fsck: exit
with exit status 0 if no errors were fixed").  The backup superblocks
are not supposed to have the EXT2_VALID_FS or the NEEDS_RECOVERY bits
set, and earlier 1.43.x versions of e2fsprogs were byte swapping the
shadow superblock each time it was written, so that every other backup
superblock was incorrectly byte swapped.

Fortunately the primary backup superblock was correctly written
(modulo having the VALID_FS bit set when it should not have been set)
so for the most part no one noticed.  And very few architectures use
big endian byte ordering these days.  (Even IBM has seen the light
with the ppcle architecture.  :-)

Fortunately commit bf9f3b6d5b caused f_desc_size_bad and
f_resize_inode to fail on a big endian system, which allowed me to
notice the issue and investigate.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2freefrag: use GETFSMAP on mounted filesystems
Darrick J. Wong [Mon, 15 May 2017 18:37:11 +0000 (11:37 -0700)] 
e2freefrag: use GETFSMAP on mounted filesystems

Use GETFSMAP to query mounted filesystems for free space information.
This prevents us from reporting stale free space stats if there happen
to be uncheckpointed block bitmap updates sitting in the journal.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoMerge branch 'maint' into next
Theodore Ts'o [Tue, 30 May 2017 00:43:01 +0000 (20:43 -0400)] 
Merge branch 'maint' into next

7 years agotune2fs: fix BUGs of tuning project quota
Wang shilong [Tue, 30 May 2017 00:36:51 +0000 (20:36 -0400)] 
tune2fs: fix BUGs of tuning project quota

There are several problems for project quota enable/disable:
tune2fs -O ^project did not work, because @clear_ok_features
did not include @EXT4_FEATURE_RO_COMPAT_PROJECT.

update_feature_set() works for -O option, but tune2fs -Q prj/^prj
did not work well, because function handle_quota_options()
did not set and clear @EXT4_FEATURE_RO_COMPAT_PROJECT feature very well.

one warning message is removed, because with project feature
enabled, quota feature will be enabled automatically.

Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agobadblocks: support languages which use multi-column wide characters
Theodore Ts'o [Tue, 30 May 2017 00:04:56 +0000 (20:04 -0400)] 
badblocks: support languages which use multi-column wide characters

CJK characters take up two columns for each character; teach badblocks
to take this into account.

Addresses-Debian-Bug: #860926

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: "Mingye Wang (Arthur2e5)" <arthur200126@gmail.com>
7 years agoe2fsck: don't flush to device opened in read-only mode
Konstantin Chistyakov [Mon, 29 May 2017 23:11:38 +0000 (19:11 -0400)] 
e2fsck: don't flush to device opened in read-only mode

If the e2fsck is called with both the -f and -n options, it will
complete with an exit status of 8 due to an error when trying to flush
the io_channel (which was opened read-only) when built on on Cygwin on
Windows 8.1 and Windows 10.  Apparently Cygwin is unhappy when fsync
is called on a file descriptor opened read-only.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsprogs: Make -U option consistent between tune2fs and mke2fs
Drew Davenport [Mon, 29 May 2017 22:51:21 +0000 (18:51 -0400)] 
e2fsprogs: Make -U option consistent between tune2fs and mke2fs

Allow "null", "clear", "random", or "time" for the -U option for
mke2fs, which are already allowed options for tune2fs.

Signed-off-by: Drew Davenport <ddavenport@google.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoMerge branch 'maint' into next
Theodore Ts'o [Thu, 25 May 2017 17:55:23 +0000 (13:55 -0400)] 
Merge branch 'maint' into next

7 years agotests: fix expected output for f_detect_junk
Theodore Ts'o [Thu, 25 May 2017 17:11:40 +0000 (13:11 -0400)] 
tests: fix expected output for f_detect_junk

The expect files for f_detect_junk had gotten out of sync with the
code base, and since this test is optional (it depends on libmagic
being installed), we hadn't noticed.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoMerge branch 'maint' into next
Theodore Ts'o [Thu, 25 May 2017 02:13:26 +0000 (22:13 -0400)] 
Merge branch 'maint' into next

7 years agoe2fsck: fix sparse bmap to extent conversion
Darrick J. Wong [Thu, 25 May 2017 01:56:36 +0000 (21:56 -0400)] 
e2fsck: fix sparse bmap to extent conversion

When e2fsck is trying to convert a sparse block-mapped file to an extent
file, we incorrectly merge block mappings that are physically contiguous
but not logically contiguous because of insufficient checking with the
extent we're constructing.  Therefore, compare the logical offsets for
contiguity as well.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: correctly subtract xattr blocks on bigalloc filesystems
Eric Biggers [Thu, 25 May 2017 01:48:41 +0000 (21:48 -0400)] 
libext2fs: correctly subtract xattr blocks on bigalloc filesystems

ext2fs_inode_data_blocks2() calculates an inode's data block count by
subtracting the external xattr block, if any, from the total blocks.
But on bigalloc filesystems, the xattr "block" is actually a whole
cluster, so ext2fs_inode_data_blocks2() would return a too-large value.

It seems this could have caused several different problems, but the one
I encountered was that xfstest generic/399 failed in the "bigalloc"
config because e2fsck incorrectly considered a symlink on the filesystem
to be corrupted at the end of the test.  This happened because e2fsck
incorrectly calculated a nonzero data block count for a "fast" symlink
with an external xattr block and therefore treated it as a "slow"
symlink, which failed validation.

Fix this by updating ext2fs_inode_data_blocks2() to subtract the cluster
size rather than the block size.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: fix multiply-claimed block quota accounting when deleting files
Eric Whitney [Thu, 25 May 2017 01:34:20 +0000 (21:34 -0400)] 
e2fsck: fix multiply-claimed block quota accounting when deleting files

As e2fsck processes each file in pass1, the actual file system quota is
increased by the number of blocks discovered in the file.  This can
include both non-multiply-claimed and multiply-claimed blocks, if the
latter exist.  However, if a file containing multiply-claimed blocks
is then deleted in pass1b, those blocks are not taken into account when
decreasing the actual quota.  In this case, the new quota values written
to the file system by e2fsck overstate the space actually consumed.
And, e2fsck must be run twice on the file system to fully correct
quota.

Fix this by counting multiply-claimed blocks as a debit to quota when
deleting files in pass1b.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
7 years agoAOSP: Define HAVE_SYS_SYSMACROS_H for Android.
Elliott Hughes [Fri, 19 May 2017 19:49:54 +0000 (12:49 -0700)] 
AOSP: Define HAVE_SYS_SYSMACROS_H for Android.

Also remove a duplicate copy of misc/create_inode.c that isn't upstream.

Bug: https://github.com/android-ndk/ndk/issues/398
Test: builds
Change-Id: Ibc475c82aa21f063673cb68bcf6e41ad9d821cd3
From AOSP commit: 37f805a9571cf33c95080c3dbd65c7a4e46fcd71

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoconfigure: Update configure script after integrated AOSP commits
Theodore Ts'o [Wed, 24 May 2017 03:08:47 +0000 (23:08 -0400)] 
configure: Update configure script after integrated AOSP commits

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoAOSP: e2fsdroid: skip setting timestamp if src_dir is null
Jin Qian [Tue, 2 May 2017 20:20:27 +0000 (13:20 -0700)] 
AOSP: e2fsdroid: skip setting timestamp if src_dir is null

fs_mgr formats /data without src_dir.

Test: zero-out first 4096 bytes on /data partition and reboot
Bug: 35219933
Change-Id: I12f1eb1002fd96d18fc7a9ae5a529f673eb57273
From AOSP commit: b5330546f444b49c4d751e9ddd7677ae97161f0c

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoAOSP: e2fsdroid: support multiple selinux file contexts
Jin Qian [Fri, 21 Apr 2017 23:29:07 +0000 (16:29 -0700)] 
AOSP: e2fsdroid: support multiple selinux file contexts

Support passing a string of multiple selinux file contexts separated by
comma with -S option.

E.g. e2fsdroid -S ctx1,ctx2 output

Test: make systemimage
Bug: 35219933
Change-Id: Icc0f9d5d6180b5db7d68f7de45a1128f5a20be89
From AOSP commit: 34f4f33b24280c0a21a95407da4cf4988b275c95

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibblkid: fix buffer overflow scanning partition name
Jin Qian [Mon, 17 Apr 2017 23:13:20 +0000 (16:13 -0700)] 
libblkid: fix buffer overflow scanning partition name

If "line" is carefully crafted, sscanf will write 1 byte over ptname.

Bug: 36103037
Change-Id: Ia19e032d7c65edc27373ebccc0a5569f0fa31161
From AOSP commit: 085e63d064620c763a62406a5ff4299bcee1838e

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoAOSP: e2fsdroid: don't print empty files in block_list.c:end_new_file
Ben Fennema [Thu, 9 Mar 2017 06:44:17 +0000 (22:44 -0800)] 
AOSP: e2fsdroid: don't print empty files in block_list.c:end_new_file

Change-Id: I4b38841c9c36a8faaa9f65bc7b61c7abdddab094
Signed-off-by: Ben Fennema <fennema@google.com>
From AOSP commit: cc933ab3bfee821dc885fe5a6bbb2a4997304ff9

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoAOSP: Disable macro redefined warnings.
Christopher Ferris [Thu, 23 Feb 2017 23:36:54 +0000 (15:36 -0800)] 
AOSP: Disable macro redefined warnings.

The new kernel headers do:

  #define __bitwise __bitwise__

However, the code redefines __bitwise without undef'ing it first.

This is a temporary fix, b/35721782 filed to fix this.

Change-Id: I2c6a64146966f1737835f012d24ccc844570d02b
Test: Builds without warningers/errors.
From AOSP commit: commit 91581e8f15b8a29aedea3e7c11162301c7e66ec3

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoAOSP: Add "libc" to soong static_executable targets.
Alex Deymo [Thu, 26 Jan 2017 01:47:50 +0000 (17:47 -0800)] 
AOSP: Add "libc" to soong static_executable targets.

When building a static exectuable for "arm", the libgcc is automatically
included by the build system *after* libc, but libgcc has some symbol
dependencies on "libc", like for example the "raise" symbol.

libgcc, libatomic and libcompiler_rt-extras are passed in a group
(enclosed by --start-group and --end-group) so they all are included
regardless of the order inside that group. Nevertheless libc only
appears outside this group and before them, so the undefined references
from libgcc are not resolved.

This patch adds "libc" as a explicit static_libs dependency to
static_executable targets forcing it to be included in the group.

Bug: 34220783
Test: mmma external/e2fsprogs
Change-Id: Ia18db10da0f18494600d7e0c870291902d71b287
From AOSP commit: b799ad178fa18c2925a283206496d3f5d6e87f35

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoAOSP: Convert e2fsprogs targets to soong.
Alex Deymo [Thu, 12 Jan 2017 17:48:04 +0000 (09:48 -0800)] 
AOSP: Convert e2fsprogs targets to soong.

This patch also removes all the "-host" and "_static" suffix from all
the libraries adding "unique_host_soname: true". This prevents
confusions with the host installed libraries.

A new "libext2_misc" library is introduced to export some files from
the misc/ directory to other binaries in this project.

Bug: 34220783
Test: mmma external/e2fsprogs

Change-Id: Ia1b689991346b11f8cb38f7c6ee356e666e01d6d
From AOSP commit: 7a9e1a96766d31a41b88f0a539fcc3d532b5c530

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoAOSP: HACK: android: exit(1) if selabel_lookup fails
Nick Kralevich [Wed, 18 Jan 2017 23:17:42 +0000 (15:17 -0800)] 
AOSP: HACK: android: exit(1) if selabel_lookup fails

If selabel_lookup fails, the current implementation of set_selinux_xattr
returns -1, but the command line tool e2fsdroid reports success.
There's a bunch of things wrong:

1) -1 does not appear to be a legal errcode_t value. The appropriate
return value appears to be DIRENT_ABORT.
2) A return value of DIRENT_ABORT is ignored by the upper layers of the
code.
3) Attempting to fix the upper layers of the code to not ignore
DIRENT_ABORT results in complaints about not being able to create
/lost+found.

Call stack:

- main
 - android_configure_fs
  - __android_configure_fs
   - ext2fs_dir_iterate2
    - ext2fs_block_iterate3
     - ext2fs_process_dir_block
      - walk_dir
       - ext2fs_dir_iterate2
        - ext2fs_block_iterate3
         - ext2fs_process_dir_block
          - walk_dir
           - ext2fs_dir_iterate2
            - ext2fs_block_iterate3
             - ext2fs_process_dir_block
              - androidify_inode
               - set_selinux_xattr

I'm honestly not sure how to fix this, so just throw an exit(1) in
there, to make sure the program dies a horrible death if
selabel_lookup() fails. This is much better than the alternative of
e2fsdroid returning success with an improperly labeled file.

Bug: 34358308
Test: Artifically modify selabel_lookup() to return a failure, and
      verify Android doesn't compile.
Test: Verify Android compiles under normal circumstances.
Change-Id: I60e04bc6559a66d3f3202f2c28e2519856385ded
From AOSP commit: 87a7db7cf2ca0feecaccad94bf22f92c726000c3

Signed-off-by: Theodore Ts'o <tytso@mit.edu>