git: a9dcfac2fd6a - stable/12 - OpenZFS: Ensure that zfs_getattr() initializes the va_rdev field
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 10 Dec 2023 17:49:43 UTC
The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a9dcfac2fd6a26671b707d15727935ed24c681b5 commit a9dcfac2fd6a26671b707d15727935ed24c681b5 Author: Mark Johnston <markjdb@gmail.com> AuthorDate: 2023-12-07 16:20:11 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2023-12-10 17:48:51 +0000 OpenZFS: Ensure that zfs_getattr() initializes the va_rdev field Otherwise the field is left uninitialized, leading to a possible kernel memory disclosure to userspace or to the network. Use the same initialization value we use in zfsctl_common_getattr(). Reported-by: KMSAN Sponsored-by: The FreeBSD Foundation Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ed Maste <emaste@FreeBSD.org> Signed-off-by: Mark Johnston <markj@FreeBSD.org> (cherry picked from commit 11656234b560c401dec6a16e1bf048b20fd31aac) (cherry picked from commit af1e8b52d26502bac9a2484b87d1879334debd67) Differential Revision: https://reviews.freebsd.org/D42987 --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index c61714bb358a..34f3476c2064 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -2735,6 +2735,8 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, #else if (vp->v_type == VBLK || vp->v_type == VCHR) vap->va_rdev = zfs_cmpldev(rdev); + else + vap->va_rdev = 0; #endif vap->va_seq = zp->z_seq; vap->va_flags = 0; /* FreeBSD: Reset chflags(2) flags. */