-
Notifications
You must be signed in to change notification settings - Fork 1.5k
syscalls: beef up write(2) and pwrite(2) tests #12426
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
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Thanks, could you squash your commits? Lines 95 to 99 in 4e9165c
|
2acf754 to
2b30584
Compare
|
thanks for the guidance @ayushr2 , squashed them🙏 |
Fixes #2370 Add comprehensive tests for write(2), pwrite(2), and writev(2) syscalls to improve coverage as requested in the issue. New tests include: - Bad buffer states (EFAULT): nullptr buffer, bad iov_base address - Bad file descriptors (EBADF): closed fd, negative fd, read-only fd, O_PATH fd - Offset behavior: verify offset increments, pwrite doesn't change offset - EOF handling: write extends past EOF, pwrite creates holes - Pipes: write to pipe, pwrite returns ESPIPE, write to read end fails - Symlinks: write through symlink, O_NOFOLLOW returns ELOOP - Special files: /dev/null and /dev/zero - writev edge cases: empty iovec, zero-length entries Also adds similar tests to `pwrite64.cc` for consistency. FUTURE_COPYBARA_INTEGRATE_REVIEW=#12426 from 0xzre:write-syscall-tests 2b30584 PiperOrigin-RevId: 852782177
|
there seems to be error on build CI because compiler warning, lookin on it |
|
it seems the compiler detects and warns about passing nullptr at compile time, should I use volatile to prevent compiler from optimizing away the nullptr check? @ayushr2 |
|
I am a bit wary about obfuscating the pointer like that to fool libc. The libc headers declare these functions with attributes (specifically |
|
Maybe bypass the libc wrapper using (be sure to add comments to justify the We do this in some other tests as well. |
|
Also, could you run clang-tidy on this? Seeing a warning |
hi can help ref which build this warning appear on the CI? |
This is from our internal CI build. You can probably ignore this as both files already have this warning and it is not introduced by this PR. Lets fix the other issues. |
2b30584 to
6b51a40
Compare
Fixes #2370 Add comprehensive tests for write(2), pwrite(2), and writev(2) syscalls to improve coverage as requested in the issue. New tests include: - Bad buffer states (EFAULT): nullptr buffer, bad iov_base address - Bad file descriptors (EBADF): closed fd, negative fd, read-only fd, O_PATH fd - Offset behavior: verify offset increments, pwrite doesn't change offset - EOF handling: write extends past EOF, pwrite creates holes - Pipes: write to pipe, pwrite returns ESPIPE, write to read end fails - Symlinks: write through symlink, O_NOFOLLOW returns ELOOP - Special files: /dev/null and /dev/zero - writev edge cases: empty iovec, zero-length entries Also adds similar tests to `pwrite64.cc` for consistency. FUTURE_COPYBARA_INTEGRATE_REVIEW=#12426 from 0xzre:write-syscall-tests 6b51a40 PiperOrigin-RevId: 852782177
Fixes #2370 Add comprehensive tests for write(2), pwrite(2), and writev(2) syscalls to improve coverage as requested in the issue. New tests include: - Bad buffer states (EFAULT): nullptr buffer, bad iov_base address - Bad file descriptors (EBADF): closed fd, negative fd, read-only fd, O_PATH fd - Offset behavior: verify offset increments, pwrite doesn't change offset - EOF handling: write extends past EOF, pwrite creates holes - Pipes: write to pipe, pwrite returns ESPIPE, write to read end fails - Symlinks: write through symlink, O_NOFOLLOW returns ELOOP - Special files: /dev/null and /dev/zero - writev edge cases: empty iovec, zero-length entries Also adds similar tests to `pwrite64.cc` for consistency. FUTURE_COPYBARA_INTEGRATE_REVIEW=#12426 from 0xzre:write-syscall-tests 6b51a40 PiperOrigin-RevId: 852782177
Fixes #2370 Add comprehensive tests for write(2), pwrite(2), and writev(2) syscalls to improve coverage as requested in the issue. New tests include: - Bad buffer states (EFAULT): nullptr buffer, bad iov_base address - Bad file descriptors (EBADF): closed fd, negative fd, read-only fd, O_PATH fd - Offset behavior: verify offset increments, pwrite doesn't change offset - EOF handling: write extends past EOF, pwrite creates holes - Pipes: write to pipe, pwrite returns ESPIPE, write to read end fails - Symlinks: write through symlink, O_NOFOLLOW returns ELOOP - Special files: /dev/null and /dev/zero - writev edge cases: empty iovec, zero-length entries Also adds similar tests to `pwrite64.cc` for consistency. FUTURE_COPYBARA_INTEGRATE_REVIEW=#12426 from 0xzre:write-syscall-tests 6b51a40 PiperOrigin-RevId: 852782177
6b51a40 to
7880a4c
Compare
I think this might be a bug in our FUSE implementation. Looking. |
7880a4c to
4f4666f
Compare
Fixes #2370 Add comprehensive tests for write(2), pwrite(2), and writev(2) syscalls to improve coverage as requested in the issue. New tests include: - Bad buffer states (EFAULT): nullptr buffer, bad iov_base address - Bad file descriptors (EBADF): closed fd, negative fd, read-only fd, O_PATH fd - Offset behavior: verify offset increments, pwrite doesn't change offset - EOF handling: write extends past EOF, pwrite creates holes - Pipes: write to pipe, pwrite returns ESPIPE, write to read end fails - Symlinks: write through symlink, O_NOFOLLOW returns ELOOP - Special files: /dev/null and /dev/zero - writev edge cases: empty iovec, zero-length entries Also adds similar tests to `pwrite64.cc` for consistency. FUTURE_COPYBARA_INTEGRATE_REVIEW=#12426 from 0xzre:write-syscall-tests 4f4666f PiperOrigin-RevId: 852782177
Fixes #2370 Add comprehensive tests for write(2), pwrite(2), and writev(2) syscalls to improve coverage as requested in the issue. New tests include: - Bad buffer states (EFAULT): nullptr buffer, bad iov_base address - Bad file descriptors (EBADF): closed fd, negative fd, read-only fd, O_PATH fd - Offset behavior: verify offset increments, pwrite doesn't change offset - EOF handling: write extends past EOF, pwrite creates holes - Pipes: write to pipe, pwrite returns ESPIPE, write to read end fails - Symlinks: write through symlink, O_NOFOLLOW returns ELOOP - Special files: /dev/null and /dev/zero - writev edge cases: empty iovec, zero-length entries Also adds similar tests to `pwrite64.cc` for consistency. FUTURE_COPYBARA_INTEGRATE_REVIEW=#12426 from 0xzre:write-syscall-tests 4f4666f PiperOrigin-RevId: 852782177
Fixes #2370 Add comprehensive tests for write(2), pwrite(2), and writev(2) syscalls to improve coverage as requested in the issue. New tests include: - Bad buffer states (EFAULT): nullptr buffer, bad iov_base address - Bad file descriptors (EBADF): closed fd, negative fd, read-only fd, O_PATH fd - Offset behavior: verify offset increments, pwrite doesn't change offset - EOF handling: write extends past EOF, pwrite creates holes - Pipes: write to pipe, pwrite returns ESPIPE, write to read end fails - Symlinks: write through symlink, O_NOFOLLOW returns ELOOP - Special files: /dev/null and /dev/zero - writev edge cases: empty iovec, zero-length entries Also adds similar tests to `pwrite64.cc` for consistency. FUTURE_COPYBARA_INTEGRATE_REVIEW=#12426 from 0xzre:write-syscall-tests 4f4666f PiperOrigin-RevId: 852782177
|
Your tests caught another bug in tmpfs :) This is why testing is important. I will send a fix for that and then try to get this submitted. |
glad the test is proving its worth immediately. let me know if I can help w anything |


Fixes #2370
Add comprehensive tests for write(2), pwrite(2), and writev(2) syscalls
to improve coverage as requested in the issue.
New tests include:
Also adds similar tests to
pwrite64.ccfor consistency.