- add upstream patch and patch to fix bug 1965593.

This commit is contained in:
Ian Kent 2021-05-31 09:24:51 +08:00
parent ce865bc0fb
commit a9f7a3c9b4
3 changed files with 116 additions and 1 deletions

View File

@ -0,0 +1,47 @@
autofs-5.1.7 - dont use AUTOFS_DEV_IOCTL_CLOSEMOUNT
From: Ian Kent <raven@themaw.net>
Using an ioctl (AUTOFS_DEV_IOCTL_CLOSEMOUNT) to close an autofs mount
file handle can race with copy_to_user() so the file handle needs to
be closed using close(2) instead.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/dev-ioctl-lib.c | 10 +---------
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 06bf24b8..51e7767e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -68,6 +68,7 @@
- add ext_mount_hash_mutex lock helpers.
- fix amd section mounts map reload.
- fix dandling symlink creation if nis support is not available.
+- dont use AUTOFS_DEV_IOCTL_CLOSEMOUNT.
25/01/2021 autofs-5.1.7
- make bind mounts propagation slave by default.
diff --git a/lib/dev-ioctl-lib.c b/lib/dev-ioctl-lib.c
index e7a1b42a..6b549d73 100644
--- a/lib/dev-ioctl-lib.c
+++ b/lib/dev-ioctl-lib.c
@@ -404,15 +404,7 @@ err:
/* Close */
static int dev_ioctl_close(unsigned int logopt, int ioctlfd)
{
- struct autofs_dev_ioctl param;
-
- init_autofs_dev_ioctl(&param);
- param.ioctlfd = ioctlfd;
-
- if (ioctl(ctl.devfd, AUTOFS_DEV_IOCTL_CLOSEMOUNT, &param) == -1)
- return -1;
-
- return 0;
+ return close(ioctlfd);
}
static int ioctl_close(unsigned int logopt, int ioctlfd)

View File

@ -0,0 +1,60 @@
autofs-5.1.7 - fix lookup_prune_one_cache() refactoring change
From: Ian Kent <raven@themaw.net>
Commit 256963d6b (autofs-5.1.7 - refactor lookup_prune_one_cache() a bit)
changed the position of the getting the next enumeration map entry but
failed to update a couple of other locations that assume the next map
entry has been set. Under certain fairly common conditions this leads
to an infinite loop.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/lookup.c | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG b/CHANGELOG
index 51e7767e..698cc27a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -69,6 +69,7 @@
- fix amd section mounts map reload.
- fix dandling symlink creation if nis support is not available.
- dont use AUTOFS_DEV_IOCTL_CLOSEMOUNT.
+- fix lookup_prune_one_cache() refactoring change.
25/01/2021 autofs-5.1.7
- make bind mounts propagation slave by default.
diff --git a/daemon/lookup.c b/daemon/lookup.c
index 3e9722e4..0b281f83 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -1379,6 +1379,7 @@ void lookup_prune_one_cache(struct autofs_point *ap, struct mapent_cache *mc, ti
if (!key || strchr(key, '*')) {
if (key)
free(key);
+ me = cache_enumerate(mc, me);
continue;
}
@@ -1386,6 +1387,7 @@ void lookup_prune_one_cache(struct autofs_point *ap, struct mapent_cache *mc, ti
if (!path) {
warn(ap->logopt, "can't malloc storage for path");
free(key);
+ me = cache_enumerate(mc, me);
continue;
}
@@ -1413,9 +1415,10 @@ void lookup_prune_one_cache(struct autofs_point *ap, struct mapent_cache *mc, ti
}
if (!valid &&
is_mounted(path, MNTS_REAL)) {
- debug(ap->logopt, "prune posponed, %s mounted", path);
+ debug(ap->logopt, "prune postponed, %s mounted", path);
free(key);
free(path);
+ me = cache_enumerate(mc, me);
continue;
}
if (valid)

View File

@ -12,7 +12,7 @@
Summary: A tool for automatically mounting and unmounting filesystems Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs Name: autofs
Version: 5.1.7 Version: 5.1.7
Release: 12%{?dist} Release: 13%{?dist}
Epoch: 1 Epoch: 1
License: GPLv2+ License: GPLv2+
Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}.tar.gz Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}.tar.gz
@ -86,6 +86,8 @@ Patch66: autofs-5.1.7-cater-for-empty-mounts-list-in-mnts_get_expire_list.patch
Patch67: autofs-5.1.7-add-ext_mount_hash_mutex-lock-helpers.patch Patch67: autofs-5.1.7-add-ext_mount_hash_mutex-lock-helpers.patch
Patch68: autofs-5.1.7-fix-amd-section-mounts-map-reload.patch Patch68: autofs-5.1.7-fix-amd-section-mounts-map-reload.patch
Patch69: autofs-5.1.7-fix-dandling-symlink-creation-if-nis-support-is-not-available.patch Patch69: autofs-5.1.7-fix-dandling-symlink-creation-if-nis-support-is-not-available.patch
Patch70: autofs-5.1.7-dont-use-AUTOFS_DEV_IOCTL_CLOSEMOUNT.patch
Patch71: autofs-5.1.7-fix-lookup_prune_one_cache-refactoring-change.patch
%if %{with_systemd} %if %{with_systemd}
BuildRequires: systemd-units BuildRequires: systemd-units
@ -219,6 +221,8 @@ echo %{version}-%{release} > .version
%patch67 -p1 %patch67 -p1
%patch68 -p1 %patch68 -p1
%patch69 -p1 %patch69 -p1
%patch70 -p1
%patch71 -p1
%build %build
LDFLAGS=-Wl,-z,now LDFLAGS=-Wl,-z,now
@ -327,6 +331,10 @@ fi
%dir /etc/auto.master.d %dir /etc/auto.master.d
%changelog %changelog
* Mon May 31 2021 Ian Kent <ikent@redhat.com> - 1:5.1.7-13
- dont use AUTOFS_DEV_IOCTL_CLOSEMOUNT.
- fix lookup_prune_one_cache() refactoring change.
* Mon Apr 19 2021 Ian Kent <ikent@redhat.com> - 1:5.1.7-12 * Mon Apr 19 2021 Ian Kent <ikent@redhat.com> - 1:5.1.7-12
- Coverity fixes. - Coverity fixes.
- add missing free in handle_mounts(). - add missing free in handle_mounts().