diff --git a/0012-rpcdebug-avoid-buffer-underflow-if-read-returns-0.patch b/0012-rpcdebug-avoid-buffer-underflow-if-read-returns-0.patch new file mode 100644 index 0000000000000000000000000000000000000000..11f90be810d7bf1470ff71904d148aa306ab2a9b --- /dev/null +++ b/0012-rpcdebug-avoid-buffer-underflow-if-read-returns-0.patch @@ -0,0 +1,29 @@ +From a746c35822e557766d1871ec976490a71e6962d9 Mon Sep 17 00:00:00 2001 +From: Zhi Li +Date: Wed, 5 Apr 2023 12:08:10 -0400 +Subject: [PATCH] rpcdebug: avoid buffer underflow if read() returns 0 + +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2176740 + +Signed-off-by: Zhi Li +Signed-off-by: Steve Dickson +--- + tools/rpcdebug/rpcdebug.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/rpcdebug/rpcdebug.c b/tools/rpcdebug/rpcdebug.c +index 68206cc5..ec05179e 100644 +--- a/tools/rpcdebug/rpcdebug.c ++++ b/tools/rpcdebug/rpcdebug.c +@@ -257,7 +257,7 @@ get_flags(char *module) + perror(filename); + exit(1); + } +- if ((len = read(sysfd, buffer, sizeof(buffer))) < 0) { ++ if ((len = read(sysfd, buffer, sizeof(buffer))) <= 0) { + perror("read"); + exit(1); + } +-- +2.33.0 + diff --git a/0013-export-Fix-rootdir-corner-case-in-next_mnt.patch b/0013-export-Fix-rootdir-corner-case-in-next_mnt.patch new file mode 100644 index 0000000000000000000000000000000000000000..72723d216b5f2421de6837e30974147bc91de7be --- /dev/null +++ b/0013-export-Fix-rootdir-corner-case-in-next_mnt.patch @@ -0,0 +1,58 @@ +From c0bf5895173972a0b86633c7d61d0de46798bbe1 Mon Sep 17 00:00:00 2001 +From: Richard Weinberger +Date: Wed, 5 Apr 2023 12:16:24 -0400 +Subject: [PATCH] export: Fix rootdir corner case in next_mnt() + +Currently the following setup causes failure: +1. /etc/exports: +/ *(rw,crossmnt,no_subtree_check,fsid=root) + +2. /etc/nfs.conf: +[exports] + rootdir=/nfs_srv + +3. Mounts: +/root/fs1.ext4 on /nfs_srv type ext4 (rw,relatime) +/root/fs2.ext4 on /nfs_srv/fs2 type ext4 (rw,relatime) + +4. On the client: +$ ls /nfs_client/fs2 +ls: cannot open directory '/nfs_client/fs2': Stale file handle + +The problem is that next_mnt() misses the corner case that +every mount is a sub-mount of "/". +So it fails to see that /nfs_srv/fs2 is a mountpoint when the +client asks for fs2 it and as consequence the crossmnt mechanism +fails. + +Signed-off-by: Richard Weinberger +Signed-off-by: Steve Dickson +--- + support/export/cache.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/support/export/cache.c b/support/export/cache.c +index 2497d4f4..1c526277 100644 +--- a/support/export/cache.c ++++ b/support/export/cache.c +@@ -410,12 +410,16 @@ static char *next_mnt(void **v, char *p) + *v = f; + } else + f = *v; +- while ((me = getmntent(f)) != NULL && l > 1) { ++ while ((me = getmntent(f)) != NULL && l >= 1) { + char *mnt_dir = nfsd_path_strip_root(me->mnt_dir); + + if (!mnt_dir) + continue; + ++ /* Everything below "/" is a proper sub-mount */ ++ if (strcmp(p, "/") == 0) ++ return mnt_dir; ++ + if (strncmp(mnt_dir, p, l) == 0 && mnt_dir[l] == '/') + return mnt_dir; + } +-- +2.33.0 + diff --git a/0014-Move-version.h-into-a-common-include-directory.patch b/0014-Move-version.h-into-a-common-include-directory.patch new file mode 100644 index 0000000000000000000000000000000000000000..d19d76e46c3bd730dee0d1770567df9a846b280c --- /dev/null +++ b/0014-Move-version.h-into-a-common-include-directory.patch @@ -0,0 +1,64 @@ +From 47e6d7667cd7cd82c9033a3176afbdd2341065b0 Mon Sep 17 00:00:00 2001 +From: Steve Dickson +Date: Wed, 22 Sep 2021 11:29:34 -0400 +Subject: [PATCH] Move version.h into a common include directory + +Signed-off-by: Steve Dickson +--- + support/include/version.h | 1 + + utils/gssd/svcgssd_krb5.c | 2 +- + utils/nfsd/nfssvc.c | 2 +- + utils/nfsdcld/nfsdcld.c | 2 +- + 4 files changed, 4 insertions(+), 3 deletions(-) + create mode 120000 support/include/version.h + +diff --git a/support/include/version.h b/support/include/version.h +new file mode 120000 +index 00000000..b7db0bbb +--- /dev/null ++++ b/support/include/version.h +@@ -0,0 +1 @@ ++../../utils/mount/version.h +\ No newline at end of file +diff --git a/utils/gssd/svcgssd_krb5.c b/utils/gssd/svcgssd_krb5.c +index 305d4751..2503c384 100644 +--- a/utils/gssd/svcgssd_krb5.c ++++ b/utils/gssd/svcgssd_krb5.c +@@ -46,7 +46,7 @@ + #include "gss_oids.h" + #include "err_util.h" + #include "svcgssd_krb5.h" +-#include "../mount/version.h" ++#include "version.h" + + #define MYBUFLEN 1024 + +diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c +index 720bdd97..46452d97 100644 +--- a/utils/nfsd/nfssvc.c ++++ b/utils/nfsd/nfssvc.c +@@ -25,7 +25,7 @@ + #include "nfslib.h" + #include "xlog.h" + #include "nfssvc.h" +-#include "../mount/version.h" ++#include "version.h" + + #ifndef NFSD_FS_DIR + #define NFSD_FS_DIR "/proc/fs/nfsd" +diff --git a/utils/nfsdcld/nfsdcld.c b/utils/nfsdcld/nfsdcld.c +index 636c3983..dbc7a57f 100644 +--- a/utils/nfsdcld/nfsdcld.c ++++ b/utils/nfsdcld/nfsdcld.c +@@ -45,7 +45,7 @@ + #include "cld.h" + #include "cld-internal.h" + #include "sqlite.h" +-#include "../mount/version.h" ++#include "version.h" + #include "conffile.h" + #include "legacy.h" + +-- +2.25.1 + diff --git a/0015-mountd-only-do-NFSv4-logging-on-supported-kernels.patch b/0015-mountd-only-do-NFSv4-logging-on-supported-kernels.patch new file mode 100644 index 0000000000000000000000000000000000000000..1548949cdea89ac6fff55311f64ca5551a1b9b17 --- /dev/null +++ b/0015-mountd-only-do-NFSv4-logging-on-supported-kernels.patch @@ -0,0 +1,35 @@ +From feb3dfc7127cf1337530ccb06ed90e818b026a07 Mon Sep 17 00:00:00 2001 +From: Steve Dickson +Date: Wed, 22 Sep 2021 11:31:56 -0400 +Subject: [PATCH] mountd: only do NFSv4 logging on supported kernels. + +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1979816 +Signed-off-by: Steve Dickson +--- + support/export/v4clients.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/support/export/v4clients.c b/support/export/v4clients.c +index dd985463..5e4f1058 100644 +--- a/support/export/v4clients.c ++++ b/support/export/v4clients.c +@@ -10,6 +10,7 @@ + #include + #include + #include "export.h" ++#include "version.h" + + /* search.h declares 'struct entry' and nfs_prot.h + * does too. Easiest fix is to trick search.h into +@@ -23,6 +24,8 @@ static int clients_fd = -1; + + void v4clients_init(void) + { ++ if (linux_version_code() < MAKE_VERSION(5, 3, 0)) ++ return; + if (clients_fd >= 0) + return; + clients_fd = inotify_init1(IN_NONBLOCK); +-- +2.25.1 + diff --git a/nfs-utils.spec b/nfs-utils.spec index c6e1db3553e462663d4f743b0f706633178921a7..e8292279e3e8145b0428e5fc32dae1787320e24b 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -4,7 +4,7 @@ Name: nfs-utils Version: 2.5.4 -Release: 10 +Release: 13 Epoch: 2 Summary: The Linux NFS userland utility package License: MIT and GPLv2 and GPLv2+ and BSD @@ -24,6 +24,10 @@ Patch8: 0008-svcgssd-Fix-use-after-free-bug-config-variables.patch Patch9: 0009-rpc-pipefs-generator-allocate-enough-space-for-pipef.patch Patch10: 0010-nfs-utils-Don-t-allow-junction-tests-to-trigger-auto.patch Patch11: 0011-Covscan-Scan-Wrong-Check-of-Return-Value.patch +Patch12: 0012-rpcdebug-avoid-buffer-underflow-if-read-returns-0.patch +Patch13: 0013-export-Fix-rootdir-corner-case-in-next_mnt.patch +Patch14: 0014-Move-version.h-into-a-common-include-directory.patch +Patch15: 0015-mountd-only-do-NFSv4-logging-on-supported-kernels.patch BuildRequires: libevent-devel,libcap-devel, libtirpc-devel libblkid-devel BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2 @@ -34,7 +38,7 @@ BuildRequires: systemd, pkgconfig, rpcgen Requires: rpcbind, sed, gawk, grep, kmod, keyutils, quota -Requires: libevent libblkid libcap libmount +Requires: libevent libblkid libcap libmount libnfsidmap Requires: libtirpc >= 0.2.3-1 gssproxy => 0.7.0-3 Recommends: %{name}-help = %{epoch}:%{version}-%{release} Requires(pre): shadow-utils >= 4.0.3-25 @@ -46,7 +50,6 @@ Requires(post): systemd Requires(preun): systemd Requires(postun): systemd Requires(postun): glibc -Requires: openldap Provides: exportfs = %{epoch}:%{version}-%{release} @@ -64,10 +67,6 @@ Provides: umount.nfs = %{epoch}:%{version}-%{release} Provides: umount.nfs4 = %{epoch}:%{version}-%{release} Provides: sm-notify = %{epoch}:%{version}-%{release} Provides: start-statd = %{epoch}:%{version}-%{release} -Provides: libnfsidmap = %{epoch}:%{version}-%{release} -Provides: libnfsidmap%{?_isa} = %{epoch}:%{version}-%{release} -Obsoletes: libnfsidmap - %description This is he nfs-utils tools package. @@ -76,7 +75,7 @@ It contains the showmount,mount.nfs,umount.nfs and libnfsidmap %package devel Summary: Including header files and library for the developing of libnfsidmap library Requires: nfs-utils%{?_isa} = %{epoch}:%{version}-%{release} -Requires: pkgconfig +Requires: pkgconfig libnfsidmap Provides: libnfsidmap-devel = %{epoch}:%{version}-%{release} Provides: libnfsidmap-devel%{?_isa} = %{epoch}:%{version}-%{release} Obsoletes: libnfsidmap-devel @@ -85,6 +84,37 @@ Obsoletes: libnfsidmap-devel This contains dynamic libraries and header files for the developing of the libnfsidmap library. +%package -n libnfsidmap +Summary: NFSv4 User and Group ID Mapping Library +Provides: libnfsidmap%{?_isa} = %{epoch}:%{version}-%{release} +License: BSD +BuildRequires: pkgconfig, openldap-devel +BuildRequires: automake, libtool +Requires: openldap + +%description -n libnfsidmap +Library that handles mapping between names and ids for NFSv4. + +%package -n nfs-utils-min +Summary: Minimal NFS utilities for supporting clients +Provides: nfsstat = %{epoch}:%{version}-%{release} +Provides: rpc.statd = %{epoch}:%{version}-%{release} +Provides: rpc.gssd = %{epoch}:%{version}-%{release} +Provides: mount.nfs = %{epoch}:%{version}-%{release} +Provides: mount.nfs4 = %{epoch}:%{version}-%{release} +Provides: umount.nfs = %{epoch}:%{version}-%{release} +Provides: umount.nfs4 = %{epoch}:%{version}-%{release} +Provides: start-statd = %{epoch}:%{version}-%{release} +Provides: nfsidmap = %{epoch}:%{version}-%{release} +Provides: showmount = %{epoch}:%{version}-%{release} +Requires: rpcbind +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +Conflicts: nfs-utils + +%description -n nfs-utils-min +Minimal NFS utilities for supporting clients %package help Summary: Including man files for nfs-utils @@ -202,12 +232,11 @@ fi %files -%doc support/nfsidmap/AUTHORS linux-nfs/README linux-nfs/THANKS +%doc linux-nfs/README linux-nfs/THANKS %license support/nfsidmap/COPYING %config(noreplace) /etc/nfsmount.conf %config(noreplace) %{_sharedstatedir}/nfs/etab %config(noreplace) %{_sharedstatedir}/nfs/rmtab -%config(noreplace) %{_sysconfdir}/idmapd.conf %config(noreplace) %{_sysconfdir}/request-key.d/id_resolver.conf %config(noreplace) %{_sysconfdir}/nfs.conf %dir %{_sysconfdir}/exports.d @@ -222,8 +251,6 @@ fi /sbin/{rpc.statd,nfsdcltrack,osd_login,mount.nfs4,umount.*,nfsdcld} %{_sbindir}/* %{_prefix}/lib/systemd/*/* -%{_libdir}/libnfsidmap.so.* -%{_libdir}/libnfsidmap/*.so %files devel %{_includedir}/nfsidmap.h @@ -231,13 +258,56 @@ fi %{_libdir}/pkgconfig/libnfsidmap.pc %{_libdir}/libnfsidmap.so +%files -n nfs-utils-min +%dir %attr(555, root, root) %{_sharedstatedir}/nfs/rpc_pipefs +%dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd +%dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd/sm +%dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd/sm.bak +%ghost %attr(644,rpcuser,rpcuser) %{_statdpath}/state +%config(noreplace) %{_sysconfdir}/nfsmount.conf +%config(noreplace) %{_sysconfdir}/nfs.conf +%config(noreplace) %{_sysconfdir}/request-key.d/id_resolver.conf +%{_sbindir}/nfsidmap +%{_sbindir}/nfsstat +%{_sbindir}/rpc.gssd +%{_sbindir}/start-statd +%{_sbindir}/showmount +%attr(4755,root,root) /sbin/mount.nfs +/sbin/mount.nfs4 +/sbin/rpc.statd +/sbin/umount.nfs +/sbin/umount.nfs4 +%{_prefix}/lib/systemd/*/rpc-pipefs-generator +%{_prefix}/lib/systemd/*/auth-rpcgss-module.service +%{_prefix}/lib/systemd/*/nfs-client.target +%{_prefix}/lib/systemd/*/rpc-gssd.service +%{_prefix}/lib/systemd/*/rpc-statd.service +%{_prefix}/lib/systemd/*/rpc_pipefs.target +%{_prefix}/lib/systemd/*/var-lib-nfs-rpc_pipefs.mount + +%files -n libnfsidmap +%doc support/nfsidmap/AUTHORS support/nfsidmap/README support/nfsidmap/COPYING +%config(noreplace) %{_sysconfdir}/idmapd.conf +%{_libdir}/libnfsidmap.so.* +%{_libdir}/libnfsidmap/*.so +%{_mandir}/man3/nfs4_uid_to_name.* + %files help %{_mandir}/*/* %changelog -* Wed Mar 22 2023 wuguanghao - 2:2.5.4-10 +* Tue Aug 29 2023 Zhiqiang Liu - 2:2.5.4-13 +- backport two bugfix patches + +* Sun Jun 25 2023 wuguanghao - 2:2.5.4-12 - backport patches from community +* Thu Mar 23 2023 wuguanghao - 2:2.5.4-11 +- backport patches from community + +* Fri Nov 25 2022 fushanqing - 2:2.5.4-10 +- add subpackage libnfsidmap and nfs-utils-min + * Thu Nov 24 2022 Zhiqiang Liu - 2:2.5.4-9 - nfs-blkmapd: PID file read by systemd failed