diff options
author | tegge <tegge@FreeBSD.org> | 1998-05-19 00:00:14 +0000 |
---|---|---|
committer | tegge <tegge@FreeBSD.org> | 1998-05-19 00:00:14 +0000 |
commit | 9fdbafa2fe06cfff465241ce76c5395269982396 (patch) | |
tree | 3b482820bffff64041452ded3ad80246ff105eb3 /sys/amd64/amd64/vm_machdep.c | |
parent | 34f4d24e56af87f75658e327d3046622ea4bc85d (diff) | |
download | FreeBSD-src-9fdbafa2fe06cfff465241ce76c5395269982396.zip FreeBSD-src-9fdbafa2fe06cfff465241ce76c5395269982396.tar.gz |
Disallow reading the current kernel stack. Only the user structure and
the current registers should be accessible.
Reviewed by: David Greenman <dg@root.com>
Diffstat (limited to 'sys/amd64/amd64/vm_machdep.c')
-rw-r--r-- | sys/amd64/amd64/vm_machdep.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 7e3b32a..9c8b1f5 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.106 1998/05/16 14:44:11 kato Exp $ + * $Id: vm_machdep.c,v 1.107 1998/05/17 22:12:11 tegge Exp $ */ #include "npx.h" @@ -742,10 +742,27 @@ cpu_coredump(p, vp, cred) struct vnode *vp; struct ucred *cred; { - - return (vn_rdwr(UIO_WRITE, vp, (caddr_t) p->p_addr, ctob(UPAGES), - (off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, (int *)NULL, - p)); + int error; + caddr_t tempuser; + + tempuser = malloc(ctob(UPAGES), M_TEMP, M_WAITOK); + if (!tempuser) + return EINVAL; + + bzero(tempuser, ctob(UPAGES)); + bcopy(p->p_addr, tempuser, sizeof(struct user)); + bcopy(p->p_md.md_regs, + tempuser + ((caddr_t) p->p_md.md_regs - (caddr_t) p->p_addr), + sizeof(struct trapframe)); + + error = vn_rdwr(UIO_WRITE, vp, (caddr_t) tempuser, + ctob(UPAGES), + (off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, + cred, (int *)NULL, p); + + free(tempuser, M_TEMP); + + return error; } #ifdef notyet |