Commit Graph
36 Commits
Author SHA1 Message Date
Kevin Krakauer dbbce69479 tty: enable TCSETSF
While there is a difference between flavors of this ioctl (`TCSETS`,
`TCSETSF`, `TCSETSW`), in practice it seems not to matter. We should let
users call `TCSETSF` and can implement those differences if necessary.
2023-09-05 09:53:50 -07:00
gVisor bot 3f4a827498 [pty_test] Test that poll() actually sets the POLLIN flag in PollAndReadFd
PiperOrigin-RevId: 534841961
2023-05-24 08:06:54 -07:00
gVisor bot 6194407feb [pty] Return enqueued data and then EIO if the replica is closed
PiperOrigin-RevId: 532496868
2023-05-16 10:15:01 -07:00
Nelson Elhage 29e64f10f8 Fixes to TTOU handling in TIOCSPGRP
Fixes two issues in TTOU handling while handling TIOCSPGRP on a tty
device.

fixes #7941; see that issue for details of the bugs.

Updates the tests to test the fixed behavior; both tests are verified
to fail without the `thread_group.go` fixes.
2022-09-02 14:32:54 -07:00
Andrei VaginandgVisor bot 03b34d258b test/pty: last read in TermiosICANONEOF returns 0 on new linux kernels
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from PtyTest
[ RUN      ] PtyTest.TermiosICANONEOF
test/syscalls/linux/pty.cc:464: Failure
Value of: ReadFd(fd.get(), &c, 1)
Expected: -1 (failure), with errno PosixError(errno=11 Resource temporarily unavailable)
  Actual: 0 (of type long)
[  FAILED  ] PtyTest.TermiosICANONEOF (20018 ms)
[----------] 1 test from PtyTest (20018 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (20018 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] PtyTest.TermiosICANONEOF

PiperOrigin-RevId: 452799870
2022-06-03 11:04:15 -07:00
gVisor bot f2f9f5d5b0 Internal change.
PiperOrigin-RevId: 442117196
2022-04-15 16:11:38 -07:00
Ayush RanjanandgVisor bot f6263c38df Remove VFS1 special handling in tests.
Also clean up usage of GVISOR_VFS environment variable.
Updates #1624

PiperOrigin-RevId: 429100450
2022-02-16 11:41:51 -08:00
gystemd 6394d78839 fix tests in pty.cc
fixed and enabled SetForegroundProcessGroup and SetForegroundProcessGroupEmptyProcessGroup.
2021-08-26 17:00:10 +02:00
gystemd 251a9e9b54 Added a system call test for SetForegroundProcessGroup
-Added a test to check if the process in background is blocking SIGTTOU
-Some minor formatting fixes
2021-08-19 01:05:42 +02:00
gystemd 3edc18392d added two system call tests for setForegroundProcessGroup
Test the correct sending of the SIGTTOU in setForegroundProcess
2021-08-17 23:40:24 +02:00
Kevin KrakauerandgVisor bot fd76b89760 Be explicit about setsid() return values in pty.cc
PiperOrigin-RevId: 374570219
2021-05-18 21:57:34 -07:00
gVisor bot 1e88253b44 Merge pull request #5908 from zhlhahaha:2157
PiperOrigin-RevId: 374517895
2021-05-18 15:26:39 -07:00
Howard Zhang bdc0ad39e0 fix pty_test error by releasing tty received from test
The test Truncate set ControllingTTY without releasing
it on VFS2. This leads test ReleaseTTYSignals and ReleaseTTY
fail when setting ControllingTTY.

Skip the test on VFS1 and native, as setting Controlling TTY
when open replica only happens on VFS2.

Signed-off-by: Howard Zhang <[email protected]>
2021-05-11 09:47:16 +08:00
Nicolas LacasseandgVisor bot 51e62c7a3b Allow reading from PTY into bad buffer to return EAGAIN.
Kernels after 3b830a9c return EAGAIN in this case.

PiperOrigin-RevId: 361936327
2021-03-09 17:37:54 -08:00
Fabricio VoznikaandgVisor bot eb113dfe90 Remove side effect from pty tests
Individual test cases must not rely on being executed in a clean environment.

PiperOrigin-RevId: 358207468
2021-02-18 10:19:04 -08:00
Kevin KrakauerandgVisor bot 4b23a3c2bd Assign controlling terminal when tty is opened and support NOCTTY
PiperOrigin-RevId: 357015186
2021-02-11 11:09:22 -08:00
Fabricio VoznikaandgVisor bot 4b6924fa3a Change EXPECT/ASSERT to TEST_CHECK inside InForkedProcess
PiperOrigin-RevId: 354441239
2021-01-28 18:24:58 -08:00
Ayush RanjanandgVisor bot 10c84f454e Refactor tty codebase to use master-replica terminology.
Updates #2972

PiperOrigin-RevId: 329584905
2020-09-01 14:43:41 -07:00
Zach KoopmansandgVisor bot 9cf43b31d6 Fix JobControl tests for open source.
ioctl calls with TIOCSCTTY fail if the calling process already has a
controlling terminal, which occurs on a 5.4 kernel like our Ubuntu 18 CI.
Thus, run tests calling ioctl TTOCSCTTY in clean subprocess.

Also, while we're here, switch out non-inclusive master/slave for main/replica.

PiperOrigin-RevId: 328756598
2020-08-27 09:52:49 -07:00
Craig Chi f475dfaac1 Add missing ICRNL flag in master termios test
Closes #2768
2020-06-30 09:31:28 -07:00
Nicolas LacasseandgVisor bot 57db0d8354 Deflake pty_test_linux.
PiperOrigin-RevId: 314208973
2020-06-01 14:55:42 -07:00
gVisor bot adfd3a1d37 Internal change.
PiperOrigin-RevId: 304641990
2020-04-03 10:20:55 -07:00
Adin ScannellandgVisor bot 1b8ff2ce79 Change to standard types.
PiperOrigin-RevId: 290846481
2020-01-21 17:28:57 -08:00
gVisor bot 33f3ef287f Merge pull request #1492 from majek:err_typo_in_netstack_tests
PiperOrigin-RevId: 290840370
2020-01-21 16:32:49 -08:00
Kevin KrakauerandgVisor bot 57c6ef47a4 Check that a file is a regular file with open(O_TRUNC).
It was possible to panic the sentry by opening a cache revalidating folder with
O_TRUNC|O_CREAT.

Avoids breaking php tests.

PiperOrigin-RevId: 280533213
2019-11-14 16:08:34 -08:00
Kevin KrakauerandgVisor bot c8be1648bb De-flake SetForegroundProcessGroupDifferentSession.
PiperOrigin-RevId: 272059043
2019-09-30 13:59:36 -07:00
Andrei VaginandgVisor bot 5d9ea16d0e test: don't use designated initializers
This change fixes compile errors:
pty.cc:1460:7: error: expected primary-expression before '.' token
...

PiperOrigin-RevId: 271033729
2019-09-24 19:05:12 -07:00
Kevin KrakauerandgVisor bot 220cfabaa0 Job control: controlling TTYs and foreground process groups.
Adresses a deadlock with the rolled back change:
https://github.com/google/gvisor/commit/e72cf7af1fcbef3d9fb9bf102435bb36dd302a63
Creating a session from an orphaned process group was causing a lock to be
acquired twice by a single goroutine. This behavior is addressed, and a test
(OrphanRegression) has been added to pty.cc.

Implemented the following ioctls:
- TIOCSCTTY - set controlling TTY
- TIOCNOTTY - remove controlling tty, maybe signal some other processes
- TIOCGPGRP - get foreground process group. Also enables tcgetpgrp().
- TIOCSPGRP - set foreground process group. Also enabled tcsetpgrp().

Next steps are to actually turn terminal-generated control characters (e.g. C^c)
into signals to the proper process groups, and to send SIGTTOU and SIGTTIN when
appropriate.

PiperOrigin-RevId: 270088599
2019-09-19 11:36:47 -07:00
Bhasker HariharanandgVisor bot 17921766f9 Automated rollback of changelist 261387276
PiperOrigin-RevId: 266491264
2019-08-30 18:15:32 -07:00
Adin ScannellandgVisor bot e5375d154f Add C++ toolchain and fix compile issues.
This was accidentally introduced in e470adb351.

Fixes #788.

PiperOrigin-RevId: 266462843
2019-08-30 15:03:15 -07:00
Kevin KrakauerandgVisor bot e72cf7af1f Job control: controlling TTYs and foreground process groups.
(Don't worry, this is mostly tests.)

Implemented the following ioctls:
- TIOCSCTTY - set controlling TTY
- TIOCNOTTY - remove controlling tty, maybe signal some other processes
- TIOCGPGRP - get foreground process group. Also enables tcgetpgrp().
- TIOCSPGRP - set foreground process group. Also enabled tcsetpgrp().

Next steps are to actually turn terminal-generated control characters (e.g. C^c)
into signals to the proper process groups, and to send SIGTTOU and SIGTTIN when
appropriate.

PiperOrigin-RevId: 261387276
2019-08-02 14:05:48 -07:00
Nicolas LacasseandgVisor bot cf51e77d6d Fix suggestions from clang.
PiperOrigin-RevId: 255679603
2019-06-28 15:32:29 -07:00
Andrei VaginandShentubot 9e1c253fe8 gvisor: run bazel in a docker container
bazel has a lot of dependencies and users don't want to install them
just to build gvisor.

These changes allows to run bazel in a docker container.
A bazel cache is on the local file system (~/.cache/bazel), so
incremental builds should be fast event after recreating a bazel
container.

Here is an example how to build runsc:
make BAZEL_OPTIONS="build runsc:runsc" bazel

Change-Id: I8c0a6d0c30e835892377fb6dd5f4af7a0052d12a
PiperOrigin-RevId: 246570877
2019-05-03 14:13:08 -07:00
Michael PrattandShentubot 4d52a55201 Change copyright notice to "The gVisor Authors"
Based on the guidelines at
https://opensource.google.com/docs/releasing/authors/.

1. $ rg -l "Google LLC" | xargs sed -i 's/Google LLC.*/The gVisor Authors./'
2. Manual fixup of "Google Inc" references.
3. Add AUTHORS file. Authors may request to be added to this file.
4. Point netstack AUTHORS to gVisor AUTHORS. Drop CONTRIBUTORS.

Fixes #209

PiperOrigin-RevId: 245823212
Change-Id: I64530b24ad021a7d683137459cafc510f5ee1de9
2019-04-29 14:26:23 -07:00
Kevin KrakauerandShentubot 82529becae Fix index out of bounds in tty implementation.
The previous implementation revolved around runes instead of bytes, which caused
weird behavior when converting between the two. For example, peekRune would read
the byte 0xff from a buffer, convert it to a rune, then return it. As rune is an
alias of int32, 0xff was 0-padded to int32(255), which is the hex code point for
?. However, peekRune also returned the length of the byte (1). When calling
utf8.EncodeRune, we only allocated 1 byte, but tried the write the 2-byte
character ?.

tl;dr: I apparently didn't understand runes when I wrote this.

PiperOrigin-RevId: 241789081
Change-Id: I14c788af4d9754973137801500ef6af7ab8a8727
2019-04-03 13:00:34 -07:00
Brian GeffonandShentubot d3bc79bc84 Open source system call tests.
PiperOrigin-RevId: 224886231
Change-Id: I0fccb4d994601739d8b16b1d4e6b31f40297fb22
2018-12-10 14:42:34 -08:00