Skip to content

Commit

Permalink
Merge tag 'v1.47.1' into debian/master
Browse files Browse the repository at this point in the history
v1.47.1
  • Loading branch information
tytso committed May 21, 2024
2 parents 14c2e67 + 950a0d6 commit 1d356bc
Show file tree
Hide file tree
Showing 62 changed files with 464 additions and 136 deletions.
4 changes: 4 additions & 0 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ cc_defaults {
"libdl",
],
},
darwin: {
// This matches what the upstream CI uses
cflags: ["-Wno-error=deprecated-declarations"],
},
windows: {
include_dirs: ["external/e2fsprogs/include/mingw"],
},
Expand Down
3 changes: 0 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -15645,9 +15645,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu



fi
if test "$enable_fuzzer" = "yes" && test "$have_fuzzer" != "yes"; then
as_fn_error $? "Fuzzing not supported by compiler." "$LINENO" 5
fi

LINUX_CMT="#"
Expand Down
3 changes: 0 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1664,9 +1664,6 @@ if test "$enable_fuzzing" = "yes" || test "$enable_fuzzing" = "probe"; then
AC_SUBST(fuzzer_cflags)
AC_SUBST(fuzzer_ldflags)
fi
if test "$enable_fuzzer" = "yes" && test "$have_fuzzer" != "yes"; then
AC_MSG_ERROR([Fuzzing not supported by compiler.])
fi
AC_SUBST(FUZZING_CMT)
dnl
dnl OS-specific uncomment control
Expand Down
1 change: 1 addition & 0 deletions contrib/android/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cc_binary {
name: "e2fsdroid",
host_supported: true,
recovery_available: true,
vendor_available: true,
defaults: ["e2fsprogs-defaults"],

srcs: [
Expand Down
5 changes: 5 additions & 0 deletions contrib/android/e2fsdroid.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
#define UID_GID_MAP_MAX_EXTENTS 340
#endif

// disable leak detection, breaks host asan build
const char *__asan_default_options() {
return "detect_leaks=0";
}

static char *prog_name = "e2fsdroid";
static char *in_file;
static char *block_list;
Expand Down
123 changes: 73 additions & 50 deletions contrib/android/ext2simg.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@
#include <sparse/sparse.h>

struct {
int crc;
int sparse;
int gzip;
bool crc;
bool sparse;
bool gzip;
char *in_file;
char *out_file;
bool overwrite_input;
} params = {
.crc = 0,
.sparse = 1,
.gzip = 0,
.sparse = true,
};

#define ext2fs_fatal(Retval, Format, ...) \
Expand All @@ -60,39 +58,41 @@ static void usage(char *path)

static struct buf_item {
struct buf_item *next;
void *buf[0];
void *buf[];
} *buf_list;

static void add_chunk(ext2_filsys fs, struct sparse_file *s, blk_t chunk_start, blk_t chunk_end)
/*
* Add @num_blks blocks, starting at index @chunk_start, of the filesystem @fs
* to the sparse file @s.
*/
static void add_chunk(ext2_filsys fs, struct sparse_file *s,
blk_t chunk_start, int num_blks)
{
uint64_t len = (uint64_t)num_blks * fs->blocksize;
int64_t offset = (int64_t)chunk_start * fs->blocksize;
struct buf_item *bi;
int retval;
unsigned int nb_blk = chunk_end - chunk_start;
size_t len = nb_blk * fs->blocksize;
int64_t offset = (int64_t)chunk_start * (int64_t)fs->blocksize;

if (params.overwrite_input == false) {
if (!params.overwrite_input) {
if (sparse_file_add_file(s, params.in_file, offset, len, chunk_start) < 0)
sparse_fatal("adding data to the sparse file");
} else {
/*
* The input file will be overwritten, make a copy of
* the blocks
*/
struct buf_item *bi = calloc(1, sizeof(struct buf_item) + len);
if (buf_list == NULL)
buf_list = bi;
else {
bi->next = buf_list;
buf_list = bi;
}
return;
}

retval = io_channel_read_blk64(fs->io, chunk_start, nb_blk, bi->buf);
if (retval < 0)
ext2fs_fatal(retval, "reading block %u - %u", chunk_start, chunk_end);
/* The input file will be overwritten, so make a copy of the blocks. */
if (len > SIZE_MAX - sizeof(*bi))
sparse_fatal("filesystem is too large");
bi = calloc(1, sizeof(*bi) + len);
if (!bi)
sparse_fatal("out of memory");
bi->next = buf_list;
buf_list = bi;
retval = io_channel_read_blk64(fs->io, chunk_start, num_blks, bi->buf);
if (retval)
ext2fs_fatal(retval, "reading data from %s", params.in_file);

if (sparse_file_add_data(s, bi->buf, len, chunk_start) < 0)
sparse_fatal("adding data to the sparse file");
}
if (sparse_file_add_data(s, bi->buf, len, chunk_start) < 0)
sparse_fatal("adding data to the sparse file");
}

static void free_chunks(void)
Expand All @@ -106,13 +106,23 @@ static void free_chunks(void)
}
}

static blk_t fs_blocks_count(ext2_filsys fs)
{
blk64_t blks = ext2fs_blocks_count(fs->super);

/* libsparse assumes 32-bit block numbers. */
if ((blk_t)blks != blks)
sparse_fatal("filesystem is too large");
return blks;
}

static struct sparse_file *ext_to_sparse(const char *in_file)
{
errcode_t retval;
ext2_filsys fs;
struct sparse_file *s;
int64_t chunk_start = -1;
blk_t first_blk, last_blk, nb_blk, cur_blk;
blk_t fs_blks, cur_blk;

retval = ext2fs_open(in_file, 0, 0, 0, unix_io_manager, &fs);
if (retval)
Expand All @@ -122,11 +132,9 @@ static struct sparse_file *ext_to_sparse(const char *in_file)
if (retval)
ext2fs_fatal(retval, "while reading block bitmap of %s", in_file);

first_blk = ext2fs_get_block_bitmap_start2(fs->block_map);
last_blk = ext2fs_get_block_bitmap_end2(fs->block_map);
nb_blk = last_blk - first_blk + 1;
fs_blks = fs_blocks_count(fs);

s = sparse_file_new(fs->blocksize, (uint64_t)fs->blocksize * (uint64_t)nb_blk);
s = sparse_file_new(fs->blocksize, (uint64_t)fs_blks * fs->blocksize);
if (!s)
sparse_fatal("creating sparse file");

Expand All @@ -138,24 +146,39 @@ static struct sparse_file *ext_to_sparse(const char *in_file)
* larger than INT32_MAX (32-bit _and_ 64-bit systems).
* Make sure we do not create chunks larger than this limit.
*/
int64_t max_blk_per_chunk = (INT32_MAX - 12) / fs->blocksize;
int32_t max_blk_per_chunk = (INT32_MAX - 12) / fs->blocksize;

/* Iter on the blocks to merge contiguous chunk */
for (cur_blk = first_blk; cur_blk <= last_blk; ++cur_blk) {
/*
* Iterate through the filesystem's blocks, identifying "chunks" that
* are contiguous ranges of blocks that are in-use by the filesystem.
* Add each chunk to the sparse_file.
*/
for (cur_blk = ext2fs_get_block_bitmap_start2(fs->block_map);
cur_blk < fs_blks; ++cur_blk) {
if (ext2fs_test_block_bitmap2(fs->block_map, cur_blk)) {
/*
* @cur_blk is in-use. Append it to the pending chunk
* if there is one, otherwise start a new chunk.
*/
if (chunk_start == -1) {
chunk_start = cur_blk;
} else if (cur_blk - chunk_start + 1 == max_blk_per_chunk) {
add_chunk(fs, s, chunk_start, cur_blk);
/*
* Appending @cur_blk to the pending chunk made
* it reach the maximum length, so end it.
*/
add_chunk(fs, s, chunk_start, max_blk_per_chunk);
chunk_start = -1;
}
} else if (chunk_start != -1) {
add_chunk(fs, s, chunk_start, cur_blk);
/* @cur_blk is not in-use, so end the pending chunk. */
add_chunk(fs, s, chunk_start, cur_blk - chunk_start);
chunk_start = -1;
}
}
/* If there's still a pending chunk, end it. */
if (chunk_start != -1)
add_chunk(fs, s, chunk_start, cur_blk - 1);
add_chunk(fs, s, chunk_start, cur_blk - chunk_start);

ext2fs_free(fs);
return s;
Expand All @@ -165,14 +188,14 @@ static bool same_file(const char *in, const char *out)
{
struct stat st1, st2;

if (access(out, F_OK) == -1)
return false;

if (lstat(in, &st1) == -1)
if (stat(in, &st1) == -1)
ext2fs_fatal(errno, "stat %s\n", in);
if (lstat(out, &st2) == -1)
if (stat(out, &st2) == -1) {
if (errno == ENOENT)
return false;
ext2fs_fatal(errno, "stat %s\n", out);
return st1.st_ino == st2.st_ino;
}
return st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino;
}

int main(int argc, char *argv[])
Expand All @@ -184,13 +207,13 @@ int main(int argc, char *argv[])
while ((opt = getopt(argc, argv, "czS")) != -1) {
switch(opt) {
case 'c':
params.crc = 1;
params.crc = true;
break;
case 'z':
params.gzip = 1;
params.gzip = true;
break;
case 'S':
params.sparse = 0;
params.sparse = false;
break;
default:
usage(argv[0]);
Expand Down
21 changes: 20 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
e2fsprogs (1.47.1-1) unstable; urgency=medium

* New upstream version
* Clarify the lsattr and mklost+found man pages that they are applicable
for ext2, ext3, and ext4 file systems and not just for ext2. (Closes:
#1041115)
* Replace the build-depend on pkg-config with pkgconf to fix a Lintian
warning.
* E2fsck will now perform more consistency checks on EA (extended
attribute value) inodes.
* Fix a big where e2fsck could potentially leak an acl block when
releasing an orphan inode.
* Avoid a divide by zero crash in libext2fs if the container
infrastructure, such as lxcfs, reports that the system has zero CPU's
via sysconf(_SC_NPROCESSORS_CONF).

-- Theodore Y. Ts'o <tytso@mit.edu> Mon, 20 May 2024 15:28:06 -0400

e2fsprogs (1.47.1~rc2-1) unstable; urgency=medium

* New upstream version
* Update Chinese, Czech, French, Polish Romainian, Swedish, and
Ukrainian translations
* Fix libarchive support in mke2fs on mips64el (Closes: #1070042)
* Fix e2scrub when the "systemctl" package is installed instead of
systemd. (Closes: #1070107)
* Update to standards 4.7.0

-- Theodore Y. Ts'o <tytso@mit.edu> Wed, 01 May 2024 00:50:49 -0400
-- Theodore Y. Ts'o <tytso@mit.edu> Mon, 20 May 2024 15:24:47 -0400

e2fsprogs (1.47.1~rc1-3) unstable; urgency=medium

Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: e2fsprogs
Section: admin
Priority: required
Maintainer: Theodore Y. Ts'o <tytso@mit.edu>
Build-Depends: dpkg-dev (>= 1.22.5), gettext, texinfo, pkg-config, libarchive-dev, libfuse3-dev [linux-any kfreebsd-any] <!pkg.e2fsprogs.no-fuse2fs>, debhelper-compat (= 12), dh-exec, libblkid-dev, uuid-dev, m4, udev [linux-any], systemd [linux-any], systemd-dev [linux-any], cron [linux-any], dh-sequence-movetousr
Build-Depends: dpkg-dev (>= 1.22.5), gettext, texinfo, pkgconf, libarchive-dev, libfuse3-dev [linux-any kfreebsd-any] <!pkg.e2fsprogs.no-fuse2fs>, debhelper-compat (= 12), dh-exec, libblkid-dev, uuid-dev, m4, udev [linux-any], systemd [linux-any], systemd-dev [linux-any], cron [linux-any], dh-sequence-movetousr
Rules-Requires-Root: no
Standards-Version: 4.7.0
Homepage: http://e2fsprogs.sourceforge.net
Expand Down
18 changes: 10 additions & 8 deletions debugfs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -363,16 +363,18 @@ create_inode.o: $(srcdir)/../misc/create_inode.c $(top_builddir)/lib/config.h \
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \
$(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/fiemap.h \
$(srcdir)/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \
$(top_srcdir)/lib/support/nls-enable.h
$(top_srcdir)/lib/support/nls-enable.h \
$(srcdir)/../misc/create_inode_libarchive.h
create_inode_libarchive.o: $(srcdir)/../misc/create_inode_libarchive.c \
$(top_builddir)/lib/config.h $(srcdir)/../misc/create_inode_libarchive.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
$(top_builddir)/lib/ext2fs/ext2_types.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
$(top_srcdir)/lib/ext2fs/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \
$(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
$(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \
$(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/../misc/create_inode.h \
$(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/e2p/e2p.h \
$(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
$(top_srcdir)/lib/ext2fs/ext3_extents.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h \
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \
$(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/fiemap.h \
$(srcdir)/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \
$(top_srcdir)/lib/ext2fs/bitops.h \
$(srcdir)/../misc/create_inode_libarchive.h \
$(top_srcdir)/lib/support/nls-enable.h
xattrs.o: $(srcdir)/xattrs.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/support/cstring.h \
Expand Down
21 changes: 18 additions & 3 deletions doc/RelNotes/v1.47.1.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
E2fsprogs 1.47.1 (May 1, 2024)
==============================
E2fsprogs 1.47.1 (May 20, 2024)
===============================

Updates/Fixes since v1.47.0:

Expand Down Expand Up @@ -60,6 +60,16 @@ In the case where e2fsck comes across an orphan file which is empty but
the orphan_present feature is set, in preen mode, e2fsck will now clear
the orphan_present feature flag silently.

E2fsck will now perform more consistency checks on EA (extended
attribute value) inodes.

Fix a big where e2fsck could potentially leak an acl block when
releasing an orphan inode.

Avoid a divide by zero crash in libext2fs if the container
infrastructure, such as lxcfs, reports that the system has zero CPU's
via sysconf(_SC_NPROCESSORS_CONF).

When resize2fs is performing an online resize, it's possible for reading
the superblock can race with a kernel modifying the superblock with the
checksum being invalid and causing the resize to fail with an bad
Expand Down Expand Up @@ -123,7 +133,8 @@ systemd. (Addresses Debian Bug #1070107)

Fixed/improved various Debian packaging issues.

Update and clarify various man pages. (Addresses Debian Bug #1038286)
Update and clarify various man pages. (Addresses Debian Bugs #1038286,
#1041115)



Expand Down Expand Up @@ -169,6 +180,10 @@ Fix various portability problems in the regression test suite.

Fix various sanitizer, static code analysis, and compiler warnings.

Synchronized changes from Android's AOSP e2fsprogs tree.

Updated config.guess and config.sub with newer versions from the FSF.

Add Romainian translation.

Update Chinese, Czech, French, Malay, Polish, Swedish, and Ukrainian
Expand Down
6 changes: 6 additions & 0 deletions e2fsck/e2fsck.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,12 @@ extern struct dx_dir_info *e2fsck_dx_dir_info_iter(e2fsck_t ctx,
typedef __u64 ea_key_t;
typedef __u64 ea_value_t;

/*
* Special refcount value we use for inodes which have EA_INODE flag set but we
* do not yet know about any references.
*/
#define EA_INODE_NO_REFS (~(ea_value_t)0)

extern errcode_t ea_refcount_create(size_t size, ext2_refcount_t *ret);
extern void ea_refcount_free(ext2_refcount_t refcount);
extern errcode_t ea_refcount_fetch(ext2_refcount_t refcount, ea_key_t ea_key,
Expand Down
Loading

0 comments on commit 1d356bc

Please sign in to comment.