Skip to content

Commit

Permalink
Fix an uninitialized data access
Browse files Browse the repository at this point in the history
zfs_acl_node_alloc allocates an uninitialized data buffer, but upstack
zfs_acl_chmod only partially initializes it.  KMSAN reported that this
memory remained uninitialized at the point when it was read by
lzjb_compress, which suggests a possible kernel memory disclosure bug.

The full KMSAN warning may be found in the PR.
openzfs#16511

Signed-off-by:	Alan Somers <asomers@gmail.com>
Sponsored by:	Axcient
  • Loading branch information
asomers committed Sep 10, 2024
1 parent 17dd66d commit 361e119
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion module/os/freebsd/zfs/zfs_acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ zfs_acl_node_alloc(size_t bytes)

aclnode = kmem_zalloc(sizeof (zfs_acl_node_t), KM_SLEEP);
if (bytes) {
aclnode->z_acldata = kmem_alloc(bytes, KM_SLEEP);
aclnode->z_acldata = kmem_zalloc(bytes, KM_SLEEP);
aclnode->z_allocdata = aclnode->z_acldata;
aclnode->z_allocsize = bytes;
aclnode->z_size = bytes;
Expand Down
2 changes: 1 addition & 1 deletion module/os/linux/zfs/zfs_acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ zfs_acl_node_alloc(size_t bytes)

aclnode = kmem_zalloc(sizeof (zfs_acl_node_t), KM_SLEEP);
if (bytes) {
aclnode->z_acldata = kmem_alloc(bytes, KM_SLEEP);
aclnode->z_acldata = kmem_zalloc(bytes, KM_SLEEP);
aclnode->z_allocdata = aclnode->z_acldata;
aclnode->z_allocsize = bytes;
aclnode->z_size = bytes;
Expand Down

0 comments on commit 361e119

Please sign in to comment.