Commit Graph

272 Commits

Author SHA1 Message Date
Theodore Ts'o
faae7aa00d Reserve codepoints for the fsverity feature.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-13 22:39:27 -04:00
Ross Burton
5abc041492 build: use MKDIR_P instead of MKINSTALLDIRS
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-11 15:29:48 -04:00
David Anderson
0958bc6327 AOSP: Update Android.bp files.
debugfs now links to a new libext2_support library, which only includes
cstring.c (Android separates other pieces of libsupport into separate
libraries).

e2fsck now builds with -Wno-unused-variable to work around an unused
variable introduced by cabde4999d.

libext_e2p builds the new ljs.c file, and links to ws2_32 on Windows for
ntohl().

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

Change-Id: I42edce0478f1529f44acdbef1495ec5270e3a61e
From AOSP commit: af14814afe0cb3389ecc4b9e9422bd7e8962e0ed
2018-08-05 13:54:26 -04:00
Jiyong Park
722b9ca4ca AOSP: e2fsdroid and mke2fs are dynamic executable in recovery partition
The two utilities are now converted to dynamic executables as shared
libraries are supported in recovery mode.

As part of the conversion, shared libraries that are depended from them
are also marked as recovery_available: true.

Bug: 79146551
Test: adb reboot recovery, and select 'Wipe data/factory reset'. The
data partition is formatted and there is no selinux denial.

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

Change-Id: I22fbc83a4ff0496096efca90721b0db1237c32cd
From AOSP commit: df1f088849ed3336bb4f6f200c29b30682f15948
2018-06-27 23:51:40 -04:00
Theodore Ts'o
574b714d58 Update Makefile.in files using "make depend"
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-25 10:10:39 -04:00
Theodore Ts'o
ac3256fd31 Fix gcc and clang warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-23 23:00:50 -04:00
Jin Qian
611d341377 AOSP: libext2fs: add EXT2_FLAG_SHARE_DUP to de-duplicate data blocks
When assigning physical address for new data block, search sha
of existing blocks for match. If there's a match, reuse address
of the matched block.

Also set EXT4_FEATURE_RO_COMPAT_SHARED_BLOCKS in de-duped image.

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

Google-Bug-Id: 64109868
Change-Id: I8d2d22e9c301264413c1454c84d7bf6bb32ac5c0
From AOSP commit: 3d7abcc7843d6dfdfdafabf43f5e072cb7aaffbd
2018-06-21 09:43:09 -04:00
Theodore Ts'o
c19b18f84b AOSP: use e2fsprogs-defaults for ccflags
From AOSP commit: 2002d7f1fc: Use -Werror in external/e2fsprogs

... which got reverted and reapplied in a confusing way.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-02-26 13:54:20 -05:00
Dan Willemsen
182fa0cd61 AOSP: Suppress warnings/errors for clang+mingw
Hide unused parameters/variables warnings for mingw.

There are a lot of typedef redefinition errors (warnings) stemming from
linux/types.h being included after ext2_types.h

Bug: 69933068
Test: mmma external/e2fsprogs
Change-Id: Id0815e9e01f4c137fb57696f7afd37935ebd35a1
From AOSP commit: 5155fb404659d345ee4b536673ac83b0f822e8a3
2018-02-26 13:34:35 -05:00
Jin Qian
0a3d804189 AOSP: build mke2fs for windows using android mingw library
Bug: 23686092
Change-Id: I4c7b0c69e3e3c48321d3a0a964ad65c87fc32bbd
From AOSP commit: 83da0276c3ff0a1c33f9042798b319542e254060
2018-02-26 12:23:00 -05:00
Theodore Ts'o
604075a0ad v1.43.9
-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEK2m5VNv+CHkogTfJ8vlZVpUNgaMFAlp9KFYACgkQ8vlZVpUN
 gaNEdwgAgstbkq3T7E16dIbW+f7/U7JbF8ugvZh/OnXp0OunmrkP+N2T9ZHriG8k
 f0eb2Polp25lC2U3tHGUs4gRsTaZPKmxMQVwY8/cLs556+zlmItZpDdaT7Hu5zPH
 ReL/s0k9SjF9Cv75YAu8m6ygtkyiy+36HD50EFNAmZoWLQa2xHx/df+HXAXVVz5D
 ujzQ/W899RXdOBERzbvfYpblA/VoYPZaaPf6ctZMtBZfzWUcn+PLljmxPgZEJWNn
 KO/e0cftfulmD12G3OgLsge6hbOyJSN3SEHW5EBy87y3sR1EjJnrHADUxaaXDYrD
 9znRtY0LKqQfIX103Jlm82pigq+adA==
 =5ztX
 -----END PGP SIGNATURE-----

Merge tag 'v1.43.9' into next

v1.43.9
2018-02-09 00:29:10 -05:00
Tyson Nottingham
4825daeb02 chattr/lsattr: update obsolete attribute support
* Remove description of and printing of h, which was never visible to
  clients of the EXT4_IOC_GETFLAGS ioctl, including chattr and lsattr.

* Remove descriptions of X and Z, whose support was removed in
  4a05268cf8 (Remove compression support).

* Update a brief description of E, whose meaning was changed in
  22f22ab1d2 (Reserve the codepoints for the new INCOMPAT
  feature ENCRYPT).

* Add P to symbolic mode format string.

Signed-off-by: Tyson Nottingham <tgnottingham@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-02-07 23:34:56 -05:00
Theodore Ts'o
69ab815dbe Merge branch 'maint' into next 2017-10-15 23:20:53 -04:00
Sebastian Rasmussen
ce20096fc6 Fix typos in error messages and documentation
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
2017-10-15 23:00:03 -04:00
Theodore Ts'o
c920def92d Merge branch 'maint' into next 2017-08-04 12:30:01 -04:00
Theodore Ts'o
44de917886 Update lib/e2p/Makefile.in using "make depend"
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2017-08-04 01:27:48 -04:00
Theodore Ts'o
fed2dbdc64 Merge branch 'maint' into next 2017-07-27 20:07:22 -04:00
Adam Buchbinder
44137c3b26 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>
2017-07-22 17:52:30 -04:00
Christopher Ferris
1333f2b35f 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>
2017-05-23 23:02:50 -04:00
Alex Deymo
a95c632b53 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>
2017-05-23 23:00:54 -04:00
Adrien Schildknecht
a2731accce AOSP: android: add rules to build the static host libraries
Test: m libext2fs-host

Change-Id: I0f8155bc37516a59cf0ae1545ba37d52025f7a36
From AOSP commit: ef511144c0104bcf2c730888bb39e1c4f95680d2

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2017-05-23 22:24:21 -04:00
Theodore Ts'o
11b8ef8bd6 tests: skip running long test with "make check" and add "make fullcheck"
Don't run tests which take longer than 20 seconds to run (especially
f_large_dir, whose run time is well over ten minutes) for "make
check".  The new "make fullcheck" will run all of the regression tests
for e2fsprogs.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2017-04-26 10:07:18 -04:00
Theodore Ts'o
03a179a10e Refactor code to print journal superblock information
Move the code to list the journal superblock information to libe2p, so
it can be used by debugfs, and so we don't have two copies of
substantially the same code in dumpe2fs.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2017-02-16 18:54:41 -05:00
Theodore Ts'o
151c49bc21 Make sure test progams free all allocated memory
This eliminates complaints from ASAN's memory leak detector.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-11-11 23:15:56 -05:00
Theodore Ts'o
0eb9fb99da lib: build elf shared libraries using -fPIC -shared
Make sure we use "-fPIC -shared" consistently on linker and compiler
command lines when building or linking the shared objects for the ELF
shared library.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-31 01:54:09 -04:00
Filipe Brandenburger
c64313084e libe2p: apply LDFLAGS when building tests
This was previously addressed by Michael Forney on commit 53904ae543
but it seems the test cases from lib/e2p (tst_ostype and tst_feature)
were missed.

Fix them by adding the same $(ALL_LDFLAGS) to those two targets.

Tested by building it on a system that depends on LDFLAGS to produce
working binaries and confirming that `make check` succeeds.

Reported-by: Eric Christopher <echristo@google.com>
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-28 11:20:10 -04:00
Theodore Ts'o
fd1677e801 Add --enable-hardening which builds e2fsprogs with security hardening
Enable the following security features: stack protection, fortify,
read-only relocation tables, immediate dynamic symbol binding, and
text segment ASLR by enabling position independent executable
(PIE).

Special handling is provided for shared library and statically linked
executables.  For all the gory details please see:

   https://lists.debian.org/debian-devel/2016/05/msg00302.html

Distributions who want to do their own special thing can set CFLAGS,
CFLAGS_SHLIB, CLFAGS_STLIB, LDFLAGS, LDFLAGS_SHLIB and LDFLAGS_STATIC
as appropriate.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-22 01:58:09 -04:00
Theodore Ts'o
97d7e2fdb2 libe2p: change the long flag name for -P to be Project_Hierarchy
This more clearly describes what the flag means.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-08 22:11:36 -04:00
Theodore Ts'o
0fad49b50d Fix missing prototype warnings caused by missing header files
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-26 23:18:34 -04:00
Theodore Ts'o
e1eee3e13e Android.mk: add missing source files from lib/e2p/Android.mk
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-18 16:24:53 -04:00
Theodore Ts'o
f5b69d4ad1 Android.mk: fix up the library -host naming convention change
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-18 15:24:39 -04:00
Ying Wang
d8d67ec7d9 Cleanup Obsolete LOCAL_PRELINK_MODULE
Addresses-Google-Bug: #18675947

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-14 18:38:43 -04:00
Theodore Ts'o
dcb8e1fa04 Merge branch 'maint' into next 2016-03-06 20:37:49 -05:00
Darrick J. Wong
2ed0adbce6 libext2fs: store checksum seed in superblock
Allow the filesystem to store the metadata checksum seed in the
superblock and add an incompat feature to say that we're using it.
This enables tune2fs to change the UUID on a mounted metadata_csum
FS without having to (racy!) rewrite all disk metadata.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:52 -05:00
Theodore Ts'o
ccf028f2e7 libe2p: add missing f[gs]etproject.c files
Li Xi's patch was missing the sources for fgetproject.c and
fsetproject.c.  I've created replacement files which will service the
purpose.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:52 -05:00
Li Xi
3627e83830 Add project ID support for chattr/lsattr
Chattr and lsattr can be used to set or get project ID:
chattr -p <project id> file
lsattr -p file

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:45 -05:00
Andreas Dilger
1e3f5c889d lsattr: treat inode generation as an unsigned int
The EXT2_GETVERSION ioctl is defined to take a "long" parameter, but
fgetversion() calls ioctl() with an "int" parameter instead.  This is
handled in the kernel correctly, but the generation is sign-extended
in fgetversion() before return on 64-bit systems and lsattr prints
it as a huge positive number for inode generation above 0x80000000:

        1635574212 -------------e-- /mnt/ost0/O/0/d0/12928
        18446744073045131735 -------------e-- /mnt/ost0/O/0/d0/166240
        782808861 -------------e-- /mnt/ost0/O/0/d0/31744
        18446744072181134840 -------------e-- /mnt/ost0/O/0/d0/135008

Correctly assign the returned generation number as an unsigned value,
and print it with a 10-character field width.  The version is printed
left-aligned for consistency with the old code and to ensure it is
always printed in the first column for use with tools like "cut":

        1635574212 -------------e-- /mnt/ost0/O/0/d0/12928
        3630547415 -------------e-- /mnt/ost0/O/0/d0/166240
        782808861  -------------e-- /mnt/ost0/O/0/d0/31744
        2766550520 -------------e-- /mnt/ost0/O/0/d0/135008

Do not return a random value from the stack as the version on error.
Clean up some style issues and consolidate some duplicate code.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 18:12:57 -05:00
Li Xi
e1cec4464b Add inherit flags for project quota
This patch add EXT4_PROJINHERIT_FL to enable inherit feature for
project ID. If an directory has its inherit flag set, all its
newly created children will inherit its project ID. Conversely,
new inodes will get a default project ID (i.e. zero). Also, no
hard link or rename is permitted if the directory and child has
different project ID.

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 17:33:45 -05:00
Li Xi
080e09b46f Add project quota support
This patch adds project quota support. An new quota type PRJQUOTA(2)
is added. EXT4_PRJ_QUOTA_INO(11) is reserved for project quota inode.
The super block reservers an field s_prj_quota_inum for saving
project quota inode. And each inode adds an internal field i_projid
for saving its project ID.

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 17:33:39 -05:00
Li Xi
0c18d0368a Add project feature flag EXT4_FEATURE_RO_COMPAT_PROJECT
This patch add project feature flag EXT4_FEATURE_RO_COMPAT_PROJECT.
Project feature is a read-only compat feature. Thus, an ext4 file
system with project feature enabled could only be read by ext4
kernel module without project feature support.

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 15:56:28 -05:00
Li Xi
2d2d799c72 Clean up codes for adding new quota type
Project quota related fields are reserved in Linux kernel.
As a preparation for it, this patch cleans up quota codes
of e2fsprogs so as to make it easier to add new quota type(s).

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 15:56:24 -05:00
Darrick J. Wong
77b3e98718 libext2fs: clean up feature test macros with predicate functions
Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros.  Furthermore, clean out the
places where we open-coded feature tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-10-24 00:34:09 -04:00
Theodore Ts'o
f1644c324b Eliminate doubly defined _LARGEFILE_SOURCE warning
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-07-12 22:54:37 -04:00
Theodore Ts'o
273c2c5dfd tune2fs: allow tune2fs to be built as a static library for Android
Sync up with aosp's e2fsprogs commits:

    d25948b9b4a9e361ef071dc8175df0407f60b7e0
    e59f7c7cedb1e07eb4dbbb66e115c14faea19f19

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-07-12 20:21:17 -04:00
Theodore Ts'o
f34af41b72 rename libquota.a to libsupport.a
We will be using libsupport.a for e2fsprogs's internal support
functions.  It will contain the quota support functions, but we will
also be moving code such as profile.c and plausible.c to libsupport.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-07-12 16:09:22 -04:00
Theodore Ts'o
59a220dd9f Fix "make clean" and "make distclean"
There were some generated files that weren't getting removed by the
clean and distclean targets; fix this.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-07-01 19:40:23 -04:00
Theodore Ts'o
81f95d43d5 libext2fs, libe2p, misc: git rid of jfs_user.h
Having multiple versions of jfs_user.h was confusing the Android
build.  Clean up things by removing the lib/ext2fs/jfs_user.h and
misc/jfs_user.h and simplifying how we emulate the kernel
infrastructure needed by journal replay code and removing the
kernel-specific lines from kernel-jbd.h.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-05-25 21:18:15 -04:00
Darrick J. Wong
63cd76d6ac misc: fix Coverity bugs
Fix Coverity bugs 1297093, 1297096, 1297489, 1297491, 1297493,
1297506, 1297507, 1297514, 1297516, and 1297517.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-05-16 18:32:33 -04:00
Theodore Ts'o
4a05268cf8 Remove compression support
The compression patches were an out-of-kernel patch set that was (a)
only available for ext2, (b) something that was never could be
stablized due to file system corruption, and (c) the most recent
patches were for 3.1, last updated in 2011.

The history of the compression patches has been a bit checkered.
There is a long history here at http://e2compr.sourceforge.net which
lists the perspective of the people working on it from the e2compr
side.

From the ext2/3/4 mainline developers' perspective, initial
compression support was added to e2fsprogs in 2000 (in the Linux 2.2
era), but due to stability concerns the kernel patches were never
merged into the mainline kernel.  While there were some sporadic
efforts to try to get the ext2 compression patches working in the 2.4
and 2.6 era, by that time mainline work had moved on to ext4, and the
e2compr approach could only work with 32-bit block numbers and
indirect mapped files.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-04-12 08:42:40 -04:00
Theodore Ts'o
4fb758aa4b Clean up and fix Android build files
Add missing new lib/ext2fs source files that were added for encryption
support.  Also move configuration #define's from individual Android.mk
to the android_config.h file, since we've moved away from specifying
configuration #define's on the command-line upstream.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-03-30 14:50:55 -04:00