diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-02-21 03:00:24 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-02-21 03:00:24 +0000 |
commit | 468c889d905916a8b835e4d3a0f58c51c4acf24e (patch) | |
tree | 544c6776ed7d44c4a213a09d686201c319eccd4b /sys/arch/amd64 | |
parent | 9df7289ef4f24e87637772f42b80dd3ac4908ebc (diff) |
aperture stuff
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 32 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/sys_machdep.c | 17 |
2 files changed, 32 insertions, 17 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 003d48cea4f..93e392c272e 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.6 2004/02/19 18:48:44 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.7 2004/02/21 03:00:23 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -218,6 +218,14 @@ void dumpsys(void); void init_x86_64(paddr_t); void syscall_intern(struct proc *p); +#ifdef APERTURE +#ifdef INSECURE +int allowaperture = 1; +#else +int allowaperture = 0; +#endif +#endif + /* * Machine-dependent startup code */ @@ -551,18 +559,16 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev, sizeof consdev)); -#ifdef notyet - case CPU_BOOTED_KERNEL: - bibp = lookup_bootinfo(BTINFO_BOOTPATH); - if(!bibp) - return(ENOENT); /* ??? */ - return (sysctl_rdstring(oldp, oldlenp, newp, bibp->bootpath)); - case CPU_DISKINFO: - if (x86_64_alldisks == NULL) - return (ENOENT); - return (sysctl_rdstruct(oldp, oldlenp, newp, x86_64_alldisks, - sizeof (struct disklist) + - (x86_64_ndisks - 1) * sizeof (struct nativedisk_info))); + case CPU_ALLOWAPERTURE: +#ifdef APERTURE + if (securelevel > 0) + return (sysctl_rdint(oldp, oldlenp, newp, + allowaperture)); + else + return (sysctl_int(oldp, oldlenp, newp, newlen, + &allowaperture)); +#else + return (sysctl_rdint(oldp, oldlenp, newp, 0)); #endif default: return (EOPNOTSUPP); diff --git a/sys/arch/amd64/amd64/sys_machdep.c b/sys/arch/amd64/amd64/sys_machdep.c index 098c523ea68..e49945f6589 100644 --- a/sys/arch/amd64/amd64/sys_machdep.c +++ b/sys/arch/amd64/amd64/sys_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_machdep.c,v 1.1 2004/01/28 01:39:39 mickey Exp $ */ +/* $OpenBSD: sys_machdep.c,v 1.2 2004/02/21 03:00:23 deraadt Exp $ */ /* $NetBSD: sys_machdep.c,v 1.1 2003/04/26 18:39:32 fvdl Exp $ */ /*- @@ -281,6 +281,10 @@ out: } #endif /* USER_LDT */ +#ifdef APERTURE +extern int allowaperture; +#endif + int x86_64_iopl(struct proc *p, void *args, register_t *retval) { @@ -288,12 +292,17 @@ x86_64_iopl(struct proc *p, void *args, register_t *retval) struct trapframe *tf = p->p_md.md_regs; struct x86_64_iopl_args ua; - if (securelevel > 1) - return EPERM; - if ((error = suser(p, 0)) != 0) return error; +#ifdef APERTURE + if (!allowaperture && securelevel > 0) + return EPERM; +#else + if (securelevel > 1) + return EPERM; +#endif + if ((error = copyin(args, &ua, sizeof(ua))) != 0) return error; |