2 Commits

Author SHA1 Message Date
Jing Chen cf5c4c9cbf Replace reflect.DeepEqual with [slices/maps].Equal.
They are faster on slice/map comparisons.

PiperOrigin-RevId: 633080355
2024-05-12 21:20:18 -07:00
Etienne Perot 0a3bced479 Add tooling to compile seccomp-bpf programs at bazel build time.
This adds a `precompiledseccomp` library which provides tooling to compile
`seccomp-bpf` programs and generate Go source code that contains the
resulting bytecode embedded into it. In turn, this bytecode can be used in
Go libraries.

This avoids spending time compiling and optimizing `seccomp-bpf` programs
at runsc container creation time.

This library also contains support for "variables", which are `uint32`s whose
values are part of the seccomp filters but only known at runtime. To support
this, the program is compiled twice with placeholder values for these
variables, and we verify that the offsets at which these values show up in the
bytecode is consistent across these two compilation attempts.

PiperOrigin-RevId: 583117683
2023-11-16 12:00:44 -08:00