Skip to content

Commit cb53d08

Browse files
markjdbtonyhutter
authored andcommitted
Initialize all fields in zfs_log_xvattr()
When logging TX_SETATTR, we could otherwise fail to initialize part of the corresponding ZIL record depending on which fields are present in the xvattr. Initialize the creation time and the AV scan timestamp to zero so that uninitialized bytes are not written to the ZIL. This was found using KMSAN. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Mark Johnston <[email protected]> Closes #12383
1 parent 158e1b6 commit cb53d08

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

module/zfs/zfs_log.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,11 @@ zfs_log_xvattr(lr_attr_t *lrattr, xvattr_t *xvap)
126126

127127
/* Now pack the attributes up in a single uint64_t */
128128
attrs = (uint64_t *)bitmap;
129+
*attrs = 0;
129130
crtime = attrs + 1;
131+
bzero(crtime, 2 * sizeof (uint64_t));
130132
scanstamp = (caddr_t)(crtime + 2);
131-
*attrs = 0;
133+
bzero(scanstamp, AV_SCANSTAMP_SZ);
132134
if (XVA_ISSET_REQ(xvap, XAT_READONLY))
133135
*attrs |= (xoap->xoa_readonly == 0) ? 0 :
134136
XAT0_READONLY;

0 commit comments

Comments
 (0)