-
Notifications
You must be signed in to change notification settings - Fork 1k
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
getcwd01,readlinkat02 fails in Alpine 3.18 container #1084
Comments
Looks like glibc uses the size argument to allocate the buffer unless it's 0. So I suppose that musl ignores the size completely and allocates the buffer so that it fits the path. |
readlinkat02 fails for a similar reason. Except that this time musl checks the buffer size instead and uses a stack buffer. |
uclibc-ng does the same as glibc |
1 similar comment
Fixes: linux-test-project#1084 Signed-off-by: Wei Gao <wegao@suse.com>
@coolgw |
Fixes: linux-test-project#1084 User space wrap getcwd with different implementation, for example glibc will directly input parameter into kernel in normal situation but uclibc-ng and musl will malloc buffer when buffer is NULL, so for uclibc and musl the parameter size will be ignored. Use system call directly check invalid argument can be a solution. Signed-off-by: Wei Gao <wegao@suse.com>
The test passes NULL as the buffer to
getcwd
. This causes musl to allocate a buffer and ignore the length argument. The test then passes unexpectedly.glibc should do the same, but it possibly checks the length argument or passes it to the syscall.
The text was updated successfully, but these errors were encountered: