From 1c2ad3e9623047701a0a49ef6823ea5f25849966 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sat, 11 Feb 2017 20:27:39 +0000 Subject: [PATCH] Change type of the prot parameter for kern_vm_mmap() from vm_prot_t to int. This makes the code to pass whole word of the mmap(2) syscall argument prot to the syscall helper kern_vm_mmap(), which can validate all bits. The change provides temporal fix for sys/vm/mmap_test mmap__bad_arguments, which was broken after r313352. PR: 216976 Reported and tested by: ngie Sponsored by: The FreeBSD Foundation --- sys/vm/vm_extern.h | 2 +- sys/vm/vm_mmap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h index 49553570ed7..c11dc25d6d9 100644 --- a/sys/vm/vm_extern.h +++ b/sys/vm/vm_extern.h @@ -72,7 +72,7 @@ void kmem_init_zero_region(void); void kmeminit(void); int kern_vm_mmap(struct thread *td, vm_offset_t addr, vm_size_t size, - vm_prot_t prot, int flags, int fd, off_t pos); + int prot, int flags, int fd, off_t pos); int kern_vm_mprotect(struct thread *td, vm_offset_t addr, vm_size_t size, vm_prot_t prot); int kern_vm_msync(struct thread *td, vm_offset_t addr, vm_size_t size, diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 81124aba54f..b2ad621a925 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -196,7 +196,7 @@ sys_mmap(struct thread *td, struct mmap_args *uap) int kern_vm_mmap(struct thread *td, vm_offset_t addr, vm_size_t size, - vm_prot_t prot, int flags, int fd, off_t pos) + int prot, int flags, int fd, off_t pos) { struct file *fp; vm_size_t pageoff;