aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-02-09 03:11:15 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-02-09 18:47:18 +0000
commit8066b8923ebfd438dc8cb840d2f57066f4daa45d (patch)
tree7d6d7c8cde08cc7c2358c483f0e8f4a7ea14b528
parent997bfa20d2716e4bae94ab7089ec970b8d884376 (diff)
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
-rw-r--r--sys/compat/linux/linux_file.c2
-rw-r--r--sys/kern/vfs_mount.c4
-rw-r--r--sys/sys/syscallsubr.h2
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);