Date: Wed, 24 Jul 2002 13:49:49 -0700 (PDT) From: Brian Feldman <green@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 14863 for review Message-ID: <200207242049.g6OKnnOT091267@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=14863 Change 14863 by green@green_laptop_2 on 2002/07/24 13:48:51 Change vm_mmap(9) semantics to remove all non-MAC-policy-specified protections from the maximum protections on the mapping and to reject the mapping if the protections requested are not a subset of such protections allowed. Affected files ... .. //depot/projects/trustedbsd/mac/sys/vm/vm_mmap.c#10 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/vm/vm_mmap.c#10 (text+ko) ==== @@ -426,14 +426,25 @@ #ifdef MAC if (handle != NULL) { if (flags & MAP_SHARED) { + /* + * Decrease maximum allowed protection that may be + * used with mprotect(2) later to that which the + * policies might allow "at the moment". This + * should possibly be revoked or limited further + * in mprotect(2). + * + * Make sure that prot is within the scope of + * what policies will allow, or fail immediately. + */ vm_prot_t macmaxprot; macmaxprot = mac_cred_check_mmap_vnode_prot( td->td_ucred, (struct vnode *)handle, 1); - if ((maxprot & macmaxprot) != maxprot) { - error = EPERM; + if ((prot & macmaxprot) != prot) { + error = EACCES; goto done; } + maxprot &= macmaxprot; } /* * XXX Policies (e.g. LOMAC) should possibly check for a read To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207242049.g6OKnnOT091267>