Skip to content

Commit

Permalink
Change unused fflags parameter in VOP_MMAP to prot and pass in
Browse files Browse the repository at this point in the history
desired vm protection.
  • Loading branch information
pooka authored and pooka committed Jul 27, 2007
1 parent d9970c8 commit 1ce406a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions sys/fs/puffs/puffs_msgif.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: puffs_msgif.h,v 1.44 2007/07/19 07:52:45 pooka Exp $ */
/* $NetBSD: puffs_msgif.h,v 1.45 2007/07/27 08:26:39 pooka Exp $ */

/*
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
Expand Down Expand Up @@ -83,7 +83,7 @@ enum {
#define PUFFS_VN_MAX PUFFS_VN_SETEXTATTR

#define PUFFSDEVELVERS 0x80000000
#define PUFFSVERSION 15
#define PUFFSVERSION 16
#define PUFFSNAMESIZE 32

#define PUFFS_TYPELEN (_VFS_NAMELEN - (sizeof(PUFFS_TYPEPREFIX)+1))
Expand Down Expand Up @@ -691,7 +691,7 @@ struct puffs_vnreq_advlock {
struct puffs_vnreq_mmap {
struct puffs_req pvn_pr;

int pvnr_fflags; /* OUT */
vm_prot_t pvnr_prot; /* OUT */
struct puffs_kcred pvnr_cred; /* OUT */
struct puffs_kcid pvnr_cid; /* OUT */
};
Expand Down
8 changes: 4 additions & 4 deletions sys/fs/puffs/puffs_vnops.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: puffs_vnops.c,v 1.91 2007/07/22 18:59:00 pooka Exp $ */
/* $NetBSD: puffs_vnops.c,v 1.92 2007/07/27 08:26:39 pooka Exp $ */

/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
Expand Down Expand Up @@ -30,7 +30,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.91 2007/07/22 18:59:00 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.92 2007/07/27 08:26:39 pooka Exp $");

#include <sys/param.h>
#include <sys/fstrans.h>
Expand Down Expand Up @@ -2092,7 +2092,7 @@ puffs_mmap(void *v)
struct vop_mmap_args /* {
const struct vnodeop_desc *a_desc;
struct vnode *a_vp;
int a_fflags;
vm_prot_t a_prot;
kauth_cred_t a_cred;
struct lwp *a_l;
} */ *ap = v;
Expand All @@ -2107,7 +2107,7 @@ puffs_mmap(void *v)
return genfs_eopnotsupp(v);

if (EXISTSOP(pmp, MMAP)) {
mmap_arg.pvnr_fflags = ap->a_fflags;
mmap_arg.pvnr_prot = ap->a_prot;
puffs_credcvt(&mmap_arg.pvnr_cred, ap->a_cred);
puffs_cidcvt(&mmap_arg.pvnr_cid, ap->a_l);

Expand Down
18 changes: 9 additions & 9 deletions sys/kern/exec_subr.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: exec_subr.c,v 1.53 2007/07/22 19:16:04 pooka Exp $ */
/* $NetBSD: exec_subr.c,v 1.54 2007/07/27 08:26:38 pooka Exp $ */

/*
* Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
Expand Down Expand Up @@ -31,7 +31,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: exec_subr.c,v 1.53 2007/07/22 19:16:04 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: exec_subr.c,v 1.54 2007/07/27 08:26:38 pooka Exp $");

#include "opt_pax.h"

Expand Down Expand Up @@ -175,11 +175,17 @@ vmcmd_map_pagedvn(struct lwp *l, struct exec_vmcmd *cmd)
if (cmd->ev_len & PAGE_MASK)
return(EINVAL);

prot = cmd->ev_prot;
maxprot = UVM_PROT_ALL;
#ifdef PAX_MPROTECT
pax_mprotect(l, &prot, &maxprot);
#endif /* PAX_MPROTECT */

/*
* check the file system's opinion about mmapping the file
*/

error = VOP_MMAP(vp, 0, p->p_cred, l);
error = VOP_MMAP(vp, prot, p->p_cred, l);
if (error)
return error;

Expand All @@ -191,12 +197,6 @@ vmcmd_map_pagedvn(struct lwp *l, struct exec_vmcmd *cmd)
VOP_UNLOCK(vp, 0);
}

prot = cmd->ev_prot;
maxprot = UVM_PROT_ALL;
#ifdef PAX_MPROTECT
pax_mprotect(l, &prot, &maxprot);
#endif /* PAX_MPROTECT */

/*
* do the map, reference the object for this map entry
*/
Expand Down
4 changes: 2 additions & 2 deletions sys/kern/vnode_if.src
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: vnode_if.src,v 1.53 2007/07/22 21:26:53 pooka Exp $
# $NetBSD: vnode_if.src,v 1.54 2007/07/27 08:26:38 pooka Exp $
#
# Copyright (c) 1992, 1993
# The Regents of the University of California. All rights reserved.
Expand Down Expand Up @@ -236,7 +236,7 @@ vop_revoke {
#
vop_mmap {
IN struct vnode *vp;
IN int fflags;
IN vm_prot_t prot;
IN kauth_cred_t cred;
IN struct lwp *l;
};
Expand Down
6 changes: 3 additions & 3 deletions sys/ufs/lfs/lfs_vnops.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: lfs_vnops.c,v 1.208 2007/07/10 23:06:24 perseant Exp $ */
/* $NetBSD: lfs_vnops.c,v 1.209 2007/07/27 08:26:39 pooka Exp $ */

/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -67,7 +67,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.208 2007/07/10 23:06:24 perseant Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.209 2007/07/27 08:26:39 pooka Exp $");

#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
Expand Down Expand Up @@ -2439,7 +2439,7 @@ lfs_mmap(void *v)
struct vop_mmap_args /* {
const struct vnodeop_desc *a_desc;
struct vnode *a_vp;
int a_fflags;
vm_prot_t a_prot;
kauth_cred_t a_cred;
struct lwp *a_l;
} */ *ap = v;
Expand Down
6 changes: 3 additions & 3 deletions sys/uvm/uvm_mmap.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: uvm_mmap.c,v 1.113 2007/07/22 19:16:06 pooka Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.114 2007/07/27 08:26:38 pooka Exp $ */

/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
Expand Down Expand Up @@ -51,7 +51,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.113 2007/07/22 19:16:06 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.114 2007/07/27 08:26:38 pooka Exp $");

#include "opt_compat_netbsd.h"
#include "opt_pax.h"
Expand Down Expand Up @@ -1113,7 +1113,7 @@ uvm_mmap(map, addr, size, prot, maxprot, flags, handle, foff, locklimit)
return (EACCES);

if (vp->v_type != VCHR) {
error = VOP_MMAP(vp, 0, curlwp->l_cred, curlwp);
error = VOP_MMAP(vp, prot, curlwp->l_cred, curlwp);
if (error) {
return error;
}
Expand Down

0 comments on commit 1ce406a

Please sign in to comment.