Skip to contentSkip to conversation

Regression in 5.2.0, SIGSEGV in master.c line 619

DISCUSSION Kris Karas (Bug Reporting) 2 participants 4 messages Nov 17 – Nov 22 Kernel automounter

lore
Share & tools
lore
#0 lore raw

Greetings,

After upgrading autofs-5.1.9 to autofs-5.2.0, automount successfully shows --ghost subdirectories under a configured indirect map. But any attempt to view files under one of the mount points crashes automount and causes the file access to hang.

Interestingly, the mountpoint actually does get mounted, so killing the wedged file access and re-running will show the mounted contents. But the automount daemon is dead at this point.

~# gdb /usr/sbin/automount
(gdb) set args -f -v
(gdb) run
[boilerplate here trimmed]
[doing <ls /amnt/slack> in another terminal window]
(gdb)
Thread 9 "automount" received signal SIGSEGV, Segmentation fault. [Switching to thread 9 (Thread 0x7fffe7fff6c0 (LWP 16086))] 0x00007ffff7b90c47 in __strcmp_avx2 () from /lib64/libc.so.6
(gdb) up
#1 0x00005555555710f4 in send_map_update_request (ap=0x5555555bf920) at master.c:619
619 if (!strcmp(ap->entry->maps->type, "hosts"))
(gdb) print ap->entry->maps
$1 = (struct map_source *) 0x5555555bfa20
(gdb) print ap->entry->maps->type
$2 = 0x0
(gdb)

No changes to config files, using the unaltered ones in autofs-5.2.0/samples/* that ship with the package.

It's a Slackware64-current distro here.
The only customizations are these:

---- Start /etc/auto.master.d/amnt.autofs

/amnt /etc/auto.master.d/amnt.map --timeout=60 --ghost

---- End /etc/auto.master.d/amnt.autofs

---- Start /etc/auto.master.d/amnt.map ----

slack -fstype=nfs,nfsvers=4.2,ro fileserver:/srv/slackware

---- End /etc/auto.master.d/amnt.map ----

Kindly CC me on any replies you wish me to see, as I'm not subbed to the mailing list.

Kris

maintainer
#1 lore raw
Quoted 50 lines · Kris Karas (Bug Reporting)

Greetings,

After upgrading autofs-5.1.9 to autofs-5.2.0, automount successfully shows --ghost subdirectories under a configured indirect map.  But any
attempt to view files under one of the mount points crashes automount and causes the file access to hang.

Interestingly, the mountpoint actually does get mounted, so killing the
wedged file access and re-running will show the mounted contents. But
the automount daemon is dead at this point.

~# gdb /usr/sbin/automount
(gdb) set args -f -v
(gdb) run
    [boilerplate here trimmed]
    [doing  <ls /amnt/slack>  in another terminal window] (gdb)
Thread 9 "automount" received signal SIGSEGV, Segmentation fault. [Switching to thread 9 (Thread 0x7fffe7fff6c0 (LWP 16086))] 0x00007ffff7b90c47 in __strcmp_avx2 () from /lib64/libc.so.6 (gdb) up
#1  0x00005555555710f4 in send_map_update_request (ap=0x5555555bf920) at
master.c:619
619             if (!strcmp(ap->entry->maps->type, "hosts")) (gdb) print ap->entry->maps
$1 = (struct map_source *) 0x5555555bfa20
(gdb) print ap->entry->maps->type
$2 = 0x0
(gdb)

No changes to config files, using the unaltered ones in autofs-5.2.0/samples/* that ship with the package.

It's a Slackware64-current distro here.
The only customizations are these:

---- Start /etc/auto.master.d/amnt.autofs

/amnt  /etc/auto.master.d/amnt.map  --timeout=60 --ghost

---- End /etc/auto.master.d/amnt.autofs

---- Start /etc/auto.master.d/amnt.map ----

slack  -fstype=nfs,nfsvers=4.2,ro  fileserver:/srv/slackware

Quoted 8 lines

---- End /etc/auto.master.d/amnt.map ----

Kindly CC me on any replies you wish me to see, as I'm not subbed to the
mailing list.

Kris

Sorry to be slow to get back to you.

This has been reported a couple of times now and I have a patch I think resolves it but have not yet uploaded it to kernel.org.

I'm not a Slackware maintainer so I'm not sure what we should do in that respect.

If you can, please test the attached patch so I can move along the posting it upstream and committing it to the autofs repo. etc.

Ian Kent

autofs-5.2.0 - fix map type check when reading master map

From: Ian Kent <[email protected]>

Commit 567b4ea2 ("dont auto readmap for hosts map") added two strcmp(ap->entry->maps->type, "hosts") calls in daemon/master.c without a NULL check. If ap->maps->type is NULL when the master map entry has no explicit type, e.g. "/auto /etc/auto.auto", automount segfaults.

After the daemon dies, processes that accessed the mount point stay blocked in autofs_wait and the system frequently needs to be rebooted.

Thanks to Derek Parks for the initial patch.

Fixes 567b4ea2 ("dont auto readmap for hosts map")
---
 CHANGELOG       |    2 ++
 daemon/master.c |    9 +++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
CHANGELOG +2 -0
index a7c7abd4f..fdf4570ad 100644
@@ -1,3 +1,5 @@
+- fix map type check when reading master map.
+
 10/11/2026 autofs-5.2.0
 - Update configure script.
 - fix ldap_parse_page_control() check.
daemon/master.c +7 -2
index f1df80731..94b0d8db8 100644
@@ -613,10 +613,14 @@ void send_map_update_request(struct autofs_point *ap)
 	struct map_source *map;
 	int status, need_update = 0;
 
+	/* Don't bother if there are no maps. */
+	if (!ap->entry->maps)
+		return;
+
 	/* Don't send an update request if the primary map is the
 	 * "hosts" map.
 	 */
-	if (!strcmp(ap->entry->maps->type, "hosts"))
+	if (ap->entry->maps->type && !strcmp(ap->entry->maps->type, "hosts"))
 		return;
 
 	status = pthread_mutex_lock(&instance_mutex);
@@ -1513,7 +1517,8 @@ void check_update_map_sources(struct master_mapent *entry, int readall)
 		/* Don't send an update request if the primary map is
 		 * the "hosts" map.
 		 */
-		if (strcmp(ap->entry->maps->type, "hosts"))
+		if (entry->maps &&
+		   (!entry->maps->type || strcmp(entry->maps->type, "hosts")))
 			st_add_task(ap, ST_READMAP);
 	}
 
#2 lore raw
Quoted 1 line · Ian Kent

Sorry to be slow to get back to you.

No problem. Thanks for the patch!

Quoted 2 lines

If you can, please test the attached patch so I can move along the posting it upstream and committing it to the autofs repo. etc.

Tested just now, and it working fine here.

Kris

~/autofs# automount --version

Linux automount version 5.2.0

Directories:
config dir: /etc/default
maps dir: /etc
modules dir: /usr/lib64/autofs

Compile options:
WITH_LDAP LIBXML2_WORKAROUND WITH_LIBTIRPC

maintainer
#3 lore raw
Quoted 16 lines · Kris Karas (Bug Reporting)
Quoted 1 line · Ian Kent

Sorry to be slow to get back to you.

No problem.  Thanks for the patch!

Quoted 2 lines

If you can, please test the attached patch so I can move along the posting it upstream and committing it to the autofs repo. etc.

Tested just now, and it working fine here.

Kris

     ~/autofs# automount --version

     Linux automount version 5.2.0

Quoted 7 lines

     Directories:
             config dir:     /etc/default
             maps dir:       /etc
             modules dir:    /usr/lib64/autofs

     Compile options:
       WITH_LDAP LIBXML2_WORKAROUND WITH_LIBTIRPC

Thank you for checking it and getting back, ;)

Ian