mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
Zero out the file directory entry metadata to reduce disk
scavenging disclosure. Submitted by: David G. Lawrence <dg@dglawrence.com> MFC after: 1 week
This commit is contained in:
parent
83dc49beaf
commit
44b193b09e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347130
@ -1218,16 +1218,21 @@ ufs_dirremove(dvp, ip, flags, isrmdir)
|
||||
if (ip && rep->d_ino != ip->i_number)
|
||||
panic("ufs_dirremove: ip %ju does not match dirent ino %ju\n",
|
||||
(uintmax_t)ip->i_number, (uintmax_t)rep->d_ino);
|
||||
if (dp->i_count == 0) {
|
||||
/*
|
||||
* First entry in block: set d_ino to zero.
|
||||
*/
|
||||
ep->d_ino = 0;
|
||||
} else {
|
||||
/*
|
||||
* Zero out the file directory entry metadata to reduce disk
|
||||
* scavenging disclosure.
|
||||
*/
|
||||
bzero(&rep->d_name[0], rep->d_namlen);
|
||||
rep->d_namlen = 0;
|
||||
rep->d_type = 0;
|
||||
rep->d_ino = 0;
|
||||
|
||||
if (dp->i_count != 0) {
|
||||
/*
|
||||
* Collapse new free space into previous entry.
|
||||
*/
|
||||
ep->d_reclen += rep->d_reclen;
|
||||
rep->d_reclen = 0;
|
||||
}
|
||||
#ifdef UFS_DIRHASH
|
||||
if (dp->i_dirhash != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user