-
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 getcwd to use the kernel API #1268
Conversation
Previously the getcwd syscall behaved according to the libc API instead of the kernel one, returning a pointer to the buffer containing the path, as well as potentially allocating memory. This change fixes this, providing the correct API: userspace is solely responsible for memory allocation, and the syscall returns the length of the output path. Signed-off-by: Andrei Tatar <andrei@unikraft.io>
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.
Works fine, thanks.
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: Simon Kuenzer simon@unikraft.io
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.
Great, I also checked that it works and code update looks fine. Thanks!
Approved-by: Simon Kuenzer simon@unikraft.io
Previously the getcwd syscall behaved according to the libc API instead of the kernel one, returning a pointer to the buffer containing the path, as well as potentially allocating memory. This change fixes this, providing the correct API: userspace is solely responsible for memory allocation, and the syscall returns the length of the output path. Signed-off-by: Andrei Tatar <andrei@unikraft.io> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> GitHub-Closes: #1268
Description of changes
Previously the getcwd syscall behaved according to the libc API instead of the kernel one, returning a pointer to the buffer containing the path, as well as potentially allocating memory.
This change fixes this, providing the correct API: userspace is solely responsible for memory allocation, and the syscall returns the length of the output path.
Prerequisite checklist
checkpatch.uk
on your commit series before opening this PR;Base target
Additional configuration
Build with vfscore enabled (e.g.,
app-elfloader
). Bincompat golang will, for some PWDs, return error fromos.Getwd
without this fix.