Don't leak kernel stack into userspace.

This commit is contained in:
pooka 2010-07-13 15:38:15 +00:00
parent 9cccbb6195
commit c99c5d9840
2 changed files with 7 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_syscalls_50.c,v 1.5 2009/08/09 22:49:00 haad Exp $ */
/* $NetBSD: vfs_syscalls_50.c,v 1.6 2010/07/13 15:38:15 pooka Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.5 2009/08/09 22:49:00 haad Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.6 2010/07/13 15:38:15 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -93,6 +93,7 @@ cvtstat(struct stat30 *ost, const struct stat *st)
ost->st_blksize = st->st_blksize;
ost->st_flags = st->st_flags;
ost->st_gen = st->st_gen;
memset(ost->st_spare, 0, sizeof(ost->st_spare));
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_vnops.c,v 1.174 2010/06/24 13:03:12 hannken Exp $ */
/* $NetBSD: vfs_vnops.c,v 1.175 2010/07/13 15:38:15 pooka Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.174 2010/06/24 13:03:12 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.175 2010/07/13 15:38:15 pooka Exp $");
#include "veriexec.h"
@ -601,6 +601,7 @@ vn_stat(struct vnode *vp, struct stat *sb)
int error;
mode_t mode;
memset(&va, 0, sizeof(va));
error = VOP_GETATTR(vp, &va, kauth_cred_get());
if (error)
return (error);
@ -649,6 +650,7 @@ vn_stat(struct vnode *vp, struct stat *sb)
sb->st_flags = va.va_flags;
sb->st_gen = 0;
sb->st_blocks = va.va_bytes / S_BLKSIZE;
memset(sb->st_spare, 0, sizeof(sb->st_spare));
return (0);
}