BSD is planning on changing their qsort_r() implementation to align
with the POSIX/GNU-style qsort_r() function signature. So use an
autoconf test to determine which qsort_r() a system has.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The fuzzers from oss-fuzz in projects/e2fsprogs/fuzz (as of commit
78ecd3f07fca with some slight modifications for better error
reporting) have been placed in the tests/fuzz directory and the
configure script now supports a new option --enable-fuzzing which will
build these fuzzers using clang's -fsanitize=fuzzer command line
option.
In general, some sanitizer such as --enable-addrsan or --enable-ubsan
(to enable ASAN or UBSAN, respectively) should be enabled alongside
--enable-fuzzing.
A typical configure command to build the fuzzers might be:
configure CC=clang CXX=clang++ CFLAGS=-g --enable-fuzzing --enable-addrsan
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
mallinfo has been deprecated with GNU C library version 2.33 in favor of
mallinfo2 which works exactly the same as mallinfo but with larger field
widths. Use mallinfo2 if available.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
If getrandom() or getentropy() is available, use these interfaces in
favor of opening /dev/[u]random. This avoids a potential TSAN problem
that could potentially cause a fd leak when trying to open
/dev/urandom. (Which is not a disaster, but these interfaces are more
foolproof and avoids needing to open a file descriptor in a library,
which is a good thing.)
Addresses-Google-Bug: #198050608
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The configure script checks for pthread.h as part of double-checking
that the FUSE support works correctly, which implicitly defined
HAVE_PHREAD_H. If the FUSE libraries are not present (or fuse support
is explicitly disabled), this check doesn't happen and so
HAVE_PTHREAD_H is not defined, and this causes a build failure.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Remove the use of the binary interface using the sysctl(2) system call
since sys/sysctl.h has been deprecated. We can find the total memory
available in the system using the POSIX standard sysconf(2) interface.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Support for pthreads can be forcibly disabled by passing
"--without-pthread" to the configure script.
The actual changes in this commit are in configure.ac and MCONFIG.in;
the other files were generated as a result of running aclocal,
autoconf, and autoheader on a Debian testing system.
Note: the autoconf-archive package must now be installed before
rerunning aclocal, to supply the AX_PTHREAD macro.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This also removes the built-in "intl" directory as this is now
considered deprecated by the gettext package. This means that we
won't try to use an internal version of gettext if it's not installed
on the build system. We will simply disable NLS support in that case.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
If we are creating filesystem on DAX capable device, warn if set block
size is incompatible with DAX to give admin some hint why DAX might not
be available.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This option clears the uninitialized bit on all extents of all inodes.
Note that this can end up exposing uninitialized data to userspace.
It should only used in very specialized situations.
This option is only enabled via a new configure flag,
--enable-developer-features. It should *not* be enabled by
distributions, as it enables features thare only designed for use by
ext4 developers. These features have no documentation in the man
page, or regression tests, and if it breaks, you get to keep both
pieces.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
If we are using the system-provided blkid, check for the newer blkid
functions without adding -lblkid to @LIBS@. This prevents programs
(like badblocks) which don't use the blkid library getting linked
against it.
Addresses-Debian-Bug: #919958
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Add a new 'fakeroot' option to fuse2fs. When enabled, fuse2fs will
will pretend to be root when checking file permssions. This allows
fuse2fs to be used for building/modifying rootfs images as an
unprivileged user.
As per the maintainer's request, nosuid and nodev are automatically
enabled when fakeroot is selected (on platforms that support them)
to help prevent accidental misuse.
Signed-off-by: Nicholas Clark <nicholas.clark@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The e2fsprogs-libs-1.44.x.tar.gz subset distribution had a hack so
that "make install" would install the libraries via an implied "make
install-libs" --- since after all the tarball had was just the
libraries.
This commit makes "make install" behave the same was as the
e2fsprogs-libs distribution in the case of "configure --enable-subset"
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
There's no point creating two separate tarfiles. It's not clear
anyone was actually using the subset tarball --- and if they are, they
can replace it by the full source distribution and using the
--enable-subset option.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
It adds extra complexity for not much gain, and stands in the way of
generating the release tarfile via git archive.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Not all compilers (or versions of compilers) use the same LTO options
or behave the same way with LTO. In particular, using clang and the
current LTO options cause the build to fail. We should probably fix
up the configure script to handle Clang and LTO, but for now, we won't
enable LTO unless the user explicitly passes --enable-lto to the
configure script.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Enable the gcc/clang thread data corruption sanitizer if the builder
requests it and it's available.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Enable AddressSanitizer to look for memory usage errors if the builder
asks for it and it's available.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Enable the undefined behavior sanitizer (ubsan) if the builder requests
it and it's available.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Enable link time optimization (LTO) if the builder requests it. The
extra link optimization results in smaller binaries.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Add the ability to run the e2scrub utilities as a periodically scheduled
system service.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Implement online fsck for ext* filesystems which live on LVM-managed
logical volumes. The basic strategy mirrors that of e2croncheck --
create a snapshot, fsck the snapshot, report whatever errors appear,
remove snapshot. Unlike e2croncheck, this utility accepts any LVM
device path, knows about snapshots running out of space, and can call
fstrim having validated that the fs metadata is ok.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2mmpstatus is a Multi-Mount Protection (MMP) helper utility to read
an MMP block to see if it is being updated. It can also output the
latest update time, nodename, and device from the MMP block.
This is useful for HA and other maintenance scripts to determine if
the filesystem is in use on another node, and which node it is.
Signed-off-by: Shuichi Ihara <sihara@ddn.com>
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Moved e2mmpstatus checking/dumping code to be part of dumpe2fs rather
than a standalone program, using the "-m" option to check MMP status,
and "-i" to dump info. If dumpe2fs is called as "e2mmpstatus" (and
also "mmpstatus" for compatibility reasons), assume "-m" is specified.
Re-use the existing MMP block handing routines (with some changes) to
check and dump the MMP block, rather than adding duplicate versions.
Modify dumpe2fs to exit with a non-zero error code if there is an
error while reading the filesystem metadata or MMP block, or if
"-m" is used with the "mmp" feature and is in use by another node.
Add a configure check for gethostname() rather than depending on
_BSD_SOURCE or _XOPEN_SOURCE to be set.
Update the f_mmp, m_mmp, m_mmp_bad_csum, and m_mmp_bad_magic tests
to use e2mmpstatus to check and dump the MMP state before and after
e2fsck is run to verify that the tool is working correctly.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
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>
This checks for a dd that supports iflag=fullblock oflag=append,
and looks at gdd and dd for now, and warns of failing self-tests
if neither supports these two flags.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
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>
The mk_cmds and compile_et scripts include the build directory, which
breaks the build reproducibility goal of Debian.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
It uses clock_gettime() which in older glibc versions is in librt.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>