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:
parent
e918fc8f72
commit
91921bd597
@ -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_
|
||||
|
@ -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_
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user