summaryrefslogtreecommitdiffhomepage
path: root/runsc/boot/loader.go
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2020-01-28 15:13:46 -0800
committergVisor bot <gvisor-bot@google.com>2020-01-28 15:31:03 -0800
commit437c986c6a0ed0e1fccfbfb6706f43d2c801c444 (patch)
treec3ae0e02f85601e59ec58d946fc68cb151c44bbe /runsc/boot/loader.go
parent2862b0b1be9ce821e86877802b9608aad3102916 (diff)
Add vfs.FileDescription to FD table
FD table now holds both VFS1 and VFS2 types and uses the correct one based on what's set. Parts of this CL are just initial changes (e.g. sys_read.go, runsc/main.go) to serve as a template for the remaining changes. Updates #1487 Updates #1623 PiperOrigin-RevId: 292023223
Diffstat (limited to 'runsc/boot/loader.go')
-rw-r--r--runsc/boot/loader.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/runsc/boot/loader.go b/runsc/boot/loader.go
index fad72f4ab..9f0d5d7af 100644
--- a/runsc/boot/loader.go
+++ b/runsc/boot/loader.go
@@ -26,6 +26,7 @@ import (
specs "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/sys/unix"
+ "gvisor.dev/gvisor/pkg/abi"
"gvisor.dev/gvisor/pkg/abi/linux"
"gvisor.dev/gvisor/pkg/cpuid"
"gvisor.dev/gvisor/pkg/log"
@@ -42,6 +43,7 @@ import (
"gvisor.dev/gvisor/pkg/sentry/pgalloc"
"gvisor.dev/gvisor/pkg/sentry/platform"
"gvisor.dev/gvisor/pkg/sentry/sighandling"
+ "gvisor.dev/gvisor/pkg/sentry/syscalls/linux/vfs2"
"gvisor.dev/gvisor/pkg/sentry/time"
"gvisor.dev/gvisor/pkg/sentry/usage"
"gvisor.dev/gvisor/pkg/sentry/watchdog"
@@ -184,6 +186,13 @@ func New(args Args) (*Loader, error) {
return nil, fmt.Errorf("setting up memory usage: %v", err)
}
+ if args.Conf.VFS2 {
+ st, ok := kernel.LookupSyscallTable(abi.Linux, arch.Host)
+ if ok {
+ vfs2.Override(st.Table)
+ }
+ }
+
// Create kernel and platform.
p, err := createPlatform(args.Conf, args.Device)
if err != nil {