From owner-svn-src-head@freebsd.org Wed Feb 26 20:03:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A3B724355F; Wed, 26 Feb 2020 20:03:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48SRZS6MMXz400v; Wed, 26 Feb 2020 20:03:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8C2F5016; Wed, 26 Feb 2020 20:03:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01QK3i8S082764; Wed, 26 Feb 2020 20:03:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01QK3iYx082761; Wed, 26 Feb 2020 20:03:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202002262003.01QK3iYx082761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 26 Feb 2020 20:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358355 - in head: lib/libc/sys sys/vm X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: lib/libc/sys sys/vm X-SVN-Commit-Revision: 358355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Feb 2020 20:03:45 -0000 Author: emaste Date: Wed Feb 26 20:03:43 2020 New Revision: 358355 URL: https://svnweb.freebsd.org/changeset/base/358355 Log: Return ENOTSUP for mmap/mprotect if prot not subset of prot_max From POSIX, [ENOTSUP] The implementation does not support the combination of accesses requested in the prot argument. This fits the case that prot contains permissions which are not a subset of prot_max. Reviewed by: brooks, cem Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23843 Modified: head/lib/libc/sys/mmap.2 head/lib/libc/sys/mprotect.2 head/sys/vm/vm_mmap.c Modified: head/lib/libc/sys/mmap.2 ============================================================================== --- head/lib/libc/sys/mmap.2 Wed Feb 26 19:39:59 2020 (r358354) +++ head/lib/libc/sys/mmap.2 Wed Feb 26 20:03:43 2020 (r358355) @@ -28,7 +28,7 @@ .\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 .\" $FreeBSD$ .\" -.Dd June 20, 2019 +.Dd February 26, 2020 .Dt MMAP 2 .Os .Sh NAME @@ -432,11 +432,6 @@ An invalid value was passed in the .Fa prot argument. .It Bq Er EINVAL -The -.Fa prot -argument contains permissions which are not a subset of the specified -maximum permissions. -.It Bq Er EINVAL An undefined option was set in the .Fa flags argument. @@ -530,6 +525,11 @@ was specified and the argument was not available. .Dv MAP_ANON was specified and insufficient memory was available. +.It Bq Er ENOTSUP +The +.Fa prot +argument contains permissions which are not a subset of the specified +maximum permissions. .El .Sh SEE ALSO .Xr madvise 2 , Modified: head/lib/libc/sys/mprotect.2 ============================================================================== --- head/lib/libc/sys/mprotect.2 Wed Feb 26 19:39:59 2020 (r358354) +++ head/lib/libc/sys/mprotect.2 Wed Feb 26 20:03:43 2020 (r358355) @@ -28,7 +28,7 @@ .\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 20, 2019 +.Dd February 26, 2020 .Dt MPROTECT 2 .Os .Sh NAME @@ -104,7 +104,7 @@ arguments is not valid. The .Fa prot argument contains unhandled bits. -.It Bq Er EINVAL +.It Bq Er ENOTSUP The .Fa prot argument contains permissions which are not a subset of the specified Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Wed Feb 26 19:39:59 2020 (r358354) +++ head/sys/vm/vm_mmap.c Wed Feb 26 20:03:43 2020 (r358355) @@ -225,7 +225,7 @@ kern_mmap_fpcheck(struct thread *td, uintptr_t addr0, max_prot = PROT_MAX_EXTRACT(prot); prot = PROT_EXTRACT(prot); if (max_prot != 0 && (max_prot & prot) != prot) - return (EINVAL); + return (ENOTSUP); p = td->td_proc; @@ -668,7 +668,7 @@ kern_mprotect(struct thread *td, uintptr_t addr0, size vm_error = KERN_SUCCESS; if (max_prot != 0) { if ((max_prot & prot) != prot) - return (EINVAL); + return (ENOTSUP); vm_error = vm_map_protect(&td->td_proc->p_vmspace->vm_map, addr, addr + size, max_prot, TRUE); }