Skip to content

devpts: return ESPIPE for positional writes to PTYs - #14097

Open
ryux1 wants to merge 1 commit into
google:masterfrom
ryux1:fix/pty-positional-write-espipe
Open

devpts: return ESPIPE for positional writes to PTYs#14097
ryux1 wants to merge 1 commit into
google:masterfrom
ryux1:fix/pty-positional-write-espipe

Conversation

@ryux1

@ryux1 ryux1 commented Aug 12, 2026

Copy link
Copy Markdown

Description

PTY master and replica file descriptions currently fall through to the default
PWrite implementation, which returns EINVAL. Mark both endpoints as denying
positional writes so VFS returns ESPIPE before dispatching the operation.

This matches Linux for pwritev and pwritev2 with explicit offsets while
preserving pwritev2 with offset -1 as streaming I/O. It also lets callers
such as Zig's file writer recognize PTYs as unseekable and fall back to normal
streaming writes.

Fixes #13737.

Tests

  • //test/syscalls:pwritev2_test_runsc_systrap_directfs
  • //test/syscalls:pwritev2_test_runsc_ptrace
  • //test/syscalls:pwritev2_test_native (focused regression)
  • //pkg/sentry/fsimpl/devpts:devpts_test
  • //pkg/sentry/fsimpl/devpts:devpts_nogo
  • //pkg/sentry/fsimpl/devpts:devpts_test_nogo

Assisted-by: Codex

@google-cla

google-cla Bot commented Aug 12, 2026

Copy link
Copy Markdown

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.

@ryux1
ryux1 marked this pull request as ready for review August 12, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pty: pwritev/pwritev2 with an offset return EINVAL; Linux returns ESPIPE

1 participant