Christian Blichmann
597b4430ba
GitHub workflows: Combine SAPI generator build and "prerelease"
...
PiperOrigin-RevId: 604644955
Change-Id: Ie855b0d5699d1f8e201d2ecae821f7adb2c75c17
2024-02-06 07:48:38 -08:00
A. Cody Schuffelen
f708270f35
Add DefaultAction(TraceAllSyscalls)
variant to PolicyBuilder
...
This helps write the kind of 'log, but allow' policy described in
[`notify.h`](b9c84a1f75/sandboxed_api/sandbox2/notify.h (L57)
) for all system calls not mentioned explicitly. One use case is writing a "permissive mode" runtime to give more information during development.
PiperOrigin-RevId: 603766051
Change-Id: I3c72f433a1e21c330b5dd9f1ede2faa570b75b09
2024-02-02 13:01:37 -08:00
Wiktor Garbacz
044ba1cb90
Return ENOSYS instead of hard denying clone3
...
It's currently not possible to properly inspect arguments of clone3 via seccomp.
As userspace (notably glibc) started using clone3, other sandbox solutions (e.g. in Firefox and Chrome) switched to returning ENOSYS for that syscall, which usually will result in libraries falling back to clone/clone2.
PiperOrigin-RevId: 603332131
Change-Id: If2483f6f42eca46e1c8958ef17ca3c02fa82b658
2024-02-01 04:39:02 -08:00
Wiktor Garbacz
29a3b8cd39
Add AllowAccess to SAPI's default policy
...
The syscalls are fairly common and low risk.
PiperOrigin-RevId: 603312020
Change-Id: Id06bddc4e7fcc879cad567361ae5b0bad9533142
2024-02-01 02:51:48 -08:00
Chris Kennelly
b9c84a1f75
Allow restartable sequences access to poll.
...
This is used as part of reading the proc files that tell us how many CPUs are
present.
PiperOrigin-RevId: 602953725
Change-Id: I0b64c8d3992119bb956d262cd0f39500a680cc60
2024-01-30 23:48:37 -08:00
Chris Kennelly
0e98cceb32
Permit TCMalloc to use MAP_FIXED_NOREPLACE.
...
PiperOrigin-RevId: 602616926
Change-Id: I6337f740baebea6f8c63622a502a200c6f7bdb47
2024-01-29 23:13:59 -08:00
Oliver Kunz
f2840b37a3
NullPtr: Change SAPI to accept regular nullptr
for sandboxed API calls.
...
This change allows to use a `nullptr` instead to having to instantiate a `sapi:✌️ :NullPtr` object.
```
sapi:✌️ :NullPtr null;
SAPI_RETURN_IF_ERROR(api.testNullPtr(&null);
```
Becomes:
```
SAPI_RETURN_IF_ERROR(api.testNullPtr(nullptr);
```
PiperOrigin-RevId: 602333882
Change-Id: Ie2517dbedab8c514d7a102c4ef4bad90b34a219d
2024-01-29 03:23:45 -08:00
Wiktor Garbacz
fa5360351b
Use absl::string_view
consistently
...
PiperOrigin-RevId: 600363060
Change-Id: I14e4b78c90d1f66e6b429436b09fad9dcd0f2cfc
2024-01-21 23:42:32 -08:00
Sandboxed API Team
25cfb5ef03
Adding missing syscalls to the syscall tables.
...
PiperOrigin-RevId: 599971082
Change-Id: Icbec577ccf30a3868e4ac6ec356c3544c3d86aab
2024-01-19 16:46:15 -08:00
Sandboxed API Team
824d894822
Make sandbox2::SyscallTable::GetEntry public and add new helper GetEntries.
...
PiperOrigin-RevId: 599967495
Change-Id: Iae524c2c9b2829cbdcd51117134223d08e993a01
2024-01-19 16:28:20 -08:00
Wiktor Garbacz
28b45670c2
Allow sched_getaffinity
in AllowLlvmSanitizers
...
Otherwise sanitizers might CHECK-fail at `pthread_getattr_np` call.
PiperOrigin-RevId: 598809849
Change-Id: I221b25ecc640672586acfa350e2748769e38c70c
2024-01-16 05:18:55 -08:00
Wiktor Garbacz
fbfc2b9eac
Handle prlimit64
in Allow*RLimit
...
PiperOrigin-RevId: 598794581
Change-Id: If7898294aab1cf77f9b8007e4a9dc8bd74449f9b
2024-01-16 04:00:31 -08:00
Sandboxed API Team
9a06f3ac0c
Change the order of including system include paths.
...
PiperOrigin-RevId: 596657109
Change-Id: I4a50253561cf251b271623c607769e14e66a3de2
2024-01-08 11:39:17 -08:00
Chris Kennelly
a56660f542
Allow restartable sequences' mmaps to name their VMAs.
...
PiperOrigin-RevId: 596593499
Change-Id: Ice231b633758667947ec31da5c22f146847e6c6f
2024-01-08 07:57:34 -08:00
Sandboxed API Team
fc610b7c7a
Fix UB caused by uninitialized value.
...
PiperOrigin-RevId: 595332410
Change-Id: I88ca3e826853b8731e2c9a0c8b327cf13aeca046
2024-01-03 01:48:45 -08:00
Wiktor Garbacz
1339d0b7f2
Remove unneeded include
...
PiperOrigin-RevId: 594408507
Change-Id: I7bbfa0c47243755ae8bc0a6f69efe66d881076a1
2023-12-29 01:30:29 -08:00
Wiktor Garbacz
52babc15d4
logserver: Support non-UTF8 log messages
...
PiperOrigin-RevId: 594244338
Change-Id: Icc6bf1bea0dd8ad62e6fa274979cecd01e9b8283
2023-12-28 06:35:09 -08:00
Sandboxed API Team
e5370e93ca
Minor cleanups, no functional change.
...
PiperOrigin-RevId: 594091580
Change-Id: Id870592374069840fedf51cd228c9ed2f84b7542
2023-12-27 13:39:58 -08:00
Wiktor Garbacz
36e4b80f9a
Introduce and prefer AllowMmapWithoutExec
...
PiperOrigin-RevId: 593968486
Change-Id: I4f7d4d8a6f593d94c0a7e7672826074c4cefc230
2023-12-27 02:51:13 -08:00
Oliver Kunz
1255f57108
Provide an option to use the unotify monitor instead of the ptrace monitor.
...
PiperOrigin-RevId: 590847415
Change-Id: I45b1c392e108694f990a9762a2077e19d72f7b05
2023-12-14 00:48:21 -08:00
Wiktor Garbacz
0a992b683f
Add special handling for global forkserver
...
PiperOrigin-RevId: 590533638
Change-Id: Ibbb7685c58bae0ebf340eaa0186ecc794a5a5fea
2023-12-13 03:34:22 -08:00
Wiktor Garbacz
d95df64ebb
Add a test for custom forkserver
...
PiperOrigin-RevId: 590187497
Change-Id: I9e2d4a2ed585a78bd3cb44b3f78d91afd527f6ab
2023-12-12 06:53:33 -08:00
Oliver Kunz
39e49549e6
The current implementation of Sandbox::Terminate
results in timeout's being reported to coroner in cases where a Restart or Terminate with graceful exit is requested.
...
This change requests an exit from the sandboxee and then awaits the result either with a timeout of 1 second (the grace period) or else with infinite duration - which would then report the timeout again.
PiperOrigin-RevId: 589128986
Change-Id: Icc948b37f13f46af907fd1eab649cabb5ed50b25
2023-12-08 07:48:18 -08:00
Wiktor Garbacz
19d8f4729a
Add clone3 to syscall defs
...
PiperOrigin-RevId: 588688163
Change-Id: I7f309c8d05ca1bce5ddf160d1a33203b17317697
2023-12-07 00:46:35 -08:00
Dmitri Gribenko
4d34bdb145
Integrate LLVM at llvm/llvm-project@3287ae8f65
...
Updates LLVM usage to match
[3287ae8f6520](https://github.com/llvm/llvm-project/commit/3287ae8f6520 )
PiperOrigin-RevId: 586379104
Change-Id: Id69e27932def712bbb0f4a58112dfeb5b4f76275
2023-11-29 10:14:05 -08:00
Wiktor Garbacz
5ed720eeb1
SAPI_RAW_CHECK expects NUL-terminated strings
...
PiperOrigin-RevId: 586244294
Change-Id: I85492eb2f4833a1b31312981265ad3d715dfaa72
2023-11-29 01:03:45 -08:00
Oliver Kunz
a0ba1c520f
Enable the ability to change the sandboxee's malloc implementation. The default is set to "@bazel_tools//tools/cpp:malloc", which is also the default for Bazel's cc_binary [1].
...
[1] https://bazel.build/reference/be/c-cpp#cc_binary
PiperOrigin-RevId: 583081047
Change-Id: I08e7f6d0dffb1926e7bf9a9a96a7d6727d4cd3d6
2023-11-16 10:01:21 -08:00
Wiktor Garbacz
9a171c7e5f
Fix quoting for fedora build action
...
PiperOrigin-RevId: 582313110
Change-Id: I6f756a95d89efff95a71b3a57e33a6ae2caec829
2023-11-14 07:21:16 -08:00
Wiktor Garbacz
dc8bcc9d48
Update github actions OS and dependencies versions
...
Builds started to fail due to python's clang and libclang version mismatch.
PiperOrigin-RevId: 582287122
Change-Id: I14b6ce42fe7b7bcd2407a9277e722bc8181e41d9
2023-11-14 05:28:28 -08:00
Wiktor Garbacz
15fb5b9608
Allow sigaltstack
...
`absl::GetStackTrace` on Aarch64 since
bb7bbb12c7
will call sigaltstack.
PiperOrigin-RevId: 581914257
Change-Id: I316bdd64d1cef8a6327838681bda0067a0dc50fc
2023-11-13 04:22:29 -08:00
Wiktor Garbacz
bc3c0ec17a
Internal change
...
PiperOrigin-RevId: 581252235
Change-Id: I4de5fa0af11daa087172a81d2f81d51b51b1bace
2023-11-10 07:27:10 -08:00
Wiktor Garbacz
1bad376e42
Block sigaltstack
with ENOSYS
by default
...
`absl::GetStackTrace` on Aarch64 since
bb7bbb12c7
will call sigaltstack.
`absl::Mutex` in debug mode uses `absl::GetStackTrace` causing many new syscall violations. An error in the sigaltstack should be tolerated, so this will fix the issue without opening up the policy too much.
PiperOrigin-RevId: 580885547
Change-Id: I1acf28bff0e2f6f236a262c0ca8fa74a6c57fada
2023-11-09 06:32:16 -08:00
Sandboxed API Team
6f90a6ef2a
don't drop CAP_SYS_PTRACE as it is apparently needed by sandbox
...
running as root when combined with apparmor (or possibly yama) LSM
PiperOrigin-RevId: 578762678
Change-Id: I60803b4ed78c6750f8ce0e0c909e5cec4f619da8
2023-11-02 00:42:33 -07:00
Sandboxed API Team
79ab44c981
drop almost all capabilities during sandbox creation
...
PiperOrigin-RevId: 578096197
Change-Id: I900cfab378f0069e8daac60b5eb41c5eb7401692
2023-10-31 01:31:41 -07:00
Wiktor Garbacz
4630346fd1
Fix unaligned load
...
PiperOrigin-RevId: 577106224
Change-Id: Icd0e113031d367fa30557d4e77571abc78e8e378
2023-10-27 00:35:10 -07:00
Wiktor Garbacz
0940a9ee4a
Export config.h
from syscall.h
for sapi::cpu::Architecture
...
PiperOrigin-RevId: 569433347
Change-Id: I49b031d46f426f23cbf4556f8e22a69d6adc2c74
2023-09-29 02:32:49 -07:00
Wiktor Garbacz
37a7432178
Remove deprecated comms functions
...
PiperOrigin-RevId: 568510723
Change-Id: I517d739e44cb61eec8b0fd9fe6aa473e1bb8ec06
2023-09-26 05:45:27 -07:00
Wiktor Garbacz
fadfa79d7a
Add missing return
...
PiperOrigin-RevId: 568125662
Change-Id: If9d4990de32c9503a2b78393b944d6bcb58c5477
2023-09-24 23:47:01 -07:00
Sandboxed API Team
ee7b76f592
Automated rollback of commit 4ae281b6a2
.
...
PiperOrigin-RevId: 567287128
Change-Id: Ia12646e9ad1ebc94f6e26ae1b893b885c0908ca9
2023-09-21 06:17:56 -07:00
Wiktor Garbacz
4ae281b6a2
Remove deprecated comms functions
...
PiperOrigin-RevId: 567239465
Change-Id: Ic890404fa8b7e9797b2399a3b346c1339fbe133a
2023-09-21 02:31:16 -07:00
Wiktor Garbacz
9a985f91a7
Replace use of deprecated sandbox2::Comms
functions
...
PiperOrigin-RevId: 566863078
Change-Id: Ida96eb8046ff96bdd41cec4a1427073ae43930d9
2023-09-19 23:55:05 -07:00
Wiktor Garbacz
227daf4a42
Do 1 level of recursion on libunwind crashes
...
PiperOrigin-RevId: 566617450
Change-Id: If5e3ce2e9763360c6cbd50145c432dfb62621136
2023-09-19 06:50:05 -07:00
Wiktor Garbacz
1cf45be7df
Refactor Comms to split out listening/connecting part
...
Deprecated APIs slated for removal after migration of internal
clients.
PiperOrigin-RevId: 566598245
Change-Id: I5d7b920f3a788d4eccc6e78f239b660ba903adcc
2023-09-19 05:14:09 -07:00
Wiktor Garbacz
d26262d82e
Remove stale comment
...
PiperOrigin-RevId: 566559462
Change-Id: Iafc1e05ff4a958480c14b69b4139b370cdc63149
2023-09-19 02:04:50 -07:00
Sandboxed API Team
37b3a51ca6
Use empty instead of length
...
PiperOrigin-RevId: 566219114
Change-Id: I123e3cb8253d092b5d2d9c8e2a85cf5348c64a58
2023-09-18 00:46:50 -07:00
Chris Kennelly
f5830c93cd
Ensure that TCMalloc can execute NumCPUs.
...
PiperOrigin-RevId: 565683514
Change-Id: I391ab5f184f487ef3ffc553d10581cd6eaee54de
2023-09-15 08:21:13 -07:00
Wiktor Garbacz
700f8fa547
Skip sanitizers for limits_test
...
PiperOrigin-RevId: 565645224
Change-Id: I4441562e368ab8e0b95abbf9e3fbaa792ae59ffd
2023-09-15 04:57:24 -07:00
Wiktor Garbacz
1475458939
namespace_test: use lstat instead of stat, don't descent into procfs & sysfs
...
PiperOrigin-RevId: 565303140
Change-Id: I7600b60613f52260410098e617b00a2e4272b2fb
2023-09-14 02:09:12 -07:00
Wiktor Garbacz
b47a5ead07
Add TCMalloc related files to test policy
...
PiperOrigin-RevId: 565067820
Change-Id: I55bbe80b568042c1639435867f565880667f0180
2023-09-13 09:06:33 -07:00
Wiktor Garbacz
4289b64aa7
Disallow clone3, unsafe clone and unshare flags
...
Ability to create new namespaces and getting capabilities in there exposes a big kernel attack surface.
PiperOrigin-RevId: 564703131
Change-Id: I3dcf4c78dca9f51a4b068df16e1b1a69916d727c
2023-09-12 06:30:45 -07:00