Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amd64/amd64 Make sure we don't go farther with 32bi...
details: https://anonhg.NetBSD.org/src/rev/dd2301b00e38
branches: trunk
changeset: 356888:dd2301b00e38
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Oct 19 09:32:01 2017 +0000
description:
Make sure we don't go farther with 32bit LWPs. There appears to be some
confusion in the code - in part introduced by myself -, and clearly this
place is not supposed to handle 32bit LWPs.
Right now we're returning EINVAL, but verily we would need to redirect
these calls to their netbsd32 counterparts.
diffstat:
sys/arch/amd64/amd64/process_machdep.c | 39 ++++++++++++++++++++++++++++++++-
1 files changed, 37 insertions(+), 2 deletions(-)
diffs (108 lines):
diff -r e871c0d7e12f -r dd2301b00e38 sys/arch/amd64/amd64/process_machdep.c
--- a/sys/arch/amd64/amd64/process_machdep.c Thu Oct 19 07:02:00 2017 +0000
+++ b/sys/arch/amd64/amd64/process_machdep.c Thu Oct 19 09:32:01 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: process_machdep.c,v 1.35 2017/08/13 08:07:52 maxv Exp $ */
+/* $NetBSD: process_machdep.c,v 1.36 2017/10/19 09:32:01 maxv Exp $ */
/*
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.35 2017/08/13 08:07:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.36 2017/10/19 09:32:01 maxv Exp $");
#include "opt_xen.h"
#include <sys/param.h>
@@ -103,6 +103,11 @@
process_read_regs(struct lwp *l, struct reg *regs)
{
struct trapframe *tf = process_frame(l);
+ struct proc *p = l->l_proc;
+
+ if (p->p_flag & PK_32) {
+ return EINVAL;
+ }
#define copy_to_reg(reg, REG, idx) regs->regs[_REG_##REG] = tf->tf_##reg;
_FRAME_GREG(copy_to_reg)
@@ -114,6 +119,11 @@
int
process_read_fpregs(struct lwp *l, struct fpreg *regs, size_t *sz)
{
+ struct proc *p = l->l_proc;
+
+ if (p->p_flag & PK_32) {
+ return EINVAL;
+ }
process_read_fpregs_xmm(l, ®s->fxstate);
@@ -123,6 +133,11 @@
int
process_read_dbregs(struct lwp *l, struct dbreg *regs, size_t *sz)
{
+ struct proc *p = l->l_proc;
+
+ if (p->p_flag & PK_32) {
+ return EINVAL;
+ }
x86_dbregs_read(l, regs);
@@ -133,10 +148,15 @@
process_write_regs(struct lwp *l, const struct reg *regp)
{
struct trapframe *tf = process_frame(l);
+ struct proc *p = l->l_proc;
int error;
const long *regs = regp->regs;
int err, trapno;
+ if (p->p_flag & PK_32) {
+ return EINVAL;
+ }
+
/*
* Check for security violations.
* Note that struct regs is compatible with
@@ -168,6 +188,11 @@
int
process_write_fpregs(struct lwp *l, const struct fpreg *regs, size_t sz)
{
+ struct proc *p = l->l_proc;
+
+ if (p->p_flag & PK_32) {
+ return EINVAL;
+ }
process_write_fpregs_xmm(l, ®s->fxstate);
return 0;
@@ -176,8 +201,13 @@
int
process_write_dbregs(struct lwp *l, const struct dbreg *regs, size_t sz)
{
+ struct proc *p = l->l_proc;
int error;
+ if (p->p_flag & PK_32) {
+ return EINVAL;
+ }
+
/*
* Check for security violations.
*/
@@ -207,6 +237,11 @@
process_set_pc(struct lwp *l, void *addr)
{
struct trapframe *tf = process_frame(l);
+ struct proc *p = l->l_proc;
+
+ if (p->p_flag & PK_32) {
+ return EINVAL;
+ }
if ((uint64_t)addr >= VM_MAXUSER_ADDRESS)
return EINVAL;
Home |
Main Index |
Thread Index |
Old Index