-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
lib/vfscore: Fix lstat()
infinite loop
#711
Conversation
Including `musl` with even simple apps and attempting to call `lstat()` on `x86` results in an infinite loop due to `__lxstat()`, a helper function, existing in `musl` as well. This commit changes the function called by `lstat()` in order to stop referencing `musl` by adding an extra wrapper, used by `__lxstat()` too. GitHub-Fixes: unikraft#652 Signed-off-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
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 works file @mariasfiraiala, thank you.
I think the __lxstat
function is used since the actual implementation of lstat
may differ on different systems, and the __lxstat
function will be overwritten to provide the desired implementation.
However, I don't see any use for it in the unikraft lstat
syscall (or in the unikraft core), since we want the syscall implementation to be well defined within the core, not dependant on any kind of external libraries (like musl
).
This pr will make the __lxstat
function useless anyway since it will never be called, no matter what library implements it. so I would go for just moving the code in the UK_SYSCALL_R_DEFINE lstat
, since using another helper function makes things messy and makes the original __lxstat
useless.
Any suggestions on this @razvand @eduardvintila?
@StefanJum Indeed that would be the natural approach, however, there are other instances in I tried to follow this implemetation in order to keep the consistency. |
Yes, those instances also don't make sense to me, I would change them too, but there could be something I'm missing. |
Hi @mariasfiraiala and @StefanJum. The PR is looking good from my side: it finally fixes that pesky infinite loop issue with I agree with @StefanJum in that we should eventually consider to move the code from the helpers straight to the syscall implementations. However, I strongly propose that we postpone this refactoring effort for a seperate PR. There are at least four other syscalls currently present in
There may be even more. I find that the refactoring of all of these functions is outside the scope of this PR, which is to fix the infinite loop issue. I think it's good that this PR brings |
Makes sense @eduardvintila. @mariasfiraiala if we go with this approach, please open an issue on refactoring these |
✅ Checkpatch passed Beep boop! I ran Unikraft's
|
@mariasfiraiala , @StefanJum , @eduardvintila , as discussed on Discord, I agree we can merge this PR as it is for consistency. Then, a new PR would be required that updates all these functions (there's 5 of them:
|
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.
Alright, this should go in. Thanks, @mariasfiraiala.
Reviewed-by: Eduard Vintilă eduard.vintila47@gmail.com
@StefanJum, if this is OK with you, please approve this PR and add your message tag. I will then approve it as an assignee. |
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 @mariasfiraiala.
Reviewed-by: Stefan Jumarea stefanjumarea02@gmail.com
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.
Reviewed-by: Razvan Deaconescu razvand@unikraft.io
Approved-by: Razvan Deaconescu razvand@unikraft.io
Including `musl` with even simple apps and attempting to call `lstat()` on `x86` results in an infinite loop due to `__lxstat()`, a helper function, existing in `musl` as well. This commit changes the function called by `lstat()` in order to stop referencing `musl` by adding an extra wrapper, used by `__lxstat()` too. GitHub-Fixes: unikraft#652 Signed-off-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#711
Prerequisite checklist
checkpatch.pl
on your commit series before opening this PR;Base target
x86_64
kvm
Additional configuration
Build a simple app (such as
helloworld
) onx86
and calllstat()
.Description of changes
Including
musl
with even simple apps and attempting to calllstat()
onx86
results in an infinite loop due to__lxstat()
, a helper function, existing inmusl
as well.This PR changes the function called by
lstat()
in order to stop referencingmusl
by adding an extra wrapper, used by__lxstat()
too. The change was made in order to be consistent to other implementations found invfscore
, such as this one.Fixes: #652
Signed-off-by: Maria Sfiraiala maria.sfiraiala@gmail.com