Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/linux/arch/amd64 Make sure %rip is in userland. T...
details: https://anonhg.NetBSD.org/src/rev/17157f4c8069
branches: trunk
changeset: 351446:17157f4c8069
user: maxv <maxv%NetBSD.org@localhost>
date: Mon Feb 13 15:03:18 2017 +0000
description:
Make sure %rip is in userland. This is harmless, since the return to
userland is made with iret instead of sysret in this path. While here, use
size_t.
diffstat:
sys/compat/linux/arch/amd64/linux_machdep.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (36 lines):
diff -r 22bd00715023 -r 17157f4c8069 sys/compat/linux/arch/amd64/linux_machdep.c
--- a/sys/compat/linux/arch/amd64/linux_machdep.c Mon Feb 13 14:54:11 2017 +0000
+++ b/sys/compat/linux/arch/amd64/linux_machdep.c Mon Feb 13 15:03:18 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.c,v 1.50 2017/02/13 14:54:11 maxv Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.51 2017/02/13 15:03:18 maxv Exp $ */
/*-
* Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.50 2017/02/13 14:54:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.51 2017/02/13 15:03:18 maxv Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -457,7 +457,7 @@
{
struct trapframe *tf = arg;
uint64_t retaddr;
- int vsyscallnr;
+ size_t vsyscallnr;
/*
* Check for a vsyscall. %rip must be the fault address,
@@ -487,6 +487,8 @@
*/
if (copyin((void *)tf->tf_rsp, &retaddr, sizeof retaddr) != 0)
return 0;
+ if ((vaddr_t)retaddr >= VM_MAXUSER_ADDRESS)
+ return 0;
tf->tf_rip = retaddr;
tf->tf_rax = linux_vsyscall_to_syscall[vsyscallnr];
tf->tf_rsp += 8; /* "pop" the return address */
Home |
Main Index |
Thread Index |
Old Index