Commit Graph
44 Commits
Author SHA1 Message Date
Konstantin BogomolovandgVisor bot 832a40527a Add profiling metric flags to output metric data to local TSV file.
The idea behind conditionally compiled metrics originally was to use them in
hotpaths for profiling purposes. This CL makes that possible by outputting
declared metrics in TSV format, which can be used to track custom events at
runtime in relatively high resolution.

Usage:
    1. Optionally enable compilation of runsc conditionally-compiled metrics
       by passing in condmetric_profiling to the Go tags.
    2. Add these flags to runsc:
    - [Required] --profiling-metrics-log=/tmp/some.csv
    - [Optional] --profiling-metrics=/task/syscalls,/task/faults
      - If this flag is not specified it will monitor all
        conditionally-compiled metrics by default.
    - [Optional] --profiling-metrics-rate-us=10000

Some future improvements:
    - Flag to output a metric-difference between timestamps instead of
      constant accumulation.
    - Output a gnuplot command along with the data.
    - Current monitoring resolution is limited by what time.Sleep allows.
      This can be overcome by spinning/yielding when lower monitoring
      rates are requested.

PiperOrigin-RevId: 560849611
2023-08-28 16:28:09 -07:00
Ayush RanjanandgVisor bot b28d579e5d Make all custom flag.Value implementations idempotent.
Set(String()) should be an idempotent operation. This is a useful property
which allows us to generate args while re-execing the same process. Setting
`--flag-name=val.String()` should work.

PiperOrigin-RevId: 552598313
2023-07-31 14:53:21 -07:00
Etienne PerotandgVisor bot 3c8b5e5141 runsc: Only register some base flags if they are not already defined.
PiperOrigin-RevId: 538323866
2023-06-06 16:38:18 -07:00
Ayush RanjanandgVisor bot 3cd9ce0578 Unexport fields of config.Overlay2.
Users/callers of config.Overlay2 relied on its internal functioning/layout.
The stable contract is at the --overlay2 flag level. So changed callers to use
that contract instead via Overlay2.Set().

Unexported fields to encapsulate the type correctly.

PiperOrigin-RevId: 530818635
2023-05-09 23:42:02 -07:00
Etienne PerotandgVisor bot ce2e8f9422 Move rlimit-setting code from runsc main to run when starting a sandbox.
This allows `runsc` subcommands that don't start sandboxes to run in
restricted contexts without printing a warning about not being able to set
`RLIMIT_MEMLOCK` when the ability to do so this doesn't matter.

In particular, this helps with `runsc metric-server`, which can be locked down
to run with very little capabilities.

A previous version of this change had moved this to the beginning of the
`runsc boot` subcommand code. However, this doesn't work, because `runsc boot`
runs as an unprivileged user (`nobody`) and does not have `CAP_SYS_RESOURCE`.

Prior to that change, all `runsc` invocations tried to call `setrlimit`, so
what happened in practice is that `runsc create` (running as `root`) would
call `setrlimit`, and then `runsc boot` would inherit the `RLIM_INFINITY` and
would therefore never actually call `setrlimit` by itself. When moving the
`setrlimit` code to only run within `runsc boot`, suddenly the `runsc boot`
invocation found itself in a context where it started trying to call
`setrlimit`, which would silently fail.

This approach has the downside of having the side-effect of needlessly setting
`RLIM_INFINITY` on the calling `runsc` process. This was effectively what was
already happening prior to moving this code into `runsc boot` anyway, so this
should be OK. The alternative would be to add yet another intermediate
subcommand before `runsc boot` which runs with `CAP_SYS_RESOURCE`, then calls
`setrlimit`, then drops `CAP_SYS_RESOURCE`, then execs `runsc boot`, but that
seems like adding a lot more extra complexity to the boot process than is
warranted for this feature.

Thanks to Ayush Ranjan for bisecting the performance regression down to this
change.

Ran benchmarks and performance is comparable to before moving `setrlimit` code
within `runsc boot`.

PiperOrigin-RevId: 521916084
2023-04-04 18:08:14 -07:00
Etienne PerotandgVisor bot 30befdadf4 Automated rollback of changelist 508491474
PiperOrigin-RevId: 521829631
2023-04-04 12:10:26 -07:00
Zach KoopmansandgVisor bot b10d68072b Add portforward command to runsc
Add portforward comand so that we can use runsc to forward connections
to container ports. This will eventually be supported in k8s.

PiperOrigin-RevId: 520739913
2023-03-30 14:16:19 -07:00
Etienne PerotandgVisor bot ab2cf15e09 runsc: Refactor in how the version string is propagated in runsc.
This is helpful so that it can be imported form other packages without import
loops.

This will be used in a follow-up change to add the version string as a
per-sandbox metric metadata label.

PiperOrigin-RevId: 519002695
2023-03-23 17:12:09 -07:00
Ayush RanjanandgVisor bot 671c064754 Add support for directfs in runsc.
directfs is a feature much like host networking. The gofer security boundary is
dropped for additional performance. The sentry is allowed to directly access the
host filesystem to access or mutate files in order to service application
syscalls. This mode bypasses the gofer completely.

With directfs, the sentry is run in the root user namespace. (Similar to how
hostinet works.) The sentry also runs with additional capabilities that allow
it to bypass file permissions checks, change file owner, chroot, etc. Seccomp
filters are loosened around the sentry to allow it to make filesystem syscalls
directly to the host.

The sandbox still runs with an empty pivot root. The gofer donates FDs for the
root mount and all bind mounts so that the sentry can perform filesystem
operations using them.

There is a dummy gofer process in directfs mode. The gofer sets up all bind
mounts and donates host FDs of the mount point to the sandbox. The gofer dies
with the sandbox. All gofer mount options are supported with directfs. directfs
mounts are set up similarly to how gofer mounts are set up.

PiperOrigin-RevId: 513634936
2023-03-02 14:10:58 -08:00
Adin ScannellandgVisor bot 2911d8c3b8 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Konstantin BogomolovandgVisor bot 0416d0a2d3 Add TESTONLY sentry panic trigger through afs_syscall.
This flag is added for tests that need to trigger a panic in the sentry
kernel. Only done for x86_64 which does have a dedicated syscall number for
afs_syscall; ARM does not.

PiperOrigin-RevId: 512731631
2023-02-27 14:28:30 -08:00
Etienne PerotandgVisor bot 9f22116a2b Add runsc metric-metadata subcommand.
Also group metric-related commands together in their own command group.

PiperOrigin-RevId: 511240778
2023-02-21 10:34:37 -08:00
Etienne PerotandgVisor bot dbf2023eeb Move rlimit-setting code from runsc main to run only as part of runsc boot.
This allows other `runsc` subcommands to run in restricted contexts without
printing a warning about not being able to set `RLIMIT_MEMLOCK` in contexts
where this doesn't matter.

In particular, this helps with `runsc metric-server`, which can be locked down
to run with very little capabilities.

PiperOrigin-RevId: 508491474
2023-02-09 15:29:05 -08:00
Ayush RanjanandgVisor bot 710955192d Add dir= prefix in overlay2 flag's medium.
This is to make it clear that the host file will be created inside this
directory. This also makes it look cleaner when other medium options are added
later.

PiperOrigin-RevId: 505033408
2023-01-26 22:56:52 -08:00
Etienne PerotandgVisor bot c3c5d92d02 gVisor: Implement runsc metric-server which serves Prometheus metrics.
The metrics server implements the following interface:

- GET `/metrics`: Serves Prometheus metrics.
- POST `/runsc-metrics`: Contains administrative endpoints.
  All of them require the `root` argument to be specified, and match the one
  that the server expects. This is used to avoid confusing multiple instances
  of the  `runsc` metrics server.
  - POST `/runsc-metrics/healthcheck`: Used by clients to verify that the
    server is running and is the expected metric server.

This change has no tests, but coverage is provided in a later change that
provides an end-to-end container tests that the metric server works and
exports data faithfully.

This change is part of a series of changes to support Prometheus-style metrics
in `runsc`. Doing so requires making several seemingly-odd design decisions,
due to the following architectural constraints:

- Prometheus requires an HTTP server serving the `/metrics` endpoint.
- For performance reasons, the `runsc boot` process cannot run the `netpoller`
  goroutine.
  - Since we don't want to write our own HTTP server implementation, this
    means the HTTP endpoint has to be served by a separate process that
    remains running during the lifetime of the container.
- The `runsc boot` process is untrusted.
  - This means we cannot trust metrics data that comes out of the Sentry.
    Therefore, there needs to be an elaborate dance where we pre-register
    metric metadata before starting any untrusted workload. Then, the server
    relaying the metric data must verify the validity of metric values against
    this metric metadata. This avoids leaking metrics, cardinality blow-ups,
    and other such DoS vectors.
- This feature needs to be easy-to-use in a typical Docker setting.
  - This means having the ability to just say
    `--metrics-server=localhost:1337` in the `runsc` runtime entry in
    `/etc/docker/daemon.json` and have that Just Work(TM), even when multiple
    containers are running.
  - Since only one process may listen on a port at a given time, this means
    the metric server needs to be able to multiplex requests out to multiple
    running sandboxes, and remain alive for the entire duration of either of
    these sandboxes.
  - For this reason, the metrics server runs *outside* of the usual
    per-container cgroups.
  - This also saves system resources by not running one server per sandbox.
- The metrics server must be exposed to the outside world, and cannot assume
  that its clients are trustworthy.
  - For this reason, a metrics server is bound to a runtime root directory,
    and double-checks all that the sandboxes it is asked to follow actually
    exist in this root directory.

PiperOrigin-RevId: 503254345
2023-01-19 13:45:46 -08:00
Rahat MahmoodandgVisor bot b47ecb8223 Disable io_uring syscalls by default.
The current io_uring support is very limited and experimental. Disable
it by default, and add a flag to enable it for testing.

PiperOrigin-RevId: 500760451
2023-01-09 11:11:57 -08:00
Etienne PerotandgVisor bot 592faca601 gVisor: Add runsc metrics-export subcommand.
This subcommand prints a sandbox's instrumentation data in Prometheus format
to stdout.

This change is part of a series of changes to support Prometheus-style metrics
in `runsc`. Doing so requires making several seemingly-odd design decisions,
due to the following architectural constraints:

- Prometheus requires an HTTP server serving the `/metrics` endpoint.
- For performance reasons, the `runsc boot` process cannot run the `netpoller`
  goroutine.
  - Since we don't want to write our own HTTP server implementation, this
    means the HTTP endpoint has to be served by a separate process that
    remains running during the lifetime of the container.
- The `runsc boot` process is untrusted.
  - This means we cannot trust metrics data that comes out of the Sentry.
    Therefore, there needs to be an elaborate dance where we pre-register
    metric metadata before starting any untrusted workload. Then, the server
    relaying the metric data must verify the validity of metric values against
    this metric metadata. This avoids leaking metrics, cardinality blow-ups,
    and other such DoS vectors.
- This feature needs to be easy-to-use in a typical Docker setting.
  - This means having the ability to just say
    `--metrics-server=localhost:1337` in the `runsc` runtime entry in
    `/etc/docker/daemon.json` and have that Just Work(TM), even when multiple
    containers are running.
  - Since only one process may listen on a port at a given time, this means
    the metric server needs to be able to multiplex requests out to multiple
    running sandboxes, and remain alive for the entire duration of either of
    these sandboxes. However, it should also die when there are no sandboxes,
    so that we don't end up with leftover metric servers lying around.
  - For this reason, the metrics server runs *outside* of the usual
    per-container cgroups.
  - This also saves system resources by not running one server per sandbox.
- The metrics server must be exposed to the outside world, and cannot assume
  that its clients are trustworthy.
  - For this reason, a metrics server is bound to a runtime root directory,
    and double-checks all that the sandboxes it is asked to follow actually
    exist in this root directory.

PiperOrigin-RevId: 498067941
2022-12-27 18:11:57 -08:00
Ayush RanjanandgVisor bot c15a2e6717 Deprecate 9P gofer protocol in runsc.
Updates #7911

PiperOrigin-RevId: 495343206
2022-12-14 10:00:15 -08:00
Ayush RanjanandgVisor bot d937df6218 Replace pkg/refs with pkg/refsvfs2.
All VFS1 only bits have been deleted.

Updates #1624

PiperOrigin-RevId: 492273183
2022-12-01 12:46:11 -08:00
329def4002 Add overlay2 flag in runsc.
--overlay2 flag supersedes --overlay flag. It allows more granular
configuration for overlayfs in runsc. It does so in two ways:

1. Allows to apply overlay on all mounts or only the root mount.
   --overlay applies overlay to all mounts.
2. Allows to specify if overlay's upper layer should be backed by
   container memory or disk. --overlay always used container memory.

Allowing tmpfs to be backed by a file on disk prevents the container
memory from bloating up. Note that the tmpfs filesystem tree will
still be stored in sentry memory.

Using overlay on the root filesystem, helps avoid expensive
communication with the gofer process. The root filesystem of the
container is not preserved across container lifecycle. So we don't
need to keep updating the host filesystem, which will anyways be
destroyed once the container is destroyed. It is wasted effort.
Instead we keep all the changes to the root filesystem in tmpfs which
is directly accessible by the sentry.

The host file is created as an unnamed file using O_TMPFILE. Support
has been added for sub-containers too. Save/restore support is
still lacking.

Co-authored-by: Andrei Vagin <[email protected]>
PiperOrigin-RevId: 491988485
2022-11-30 12:29:14 -08:00
Andrei VaginandgVisor bot 1a5eb0815b runsc: umount /proc in the sandbox namespace
The sandbox process is started with the procfs mount and then it is umounted
before executing guest processes.

Here are a few reasons why we need /proc in the sandbox namespace:
* /proc/self/exe is used to re-executed itself without capabilities and
  with a specific uid,gid, etc. execveat() can be protected by some security
  policies. For example, on my workstation, it fails tomoyo_bprm_check_security
  checks.
* runsc reads /proc/cpuinfo, /proc/sys/vm/mmap_min_addr, /proc/self/auxv,
  /proc/sys/kernel/cap_last_cap.
* The kvm platform reads /proc/self/maps to get current mappings.

PiperOrigin-RevId: 488733897
2022-11-15 12:51:38 -08:00
Fabricio VoznikaandgVisor bot 50dbb516b1 Add flag to filter debug logs
This allows for only a subset of commands to be logged to reduce the
amount of logging generated.

Updates #7999

PiperOrigin-RevId: 480476369
2022-10-11 16:09:50 -07:00
Jamie LiuandgVisor bot e7d7eef71c Add populate parameter to pgalloc.MemoryFile.AllocateAndFill().
This targets the issue raised by #7977, but uses mlock(2) to force
mm_populate() of a precise address range, and also enables the use of the same
feature in other places where it makes sense (when breaking copy-on-write, and
when filling gofer page caches).

On the benchmark given in #7977, using KVM platform:
```
docker exec -ti $id fio --output-format=json --ioengine=sync --name=write --size=10G --blocksize=4K --filename=/data/data.test --iodepth=4 --rw=write
```

Before this CL:
```
      "write" : {
        "io_bytes" : 10737418240,
        "io_kbytes" : 10485760,
        "bw" : 889981,
        "iops" : 222495.331862,
        "runtime" : 11782,
        "total_ios" : 2621440,
        "short_ios" : 0,
        "drop_ios" : 0,
        "slat_ns" : {
          "min" : 0,
          "max" : 0,
          "mean" : 0.000000,
          "stddev" : 0.000000
        },
        "clat_ns" : {
          "min" : 3678,
          "max" : 183826,
          "mean" : 4253.962175,
          "stddev" : 1003.818651,
          "percentile" : {
            "1.000000" : 3792,
            "5.000000" : 3824,
            "10.000000" : 3856,
            "20.000000" : 3888,
            "30.000000" : 3920,
            "40.000000" : 3952,
            "50.000000" : 3984,
            "60.000000" : 4016,
            "70.000000" : 4080,
            "80.000000" : 4576,
            "90.000000" : 5024,
            "95.000000" : 5344,
            "99.000000" : 6752,
            "99.500000" : 7840,
            "99.900000" : 16512,
            "99.950000" : 19840,
            "99.990000" : 28544,
            "0.00" : 0,
            "0.00" : 0,
            "0.00" : 0
          }
        },
        "lat_ns" : {
          "min" : 3714,
          "max" : 183863,
          "mean" : 4294.114721,
          "stddev" : 1008.663442
        },
        "bw_min" : 760015,
        "bw_max" : 922560,
        "bw_agg" : 100.000000,
        "bw_mean" : 892699.913043,
        "bw_dev" : 41761.998527,
        "bw_samples" : 23,
        "iops_min" : 190003,
        "iops_max" : 230640,
        "iops_mean" : 223174.826087,
        "iops_stddev" : 10440.656065,
        "iops_samples" : 23
      },
```

After this CL:
```
      "write" : {
        "io_bytes" : 10737418240,
        "io_kbytes" : 10485760,
        "bw" : 1354049,
        "iops" : 338512.396694,
        "runtime" : 7744,
        "total_ios" : 2621440,
        "short_ios" : 0,
        "drop_ios" : 0,
        "slat_ns" : {
          "min" : 0,
          "max" : 0,
          "mean" : 0.000000,
          "stddev" : 0.000000
        },
        "clat_ns" : {
          "min" : 2471,
          "max" : 125666,
          "mean" : 2732.605543,
          "stddev" : 702.327985,
          "percentile" : {
            "1.000000" : 2512,
            "5.000000" : 2544,
            "10.000000" : 2576,
            "20.000000" : 2576,
            "30.000000" : 2576,
            "40.000000" : 2608,
            "50.000000" : 2608,
            "60.000000" : 2640,
            "70.000000" : 2672,
            "80.000000" : 2768,
            "90.000000" : 3056,
            "95.000000" : 3088,
            "99.000000" : 3888,
            "99.500000" : 4576,
            "99.900000" : 13504,
            "99.950000" : 18048,
            "99.990000" : 25984,
            "0.00" : 0,
            "0.00" : 0,
            "0.00" : 0
          }
        },
        "lat_ns" : {
          "min" : 2514,
          "max" : 125707,
          "mean" : 2778.332321,
          "stddev" : 708.893090
        },
        "bw_min" : 1173397,
        "bw_max" : 1402299,
        "bw_agg" : 99.894475,
        "bw_mean" : 1352620.133333,
        "bw_dev" : 74302.901710,
        "bw_samples" : 15,
        "iops_min" : 293349,
        "iops_max" : 350574,
        "iops_mean" : 338154.866667,
        "iops_stddev" : 18575.487826,
        "iops_samples" : 15
      },
```

Simple process creation benchmark to exercise copy-on-write breaking
`docker run --runtime=runsc debian /bin/bash -c 'time for i in {1..10000}; do /bin/true; done;'`
using KVM platform:

Before this CL:
```
real	1m5.794s
user	0m7.680s
sys	1m37.050s
```

After this CL:
```
real	0m57.837s
user	0m7.310s
sys	1m30.500s
```

PiperOrigin-RevId: 479461293
2022-10-06 18:22:39 -07:00
Rahat MahmoodandgVisor bot d0c5abcfea Implement sentry control commands for cgroupfs.
Add sentry control commands to read and write cgroup control
values.

PiperOrigin-RevId: 474663678
2022-09-15 14:55:45 -07:00
Fabricio VoznikaandgVisor bot 1565387b3e Add runsc usage to list of commands
Also make `runsc debug` write to stdout and log file to make it
easier to see the output when running the command manually.

PiperOrigin-RevId: 470042053
2022-08-25 11:40:36 -07:00
Nicolas LacasseandgVisor bot ab8b222f96 Delete verityfs.
PiperOrigin-RevId: 454300799
2022-06-10 22:18:49 -07:00
Fabricio VoznikaandgVisor bot 6f096cb91d Deprecate --vfs2 flag and always enable by default
Also remove VFS1 dimension from runsc unit tests.

Updates #1624

Startblock:
  after 2022-05-30
PiperOrigin-RevId: 448552271
2022-05-13 12:25:09 -07:00
Fabricio VoznikaandgVisor bot 4b6f7dd55e Add runsc trace commands
The trace commands allows a user to manipulate trace sessions.

`runsc trace create <name> --config <file>` => creates a new trace session
`runsc trace delete <name>` => deletes an existing trace session
`runsc trace list` => lists all running trace sessions
`runsc trace metadata` => lists all point with their respective optional and
context fields

This allows trace sessions to be created/deleted on a running sandbox. Note
that the system currently only allows a single trace session to exist, named
'Default'. Attempts to manipulate other sessions will error out.

Updates #4805

PiperOrigin-RevId: 447815153
2022-05-10 13:40:39 -07:00
Fabricio VoznikaandgVisor bot a917365932 Refactor subcommands error handling into a separate package
This is going to be used by the trace subcommand which lives in
another package.

Updates #4805

PiperOrigin-RevId: 447006075
2022-05-06 09:40:39 -07:00
Lucas ManningandgVisor bot 48ef47b8dd Add systemd-cgroup support to runsc.
This change adds systemd-cgroup support to cgroupv2 and modifies existing
cgroup tests for systemd support.

Fixes #193

PiperOrigin-RevId: 435457762
2022-03-17 15:03:44 -07:00
Adin ScannellandgVisor bot 4b3911824d Validate flags during install.
First, this change moves the internal config API to use flag.FlagSet, which
allows more flexibility and fixes many test usages.

Second, the runtime flags are validated during install. The platform is opened
and a warning issued if this fails, but this is not fatal.

This change requires moving the Makefile to --test_env, since the attribute
is not properly supported by test targets. Therefore, the targets can use args
while the Makefile must pass in configuration via --test_env.

PiperOrigin-RevId: 428048274
2022-02-11 11:24:01 -08:00
Fabricio VoznikaandgVisor bot f9a76036e4 Reorder cmd groups
Also fixed gofer which was added twice.

PiperOrigin-RevId: 425709601
2022-02-01 14:03:11 -08:00
Adin ScannellandgVisor bot e52546f46f Support STAGED_BINARIES to run prebuilt binaries with the test pipeline.
In some cases, it may be desirable to prebuild binaries and run all tests,
for example to run benchmarks with various experiments. Allow the top-level
Makefile to support this by checking for a STAGED_BINARIES variable.

PiperOrigin-RevId: 410673120
2021-11-17 17:49:35 -08:00
Fabricio VoznikaandgVisor bot 5adbb0f4a3 Add Debug to log file header
PiperOrigin-RevId: 404635832
2021-10-20 14:16:04 -07:00
Ayush RanjanandgVisor bot 34a4bdbd40 [lisa] Plumb lisafs through runsc.
lisafs is only supported in VFS2. Added a runsc flag which enables lisafs.
When the flag is enabled, the gofer process and the client communicate using
lisafs protocol instead of 9P.

Added a filesystem option in fsimpl/gofer which indicates if lisafs is being
used. That will be used to gate lisafs on the gofer client.

Note that this change does not make the gofer client use lisafs just yet.

Updates #5465

PiperOrigin-RevId: 397917844
2021-09-20 22:34:01 -07:00
Fabricio VoznikaandgVisor bot 8b437ee55a Fix GoLand analyzer errors under runsc/...
PiperOrigin-RevId: 384344990
2021-07-12 16:45:33 -07:00
Dean DengandgVisor bot adc390221b Move runsc reference leak checking to better locations.
In the previous spot, there was a roughly 50% chance that leak checking would
actually run. Move it to the waitContainer() call on the root container, where
it is guaranteed to run before the sandbox process is terminated. Add it to
runsc/cli/main.go as well for good measure, in case the sandbox exit path does
not involve waitContainer().

PiperOrigin-RevId: 369329796
2021-04-19 16:48:27 -07:00
Dean DengandgVisor bot d34b9da5da Allow runsc to generate coverage reports.
Add a coverage-report flag that will cause the sandbox to generate a coverage
report (with suffix .cov) in the debug log directory upon exiting. For the
report to be generated, runsc must have been built with the following Bazel
flags: `--collect_code_coverage --instrumentation_filter=...`.

With coverage reports, we should be able to aggregate results across all tests
to surface code coverage statistics for the project as a whole.

The report is simply a text file with each line representing a covered block
as `file:start_line.start_col,end_line.end_col`. Note that this is similar to
the format of coverage reports generated with `go test -coverprofile`,
although we omit the count and number of statements, which are not useful for
us.

Some simple ways of getting coverage reports:

bazel test <some_test> --collect_code_coverage \
  --instrumentation_filter=//pkg/...

bazel build //runsc --collect_code_coverage \
  --instrumentation_filter=//pkg/...
runsc -coverage-report=dir/ <other_flags> do ...

PiperOrigin-RevId: 368952911
2021-04-16 17:56:16 -07:00
Rahat MahmoodandgVisor bot 7d09771095 Implement the runsc verity-prepare command.
Implement a new runsc command to set up a sandbox with verityfs and
run the measure tool. This is loosely forked from the do command, and
currently requires the caller to provide the measure tool binary.

PiperOrigin-RevId: 366553769
2021-04-02 19:34:50 -07:00
Ayush RanjanandgVisor bot f894b943e8 [op] Replace syscall package usage with golang.org/x/sys/unix in runsc/.
The syscall package has been deprecated in favor of golang.org/x/sys.

Note that syscall is still used in some places because the following don't seem
to have an equivalent in unix package:
- syscall.SysProcIDMap
- syscall.Credential

Updates #214

PiperOrigin-RevId: 361381490
2021-03-06 22:07:07 -08:00
Zach KoopmansandgVisor bot d51edbfbe1 Add mitigate command to runsc
PiperOrigin-RevId: 356772367
2021-02-10 10:48:48 -08:00
Dean DengandgVisor bot f2b3ef13bc Add runsc symbolize command.
This command takes instruction pointers from stdin and converts them into their
corresponding file names and line/column numbers in the runsc source code. The
inputs are not interpreted as actual addresses, but as synthetic values that are
exposed through /sys/kernel/debug/kcov. One can extract coverage information
from kcov and translate those values into locations in the source code by
running symbolize on the same runsc binary.

This will allow us to generate syzkaller coverage reports.

PiperOrigin-RevId: 347089624
2020-12-11 15:43:22 -08:00
Adin ScannellandgVisor bot 727b2adc2f Tweak aarch64 support.
A few images were broken with respect to aarch64. We should now
be able to run push-all-images with ARCH=aarch64 as part of the
regular continuous integration builds, and add aarch64 smoke tests
(via user emulation for now) to the regular test suite (future).

PiperOrigin-RevId: 346685462
2020-12-09 18:51:17 -08:00
Adin ScannellandgVisor bot 56dd1e2544 Remove legacy bazel configurations.
Using the newer bazel rules necessitates a transition from proto1 to
proto2. In order to resolve the incompatibility between proto2 and
gogoproto, the cri runtimeoptions proto must be vendored.

Further, some of the semantics of bazel caching changed during the
transition. It is now necessary to:

- Ensure that :gopath depends only on pure library targets, as the
  propagation of go_binary build attributes (pure, static) will
  affected the generated files (though content remains the same,
  there are conflicts with respect to the gopath).
- Update bazel.mk to include the possibility of binaries in the
  bazel-out directory, as it will now put runsc and others there.
  This required some refinements to the mechanism of extracting
  paths, since some the existing regex resulted in false positives.
- Change nogo rules to prevent escape generation on binary targets.
  For some reason, the newer version of bazel attempted to run the
  nogo analysis on the binary targets, which fails due to the fact
  that objdump does not work on the final binary. This must be due
  to a change in the semantics of aspects in bazel3.

PiperOrigin-RevId: 337958324
2020-10-19 16:28:40 -07:00