From 0b7c89c8c236fcfabd1abd59c6b8274c7eb80f5e Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Tue, 7 Nov 2023 10:42:53 +0100 Subject: [PATCH 1/5] autofs: media: Don't include nosuid in the script We already have nosuid option in auto_master so no need to redefine it. Also it's easier for a user to modify the auto_master configuration file than the script (which shouldn't be modified). Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D42492 Reviewed by: rew --- usr.sbin/autofs/autofs/special_media | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/autofs/autofs/special_media b/usr.sbin/autofs/autofs/special_media index d72ddddddb2e..33fa4544d028 100755 --- a/usr.sbin/autofs/autofs/special_media +++ b/usr.sbin/autofs/autofs/special_media @@ -40,7 +40,7 @@ print_map_entry() { case "${_fstype}" in "exfat") if [ -f "/usr/local/sbin/mount.exfat" ]; then - echo "-mountprog=/usr/local/sbin/mount.exfat,fstype=${_fstype},nosuid :/dev/${_p}" + echo "-mountprog=/usr/local/sbin/mount.exfat,fstype=${_fstype} :/dev/${_p}" else /usr/bin/logger -p info -t "special_media[$$]" \ "Cannot mount ${_fstype} formatted device /dev/${_p}: Install sysutils/fusefs-exfat first" @@ -49,7 +49,7 @@ print_map_entry() { ;; "ntfs") if [ -f "/usr/local/bin/ntfs-3g" ]; then - echo "-mountprog=/usr/local/bin/ntfs-3g,fstype=${_fstype},nosuid :/dev/${_p}" + echo "-mountprog=/usr/local/bin/ntfs-3g,fstype=${_fstype} :/dev/${_p}" else /usr/bin/logger -p info -t "special_media[$$]" \ "Cannot mount ${_fstype} formatted device /dev/${_p}: Install sysutils/fusefs-ntfs first" @@ -57,10 +57,10 @@ print_map_entry() { fi ;; "ext2fs" | "msdosfs") - echo "-fstype=${_fstype},nosuid,async :/dev/${_p}" + echo "-fstype=${_fstype},async :/dev/${_p}" ;; *) - echo "-fstype=${_fstype},nosuid :/dev/${_p}" + echo "-fstype=${_fstype} :/dev/${_p}" ;; esac } From 5a78fcfce4c563fcd47dcfb6f36aff2bdd14839b Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Tue, 7 Nov 2023 10:45:49 +0100 Subject: [PATCH 2/5] autofs: Remove stale comment devd action for automount -c was never commented. Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D42493 Reviewed by: rew --- usr.sbin/autofs/auto_master | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr.sbin/autofs/auto_master b/usr.sbin/autofs/auto_master index bbe05c533708..111836c058a5 100644 --- a/usr.sbin/autofs/auto_master +++ b/usr.sbin/autofs/auto_master @@ -2,7 +2,5 @@ # Automounter master map, see auto_master(5) for details. # /net -hosts -nobrowse,nosuid,intr -# When using the -media special map, make sure to edit devd.conf(5) -# to move the call to "automount -c" out of the comments section. #/media -media -nosuid,noatime,autoro #/- -noauto From b3c116d50ecacaab5236e0488cb74c1bcf614ae7 Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Tue, 7 Nov 2023 11:06:15 +0100 Subject: [PATCH 3/5] devd: autofs: Move autofs related events to a separate file If a user don't have FreeBSD-autofs installed there is no need to try calling automount on every GEOM event. It's also easier to add/delete autofs related event in a separate file. Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D42495 Reviewed by: imp --- sbin/devd/Makefile | 5 +++++ sbin/devd/autofs.conf | 9 +++++++++ sbin/devd/devd.conf | 7 ------- 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 sbin/devd/autofs.conf diff --git a/sbin/devd/Makefile b/sbin/devd/Makefile index 7f334ad6b409..68ff477f09c9 100644 --- a/sbin/devd/Makefile +++ b/sbin/devd/Makefile @@ -11,6 +11,11 @@ DEVDDIR= /etc/devd DEVD+= asus.conf .endif +CONFGROUPS+= AUTOFS +AUTOFSDIR= ${DEVDDIR} +AUTOFS+= autofs.conf +AUTOFSPACKAGE= autofs + CONFGROUPS+= DHCLIENT DHCLIENTDIR= ${DEVDDIR} DHCLIENT+= dhclient.conf diff --git a/sbin/devd/autofs.conf b/sbin/devd/autofs.conf new file mode 100644 index 000000000000..a06ca7295d38 --- /dev/null +++ b/sbin/devd/autofs.conf @@ -0,0 +1,9 @@ +# +# autofs(5) specific devd events + +# Discard autofs caches, useful for the -media special map. +notify 100 { + match "system" "GEOM"; + match "subsystem" "DEV"; + action "/usr/sbin/automount -c"; +}; diff --git a/sbin/devd/devd.conf b/sbin/devd/devd.conf index d793dd296437..08cbeb840b2f 100644 --- a/sbin/devd/devd.conf +++ b/sbin/devd/devd.conf @@ -136,13 +136,6 @@ notify 0 { action "service postgresql restart"; }; -# Discard autofs caches, useful for the -media special map. -notify 100 { - match "system" "GEOM"; - match "subsystem" "DEV"; - action "/usr/sbin/automount -c"; -}; - # Handle userland coredumps. # This commented out handler makes it possible to run an # automated debugging session after the core dump is generated. From 2a35f3cdf63d1f9b1ea5ab0174adabb631757210 Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Thu, 27 Oct 2022 11:43:19 +0200 Subject: [PATCH 4/5] sys/mutex.h: Include sys/lock.h instead of sys/_lock.h It uses the LA_ defines when INVARIANTS is set. This unbreak dpaa2 with FDT only kernel (like ALLWINNER or ROCKCHIP) as the driver only include sys/lock.h via header polution for ACPI kernels. Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D37145 Reviewed by: kib, mjg --- sys/sys/mutex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h index 56c03a1b0be9..750a5e99679a 100644 --- a/sys/sys/mutex.h +++ b/sys/sys/mutex.h @@ -34,8 +34,8 @@ #define _SYS_MUTEX_H_ #include -#include #include +#include #ifdef _KERNEL #include From 50335b1ae4e48712f831e85ddfa7b00da0af382c Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Fri, 24 Nov 2023 11:30:09 +0100 Subject: [PATCH 5/5] sys/mutex.h: Reorder includes Fixes: 2a35f3cdf63d ("sys/mutex.h: Include sys/lock.h instead of sys/_lock.h") --- sys/sys/mutex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h index 750a5e99679a..9fd6663ed75d 100644 --- a/sys/sys/mutex.h +++ b/sys/sys/mutex.h @@ -34,8 +34,8 @@ #define _SYS_MUTEX_H_ #include -#include #include +#include #ifdef _KERNEL #include