diff options
author | Joshua Stein <jcs@cvs.openbsd.org> | 2015-05-28 20:53:06 +0000 |
---|---|---|
committer | Joshua Stein <jcs@cvs.openbsd.org> | 2015-05-28 20:53:06 +0000 |
commit | f225b1330d5cd7b32f0445be1aac4aa36a0cfc1a (patch) | |
tree | 4a7bca7cd584b4c0aef02e18f3c1ea58ad32d8cc | |
parent | 9720dcf9b0f447cb8683388f03629410cd4b255a (diff) |
when machdep.allowaperture sysctl is set to 3, allow concurrent access
-rw-r--r-- | share/man/man4/xf86.4 | 8 | ||||
-rw-r--r-- | sys/arch/alpha/alpha/mem.c | 13 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/mem.c | 8 | ||||
-rw-r--r-- | sys/arch/arm/arm/mem.c | 7 | ||||
-rw-r--r-- | sys/arch/i386/i386/mem.c | 8 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/mem.c | 7 |
6 files changed, 29 insertions, 22 deletions
diff --git a/share/man/man4/xf86.4 b/share/man/man4/xf86.4 index 0c01ff88c14..c421df9bf9a 100644 --- a/share/man/man4/xf86.4 +++ b/share/man/man4/xf86.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: xf86.4,v 1.18 2015/01/15 20:37:36 schwarze Exp $ +.\" $OpenBSD: xf86.4,v 1.19 2015/05/28 20:53:05 jcs Exp $ .\" .\" Copyright (c) 1998 Matthieu Herrb .\" All rights reserved. @@ -25,7 +25,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: January 15 2015 $ +.Dd $Mdocdate: May 28 2015 $ .Dt XF86 4 .Os .Sh NAME @@ -90,6 +90,10 @@ Note that this can cause some security problems, since the process that has access to the aperture driver can also access part of the kernel memory. This mode is not supported on alpha or sparc64. +.It 3 +the aperture driver allows multiple processes to concurrently access +.Xr pci 4 +configuration registers and the whole first megabyte of physical memory. .El .Sh SEE ALSO .Xr Xorg 1 , diff --git a/sys/arch/alpha/alpha/mem.c b/sys/arch/alpha/alpha/mem.c index 37c5323bd9b..fa46e8712bd 100644 --- a/sys/arch/alpha/alpha/mem.c +++ b/sys/arch/alpha/alpha/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.27 2015/02/10 22:44:35 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.28 2015/05/28 20:53:05 jcs Exp $ */ /* $NetBSD: mem.c,v 1.26 2000/03/29 03:48:20 simonb Exp $ */ /* @@ -64,7 +64,6 @@ caddr_t zeropage; /* open counter for aperture */ #ifdef APERTURE static int ap_open_count = 0; -static pid_t ap_open_pid = -1; extern int allowaperture; #endif @@ -86,11 +85,11 @@ mmopen(dev, flag, mode, p) if (suser(p, 0) != 0 || !allowaperture) return (EPERM); - /* authorize only one simultaneous open() from the same pid */ - if (ap_open_count > 0 && p->p_pid != ap_open_pid) + /* authorize only one simultaneous open() unless + * allowaperture=3 */ + if (ap_open_count > 0 && allowaperture < 3) return(EPERM); ap_open_count++; - ap_open_pid = p->p_pid; return (0); #endif case 12: @@ -109,10 +108,8 @@ mmclose(dev, flag, mode, p) { #ifdef APERTURE - if (minor(dev) == 4) { + if (minor(dev) == 4) ap_open_count = 0; - ap_open_pid = -1; - } #endif return (0); } diff --git a/sys/arch/amd64/amd64/mem.c b/sys/arch/amd64/amd64/mem.c index 68a894488e2..49b96c243e1 100644 --- a/sys/arch/amd64/amd64/mem.c +++ b/sys/arch/amd64/amd64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.23 2015/03/14 03:38:46 jsg Exp $ */ +/* $OpenBSD: mem.c,v 1.24 2015/05/28 20:53:05 jcs Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -93,8 +93,9 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) if (suser(p, 0) != 0 || !allowaperture) return (EPERM); - /* authorize only one simultaneous open() */ - if (ap_open_count > 0) + /* authorize only one simultaneous open() unless + * allowaperture=3 */ + if (ap_open_count > 0 && allowaperture < 3) return(EPERM); ap_open_count++; break; @@ -213,6 +214,7 @@ mmmmap(dev_t dev, off_t off, int prot) else return -1; case 2: + case 3: /* Allow mapping of the whole 1st megabyte for x86emu */ if (off <= BIOS_END || !amd64_pa_used(off)) diff --git a/sys/arch/arm/arm/mem.c b/sys/arch/arm/arm/mem.c index 8096f44a9e7..975ebdc9a99 100644 --- a/sys/arch/arm/arm/mem.c +++ b/sys/arch/arm/arm/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.13 2015/02/10 22:44:35 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.14 2015/05/28 20:53:05 jcs Exp $ */ /* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */ /* @@ -116,8 +116,9 @@ mmopen(dev, flag, mode, p) if (suser(p, 0) != 0 || !allowaperture) return (EPERM); - /* authorize only one simultaneous open() */ - if (ap_open_count > 0) + /* authorize only one simultaneous open() unless + * allowaperture=3 */ + if (ap_open_count > 0 && allowaperture < 3) return(EPERM); ap_open_count++; break; diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c index 1e0203ca058..b45e8e04df3 100644 --- a/sys/arch/i386/i386/mem.c +++ b/sys/arch/i386/i386/mem.c @@ -1,5 +1,5 @@ /* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */ -/* $OpenBSD: mem.c,v 1.43 2015/02/10 22:44:35 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.44 2015/05/28 20:53:05 jcs Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -87,8 +87,9 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) if (suser(p, 0) != 0 || !allowaperture) return (EPERM); - /* authorize only one simultaneous open() */ - if (ap_open_count > 0) + /* authorize only one simultaneous open() unless + * allowaperture=3 */ + if (ap_open_count > 0 && allowaperture < 3) return(EPERM); ap_open_count++; break; @@ -227,6 +228,7 @@ mmmmap(dev_t dev, off_t off, int prot) else return -1; case 2: + case 3: /* Allow mapping of the whole 1st megabyte for x86emu */ if (off <= BIOS_END || diff --git a/sys/arch/macppc/macppc/mem.c b/sys/arch/macppc/macppc/mem.c index 66af75e8f8c..bafdd92b96a 100644 --- a/sys/arch/macppc/macppc/mem.c +++ b/sys/arch/macppc/macppc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.20 2015/02/10 22:44:35 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.21 2015/05/28 20:53:05 jcs Exp $ */ /* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -204,8 +204,9 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) if (suser(p, 0) != 0 || !allowaperture) return (EPERM); - /* authorize only one simultaneous open() */ - if (ap_open_count > 0) + /* authorize only one simultaneous open() unless + * allowaperture=3 */ + if (ap_open_count > 0 && allowaperture < 3) return(EPERM); ap_open_count++; break; |