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
arch/arm/arm64: Fix stxr
's used in spinlock
s register size
#907
Conversation
Our `spinlock`s have a size of 4-bytes and an alignment of 8, which, in our `semaphore` implementation, causes a padding of 4 bytes. This is fine, but it is an inconsistency. With `QEMU` direct kernel boot, all of our free memory is zeroed out. However, when using a previous boot phase such as `UEFI`, this inconsistency shows itself through an always locked `spinlock`. `UEFI` firmware "poisons" all of its free memory with `0xaf` bytes which leads to our `stxr`, whose second register argument is 64-bit instead of 32-bit, also atomically storing the `poisoned` padding. Thus, make sure that our `stxr` uses 32-bit register for the to be transferred register. Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com> GitHub-Fixes: unikraft#289
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.
This looks good, thanks @mogasergiu!
Reviewed-by: Maria Sfiraiala maria.sfiraiala@gmail.com
@eduardvintila please let me know if you're planning to have a look at this PR, otherwise I'm ready to merge. |
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.
All good. Nice catch, @mogasergiu!
Reviewed-by: Eduard Vintilă eduard.vintila47@gmail.com
Approved-by: Michalis Pappas michalis@unikraft.io |
Our
spinlock
s have a size of 4-bytes and an alignment of 8, which, in oursemaphore
implementation, causes a padding of 4 bytes. This is fine, but it is an inconsistency.With
QEMU
direct kernel boot, all of our free memory is zeroed out. However, when using a previous boot phase such asUEFI
, this inconsistency shows itself through an always lockedspinlock
.UEFI
firmware "poisons" all of its free memory with0xaf
bytes which leads to ourstxr
, whose second register argument is 64-bit instead of 32-bit, also atomically storing thepoisoned
padding.Thus, make sure that our
stxr
uses 32-bit register for the to be transferred register.GitHub-Fixes: #289
Prerequisite checklist
checkpatch.pl
on your commit series before opening this PR;Base target
arm64
kvm
Additional configuration
Description of changes