42 Commits

Author SHA1 Message Date
Fabricio Voznika c041d9bd58 Add missing binary_sha256 field
Fixes #11466

PiperOrigin-RevId: 734209881
2025-03-06 11:01:58 -08:00
Jimmy Tran 17563a8af9 Return EACCES when calling setpgid() after execve()
From setpgid manpage,

EACCES - An attempt was made to change the process group ID of one
of the children of the calling process and the child had
already performed an execve(2) (setpgid(), setpgrp()).

This CL makes gVisor implement this rule and updates the exec test
suite accordingly.

TESTED: http://sponge2/7f364e8a-4f82-463e-ba62-79234c4d054d
PiperOrigin-RevId: 727095560
2025-02-14 16:14:14 -08:00
Jamie Liu 03bebc4402 kernel: add ThreadGroup.signalLock()
This allows "remote" locking of ThreadGroup.signalHandlers.mu without needing
to lock TaskSet.mu, analogously to Linux's lock_task_sighand().

This reveals a bug: kernel.Task.sendSignal[Timer]Locked() unintentionally
requires TaskSet.mu to be locked since it reads Task.exitState. To fix this,
use atomic memory operations on Task.exitState when required.

PiperOrigin-RevId: 681128063
2024-10-01 12:48:10 -07:00
Etienne Perot 69e0c7643d Use clear on map types wherever possible.
This is similar as pull request #9749 but for maps rather than slices.

PiperOrigin-RevId: 586504320
2023-11-29 18:00:07 -08:00
Jamie Liu f517b70ded Pass context to kernel.TaskImage.release().
PiperOrigin-RevId: 543541608
2023-06-26 14:28:58 -07:00
Andrei Vagin 758da469f7 kernel: release kernel.taskSetRWMutex before calling TaskImage.Release
Reported-by: syzbot+c58795dc8124b39436a8@syzkaller.appspotmail.com
2023-03-16 10:25:46 -07:00
Ayush Ranjan 0bb834f4e2 Delete fsbridge.
Updates #1624

PiperOrigin-RevId: 492286535
2022-12-01 13:36:10 -08:00
Ayush Ranjan 1fa3c06f1e Delete VFS1 completely.
- Delete pkg/sentry/fs/*.
- Move pkg/sentry/fs/fsutil out of VFS1 directory and remove VFS1 components.
- Remove remaining unused references to VFS1 from remaining codebase.
- Rename/refactor code to avoid even referencing VFS2, unless necessary.
- Rewrite VFS1-only tests to VFS2.

Updates #1624

PiperOrigin-RevId: 490064269
2022-11-21 13:57:52 -08:00
Zach Koopmans 991841786a [sst] Cleanup TODOs for SecurityMessages
PiperOrigin-RevId: 464589591
2022-08-01 12:04:31 -07:00
Fabricio Voznika da267f435f Rename seccheck.checkers to seccheck.sinks
Makes the naming consistent with the public configuration. There is no
behavior change.

Updates #4805

PiperOrigin-RevId: 462448505
2022-07-21 12:47:06 -07:00
Ayush Ranjan f6ed4523dc Reformat codebase.
PiperOrigin-RevId: 449358041
2022-05-17 17:48:35 -07:00
Fabricio Voznika f2b6fbb47e Add Points to some syscalls
Added a raw syscall points to all syscalls. Added schematized syscall
points to the following syscalls:

  - read
  - close
  - socket
  - connect
  - execve
  - creat
  - openat
  - execveat

Updates #4805

PiperOrigin-RevId: 446008358
2022-05-02 13:03:04 -07:00
Fabricio Voznika 548d127739 Refactor code to use seccheck.SendToCheckers
Updates #4805

PiperOrigin-RevId: 445017536
2022-04-27 18:04:14 -07:00
Fabricio Voznika 8a24f200e9 Use proto structs for seccheck points
Given that in most cases points are serialized to another process,
point data is now created diretly into protos.

As part of this change, infrastructure to track optional and context
fields was created to facilitate addition of lots of Points which is
needed for upcomming of changes.

Updates #4805

Currently the SST code is converting seccheck protos into SST protos
in the sentry before sending it to the API. After this change, SST
checker will be changed to send seccheck protos to the API and the
API then converts these into SST on the way to pubsub.

PiperOrigin-RevId: 442688320
2022-04-18 19:03:15 -07:00
Konstantin Bogomolov 5c95e1d39c Implement close_range.
Fixes #5500

PiperOrigin-RevId: 431454836
2022-02-28 09:37:03 -08:00
Jamie Liu edb6bd399e Add caller for the Execve checkpoint.
Binary fields are VFS2-only.

PiperOrigin-RevId: 424176912
2022-01-25 14:16:07 -08:00
Nicolas Lacasse f7281c6cb9 Fix lock order violations: mm.mappingMu > Task.mu.
Document this ordering in mm/mm.go.

PiperOrigin-RevId: 393413203
2021-08-27 13:18:49 -07:00
Zach Koopmans 02370bbd31 [syserror] Convert remaining syserror definitions to linuxerr.
Convert remaining public errors (e.g. EINTR) from syserror to linuxerr.

PiperOrigin-RevId: 390471763
2021-08-12 15:19:12 -07:00
Ayush Ranjan a51fcf22eb [op] Move SignalStack to abi/linux package.
Updates #214

PiperOrigin-RevId: 378594929
2021-06-10 01:00:24 -07:00
Jamie Liu 468caff451 Rename kernel.TaskContext to kernel.TaskImage.
This reduces confusion with context.Context (which is also relevant to
kernel.Tasks) and is consistent with existing function kernel.LoadTaskImage().

PiperOrigin-RevId: 342167298
2020-11-12 17:39:19 -08:00
Michael Pratt 129018ab3d Consistent precondition formatting
Our "Preconditions:" blocks are very useful to determine the input invariants,
but they are bit inconsistent throughout the codebase, which makes them harder
to read (particularly cases with 5+ conditions in a single paragraph).

I've reformatted all of the cases to fit in simple rules:

1. Cases with a single condition are placed on a single line.
2. Cases with multiple conditions are placed in a bulleted list.

This format has been added to the style guide.

I've also mentioned "Postconditions:", though those are much less frequently
used, and all uses already match this style.

PiperOrigin-RevId: 327687465
2020-08-20 13:32:24 -07:00
Andrei Vagin 13a8ae81b2 Add context.FullStateChanged()
It indicates that the Sentry has changed the state of the thread and
next calls of PullFullState() has to do nothing.

PiperOrigin-RevId: 325567415
2020-08-07 22:49:55 -07:00
Nayana Bidari b2ae7ea1bb Plumbing context.Context to DecRef() and Release().
context is passed to DecRef() and Release() which is
needed for SO_LINGER implementation.

PiperOrigin-RevId: 324672584
2020-08-03 13:36:05 -07:00
Nicolas Lacasse 4ec3516332 Implement get/set_robust_list.
PiperOrigin-RevId: 322904430
2020-07-23 17:42:50 -07:00
Andrei Vagin 8c1f5b5cd8 Unshare files on exec
The current task can share its fdtable with a few other tasks,
but after exec, this should be a completely separate process.

PiperOrigin-RevId: 314999565
2020-06-05 14:45:32 -07:00