Ensure that garbage from the kernel stack does not wind up being

returned to user mode in the spare fields of the stat structure.

PR:		kern/14966
Reviewed by:	dillon@freebsd.org
Submitted by:	Kelly Yancey kbyanc@posi.net
This commit is contained in:
Matthew Dillon 1999-11-18 08:14:20 +00:00
parent e918fc8f72
commit 91921bd597
3 changed files with 12 additions and 0 deletions

View File

@ -1745,6 +1745,8 @@ cvtnstat(sb, nsb)
nsb->st_blksize = sb->st_blksize;
nsb->st_flags = sb->st_flags;
nsb->st_gen = sb->st_gen;
nsb->st_qspare[0] = sb->st_qspare[0];
nsb->st_qspare[1] = sb->st_qspare[1];
}
#ifndef _SYS_SYSPROTO_H_

View File

@ -1745,6 +1745,8 @@ cvtnstat(sb, nsb)
nsb->st_blksize = sb->st_blksize;
nsb->st_flags = sb->st_flags;
nsb->st_gen = sb->st_gen;
nsb->st_qspare[0] = sb->st_qspare[0];
nsb->st_qspare[1] = sb->st_qspare[1];
}
#ifndef _SYS_SYSPROTO_H_

View File

@ -398,6 +398,14 @@ vn_stat(vp, sb, p)
error = VOP_GETATTR(vp, vap, p->p_ucred, p);
if (error)
return (error);
/*
* Zero the spare stat fields
*/
sb->st_lspare = 0;
sb->st_qspare[0] = 0;
sb->st_qspare[1] = 0;
/*
* Copy from vattr table
*/