- add changes for bug 2223236.

This commit is contained in:
Ian Kent 2023-07-18 10:08:41 +08:00
parent c11e9b5b51
commit b4cf2cc95a
2 changed files with 71 additions and 1 deletions

View File

@ -0,0 +1,62 @@
autofs-5.1.8 - fix incorrect matching of cached wildcard key
From: Ian Kent <raven@themaw.net>
During the implementation of amd format map entry support the code
to match a cached key was modified.
Unfortunately there's a case were the key lookup behaves incorrectly.
That case is when there are included maps in the map itself and one
of the maps (usually the last) has a wildcard key entry. In this case
the wildcard key may be found during lookup but the map it blongs to
isn't checked so it can be incorrectly returned instead of a matching
entry in a subsequent included map.
Another problem case is when there's a wildcard match and a cache prune
occurs while the mount is being done. In this case the matched cache
entry that has been added is seen as stale and removed along with the
mount point directory during the prune leading to a mount fail.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/parse_subs.c | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
--- autofs-5.1.7.orig/CHANGELOG
+++ autofs-5.1.7/CHANGELOG
@@ -155,6 +155,7 @@
- add ioctlfd open helper.
- make open files limit configurable.
- fix some sss error return cases.
+- fix incorrect matching of cached wildcard key.
25/01/2021 autofs-5.1.7
- make bind mounts propagation slave by default.
--- autofs-5.1.7.orig/lib/parse_subs.c
+++ autofs-5.1.7/lib/parse_subs.c
@@ -532,8 +532,11 @@ struct mapent *match_cached_key(struct a
while ((me = cache_lookup_key_next(me)))
if (me->source == source)
break;
- if (!me)
+ if (!me) {
me = cache_lookup_distinct(mc, "*");
+ if (me && (me->source != source))
+ me = NULL;
+ }
}
if (!me)
@@ -545,7 +548,9 @@ struct mapent *match_cached_key(struct a
*/
if (!(ap->flags & MOUNT_FLAG_REMOUNT) &&
ap->type == LKP_INDIRECT && *me->key == '*') {
- ret = cache_update(mc, source, key, me->mapent, me->age);
+ time_t now = monotonic_time(NULL);
+
+ ret = cache_update(mc, source, key, me->mapent, now);
if (!(ret & (CHE_OK | CHE_UPDATED)))
me = NULL;
}

View File

@ -12,7 +12,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.1.7
Release: 53%{?dist}
Release: 54%{?dist}
Epoch: 1
License: GPLv2+
Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}-2.tar.gz
@ -183,6 +183,7 @@ Patch170: autofs-5.1.8-add-soucre-parameter-to-module-functions.patch
Patch171: autofs-5.1.8-add-ioctlfd-open-helper.patch
Patch172: autofs-5.1.8-make-open-files-limit-configurable.patch
Patch173: autofs-5.1.8-fix-some-sss-error-return-cases.patch
Patch174: autofs-5.1.8-fix-incorrect-matching-of-cached-wildcard-key.patch
%if %{with_systemd}
BuildRequires: systemd-units
@ -410,6 +411,7 @@ echo %{version}-%{release} > .version
%patch171 -p1
%patch172 -p1
%patch173 -p1
%patch174 -p1
%build
LDFLAGS=-Wl,-z,now
@ -518,6 +520,12 @@ fi
%dir /etc/auto.master.d
%changelog
* Mon Jul 17 2023 Ian Kent <ikent@redhat.com> - 1:5.1.7-54
- bz2223236 - When looking up included maps, sometimes autofs does not
consult all the included files in order
- fix incorrect matching of cached wildcard key.
- Resolves: rhbz#2223236
* Tue Jul 13 2023 Ian Kent <ikent@redhat.com> - 1:5.1.7-53
- bz2215661 - The sss lookup modules handles error return incorrectly in
some cases