-
Notifications
You must be signed in to change notification settings - Fork 39
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
ext_config: Fixes config only operations. #123
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.
Clever, so when passing the value as none instead of a ptr, then the firmware knows it's supposed to be empty?
If the certificate input is empty, wouldn't the ext_config |
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.
See above comment.
It isn't that it is being read from the user's input, but that we created the |
I'm still not seeing how the kernel gets tripped up here unless a read takes place. If the |
Previously we were passing the u64 value of the pointer to the vector of bytes the extended report certificates were being loaded from. However, when handling the case of an extended configuration only, because the pointer value of an empty vector is not 0, this was causing an error in the kernel when attempting to access the "pointer" being provided. By modifying the underlying type of `bytes` to `Option<Vec<u8>>`, it allows the default value to be set to `None`, and conditionally update the extended config `certs_address` field when certificate bytes are present. Also updated the TryFrom<ExtConfig> for SnpExtSetConfig to use the reference instead of a copy. This prevents the underlying config object from being dropped after the if-let block. Signed-off-by: Larry Dewey <[email protected]>
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.
lgtm
The Kernel gets tripped up because Updating the pointer to the certs_address only when the certificate bytes are present fixes this problem. Further, there is a use after free issue which is happening because of the if-let block. I recently learned that when using if-let, the I have tested setting and resetting the |
I see, so when we are only setting the extended config, we have an empty certs buffer (i.e. |
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.
LGTM.
Previously we were passing the u64 value of the pointer to the vector of bytes the extended report certificates were being loaded from. However, when handling the case of an extended configuration only, because the pointer value of an empty vector is not 0, this was causing an error in the kernel when attempting to access the "pointer" being provided. By modifying the underlying type of
bytes
toOption<Vec<u8>>
, it allows the default value to be set toNone
, and conditionally update the extended configcerts_address
field when certificate bytes are present.