devpts: return ESPIPE for positional I/O on PTYs - #14111
Open
copybara-service[bot] wants to merge 1 commit into
Open
devpts: return ESPIPE for positional I/O on PTYs#14111copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
test/cl964247273
branch
5 times, most recently
from
August 14, 2026 18:55
f058572 to
27cdeb7
Compare
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
copybara-service
Bot
force-pushed
the
test/cl964247273
branch
from
August 14, 2026 19:44
27cdeb7 to
38bd4d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
devpts: return ESPIPE for positional I/O on PTYs
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
FUTURE_COPYBARA_INTEGRATE_REVIEW=#14097 from ryux1:fix/pty-positional-write-espipe 7308f5f