Compare commits

...

No commits in common. "factory" and "SLE_15_SP4" have entirely different histories.

23 changed files with 927 additions and 4576 deletions

2
.gitattributes vendored
View File

@ -21,3 +21,5 @@
*.xz filter=lfs diff=lfs merge=lfs -text *.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text
## Specific LFS patterns
e2fsprogs.keyring filter=lfs diff=lfs merge=lfs -text

2
.lfsconfig Normal file
View File

@ -0,0 +1,2 @@
[lfs]
url = http://gitea.opensuse.org:9999/gitlfs

View File

@ -1,4 +0,0 @@
<multibuild>
<package>fuse2fs</package>
</multibuild>

View File

@ -0,0 +1,81 @@
From bdcd8e7bbc374e28fa699031ad2dd83ed4bc70b4 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 23 Aug 2021 16:44:25 +0200
Subject: [PATCH 7/8] debugfs: Fix headers for quota commands
X-Developer-Signature: v=1; a=openpgp-sha256; l=4088; h=from:subject;
bh=DMtVDsyxwY63aIschGhsYoFtaRzgKdcoj+H6ag3wBwA=;
b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBhI8GmjMKrGf+RnVrgOxdjhO+t478ULkN2q+GNTt0j
Guy1xK+JATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCYSPBpgAKCRCcnaoHP2RA2QAlB/
9TcSu83oYIMfsnjdrDQJRJLdaWiCSP5A5IET00b2JGlqWkSjTLUhcJUHPWq5ZB9q2hLp8z4V4DoTBT
dsDPDPqSS6PmG5jdbjU29Gz/iOmUSnNl1IDCHhO/HJwg5DA+fbwpIC1tbNfw6XpvvqpTi6yYJ6B1LP
byj3D2PLrvqQDtoxc+V90n59U/irl9HqVh6BJOBlhyYvOdbAkvunt6LIsQZvuVmjcpL+TYhcI+S6Ey
fkyC3hebYfeKTg/ZQunW3bJkhso+XRQqUPGDTU393G3SFn5lywV2pMhhupdW7Rek0BjymcqDEqyhDS
VRa3oN+/KSiVWg1qy2JAM+ErlZu5fU
X-Developer-Key: i=jack@suse.cz; a=openpgp;
fpr=93C6099A142276A28BBE35D815BC833443038D8C
list_quota and get_quota commands have 'blocks' header while what they
actually show is a used space in bytes. Fix the header to state 'space'
instead.
Signed-off-by: Jan Kara <jack@suse.cz>
---
debugfs/quota.c | 4 ++--
tests/f_orphquot/expect | 4 ++--
tests/f_quota/expect.0 | 12 ++++++------
3 files changed, 10 insertions(+), 10 deletions(-)
Index: e2fsprogs-1.46.4/debugfs/quota.c
===================================================================
--- e2fsprogs-1.46.4.orig/debugfs/quota.c
+++ e2fsprogs-1.46.4/debugfs/quota.c
@@ -123,7 +123,7 @@ void do_list_quota(int argc, char *argv[
printf("%7s %2s %8s %8s %8s %8s %8s %8s\n",
quota_type[type], "id",
- "blocks", "quota", "limit", "inodes", "quota", "limit");
+ "space", "quota", "limit", "inodes", "quota", "limit");
qh = current_qctx->quota_file[type];
retval = qh->qh_ops->scan_dquots(qh, list_quota_callback, NULL);
if (retval) {
@@ -158,7 +158,7 @@ void do_get_quota(int argc, char *argv[]
printf("%7s %2s %8s %8s %8s %8s %8s %8s\n",
quota_type[type], "id",
- "blocks", "quota", "limit", "inodes", "quota", "limit");
+ "space", "quota", "limit", "inodes", "quota", "limit");
qh = current_qctx->quota_file[type];
Index: e2fsprogs-1.46.4/tests/f_quota/expect.0
===================================================================
--- e2fsprogs-1.46.4.orig/tests/f_quota/expect.0
+++ e2fsprogs-1.46.4/tests/f_quota/expect.0
@@ -1,21 +1,21 @@
debugfs: list_quota user
- user id blocks quota limit inodes quota limit
+ user id space quota limit inodes quota limit
0 13312 0 0 2 0 0
34 1024 0 0 1 0 0
100 2048 32 50 2 20 30
debugfs: list_quota group
- group id blocks quota limit inodes quota limit
+ group id space quota limit inodes quota limit
0 16384 0 0 5 0 0
debugfs: get_quota user 0
- user id blocks quota limit inodes quota limit
+ user id space quota limit inodes quota limit
0 13312 0 0 2 0 0
debugfs: get_quota user 100
- user id blocks quota limit inodes quota limit
+ user id space quota limit inodes quota limit
100 2048 32 50 2 20 30
debugfs: get_quota user 34
- user id blocks quota limit inodes quota limit
+ user id space quota limit inodes quota limit
34 1024 0 0 1 0 0
debugfs: get_quota group 0
- group id blocks quota limit inodes quota limit
+ group id space quota limit inodes quota limit
0 16384 0 0 5 0 0
debugfs:

View File

@ -0,0 +1,43 @@
From 1f3a91cf868ededb19b3b37caa3352f67e66a10a Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 23 Aug 2021 17:04:52 +0200
Subject: [PATCH 5/8] e2fsck: Do not trash user limits when processing orphan
list
X-Developer-Signature: v=1; a=openpgp-sha256; l=770; h=from:subject;
bh=qzGpt7+UOJv3hwzSLcLGr0hCRSh47K/myPGChyylU8U=;
b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBhI8GlX5hq3rRf6HziKT8bgW4lwXuVz7w+FuGOUcPK
Xw3NgfGJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCYSPBpQAKCRCcnaoHP2RA2R2qCA
DhX7BXpS8G05CmyapN9NiAu63JaSVW4o084uvfnud8EdFUMXbOkwGndcOty1Uk09HXfvVkeaZVTmkv
pVfz8s4Vi/vjqCPOkxo7HiElNKlm/s/yCGP05ByfwhCqCXKKoaODsbMZJHz4bpUbfxo+qcBD1C0XuE
tYgIzL35Jo0rJA65NyBao65L1jTDw4EZGykaYszfZjPayimYg3z2wl0Kv6qT+niYmOw+6w43O6b+6L
vgIv8E0XTR0Pc0/JGhfydCSqYM+zoJXpcuURhap0hIo+j3x8FvRGu5ws5tM5Nw0dLmm/MqiDxfBSdA
VYBJ83ewrnLu//5q0Kljfxo6T3qN4W
X-Developer-Key: i=jack@suse.cz; a=openpgp;
fpr=93C6099A142276A28BBE35D815BC833443038D8C
When e2fsck was loading quotas to process orphan list, it was loading
only quota usage. However subsequent quota writeout has effectively
overwritten quota limits, loosing them forever. Make sure quota limits
are preserved over orphan replay.
Signed-off-by: Jan Kara <jack@suse.cz>
---
e2fsck/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/e2fsck/super.c b/e2fsck/super.c
index 75b7b8ffa9b6..4ffafb211e50 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -282,7 +282,7 @@ static errcode_t e2fsck_read_all_quotas(e2fsck_t ctx)
continue;
retval = quota_read_all_dquots(ctx->qctx, qf_ino, qtype,
- QREAD_USAGE);
+ QREAD_USAGE | QREAD_LIMITS);
if (retval)
break;
}
--
2.26.2

BIN
e2fsprogs-1.46.4.tar.sign Normal file

Binary file not shown.

3
e2fsprogs-1.46.4.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b11042533c1b1dcf17512f0da48e05b0c573dada1dd8b762864d10f4dc399713
size 7035200

Binary file not shown.

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2f16c9176704cf645dc69d5b15ff704ae722d665df38b2ed3cfc249757d8d81e
size 7040672

View File

@ -1,58 +1,47 @@
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Dec 27 10:34:50 UTC 2022 - Ludwig Nussel <lnussel@suse.com> Fri Apr 29 15:49:06 UTC 2022 - Jan Kara <jack@suse.cz>
- Replace transitional %usrmerged macro with regular version check (boo#1206798) - libext2fs-add-sanity-check-to-extent-manipulation.patch: libext2fs: add
sanity check to extent manipulation (bsc#1198446 CVE-2022-1304)
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 15 10:23:25 UTC 2022 - Dominique Leuenberger <dimstar@opensuse.org> Mon Oct 4 16:57:08 UTC 2021 - Jan Kara <jack@suse.cz>
- Refresh e2fsprogs.keyring based on currently provided keys. - Add references from old package:
Autoreconf removed from the spec file, just without bsc reference
------------------------------------------------------------------- (bsc#1183791)
Wed Sep 14 14:47:43 UTC 2022 - Dominique Leuenberger <dimstar@opensuse.org> Fix po-remove-unnecessary-buggy-positional-parameter-spe.patch in 1.45.3
(bsc#1170964)
- Spec file cleanup: Fix e2fsck-clarify-overflow-link-count-error-message.patch in 1.46.0
+ Drop remainders regarding -mini packages, which was not a thing (bsc#1160979)
since Jan 2014. Fix ext2fs-update-allocation-info-earlier-in-ext2fs_mkdi.patch in 1.46.0
+ Split build of fuse2fs out into a sep build (_multibuild (bsc#1160979)
enabled). Fix ext2fs-implement-dir-entry-creation-in-htree-directo.patch in 1.46.0
(bsc#1160979)
------------------------------------------------------------------- Fix tests-add-test-to-excercise-indexed-directories-with.patch in 1.46.0
Tue Sep 13 13:47:21 UTC 2022 - Christian Goll <cgoll@suse.com> (bsc#1160979)
Fix tune2fs-update-dir-checksums-when-clearing-dir_index.patch in 1.46.0
- enabled fuse2fs build which enable to mount ext2/3/4 via FUSE (bsc#1160979)
Fix e2fsck-abort-if-there-is-a-corrupted-directory-block.patch in 1.45.5
------------------------------------------------------------------- (bsc#1160571 CVE-2019-5188)
Tue Apr 19 20:51:15 UTC 2022 - Dirk Müller <dmueller@suse.com> Fix e2fsck-don-t-try-to-rehash-a-deleted-directory.patch in 1.45.5
(bsc#1160571 CVE-2019-5188)
- avoid empty preuninstall script Fix resize2fs-Make-minimum-size-estimates-more-reliable.patch in 1.45.5
(bsc#1154295)
------------------------------------------------------------------- Fix libsupport-add-checks-to-prevent-buffer-overrun-bugs.patch in 1.45.4
Fri Jan 28 15:40:35 UTC 2022 - Jan Kara <jack@suse.cz> (bsc#1152101 CVE-2019-5094)
Fix libext2fs-call-fsync-2-to-clear-stale-errors-for-a-n.patch in 1.44.3
- Update to 1.46.5: (bsc#1145716)
* better handling for resizing to fs sizes which would exceed inode limits Fix e2fsck-check-and-fix-tails-of-all-bitmaps.patch in 1.45.1 (bsc#1128383)
* fix crash in e2fsck fastcommit handling Fix libext2fs-Fix-fsync-2-detection.patch in 1.44.0 (bsc#1038194)
* fix possibly lost quota limits when e2fsck corrects quota files Fix resize2fs-Fix-32-64-bit-overflow-when-multiplying-by-blocks-cl.patch
* fix tune2fs to properly transfer quota limits when convertion quota files in 1.42.12 (bsc#1009532)
* add support for handling of version 0 quota files in tune2fs Fix libext2fs-fix-potential-buffer-overflow-in-closefs.patch
* teach libss to use libreadline.so.8 in 1.42.13 (bsc#918346 CVE-2015-1572)
* optimize resize2fs cpu usage for large filesystems Fix libext2fs-avoid-buffer-overflow-if-s_first_meta_bg-i.patch
* teach libuuid to use getrandom() or getentropy() if available in 1.42.12 (bsc#915402 CVE-2015-0247)
- libss-add-newer-libreadline.so.8-to-dlopen-path.patch: Remove, merged upstream Got specfile fix through Factory (bsc#960273)
- quota-Add-support-to-version-0-quota-format.patch: Remove, merged upstream Fix libext2fs-don-t-ignore-fsync-errors.patch in 1.43.4 (bsc#1038194)
- quota-Fold-quota_read_all_dquots-into-quota_update_l.patch: Remove, merged upstream
- quota-Rename-quota_update_limits-to-quota_read_all_d.patch: Remove, merged upstream
- tune2fs-Fix-conversion-of-quota-files.patch: Remove, merged upstream
- e2fsck-Do-not-trash-user-limits-when-processing-orph.patch: Remove, merged upstream
- debugfs-Fix-headers-for-quota-commands.patch: Remove, merged upstream
- quota-Drop-dead-code.patch: Remove, merged upstream
-------------------------------------------------------------------
Fri Oct 15 12:11:41 UTC 2021 - Johannes Segitz <jsegitz@suse.com>
- Drop ProtectClock hardening, can cause issues if other device acceess is needed
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 30 14:13:06 UTC 2021 - Jan Kara <jack@suse.cz> Thu Sep 30 14:13:06 UTC 2021 - Jan Kara <jack@suse.cz>

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
# #
# spec file for package e2fsprogs # spec file for package e2fsprogs
# #
# Copyright (c) 2023 SUSE LLC # Copyright (c) 2021 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -16,31 +16,72 @@
# #
%define flavor @BUILD_FLAVOR@%nil %define build_mini 0
%if "%{flavor}" == ""
Name: e2fsprogs Name: e2fsprogs
Summary: Utilities for the Second Extended File System
License: GPL-2.0-only
%if 0%{?suse_version} >= 1010 %if 0%{?suse_version} >= 1010
# Hint for ZYPP # Hint for ZYPP
Supplements: filesystem(ext2) filesystem(ext3) filesystem(ext4) Supplements: filesystem(ext2) filesystem(ext3) filesystem(ext4)
%endif %endif
%if 0%{?suse_version} >= 1210
%bcond_without systemd
%else %else
Name: fuse2fs %bcond_with systemd
Summary: FUSE file system client for ext2/ext3/ext4 file systems
License: MIT
BuildRequires: fuse-devel
%endif %endif
Version: 1.46.5 BuildRequires: libblkid-devel
BuildRequires: libuuid-devel
BuildRequires: pkg-config
BuildRequires: xz
%if ! %{build_mini}
%if 0%{?suse_version} > 1220
BuildRequires: makeinfo
%endif
# Define info macros if missing (for Fedora builds)
%if ! 0%{?suse_version}
%define install_info_prereq info
%define install_info sbin/install-info
%define install_info_delete sbin/install-info --delete
Requires(post): %install_info_prereq
Requires(preun): %install_info_prereq
%endif
%endif
# bug437293
%ifarch ppc64
Obsoletes: e2fsprogs-64bit
%endif
%if %{build_mini}
Conflicts: e2fsprogs
Conflicts: e2fsprogs-devel
Conflicts: libext2fs2
Conflicts: libext2fs-devel
Conflicts: libcom_err2
Conflicts: libcom_err-devel
%else
Conflicts: e2fsprogs-mini
Conflicts: e2fsprogs-mini-devel
Conflicts: libext2fs2-mini
Conflicts: libext2fs-mini-devel
Conflicts: libcom_err2-mini
Conflicts: libcom_err-mini-devel
%endif
#
Version: 1.46.4
Release: 0 Release: 0
Summary: Utilities for the Second Extended File System
License: GPL-2.0-only
Group: System/Filesystems Group: System/Filesystems
URL: http://e2fsprogs.sourceforge.net URL: http://e2fsprogs.sourceforge.net
# For regenerate_initrd_post macro
Requires(post): /usr/bin/mkdir /usr/bin/touch
Requires: libcom_err2 >= %{version}
Requires: libext2fs2 >= %{version}
Suggests: e2fsprogs-scrub
Source: http://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v%{version}/e2fsprogs-%{version}.tar.xz Source: http://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v%{version}/e2fsprogs-%{version}.tar.xz
Source2: README.SUSE Source2: README.SUSE
Source3: baselibs.conf Source3: baselibs.conf
Source4: http://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v%{version}/e2fsprogs-%{version}.tar.sign Source4: http://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v%{version}/e2fsprogs-%{version}.tar.sign
Source5: https://thunk.org/tytso/tytso-key.asc#/e2fsprogs.keyring Source5: https://thunk.org/tytso/tytso-key.asc#/%{name}.keyring
# #
# e2fsprogs patches # e2fsprogs patches
# #
@ -52,37 +93,15 @@ Patch6: harden_e2scrub@.service.patch
Patch7: harden_e2scrub_all.service.patch Patch7: harden_e2scrub_all.service.patch
Patch8: harden_e2scrub_fail@.service.patch Patch8: harden_e2scrub_fail@.service.patch
Patch9: harden_e2scrub_reap.service.patch Patch9: harden_e2scrub_reap.service.patch
BuildRequires: libblkid-devel Patch10: libss-add-newer-libreadline.so.8-to-dlopen-path.patch
BuildRequires: libuuid-devel Patch11: quota-Add-support-to-version-0-quota-format.patch
BuildRequires: pkg-config Patch12: quota-Fold-quota_read_all_dquots-into-quota_update_l.patch
BuildRequires: xz Patch13: quota-Rename-quota_update_limits-to-quota_read_all_d.patch
%if "%{flavor}" == "" Patch14: tune2fs-Fix-conversion-of-quota-files.patch
%if 0%{?suse_version} >= 1210 Patch15: e2fsck-Do-not-trash-user-limits-when-processing-orph.patch
%bcond_without systemd Patch16: debugfs-Fix-headers-for-quota-commands.patch
%else Patch17: quota-Drop-dead-code.patch
%bcond_with systemd Patch18: libext2fs-add-sanity-check-to-extent-manipulation.patch
%endif
%if 0%{?suse_version} > 1220
BuildRequires: makeinfo
%endif
# Define info macros if missing (for Fedora builds)
%if ! 0%{?suse_version}
%define install_info_prereq info
%define install_info sbin/install-info
%define install_info_delete sbin/install-info --delete
Requires(post): %install_info_prereq
Requires(preun):%install_info_prereq
%endif
# bug437293
%ifarch ppc64
Obsoletes: e2fsprogs-64bit
%endif
#
# For regenerate_initrd_post macro
Requires(post): /usr/bin/mkdir /usr/bin/touch
Requires: libcom_err2 >= %{version}
Requires: libext2fs2 >= %{version}
Suggests: e2fsprogs-scrub
# Do not suppress make commands # Do not suppress make commands
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -90,13 +109,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
Utilities needed to create and maintain ext2 and ext3 file systems Utilities needed to create and maintain ext2 and ext3 file systems
under Linux. Included in this package are: chattr, lsattr, mke2fs, under Linux. Included in this package are: chattr, lsattr, mke2fs,
mklost+found, tune2fs, e2fsck, resize2fs, and badblocks. mklost+found, tune2fs, e2fsck, resize2fs, and badblocks.
%else
%description
fuse2fs is a FUSE file system client that supports reading and
writing from devices or image files containing ext2, ext3, and
ext4 file systems.
%endif
%package devel %package devel
Summary: Dummy development package Summary: Dummy development package
@ -114,7 +126,11 @@ Requires: libuuid-devel
%description devel %description devel
Dummy development package for backwards compatibility. Dummy development package for backwards compatibility.
%if %{build_mini}
%package -n e2fsprogs-scrub-mini
%else
%package -n e2fsprogs-scrub %package -n e2fsprogs-scrub
%endif
Summary: Ext2fs scrubbing scripts and service files Summary: Ext2fs scrubbing scripts and service files
License: GPL-2.0-only License: GPL-2.0-only
Group: System/Filesystems Group: System/Filesystems
@ -131,24 +147,41 @@ Requires: util-linux
Scripts and systemd service files for background scrubbing of LVM volumes Scripts and systemd service files for background scrubbing of LVM volumes
with ext2, ext3, and ext4 filesystems. with ext2, ext3, and ext4 filesystems.
%if %{build_mini}
%package -n libext2fs2-mini
%else
%package -n libext2fs2 %package -n libext2fs2
%endif
Summary: Ext2fs library Summary: Ext2fs library
License: LGPL-2.0-only License: LGPL-2.0-only
Group: System/Filesystems Group: System/Filesystems
%if %{build_mini}
%description -n libext2fs2-mini
%else
%description -n libext2fs2 %description -n libext2fs2
%endif
The basic Ext2fs shared library. The basic Ext2fs shared library.
%if %{build_mini}
%package -n libext2fs-mini-devel
%else
%package -n libext2fs-devel %package -n libext2fs-devel
%endif
Summary: Development files for libext2fs Summary: Development files for libext2fs
License: LGPL-2.0-only License: LGPL-2.0-only
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: libcom_err-devel Requires: libcom_err-devel
Requires: libext2fs2 = %version Requires: libext2fs2 = %version
%if %{build_mini}
%description -n libext2fs-mini-devel
%else
%description -n libext2fs-devel %description -n libext2fs-devel
%endif
Development files for libext2fs. Development files for libext2fs.
%if ! %{build_mini}
%package -n libext2fs-devel-static %package -n libext2fs-devel-static
Summary: Development files for libext2fs Summary: Development files for libext2fs
License: LGPL-2.0-only License: LGPL-2.0-only
@ -159,8 +192,13 @@ Provides: libext2fs-devel:%{_libdir}/libext2fs.a
%description -n libext2fs-devel-static %description -n libext2fs-devel-static
Development files for libext2fs. Static libraries. Development files for libext2fs. Static libraries.
%endif
%if %{build_mini}
%package -n libcom_err2-mini
%else
%package -n libcom_err2 %package -n libcom_err2
%endif
Summary: E2fsprogs error reporting library Summary: E2fsprogs error reporting library
# bug437293 # bug437293
License: MIT License: MIT
@ -173,10 +211,18 @@ Obsoletes: libcom_err2-64bit
Provides: libcom_err = %{version} Provides: libcom_err = %{version}
Obsoletes: libcom_err <= 1.40 Obsoletes: libcom_err <= 1.40
%if %{build_mini}
%description -n libcom_err2-mini
%else
%description -n libcom_err2 %description -n libcom_err2
%endif
com_err is an error message display library. com_err is an error message display library.
%if %{build_mini}
%package -n libcom_err-mini-devel
%else
%package -n libcom_err-devel %package -n libcom_err-devel
%endif
Summary: Development files for libcom_err Summary: Development files for libcom_err
# bug437293 # bug437293
License: MIT License: MIT
@ -188,9 +234,14 @@ Obsoletes: libcom_err-devel-64bit
Requires: glibc-devel Requires: glibc-devel
Requires: libcom_err2 = %version Requires: libcom_err2 = %version
%if %{build_mini}
%description -n libcom_err-mini-devel
%else
%description -n libcom_err-devel %description -n libcom_err-devel
%endif
Development files for the com_err error message display library. Development files for the com_err error message display library.
%if ! %{build_mini}
%package -n libcom_err-devel-static %package -n libcom_err-devel-static
Summary: Development files for libcom_err, static libraries Summary: Development files for libcom_err, static libraries
License: MIT License: MIT
@ -206,6 +257,7 @@ Obsoletes: libcom_err-devel-64bit
%description -n libcom_err-devel-static %description -n libcom_err-devel-static
Development files for the com_err error message display library. Static libraries. Development files for the com_err error message display library. Static libraries.
%endif
%prep %prep
%setup -q -n e2fsprogs-%{version} %setup -q -n e2fsprogs-%{version}
@ -218,6 +270,15 @@ cp %{SOURCE2} .
%patch7 -p1 %patch7 -p1
%patch8 -p1 %patch8 -p1
%patch9 -p1 %patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%build %build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects %global _lto_cflags %{_lto_cflags} -ffat-lto-objects
@ -231,19 +292,21 @@ cp %{SOURCE2} .
--without-crond-dir \ --without-crond-dir \
--with-systemd-unit-dir=%{?_unitdir} \ --with-systemd-unit-dir=%{?_unitdir} \
CFLAGS="$RPM_OPT_FLAGS" CFLAGS="$RPM_OPT_FLAGS"
%if %{build_mini}
rm -rf doc
%endif
make %{?_smp_mflags} V=1 make %{?_smp_mflags} V=1
#Guarantee that tranlations match the source messages #Guarantee that tranlations match the source messages
make -C po update-po make -C po update-po
%install %install
%if "%{flavor}" == ""
make install install-libs DESTDIR=$RPM_BUILD_ROOT ELF_INSTALL_DIR=/%{_libdir} make install install-libs DESTDIR=$RPM_BUILD_ROOT ELF_INSTALL_DIR=/%{_libdir}
%{find_lang} e2fsprogs %{find_lang} e2fsprogs
rm $RPM_BUILD_ROOT%{_libdir}/e2initrd_helper rm $RPM_BUILD_ROOT%{_libdir}/e2initrd_helper
%if 0%{?suse_version} < 1550 %if !0%{?usrmerged}
mkdir %{buildroot}/sbin mkdir %{buildroot}/sbin
ln -s %{_sbindir}/badblocks %{buildroot}/sbin/badblocks ln -s %{_sbindir}/badblocks %{buildroot}/sbin/badblocks
ln -s %{_sbindir}/debugfs %{buildroot}/sbin/debugfs ln -s %{_sbindir}/debugfs %{buildroot}/sbin/debugfs
@ -273,51 +336,88 @@ done
%endif %endif
%if %{with systemd} %if %{with systemd}
%if %{build_mini}
%pre -n e2fsprogs-scrub-mini
%else
%pre -n e2fsprogs-scrub %pre -n e2fsprogs-scrub
%endif
%service_add_pre e2scrub@.service e2scrub_all.service e2scrub_all.timer e2scrub_fail@.service e2scrub_reap.service %service_add_pre e2scrub@.service e2scrub_all.service e2scrub_all.timer e2scrub_fail@.service e2scrub_reap.service
%endif %endif
%post %post
/sbin/ldconfig /sbin/ldconfig
%if ! %{build_mini}
%if 0%{?suse_version} <= 1530 %if 0%{?suse_version} <= 1530
%install_info --info-dir=%{_infodir} %{_infodir}/libext2fs.info.gz %install_info --info-dir=%{_infodir} %{_infodir}/libext2fs.info.gz
%endif %endif
%{?regenerate_initrd_post} %{?regenerate_initrd_post}
%endif
%if %{with systemd} %if %{with systemd}
%if %{build_mini}
%post -n e2fsprogs-scrub-mini
%else
%post -n e2fsprogs-scrub %post -n e2fsprogs-scrub
%endif
%service_add_post e2scrub@.service e2scrub_all.service e2scrub_all.timer e2scrub_fail@.service e2scrub_reap.service %service_add_post e2scrub@.service e2scrub_all.service e2scrub_all.timer e2scrub_fail@.service e2scrub_reap.service
%endif %endif
%if %{with systemd} %if %{with systemd}
%if 0%{?suse_version} <= 1530 %if %{build_mini}
%preun -n e2fsprogs-scrub-mini
%else
%preun %preun
%if 0%{?suse_version} <= 1530
%install_info_delete --info-dir=%{_infodir} %{_infodir}/libext2fs.info.gz %install_info_delete --info-dir=%{_infodir} %{_infodir}/libext2fs.info.gz
%endif %endif
%preun -n e2fsprogs-scrub %preun -n e2fsprogs-scrub
%endif
%service_del_preun e2scrub@.service e2scrub_all.service e2scrub_all.timer e2scrub_fail@.service e2scrub_reap.service %service_del_preun e2scrub@.service e2scrub_all.service e2scrub_all.timer e2scrub_fail@.service e2scrub_reap.service
%endif %endif
%postun %postun
/sbin/ldconfig /sbin/ldconfig
%if ! %{build_mini}
%{?regenerate_initrd_post} %{?regenerate_initrd_post}
%endif
%if %{with systemd} %if %{with systemd}
%if %{build_mini}
%postun -n e2fsprogs-scrub-mini
%else
%postun -n e2fsprogs-scrub %postun -n e2fsprogs-scrub
%endif
%service_del_postun e2scrub@.service e2scrub_all.service e2scrub_all.timer e2scrub_fail@.service e2scrub_reap.service %service_del_postun e2scrub@.service e2scrub_all.service e2scrub_all.timer e2scrub_fail@.service e2scrub_reap.service
%endif %endif
%if ! %{build_mini}
%posttrans %posttrans
%{?regenerate_initrd_posttrans} %{?regenerate_initrd_posttrans}
%endif
%if %{build_mini}
%post -n libext2fs2-mini -p /sbin/ldconfig
%else
%post -n libext2fs2 -p /sbin/ldconfig %post -n libext2fs2 -p /sbin/ldconfig
%endif
%if %{build_mini}
%postun -n libext2fs2-mini -p /sbin/ldconfig
%else
%postun -n libext2fs2 -p /sbin/ldconfig %postun -n libext2fs2 -p /sbin/ldconfig
%endif
%if %{build_mini}
%post -n libcom_err2-mini -p /sbin/ldconfig
%else
%post -n libcom_err2 -p /sbin/ldconfig %post -n libcom_err2 -p /sbin/ldconfig
%endif
%if %{build_mini}
%postun -n libcom_err2-mini -p /sbin/ldconfig
%else
%postun -n libcom_err2 -p /sbin/ldconfig %postun -n libcom_err2 -p /sbin/ldconfig
%endif
%files -f e2fsprogs.lang %files -f e2fsprogs.lang
%defattr(-, root, root) %defattr(-, root, root)
@ -326,7 +426,7 @@ done
%license NOTICE %license NOTICE
%endif %endif
%config /etc/mke2fs.conf %config /etc/mke2fs.conf
%if 0%{?suse_version} < 1550 %if !0%{?usrmerged}
/sbin/badblocks /sbin/badblocks
/sbin/debugfs /sbin/debugfs
/sbin/dumpe2fs /sbin/dumpe2fs
@ -363,7 +463,7 @@ done
%{_sbindir}/resize2fs %{_sbindir}/resize2fs
%{_sbindir}/tune2fs %{_sbindir}/tune2fs
%{_sbindir}/e2image %{_sbindir}/e2image
%{_sbindir}/logsave %{_sbindir}/logsave
%{_bindir}/chattr %{_bindir}/chattr
%{_bindir}/lsattr %{_bindir}/lsattr
%{_sbindir}/mklost+found %{_sbindir}/mklost+found
@ -371,7 +471,9 @@ done
%{_sbindir}/e2freefrag %{_sbindir}/e2freefrag
%{_sbindir}/e4defrag %{_sbindir}/e4defrag
%{_sbindir}/e4crypt %{_sbindir}/e4crypt
%if ! %{build_mini}
%{_infodir}/libext2fs.info.gz %{_infodir}/libext2fs.info.gz
%endif
%{_mandir}/man1/chattr.1.gz %{_mandir}/man1/chattr.1.gz
%{_mandir}/man1/lsattr.1.gz %{_mandir}/man1/lsattr.1.gz
%{_mandir}/man5/ext?.5.gz %{_mandir}/man5/ext?.5.gz
@ -383,7 +485,11 @@ done
%defattr(-,root,root) %defattr(-,root,root)
%doc README.SUSE %doc README.SUSE
%if %{build_mini}
%files -n e2fsprogs-scrub-mini
%else
%files -n e2fsprogs-scrub %files -n e2fsprogs-scrub
%endif
%defattr(-,root,root) %defattr(-,root,root)
%config /etc/e2scrub.conf %config /etc/e2scrub.conf
%{_sbindir}/e2scrub %{_sbindir}/e2scrub
@ -398,16 +504,24 @@ done
%{_unitdir}/e2scrub_reap.service %{_unitdir}/e2scrub_reap.service
%endif %endif
%if %{build_mini}
%files -n libext2fs2-mini
%else
%files -n libext2fs2 %files -n libext2fs2
%endif
%defattr(-, root, root) %defattr(-, root, root)
%if 0%{?suse_version} < 1550 %if !0%{?usrmerged}
/%{_lib}/libext2fs.so.* /%{_lib}/libext2fs.so.*
/%{_lib}/libe2p.so.* /%{_lib}/libe2p.so.*
%endif %endif
%{_libdir}/libext2fs.so.* %{_libdir}/libext2fs.so.*
%{_libdir}/libe2p.so.* %{_libdir}/libe2p.so.*
%if %{build_mini}
%files -n libext2fs-mini-devel
%else
%files -n libext2fs-devel %files -n libext2fs-devel
%endif
%defattr(-, root, root) %defattr(-, root, root)
%{_libdir}/libext2fs.so %{_libdir}/libext2fs.so
%{_libdir}/libe2p.so %{_libdir}/libe2p.so
@ -416,16 +530,24 @@ done
%_libdir/pkgconfig/e2p.pc %_libdir/pkgconfig/e2p.pc
%_libdir/pkgconfig/ext2fs.pc %_libdir/pkgconfig/ext2fs.pc
%if %{build_mini}
%files -n libcom_err2-mini
%else
%files -n libcom_err2 %files -n libcom_err2
%endif
%defattr(-, root, root) %defattr(-, root, root)
%if 0%{?suse_version} < 1550 %if !0%{?usrmerged}
/%{_lib}/libcom_err.so.* /%{_lib}/libcom_err.so.*
/%{_lib}/libss.so.* /%{_lib}/libss.so.*
%endif %endif
%{_libdir}/libcom_err.so.* %{_libdir}/libcom_err.so.*
%{_libdir}/libss.so.* %{_libdir}/libss.so.*
%if %{build_mini}
%files -n libcom_err-mini-devel
%else
%files -n libcom_err-devel %files -n libcom_err-devel
%endif
%defattr(-, root, root) %defattr(-, root, root)
%_bindir/compile_et %_bindir/compile_et
%_bindir/mk_cmds %_bindir/mk_cmds
@ -442,6 +564,7 @@ done
%{_mandir}/man1/mk_cmds.1.gz %{_mandir}/man1/mk_cmds.1.gz
%{_mandir}/man3/com_err.3.gz %{_mandir}/man3/com_err.3.gz
%if ! %{build_mini}
%files -n libcom_err-devel-static %files -n libcom_err-devel-static
%defattr(-, root, root) %defattr(-, root, root)
%{_libdir}/libcom_err.a %{_libdir}/libcom_err.a
@ -451,14 +574,6 @@ done
%defattr(-, root, root) %defattr(-, root, root)
%{_libdir}/libext2fs.a %{_libdir}/libext2fs.a
%{_libdir}/libe2p.a %{_libdir}/libe2p.a
%else
%make_install
(cd %{buildroot}; find -L -type f | grep -v fuse2fs | xargs rm)
%files
%_bindir/fuse2fs
%{_mandir}/man1/fuse2fs.1.gz
%endif %endif
%changelog %changelog

View File

@ -2,13 +2,14 @@ Index: e2fsprogs-1.46.4/scrub/e2scrub@.service.in
=================================================================== ===================================================================
--- e2fsprogs-1.46.4.orig/scrub/e2scrub@.service.in --- e2fsprogs-1.46.4.orig/scrub/e2scrub@.service.in
+++ e2fsprogs-1.46.4/scrub/e2scrub@.service.in +++ e2fsprogs-1.46.4/scrub/e2scrub@.service.in
@@ -10,6 +10,14 @@ PrivateNetwork=true @@ -10,6 +10,15 @@ PrivateNetwork=true
ProtectSystem=true ProtectSystem=true
ProtectHome=read-only ProtectHome=read-only
PrivateTmp=yes PrivateTmp=yes
+# added automatically, for details please see +# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort +# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectHostname=true +ProtectHostname=true
+ProtectClock=true
+ProtectKernelTunables=true +ProtectKernelTunables=true
+ProtectKernelLogs=true +ProtectKernelLogs=true
+ProtectControlGroups=true +ProtectControlGroups=true

View File

@ -2,7 +2,7 @@ Index: e2fsprogs-1.46.3/scrub/e2scrub_all.service.in
=================================================================== ===================================================================
--- e2fsprogs-1.46.3.orig/scrub/e2scrub_all.service.in --- e2fsprogs-1.46.3.orig/scrub/e2scrub_all.service.in
+++ e2fsprogs-1.46.3/scrub/e2scrub_all.service.in +++ e2fsprogs-1.46.3/scrub/e2scrub_all.service.in
@@ -6,6 +6,17 @@ ConditionCapability=CAP_SYS_RAWIO @@ -6,6 +6,18 @@ ConditionCapability=CAP_SYS_RAWIO
Documentation=man:e2scrub_all(8) Documentation=man:e2scrub_all(8)
[Service] [Service]
@ -11,6 +11,7 @@ Index: e2fsprogs-1.46.3/scrub/e2scrub_all.service.in
+ProtectSystem=full +ProtectSystem=full
+ProtectHome=true +ProtectHome=true
+ProtectHostname=true +ProtectHostname=true
+ProtectClock=true
+ProtectKernelTunables=true +ProtectKernelTunables=true
+ProtectKernelModules=true +ProtectKernelModules=true
+ProtectKernelLogs=true +ProtectKernelLogs=true

View File

@ -2,7 +2,7 @@ Index: e2fsprogs-1.46.3/scrub/e2scrub_fail@.service.in
=================================================================== ===================================================================
--- e2fsprogs-1.46.3.orig/scrub/e2scrub_fail@.service.in --- e2fsprogs-1.46.3.orig/scrub/e2scrub_fail@.service.in
+++ e2fsprogs-1.46.3/scrub/e2scrub_fail@.service.in +++ e2fsprogs-1.46.3/scrub/e2scrub_fail@.service.in
@@ -3,6 +3,17 @@ Description=Online ext4 Metadata Check F @@ -3,6 +3,18 @@ Description=Online ext4 Metadata Check F
Documentation=man:e2scrub(8) Documentation=man:e2scrub(8)
[Service] [Service]
@ -11,6 +11,7 @@ Index: e2fsprogs-1.46.3/scrub/e2scrub_fail@.service.in
+ProtectSystem=full +ProtectSystem=full
+ProtectHome=true +ProtectHome=true
+ProtectHostname=true +ProtectHostname=true
+ProtectClock=true
+ProtectKernelTunables=true +ProtectKernelTunables=true
+ProtectKernelModules=true +ProtectKernelModules=true
+ProtectKernelLogs=true +ProtectKernelLogs=true

View File

@ -2,13 +2,14 @@ Index: e2fsprogs-1.46.3/scrub/e2scrub_reap.service.in
=================================================================== ===================================================================
--- e2fsprogs-1.46.3.orig/scrub/e2scrub_reap.service.in --- e2fsprogs-1.46.3.orig/scrub/e2scrub_reap.service.in
+++ e2fsprogs-1.46.3/scrub/e2scrub_reap.service.in +++ e2fsprogs-1.46.3/scrub/e2scrub_reap.service.in
@@ -11,6 +11,15 @@ PrivateNetwork=true @@ -11,6 +11,16 @@ PrivateNetwork=true
ProtectSystem=true ProtectSystem=true
ProtectHome=read-only ProtectHome=read-only
PrivateTmp=yes PrivateTmp=yes
+# added automatically, for details please see +# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort +# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectHostname=true +ProtectHostname=true
+ProtectClock=true
+ProtectKernelTunables=true +ProtectKernelTunables=true
+ProtectKernelModules=true +ProtectKernelModules=true
+ProtectKernelLogs=true +ProtectKernelLogs=true

View File

@ -0,0 +1,56 @@
From ab51d587bb9b229b1fade1afd02e1574c1ba5c76 Mon Sep 17 00:00:00 2001
From: Lukas Czerner <lczerner@redhat.com>
Date: Thu, 21 Apr 2022 19:31:48 +0200
Subject: [PATCH] libext2fs: add sanity check to extent manipulation
References: bsc#1198446 CVE-2022-1304
It is possible to have a corrupted extent tree in such a way that a leaf
node contains zero extents in it. Currently if that happens and we try
to traverse the tree we can end up accessing wrong data, or possibly
even uninitialized memory. Make sure we don't do that.
Additionally make sure that we have a sane number of bytes passed to
memmove() in ext2fs_extent_delete().
Note that e2fsck is currently unable to spot and fix such corruption in
pass1.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Nils Bars <nils_bars@t-online.de>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2068113
Addresses: CVE-2022-1304
Addresses-Debian-Bug: #1010263
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/ext2fs/extent.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
index b324c7b0f8c8..1a206a16c13f 100644
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -495,6 +495,10 @@ retry:
ext2fs_le16_to_cpu(eh->eh_entries);
newpath->max_entries = ext2fs_le16_to_cpu(eh->eh_max);
+ /* Make sure there is at least one extent present */
+ if (newpath->left <= 0)
+ return EXT2_ET_EXTENT_NO_DOWN;
+
if (path->left > 0) {
ix++;
newpath->end_blk = ext2fs_le32_to_cpu(ix->ei_block);
@@ -1630,6 +1634,10 @@ errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags)
cp = path->curr;
+ /* Sanity check before memmove() */
+ if (path->left < 0)
+ return EXT2_ET_EXTENT_LEAF_BAD;
+
if (path->left) {
memmove(cp, cp + sizeof(struct ext3_extent_idx),
path->left * sizeof(struct ext3_extent_idx));
--
2.34.1

View File

@ -0,0 +1,29 @@
From 0a60ee129b9137a9a5cd49c4dd15247830a7f319 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Fri, 20 Aug 2021 18:12:04 +0200
Subject: [PATCH] libss: add newer libreadline.so.8 to dlopen path
OpenSUSE Tumbleweed now has libreadline.so.8. Add it to the list of libs
to look for.
Signed-off-by: Jan Kara <jack@suse.cz>
---
lib/ss/get_readline.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ss/get_readline.c b/lib/ss/get_readline.c
index 11c72b3387d1..aa1615747934 100644
--- a/lib/ss/get_readline.c
+++ b/lib/ss/get_readline.c
@@ -37,7 +37,7 @@ static void ss_release_readline(ss_data *info)
#endif
/* Libraries we will try to use for readline/editline functionality */
-#define DEFAULT_LIBPATH "libreadline.so.7:libreadline.so.6:libreadline.so.5:libreadline.so.4:libreadline.so:libedit.so.2:libedit.so:libeditline.so.0:libeditline.so"
+#define DEFAULT_LIBPATH "libreadline.so.8:libreadline.so.7:libreadline.so.6:libreadline.so.5:libreadline.so.4:libreadline.so:libedit.so.2:libedit.so:libeditline.so.0:libeditline.so"
#ifdef HAVE_DLOPEN
void ss_get_readline(int sci_idx)
--
2.26.2

View File

@ -0,0 +1,188 @@
From cb060896aac2207ea77479db2e2212ebe7955de9 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Fri, 20 Aug 2021 21:18:32 +0200
Subject: [PATCH 1/8] quota: Add support to version 0 quota format
X-Developer-Signature: v=1; a=openpgp-sha256; l=6268; h=from:subject;
bh=UhE03jWwtF7/2Unh5tfHgBCzzdLaSNZ7G9C22vuq4H4=;
b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBhI8GhrizE8ehds+qrTxuX1OCIKL+zMflZgbZ3qOb5
4X5jnt+JATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCYSPBoQAKCRCcnaoHP2RA2dHMCA
CzR/VySs+XXZrCsUYOO3oUzFueRoSJnOAuAUONScP8h7x8fH7wclET0eU/ZGDTMFPrhSIAWjqqwfI8
zeFGmbi4GR5BRbsxWNCJnmjwtbxHfOiXsH8KLqT8DyLFl/Svw4yHi9URyIKk4rij2q9AqmA1DTc5M6
iMHejidF5w4SbKSmvVYpJi1Ny/TyWXUU9ATzZv01cwjBnMsTw+xq3MD55K9VVZJ9tIF3YZd0PahiT0
h/zKA7uQX6W3PKWVuTHkSzjUnsOhKMCX9MxMX6uGXzHBiUsqdCSijVQ6qwBmbwbbz5OZRBRdTfm+0X
6fJidGzi6Zcpp/jOs8RIOSu55qCTAb
X-Developer-Key: i=jack@suse.cz; a=openpgp;
fpr=93C6099A142276A28BBE35D815BC833443038D8C
Version 0 quota format differs from version 1 by having only 32-bit
counters for inodes and block limits. For many installations this is not
limiting and thus the format is widely used. Also quota tools still
create quota files with this format by default. Add support for this
quota format to e2fsprogs so that we can seamlessly convert quota files
in this format into our internal quota files.
Signed-off-by: Jan Kara <jack@suse.cz>
---
lib/support/quotaio_v2.c | 85 +++++++++++++++++++++++++++++++++++++---
lib/support/quotaio_v2.h | 17 +++++++-
2 files changed, 96 insertions(+), 6 deletions(-)
diff --git a/lib/support/quotaio_v2.c b/lib/support/quotaio_v2.c
index 23717f03f428..a49aa6ac8c2f 100644
--- a/lib/support/quotaio_v2.c
+++ b/lib/support/quotaio_v2.c
@@ -41,6 +41,68 @@ struct quotafile_ops quotafile_ops_2 = {
.report = v2_report,
};
+/*
+ * Copy dquot from disk to memory
+ */
+static void v2r0_disk2memdqblk(struct dquot *dquot, void *dp)
+{
+ struct util_dqblk *m = &dquot->dq_dqb;
+ struct v2r0_disk_dqblk *d = dp, empty;
+
+ dquot->dq_id = ext2fs_le32_to_cpu(d->dqb_id);
+ m->dqb_ihardlimit = ext2fs_le32_to_cpu(d->dqb_ihardlimit);
+ m->dqb_isoftlimit = ext2fs_le32_to_cpu(d->dqb_isoftlimit);
+ m->dqb_bhardlimit = ext2fs_le32_to_cpu(d->dqb_bhardlimit);
+ m->dqb_bsoftlimit = ext2fs_le32_to_cpu(d->dqb_bsoftlimit);
+ m->dqb_curinodes = ext2fs_le32_to_cpu(d->dqb_curinodes);
+ m->dqb_curspace = ext2fs_le64_to_cpu(d->dqb_curspace);
+ m->dqb_itime = ext2fs_le64_to_cpu(d->dqb_itime);
+ m->dqb_btime = ext2fs_le64_to_cpu(d->dqb_btime);
+
+ memset(&empty, 0, sizeof(struct v2r0_disk_dqblk));
+ empty.dqb_itime = ext2fs_cpu_to_le64(1);
+ if (!memcmp(&empty, dp, sizeof(struct v2r0_disk_dqblk)))
+ m->dqb_itime = 0;
+}
+
+/*
+ * Copy dquot from memory to disk
+ */
+static void v2r0_mem2diskdqblk(void *dp, struct dquot *dquot)
+{
+ struct util_dqblk *m = &dquot->dq_dqb;
+ struct v2r0_disk_dqblk *d = dp;
+
+ d->dqb_ihardlimit = ext2fs_cpu_to_le32(m->dqb_ihardlimit);
+ d->dqb_isoftlimit = ext2fs_cpu_to_le32(m->dqb_isoftlimit);
+ d->dqb_bhardlimit = ext2fs_cpu_to_le32(m->dqb_bhardlimit);
+ d->dqb_bsoftlimit = ext2fs_cpu_to_le32(m->dqb_bsoftlimit);
+ d->dqb_curinodes = ext2fs_cpu_to_le32(m->dqb_curinodes);
+ d->dqb_curspace = ext2fs_cpu_to_le64(m->dqb_curspace);
+ d->dqb_itime = ext2fs_cpu_to_le64(m->dqb_itime);
+ d->dqb_btime = ext2fs_cpu_to_le64(m->dqb_btime);
+ d->dqb_id = ext2fs_cpu_to_le32(dquot->dq_id);
+ if (qtree_entry_unused(&dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree, dp))
+ d->dqb_itime = ext2fs_cpu_to_le64(1);
+}
+
+static int v2r0_is_id(void *dp, struct dquot *dquot)
+{
+ struct v2r0_disk_dqblk *d = dp;
+ struct qtree_mem_dqinfo *info =
+ &dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree;
+
+ if (qtree_entry_unused(info, dp))
+ return 0;
+ return ext2fs_le32_to_cpu(d->dqb_id) == dquot->dq_id;
+}
+
+static struct qtree_fmt_operations v2r0_fmt_ops = {
+ .mem2disk_dqblk = v2r0_mem2diskdqblk,
+ .disk2mem_dqblk = v2r0_disk2memdqblk,
+ .is_id = v2r0_is_id,
+};
+
/*
* Copy dquot from disk to memory
*/
@@ -164,7 +226,8 @@ static int v2_check_file(struct quota_handle *h, int type, int fmt)
log_err("Your quota file is stored in wrong endianity");
return 0;
}
- if (V2_VERSION != ext2fs_le32_to_cpu(dqh.dqh_version))
+ if (V2_VERSION_R0 != ext2fs_le32_to_cpu(dqh.dqh_version) &&
+ V2_VERSION_R1 != ext2fs_le32_to_cpu(dqh.dqh_version))
return 0;
return 1;
}
@@ -174,13 +237,25 @@ static int v2_check_file(struct quota_handle *h, int type, int fmt)
*/
static int v2_init_io(struct quota_handle *h)
{
+ struct v2_disk_dqheader dqh;
struct v2_disk_dqinfo ddqinfo;
struct v2_mem_dqinfo *info;
__u64 filesize;
+ int version;
- h->qh_info.u.v2_mdqi.dqi_qtree.dqi_entry_size =
- sizeof(struct v2r1_disk_dqblk);
- h->qh_info.u.v2_mdqi.dqi_qtree.dqi_ops = &v2r1_fmt_ops;
+ if (!v2_read_header(h, &dqh))
+ return -1;
+ version = ext2fs_le32_to_cpu(dqh.dqh_version);
+
+ if (version == V2_VERSION_R0) {
+ h->qh_info.u.v2_mdqi.dqi_qtree.dqi_entry_size =
+ sizeof(struct v2r0_disk_dqblk);
+ h->qh_info.u.v2_mdqi.dqi_qtree.dqi_ops = &v2r0_fmt_ops;
+ } else {
+ h->qh_info.u.v2_mdqi.dqi_qtree.dqi_entry_size =
+ sizeof(struct v2r1_disk_dqblk);
+ h->qh_info.u.v2_mdqi.dqi_qtree.dqi_ops = &v2r1_fmt_ops;
+ }
/* Read information about quotafile */
if (h->e2fs_read(&h->qh_qf, V2_DQINFOOFF, &ddqinfo,
@@ -231,7 +306,7 @@ static int v2_new_io(struct quota_handle *h)
/* Write basic quota header */
ddqheader.dqh_magic = ext2fs_cpu_to_le32(file_magics[h->qh_type]);
- ddqheader.dqh_version = ext2fs_cpu_to_le32(V2_VERSION);
+ ddqheader.dqh_version = ext2fs_cpu_to_le32(V2_VERSION_R1);
if (h->e2fs_write(&h->qh_qf, 0, &ddqheader, sizeof(ddqheader)) !=
sizeof(ddqheader))
return -1;
diff --git a/lib/support/quotaio_v2.h b/lib/support/quotaio_v2.h
index de2db2785cb0..35054cafaa23 100644
--- a/lib/support/quotaio_v2.h
+++ b/lib/support/quotaio_v2.h
@@ -13,7 +13,8 @@
/* Offset of info header in file */
#define V2_DQINFOOFF sizeof(struct v2_disk_dqheader)
/* Supported version of quota-tree format */
-#define V2_VERSION 1
+#define V2_VERSION_R1 1
+#define V2_VERSION_R0 0
struct v2_disk_dqheader {
__le32 dqh_magic; /* Magic number identifying file */
@@ -36,6 +37,20 @@ struct v2_disk_dqinfo {
* free entry */
} __attribute__ ((packed));
+struct v2r0_disk_dqblk {
+ __le32 dqb_id; /* id this quota applies to */
+ __le32 dqb_ihardlimit; /* absolute limit on allocated inodes */
+ __le32 dqb_isoftlimit; /* preferred inode limit */
+ __le32 dqb_curinodes; /* current # allocated inodes */
+ __le32 dqb_bhardlimit; /* absolute limit on disk space
+ * (in QUOTABLOCK_SIZE) */
+ __le32 dqb_bsoftlimit; /* preferred limit on disk space
+ * (in QUOTABLOCK_SIZE) */
+ __le64 dqb_curspace; /* current space occupied (in bytes) */
+ __le64 dqb_btime; /* time limit for excessive disk use */
+ __le64 dqb_itime; /* time limit for excessive inode use */
+} __attribute__ ((packed));
+
struct v2r1_disk_dqblk {
__le32 dqb_id; /* id this quota applies to */
__le32 dqb_pad;
--
2.26.2

View File

@ -0,0 +1,57 @@
From 32d9f7b1e48f203315890b4d7374f4afd68ce7bb Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 23 Aug 2021 17:09:41 +0200
Subject: [PATCH 8/8] quota: Drop dead code
X-Developer-Signature: v=1; a=openpgp-sha256; l=1119; h=from:subject;
bh=61dKtjVKi3diCfHpa1/d4uDj1elmJCEY1fKv83UzzKA=;
b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBhI8GnVlsRAgEc7AzGwJddaA7LDt33ZX+Yj9rady7y
42St04GJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCYSPBpwAKCRCcnaoHP2RA2aBMCA
COK2Z3O7gobEnW9GHL1bd1MlJOqsYxPxnOp3rFCkB4Kb6V770XUoCCnyeD7NwNxooWZSNOB7JCuyGQ
Yl945dec75Yv8zw49bulfVe496hHFX4O4UzAgZKG0vZYAjHpwaEk9Txf3MLpSHxSFlvbH8LE4sT7yD
M4wEEznUZokwwRoj+ds12+Rm+P1Sj/AhghUTaPFpuA5RjplBAg728b9f6Ia2JMsNzxoBRksVdOONjU
2gtjwbR7Ne2GlN722u71YHItAL0sBAVPIHZQznZEKAZFwEnOHSRWlvwLItLdMfpoMcYXjDJIWz+mXx
QbpFU9jSQfiJBn+wba2yVZKohLP403
X-Developer-Key: i=jack@suse.cz; a=openpgp;
fpr=93C6099A142276A28BBE35D815BC833443038D8C
Drop unused function from quota support code.
Signed-off-by: Jan Kara <jack@suse.cz>
---
lib/support/mkquota.c | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/lib/support/mkquota.c b/lib/support/mkquota.c
index 0fefca90c843..a4401b7f77af 100644
--- a/lib/support/mkquota.c
+++ b/lib/support/mkquota.c
@@ -564,26 +564,6 @@ static int scan_dquots_callback(struct dquot *dquot, void *cb_data)
return 0;
}
-/*
- * Write all memory dquots into quota file
- */
-#if 0 /* currently unused, but may be useful in the future? */
-static errcode_t quota_write_all_dquots(struct quota_handle *qh,
- quota_ctx_t qctx)
-{
- errcode_t err;
-
- err = ext2fs_read_bitmaps(qctx->fs);
- if (err)
- return err;
- write_dquots(qctx->quota_dict[qh->qh_type], qh);
- ext2fs_mark_bb_dirty(qctx->fs);
- qctx->fs->flags &= ~EXT2_FLAG_SUPER_ONLY;
- ext2fs_write_bitmaps(qctx->fs);
- return 0;
-}
-#endif
-
/*
* Read quotas from disk and updates the in-memory information determined by
* 'flags' from the on-disk data.
--
2.26.2

View File

@ -0,0 +1,77 @@
From cbc02e7ef11d5129d090ff49aa1aa57c6ac67fd5 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 23 Aug 2021 16:20:52 +0200
Subject: [PATCH 2/8] quota: Fold quota_read_all_dquots() into
quota_update_limits()
X-Developer-Signature: v=1; a=openpgp-sha256; l=1845; h=from:subject;
bh=P7jQb3ZXNuPWs0M0khNUm88nO2ChkOKzT3PGfFt2YNE=;
b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBhI8GihdgOLrTUGvgyKLo/9lHgsSXNpuX+TjVHdW+m
661Y0fGJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCYSPBogAKCRCcnaoHP2RA2aEPB/
9zdPkcMlJKxGzpEO0BmaBNu0c3VbFZR72otTj64Pm1AWxyU9PL288d+VnPov7WSeduPBKtXxmevxAw
tR0TYFt4ui8Gr7HLMoTvP7EJ3YX/KZ2mnXnz9JJ5DB2fG07VBbKmcfPKzsxYTUd0Xe5RJU0PYPI62W
j8W17jQelcHCNhAJk6oJFP7hPE+dsGUzGthbeQhWrb5zmboB/Ui55mfM1mLaloebpJkg1eqEZzX1jE
6T9iEfBSgv5WowKIfJInnXkI+l4UED+Ri1pjuFgBtpWjJEP8ixpFhlo0ULZxfK/OX9sFWQU+Z+opoM
Qi0W7Fbb7hR7YZP84xnIbF1FUgHa+l
X-Developer-Key: i=jack@suse.cz; a=openpgp;
fpr=93C6099A142276A28BBE35D815BC833443038D8C
There's just one caller of quota_read_all_dquots(), fold it into its
caller quota_update_limits(). No functional changes.
Signed-off-by: Jan Kara <jack@suse.cz>
---
lib/support/mkquota.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/lib/support/mkquota.c b/lib/support/mkquota.c
index fbc3833aee98..8e5c61a601cc 100644
--- a/lib/support/mkquota.c
+++ b/lib/support/mkquota.c
@@ -564,23 +564,6 @@ static int scan_dquots_callback(struct dquot *dquot, void *cb_data)
return 0;
}
-/*
- * Read all dquots from quota file into memory
- */
-static errcode_t quota_read_all_dquots(struct quota_handle *qh,
- quota_ctx_t qctx,
- int update_limits EXT2FS_ATTR((unused)))
-{
- struct scan_dquots_data scan_data;
-
- scan_data.quota_dict = qctx->quota_dict[qh->qh_type];
- scan_data.check_consistency = 0;
- scan_data.update_limits = 0;
- scan_data.update_usage = 1;
-
- return qh->qh_ops->scan_dquots(qh, scan_dquots_callback, &scan_data);
-}
-
/*
* Write all memory dquots into quota file
*/
@@ -607,6 +590,7 @@ static errcode_t quota_write_all_dquots(struct quota_handle *qh,
errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino,
enum quota_type qtype)
{
+ struct scan_dquots_data scan_data;
struct quota_handle *qh;
errcode_t err;
@@ -625,7 +609,11 @@ errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino,
goto out;
}
- quota_read_all_dquots(qh, qctx, 1);
+ scan_data.quota_dict = qctx->quota_dict[qh->qh_type];
+ scan_data.check_consistency = 0;
+ scan_data.update_limits = 0;
+ scan_data.update_usage = 1;
+ qh->qh_ops->scan_dquots(qh, scan_dquots_callback, &scan_data);
err = quota_file_close(qctx, qh);
if (err) {
--
2.26.2

View File

@ -0,0 +1,112 @@
From f2a7403c6e232aa8dba92d56178d81ba8285fa65 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 23 Aug 2021 16:32:13 +0200
Subject: [PATCH 3/8] quota: Rename quota_update_limits() to
quota_read_all_dquots()
X-Developer-Signature: v=1; a=openpgp-sha256; l=3796; h=from:subject;
bh=EWzfurjfbAs2HTtmIoM8glu+EY0nvkRwYkafyLH0vAw=;
b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBhI8GjQ7OLyPGH5e21pa5vzRbAJrBUX2fqN9Cishyr
zRhheaOJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCYSPBowAKCRCcnaoHP2RA2fqAB/
99OFSOi1posHQs9IivQagLwUAxytNoe9VWRoUqypcx5DFtbSItNlcyRCRxmouxUdpTyWR3BoYfDz97
/R2KsPNu9XU6oA2NiC7WcmNdSJ0ay+sRuXy2EF5FxCvXjB4xN7pUu7QEEjcQXOYOwIsdEDQru+eajq
NK05uq6j0Zb/zelJ9VkTA0iKkiCkKGNYZlCUkn3x+E8wTb4RCbywnAynC6RXFlmt+EnaxxHoGCsJGv
TLIe+yhPDECdjW39RZWYV87fRRGDRiVnuDFR0uj0QRFY1unELcy+Z72lySrH9X3SZl9VB72WKvofFb
Ar8ofkj4dd4g8RTr9WRC+h9b1kwnNk
X-Developer-Key: i=jack@suse.cz; a=openpgp;
fpr=93C6099A142276A28BBE35D815BC833443038D8C
quota_update_limits() is a misnomer because what it actually does is
that it updates 'usage' counters and leaves 'limit' counters intact.
Rename quota_update_limits() to quota_read_all_dquots() and while
changing prototype also add a flags argument so that callers can control
which quota information is actually updated from the disk.
Signed-off-by: Jan Kara <jack@suse.cz>
---
e2fsck/super.c | 3 ++-
lib/support/mkquota.c | 11 ++++++-----
lib/support/quotaio.h | 7 +++++--
misc/tune2fs.c | 5 +++--
4 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/e2fsck/super.c b/e2fsck/super.c
index e1c3f93572f4..75b7b8ffa9b6 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -281,7 +281,8 @@ static errcode_t e2fsck_read_all_quotas(e2fsck_t ctx)
if (qf_ino == 0)
continue;
- retval = quota_update_limits(ctx->qctx, qf_ino, qtype);
+ retval = quota_read_all_dquots(ctx->qctx, qf_ino, qtype,
+ QREAD_USAGE);
if (retval)
break;
}
diff --git a/lib/support/mkquota.c b/lib/support/mkquota.c
index 8e5c61a601cc..0fefca90c843 100644
--- a/lib/support/mkquota.c
+++ b/lib/support/mkquota.c
@@ -585,10 +585,11 @@ static errcode_t quota_write_all_dquots(struct quota_handle *qh,
#endif
/*
- * Updates the in-memory quota limits from the given quota inode.
+ * Read quotas from disk and updates the in-memory information determined by
+ * 'flags' from the on-disk data.
*/
-errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino,
- enum quota_type qtype)
+errcode_t quota_read_all_dquots(quota_ctx_t qctx, ext2_ino_t qf_ino,
+ enum quota_type qtype, unsigned int flags)
{
struct scan_dquots_data scan_data;
struct quota_handle *qh;
@@ -611,8 +612,8 @@ errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino,
scan_data.quota_dict = qctx->quota_dict[qh->qh_type];
scan_data.check_consistency = 0;
- scan_data.update_limits = 0;
- scan_data.update_usage = 1;
+ scan_data.update_limits = !!(flags & QREAD_LIMITS);
+ scan_data.update_usage = !!(flags & QREAD_USAGE);
qh->qh_ops->scan_dquots(qh, scan_dquots_callback, &scan_data);
err = quota_file_close(qctx, qh);
diff --git a/lib/support/quotaio.h b/lib/support/quotaio.h
index 6068970009f5..84fac35dda20 100644
--- a/lib/support/quotaio.h
+++ b/lib/support/quotaio.h
@@ -224,8 +224,11 @@ void quota_data_add(quota_ctx_t qctx, struct ext2_inode_large *inode,
void quota_data_sub(quota_ctx_t qctx, struct ext2_inode_large *inode,
ext2_ino_t ino, qsize_t space);
errcode_t quota_write_inode(quota_ctx_t qctx, enum quota_type qtype);
-errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino,
- enum quota_type type);
+/* Flags for quota_read_all_dquots() */
+#define QREAD_USAGE 0x01
+#define QREAD_LIMITS 0x02
+errcode_t quota_read_all_dquots(quota_ctx_t qctx, ext2_ino_t qf_ino,
+ enum quota_type type, unsigned int flags);
errcode_t quota_compute_usage(quota_ctx_t qctx);
void quota_release_context(quota_ctx_t *qctx);
errcode_t quota_remove_inode(ext2_filsys fs, enum quota_type qtype);
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index f739f16cd62b..bb08f8026918 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -1671,8 +1671,9 @@ static int handle_quota_options(ext2_filsys fs)
if (quota_enable[qtype] == QOPT_ENABLE &&
*quota_sb_inump(fs->super, qtype) == 0) {
if ((qf_ino = quota_file_exists(fs, qtype)) > 0) {
- retval = quota_update_limits(qctx, qf_ino,
- qtype);
+ retval = quota_read_all_dquots(qctx, qf_ino,
+ qtype,
+ QREAD_USAGE);
if (retval) {
com_err(program_name, retval,
_("while updating quota limits (%d)"),
--
2.26.2

View File

@ -0,0 +1,47 @@
From 5d446b4969ee6cb4025f576158be562c87d57142 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Fri, 20 Aug 2021 21:35:34 +0200
Subject: [PATCH 4/8] tune2fs: Fix conversion of quota files
X-Developer-Signature: v=1; a=openpgp-sha256; l=1210; h=from:subject;
bh=Lx1UJPZNLgsKBmmbN+0GUP40hOyhJD5D9kEVqqVigg4=;
b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBhI8GkUaN9eZsgn0XvL7BSjbTu57jpbJHkTGpEei61
KG+q9pGJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCYSPBpAAKCRCcnaoHP2RA2Z7NB/
4osbGPQGrmAwHVUJEqkXAxOBazQE/W3qiykm9uUmzeBGC++5nQzo1J05nb479mQY84Lu8j1Mhbloh8
vtdLdJ0HVHxHQrY058HIXBQfAYlLV0pN6/qRNCVelyjdqQVTjri8oD+TVCjsu4aaTu9ZLZCYM41w5s
gweKqj260PJ93IL025nGha6ZL2BsenQy/tKRG7/I9O/c6YUAFKSvXDJ0M/L4XtgMTKxzROSiKDmy8h
gEw2Gc9oCZLISL2ulhLJ6ppxQ7jcbvoTuZmdFxhbQIfs8gQnmxlGcQLWs5fDMIKfux5qBwQGnYIC1u
jZOGndUvcOaDO3Zexb1ik8pxnpIi+F
X-Developer-Key: i=jack@suse.cz; a=openpgp;
fpr=93C6099A142276A28BBE35D815BC833443038D8C
When tune2fs is enabling quota feature, it looks for old-style quota
files and tries to transfer limits stored in these files into newly
created hidded quota files. However the code doing the transfer setups
the quota scan wrongly and instead of transferring limits we transfer
usage. So not only quota limits are lost (at least they can still be
recovered from the old quota files) but also usage information may be
wrong if the accounting in e2fsprogs does not exactly match the
accounting in quota-tools (which is actually the case). Fix the setup of
the quota scan.
Signed-off-by: Jan Kara <jack@suse.cz>
---
misc/tune2fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index bb08f8026918..0f6ef3d6df6b 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -1673,7 +1673,7 @@ static int handle_quota_options(ext2_filsys fs)
if ((qf_ino = quota_file_exists(fs, qtype)) > 0) {
retval = quota_read_all_dquots(qctx, qf_ino,
qtype,
- QREAD_USAGE);
+ QREAD_LIMITS);
if (retval) {
com_err(program_name, retval,
_("while updating quota limits (%d)"),
--
2.26.2