Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 09 Feb 2026 18:48:02 +0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 8066b8923ebf - main - kern/vfs_unmount.c: promote flags to uint64_t
Message-ID:  <698a2be2.33f25.70bdf17b@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=8066b8923ebfd438dc8cb840d2f57066f4daa45d

commit 8066b8923ebfd438dc8cb840d2f57066f4daa45d
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-02-09 03:11:15 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-02-09 18:47:18 +0000

    kern/vfs_unmount.c: promote flags to uint64_t
    
    to prevent sign-extension, causing unexpected flags to be passed to
    dounmount().  The mnt_flags and MNT_* constants are 64bit wide.
    
    Suggested and reviewed by:      jah
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D55197
---
 sys/compat/linux/linux_file.c | 2 +-
 sys/kern/vfs_mount.c          | 4 ++--
 sys/sys/syscallsubr.h         | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 96326b894d05..ca089585bb95 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -1213,7 +1213,7 @@ linux_oldumount(struct thread *td, struct linux_oldumount_args *args)
 int
 linux_umount(struct thread *td, struct linux_umount_args *args)
 {
-	int flags;
+	uint64_t flags;
 
 	flags = 0;
 	if ((args->flags & LINUX_MNT_FORCE) != 0) {
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 240bf5451a84..2237fcc6b423 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1720,11 +1720,11 @@ int
 sys_unmount(struct thread *td, struct unmount_args *uap)
 {
 
-	return (kern_unmount(td, uap->path, uap->flags));
+	return (kern_unmount(td, uap->path, (unsigned)uap->flags));
 }
 
 int
-kern_unmount(struct thread *td, const char *path, int flags)
+kern_unmount(struct thread *td, const char *path, uint64_t flags)
 {
 	struct nameidata nd;
 	struct mount *mp;
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index e2bbbc188553..35e2b771cbe7 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -403,7 +403,7 @@ int	kern_wait6(struct thread *td, enum idtype idtype, id_t id, int *status,
 int	kern_writev(struct thread *td, int fd, struct uio *auio);
 int	kern_socketpair(struct thread *td, int domain, int type, int protocol,
 	    int *rsv);
-int	kern_unmount(struct thread *td, const char *path, int flags);
+int	kern_unmount(struct thread *td, const char *path, uint64_t flags);
 int	kern_kexec_load(struct thread *td, u_long entry,
 	    u_long nseg, struct kexec_segment *seg, u_long flags);
 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?698a2be2.33f25.70bdf17b>