From d40d75d2d787b9d4f949422b88de18ede4ee20b6 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Thu, 24 Oct 2019 10:16:19 +0200 Subject: executor: move fixed pci devlink handle into network namespace In case there is a fixed pci devlink handle "pci/pci/0000:00:10.0" on the system (initial network namespace), it is moved to a working network namespace. Signed-off-by: Jiri Pirko --- pkg/csource/options.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'pkg/csource/options.go') diff --git a/pkg/csource/options.go b/pkg/csource/options.go index 7ad8c1d9c..a4cc45d45 100644 --- a/pkg/csource/options.go +++ b/pkg/csource/options.go @@ -38,6 +38,7 @@ type Options struct { EnableBinfmtMisc bool `json:"binfmt_misc,omitempty"` EnableCloseFds bool `json:"close_fds"` EnableKCSAN bool `json:"kcsan,omitempty"` + EnableDevlinkPCI bool `json:"devlinkpci,omitempty"` UseTmpDir bool `json:"tmpdir,omitempty"` HandleSegv bool `json:"segv,omitempty"` @@ -127,6 +128,9 @@ func (opts Options) checkLinuxOnly(OS string) error { if opts.EnableKCSAN { return fmt.Errorf("option EnableKCSAN is not supported on %v", OS) } + if opts.EnableDevlinkPCI { + return fmt.Errorf("option EnableDevlinkPCI is not supported on %v", OS) + } if opts.Sandbox == sandboxNamespace || (opts.Sandbox == sandboxSetuid && !(OS == openbsd || OS == freebsd || OS == netbsd)) || opts.Sandbox == sandboxAndroidUntrustedApp { @@ -154,6 +158,7 @@ func DefaultOpts(cfg *mgrconfig.Config) Options { EnableCgroups: true, EnableBinfmtMisc: true, EnableCloseFds: true, + EnableDevlinkPCI: true, UseTmpDir: true, HandleSegv: true, Repro: true, @@ -165,6 +170,12 @@ func DefaultOpts(cfg *mgrconfig.Config) Options { opts.EnableCgroups = false opts.EnableBinfmtMisc = false opts.EnableCloseFds = false + opts.EnableDevlinkPCI = false + } + if cfg.Sandbox == "" || cfg.Sandbox == "setuid" { + opts.EnableNetReset = false + } + if err := opts.Check(cfg.TargetOS); err != nil { } if cfg.Sandbox == "" || cfg.Sandbox == "setuid" { opts.EnableNetReset = false @@ -244,6 +255,7 @@ func defaultFeatures(value bool) Features { "cgroups": {"setup cgroups for testing", value}, "binfmt_misc": {"setup binfmt_misc for testing", value}, "close_fds": {"close fds after each program", value}, + "devlink_pci": {"setup devlink PCI device", value}, } } -- cgit mrf-deployment