devpts: return ESPIPE for positional I/O on PTYs - #14097
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. |
|
While you're at this, can you also fix the preadv/preadv2 case as well? |
Assisted-by: Codex
6b306d7 to
7308f5f
Compare
Done — I added Validated with the systrap/directfs and ptrace syscall targets, the focused native regression, and the devpts test/nogo targets. |
Description PTY master and replica file descriptions currently fall through to the default PRead and PWrite implementations, which return EINVAL. Mark both endpoints as denying positional reads and writes so VFS returns ESPIPE before dispatching the operation. This matches Linux for preadv, preadv2, pwritev, and pwritev2 with explicit offsets while preserving preadv2 and pwritev2 with offset -1 as streaming I/O. It also lets callers such as Zig file writers recognize PTYs as unseekable and fall back to normal streaming writes. Fixes #13737. Tests - //test/syscalls:preadv2_test_runsc_systrap_directfs - //test/syscalls:preadv2_test_runsc_ptrace - bazel-bin/test/syscalls/linux/preadv2_test --gtest_filter=Preadv2Test.PtyWithOffset (native Linux) - //test/syscalls:pwritev2_test_runsc_systrap_directfs - //test/syscalls:pwritev2_test_runsc_ptrace - //test/syscalls:pwritev2_test_native (focused PTY regression) - //pkg/sentry/fsimpl/devpts:devpts_test - //pkg/sentry/fsimpl/devpts:devpts_nogo - //pkg/sentry/fsimpl/devpts:devpts_test_nogo Assisted-by: Codex FUTURE_COPYBARA_INTEGRATE_REVIEW=#14097 from ryux1:fix/pty-positional-write-espipe 7308f5f PiperOrigin-RevId: 964247273
Description PTY master and replica file descriptions currently fall through to the default PRead and PWrite implementations, which return EINVAL. Mark both endpoints as denying positional reads and writes so VFS returns ESPIPE before dispatching the operation. This matches Linux for preadv, preadv2, pwritev, and pwritev2 with explicit offsets while preserving preadv2 and pwritev2 with offset -1 as streaming I/O. It also lets callers such as Zig file writers recognize PTYs as unseekable and fall back to normal streaming writes. Fixes #13737. Tests - //test/syscalls:preadv2_test_runsc_systrap_directfs - //test/syscalls:preadv2_test_runsc_ptrace - bazel-bin/test/syscalls/linux/preadv2_test --gtest_filter=Preadv2Test.PtyWithOffset (native Linux) - //test/syscalls:pwritev2_test_runsc_systrap_directfs - //test/syscalls:pwritev2_test_runsc_ptrace - //test/syscalls:pwritev2_test_native (focused PTY regression) - //pkg/sentry/fsimpl/devpts:devpts_test - //pkg/sentry/fsimpl/devpts:devpts_nogo - //pkg/sentry/fsimpl/devpts:devpts_test_nogo Assisted-by: Codex FUTURE_COPYBARA_INTEGRATE_REVIEW=#14097 from ryux1:fix/pty-positional-write-espipe 7308f5f PiperOrigin-RevId: 964247273
Description PTY master and replica file descriptions currently fall through to the default PRead and PWrite implementations, which return EINVAL. Mark both endpoints as denying positional reads and writes so VFS returns ESPIPE before dispatching the operation. This matches Linux for preadv, preadv2, pwritev, and pwritev2 with explicit offsets while preserving preadv2 and pwritev2 with offset -1 as streaming I/O. It also lets callers such as Zig file writers recognize PTYs as unseekable and fall back to normal streaming writes. Fixes #13737. Tests - //test/syscalls:preadv2_test_runsc_systrap_directfs - //test/syscalls:preadv2_test_runsc_ptrace - bazel-bin/test/syscalls/linux/preadv2_test --gtest_filter=Preadv2Test.PtyWithOffset (native Linux) - //test/syscalls:pwritev2_test_runsc_systrap_directfs - //test/syscalls:pwritev2_test_runsc_ptrace - //test/syscalls:pwritev2_test_native (focused PTY regression) - //pkg/sentry/fsimpl/devpts:devpts_test - //pkg/sentry/fsimpl/devpts:devpts_nogo - //pkg/sentry/fsimpl/devpts:devpts_test_nogo Assisted-by: Codex FUTURE_COPYBARA_INTEGRATE_REVIEW=#14097 from ryux1:fix/pty-positional-write-espipe 7308f5f PiperOrigin-RevId: 964247273
Description PTY master and replica file descriptions currently fall through to the default PRead and PWrite implementations, which return EINVAL. Mark both endpoints as denying positional reads and writes so VFS returns ESPIPE before dispatching the operation. This matches Linux for preadv, preadv2, pwritev, and pwritev2 with explicit offsets while preserving preadv2 and pwritev2 with offset -1 as streaming I/O. It also lets callers such as Zig file writers recognize PTYs as unseekable and fall back to normal streaming writes. Fixes #13737. Tests - //test/syscalls:preadv2_test_runsc_systrap_directfs - //test/syscalls:preadv2_test_runsc_ptrace - bazel-bin/test/syscalls/linux/preadv2_test --gtest_filter=Preadv2Test.PtyWithOffset (native Linux) - //test/syscalls:pwritev2_test_runsc_systrap_directfs - //test/syscalls:pwritev2_test_runsc_ptrace - //test/syscalls:pwritev2_test_native (focused PTY regression) - //pkg/sentry/fsimpl/devpts:devpts_test - //pkg/sentry/fsimpl/devpts:devpts_nogo - //pkg/sentry/fsimpl/devpts:devpts_test_nogo Assisted-by: Codex FUTURE_COPYBARA_INTEGRATE_REVIEW=#14097 from ryux1:fix/pty-positional-write-espipe 7308f5f PiperOrigin-RevId: 964247273
Description PTY master and replica file descriptions currently fall through to the default PRead and PWrite implementations, which return EINVAL. Mark both endpoints as denying positional reads and writes so VFS returns ESPIPE before dispatching the operation. This matches Linux for preadv, preadv2, pwritev, and pwritev2 with explicit offsets while preserving preadv2 and pwritev2 with offset -1 as streaming I/O. It also lets callers such as Zig file writers recognize PTYs as unseekable and fall back to normal streaming writes. Fixes #13737. Tests - //test/syscalls:preadv2_test_runsc_systrap_directfs - //test/syscalls:preadv2_test_runsc_ptrace - bazel-bin/test/syscalls/linux/preadv2_test --gtest_filter=Preadv2Test.PtyWithOffset (native Linux) - //test/syscalls:pwritev2_test_runsc_systrap_directfs - //test/syscalls:pwritev2_test_runsc_ptrace - //test/syscalls:pwritev2_test_native (focused PTY regression) - //pkg/sentry/fsimpl/devpts:devpts_test - //pkg/sentry/fsimpl/devpts:devpts_nogo - //pkg/sentry/fsimpl/devpts:devpts_test_nogo Assisted-by: Codex FUTURE_COPYBARA_INTEGRATE_REVIEW=#14097 from ryux1:fix/pty-positional-write-espipe 7308f5f PiperOrigin-RevId: 964247273
Description PTY master and replica file descriptions currently fall through to the default PRead and PWrite implementations, which return EINVAL. Mark both endpoints as denying positional reads and writes so VFS returns ESPIPE before dispatching the operation. This matches Linux for preadv, preadv2, pwritev, and pwritev2 with explicit offsets while preserving preadv2 and pwritev2 with offset -1 as streaming I/O. It also lets callers such as Zig file writers recognize PTYs as unseekable and fall back to normal streaming writes. Fixes #13737. Tests - //test/syscalls:preadv2_test_runsc_systrap_directfs - //test/syscalls:preadv2_test_runsc_ptrace - bazel-bin/test/syscalls/linux/preadv2_test --gtest_filter=Preadv2Test.PtyWithOffset (native Linux) - //test/syscalls:pwritev2_test_runsc_systrap_directfs - //test/syscalls:pwritev2_test_runsc_ptrace - //test/syscalls:pwritev2_test_native (focused PTY regression) - //pkg/sentry/fsimpl/devpts:devpts_test - //pkg/sentry/fsimpl/devpts:devpts_nogo - //pkg/sentry/fsimpl/devpts:devpts_test_nogo Assisted-by: Codex FUTURE_COPYBARA_INTEGRATE_REVIEW=#14097 from ryux1:fix/pty-positional-write-espipe 7308f5f PiperOrigin-RevId: 964247273
Description
PTY master and replica file descriptions currently fall through to the default
PRead and PWrite implementations, which return EINVAL. Mark both endpoints as
denying positional reads and writes so VFS returns ESPIPE before dispatching the
operation.
This matches Linux for preadv, preadv2, pwritev, and pwritev2 with explicit
offsets while preserving preadv2 and pwritev2 with offset -1 as streaming I/O.
It also lets callers such as Zig file writers recognize PTYs as unseekable and
fall back to normal streaming writes.
Fixes #13737.
Tests
Assisted-by: Codex