-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix an uninitialized data access #16511
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this fix
The checkstyle failure is due to the fact that I copied terminal output into the commit message. IMHO that should be allowed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see exactly the same code on Linux, that makes me wonder: either the same should be applied there also, or in general initialization of the memory should be up to the caller, and again on both platforms. I am not saying it is a big deal to initialize the memory here, since hopefully it is not big, but I generally don't like extra/double initializations.
I'll apply the change to Linux, too. I initially thought it would be better to initialize it in the caller, too. But the caller's code is very complicated, and zeroing out the otherwise-uninitialized bytes would be a very error-prone process. |
@asomers I understand, but could you remove it anyway to make checkstyle happy? This PR will still contain the text of the backtrace if we ever need to look it up again. |
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 <[email protected]> Sponsored by: Axcient
94dec92
to
361e119
Compare
Done, @tonyhutter |
@asomers thanks, merged. |
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 is:
Signed-off-by: Alan Somers [email protected]
Sponsored by: Axcient
Motivation and Context
Kernel memory disclosure
Description
Zero-initialize the memory buffer
How Has This Been Tested?
Tested with bootfs_test:bootfs_005_neg from FreeBSD's ZFS test suite.
Types of changes
Checklist:
Signed-off-by
.