diff options
author | Mark Johnston <markj@FreeBSD.org> | 2021-07-16 13:27:11 +0000 |
---|---|---|
committer | Brian Behlendorf <behlendorf1@llnl.gov> | 2021-07-26 18:53:47 +0000 |
commit | 03363b2f86a97f95127085864a8323853f78f479 (patch) | |
tree | a9101579ad406760503103c7afb933fa723ebf4d | |
parent | da27b8bc7f2778b28fa73547ff91bb8cc962fc0e (diff) | |
download | src-03363b2f86a97f95127085864a8323853f78f479.tar.gz src-03363b2f86a97f95127085864a8323853f78f479.zip |
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 <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Closes #12383
-rw-r--r-- | module/zfs/zfs_log.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/module/zfs/zfs_log.c b/module/zfs/zfs_log.c index 0f330ec933aa..6d2e41ad9362 100644 --- a/module/zfs/zfs_log.c +++ b/module/zfs/zfs_log.c @@ -126,9 +126,11 @@ zfs_log_xvattr(lr_attr_t *lrattr, xvattr_t *xvap) /* Now pack the attributes up in a single uint64_t */ attrs = (uint64_t *)bitmap; + *attrs = 0; crtime = attrs + 1; + bzero(crtime, 2 * sizeof (uint64_t)); scanstamp = (caddr_t)(crtime + 2); - *attrs = 0; + bzero(scanstamp, AV_SCANSTAMP_SZ); if (XVA_ISSET_REQ(xvap, XAT_READONLY)) *attrs |= (xoap->xoa_readonly == 0) ? 0 : XAT0_READONLY; |