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
Wiktor Garbacz
77f62ccb1f
Remove unused NetworkProxyClient::ConnectHandler
...
PiperOrigin-RevId: 563750900
Change-Id: Ib848aab0520032dbdcc879cb11861b133e26c4c6
2023-09-08 07:51:13 -07:00
Wiktor Garbacz
f614862e07
Remove deprecated VecStringToCharPtrArr
...
PiperOrigin-RevId: 563374332
Change-Id: I6873ca0d45fd5de6ad8eab1cbc395032130e9697
2023-09-07 03:09:30 -07:00
Wiktor Garbacz
b350a41a10
Gather more coverage data
...
Switch to ForkWithFlags for InitProcess (it will not reset coverage).
Explicitly dump coverage after initial namespace setup.
Return instead of exiting from libunwind sandbox.
PiperOrigin-RevId: 563368599
Change-Id: I3b764db015a71bd091ee7b4b5b614281cbb84832
2023-09-07 02:43:04 -07:00
Wiktor Garbacz
f6ec787902
PtraceMonitor: Add a hard deadline for waiting for kill to take effect
...
PiperOrigin-RevId: 563064233
Change-Id: Id340ba3793b82737f1976638a57df513c3d4136c
2023-09-06 04:38:51 -07:00
Wiktor Garbacz
98d7f91b4d
Run more tests with sanitizers and coverage
...
PiperOrigin-RevId: 562768789
Change-Id: I2ee9e05a75a1f4e46887ef4c6587628f36ba16eb
2023-09-05 07:14:49 -07:00
Wiktor Garbacz
92aeadddee
PolicyBuilder: test error conditions for AddPolicyOnSyscalls
...
PiperOrigin-RevId: 562768777
Change-Id: If756f83ea657cc6cd4c1283339a2909071a47493
2023-09-05 07:13:56 -07:00
Wiktor Garbacz
02d770adcc
NetworkProxyTest: test more error conditions
...
PiperOrigin-RevId: 562708702
Change-Id: Ifedcb0eb2bc84396627a0b53828e1e10e4c562ad
2023-09-05 02:17:25 -07:00
Wiktor Garbacz
b088c01ab2
Add missing Aarch64 syscall entries
...
PiperOrigin-RevId: 562705740
Change-Id: Ie75c13b4b1669cc7bcd45baa51119c633e120993
2023-09-05 02:03:36 -07:00
Wiktor Garbacz
5f9698612e
Better network proxy tests
...
Fix sending error on `connect` failure.
PiperOrigin-RevId: 562693682
Change-Id: I70c710a9001f22e172cbe4df328983bfa7188d3d
2023-09-05 00:57:27 -07:00
Wiktor Garbacz
3ea315858d
Remove mutexes from Comms
...
It was never fully thread-safe.
e.g. calling SendProtoBuf concurrently from 2 threads
could result in a data race.
Also not all users need the thread-safety thus it's better left off to be done externally by the ones that require it.
PiperOrigin-RevId: 562548941
Change-Id: Ie32dfca366be9e0c32841e55b688907f4f5f7704
2023-09-04 07:00:57 -07:00
Wiktor Garbacz
197f03aa5b
Adjust code so that variable name is correct
...
PiperOrigin-RevId: 562509424
Change-Id: I33bf50c2cdce0fbd38d669d76da95b448f1841e4
2023-09-04 03:13:42 -07:00
Jaeden Quintana
e23acfd7e7
Made slight optimizations in Sandbox2's comms.
...
The optimizations are:
* Reduced the number of calls to `write` (originating from `SendTLV()`) from 3 to 1-2 (depending on size of the payload).
* Reduced the number of calls to `read()` (originating from `RecvTLV()`) from 3 to 2.
PiperOrigin-RevId: 561750509
Change-Id: I81bc092edf602e12c85ee97bd2e77b587b750d65
2023-08-31 13:50:26 -07:00
Wiktor Garbacz
2c9ac02b68
Rework network_proxy related tests/examples
...
PiperOrigin-RevId: 561632543
Change-Id: I85843cc1cac8348273a5593339b38ae08e07592c
2023-08-31 06:06:09 -07:00
Sandboxed API Team
a0eb8d4445
Increase limits in ElfParser
...
PiperOrigin-RevId: 561621211
Change-Id: I3bbe8aecd3e3044251b67145927ee3a04bc56532
2023-08-31 05:01:51 -07:00
Wiktor Garbacz
dc25251af9
Enable sandboxed stack traces for coverage
...
PiperOrigin-RevId: 561611676
Change-Id: I852eec8fc3728da1ae0b4bca8ccc9a628b8b5adc
2023-08-31 04:05:49 -07:00
Wiktor Garbacz
f715bd8ba9
Run more tests with coverage enabled
...
PiperOrigin-RevId: 561575508
Change-Id: Ifc9a678b6a6cbcd892a1f8710b941514eb1d9764
2023-08-31 00:44:23 -07:00
Wiktor Garbacz
47c868e6b1
Merge block bpf/ptrace tests
...
PiperOrigin-RevId: 561338563
Change-Id: If2704835c75ca0ae367375212c2104289e7b5cb0
2023-08-30 07:47:15 -07:00