diff options
| author | George Kennedy <george.kennedy@oracle.com> | 2022-09-13 15:53:09 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2022-09-21 11:46:22 +0200 |
| commit | 84a66e8e4f8324de38eb230b5e2539570b4d05a5 (patch) | |
| tree | 454fe315bd0db53913128d99516201ac606addf1 /pkg/csource | |
| parent | 799171eb67633beabfe4f86022c58de3a796f1b4 (diff) | |
executor: add NIC PCI pass-through VF support
Add support for moving a NIC PCI pass-through VF into Syzkaller's network
namespace so that it will tested. As DEVLINK support is triggered by
setting the pass-through device to "addr=0x10", NIC PCI pass-through VF
support will be triggered by setting the device to "addr=0x11".
If a NIC PCI pass-through VF is detected in do_sandbox, setup a staging
namespace before the fork() and transfer the NIC VF interface to it.
After the fork() and in the child transfer the NIC VF interface to
Syzkaller's network namespace and rename the interface to netpci0 so
that it will be tested.
Signed-off-by: George Kennedy <george.kennedy@oracle.com>
Diffstat (limited to 'pkg/csource')
| -rw-r--r-- | pkg/csource/common.go | 1 | ||||
| -rw-r--r-- | pkg/csource/options.go | 4 | ||||
| -rw-r--r-- | pkg/csource/options_test.go | 4 |
3 files changed, 9 insertions, 0 deletions
diff --git a/pkg/csource/common.go b/pkg/csource/common.go index 4b9b37455..6f3920126 100644 --- a/pkg/csource/common.go +++ b/pkg/csource/common.go @@ -117,6 +117,7 @@ func commonDefines(p *prog.Prog, opts Options) map[string]bool { "SYZ_CLOSE_FDS": opts.CloseFDs, "SYZ_KCSAN": opts.KCSAN, "SYZ_DEVLINK_PCI": opts.DevlinkPCI, + "SYZ_NIC_VF": opts.NicVF, "SYZ_USB": opts.USB, "SYZ_VHCI_INJECTION": opts.VhciInjection, "SYZ_USE_TMP_DIR": opts.UseTmpDir, diff --git a/pkg/csource/options.go b/pkg/csource/options.go index b150e79a0..45cedb6a9 100644 --- a/pkg/csource/options.go +++ b/pkg/csource/options.go @@ -37,6 +37,7 @@ type Options struct { CloseFDs bool `json:"close_fds"` KCSAN bool `json:"kcsan,omitempty"` DevlinkPCI bool `json:"devlinkpci,omitempty"` + NicVF bool `json:"nicvf,omitempty"` USB bool `json:"usb,omitempty"` VhciInjection bool `json:"vhci,omitempty"` Wifi bool `json:"wifi,omitempty"` @@ -141,6 +142,7 @@ func (opts Options) checkLinuxOnly(OS string) error { "CloseFDs": &opts.CloseFDs, "KCSAN": &opts.KCSAN, "DevlinkPCI": &opts.DevlinkPCI, + "NicVF": &opts.NicVF, "USB": &opts.USB, "VhciInjection": &opts.VhciInjection, "Wifi": &opts.Wifi, @@ -175,6 +177,7 @@ func DefaultOpts(cfg *mgrconfig.Config) Options { opts.BinfmtMisc = true opts.CloseFDs = true opts.DevlinkPCI = true + opts.NicVF = true opts.USB = true opts.VhciInjection = true opts.Wifi = true @@ -307,6 +310,7 @@ func defaultFeatures(value bool) Features { "binfmt_misc": {"setup binfmt_misc for testing", value}, "close_fds": {"close fds after each program", value}, "devlink_pci": {"setup devlink PCI device", value}, + "nic_vf": {"setup NIC VF device", value}, "usb": {"setup and use /dev/raw-gadget for USB emulation", value}, "vhci": {"setup and use /dev/vhci for hci packet injection", value}, "wifi": {"setup and use mac80211_hwsim for wifi emulation", value}, diff --git a/pkg/csource/options_test.go b/pkg/csource/options_test.go index 41d7cdbab..5edc56d02 100644 --- a/pkg/csource/options_test.go +++ b/pkg/csource/options_test.go @@ -308,6 +308,7 @@ func TestParseFeaturesFlags(t *testing.T) { "binfmt_misc": true, "close_fds": true, "devlink_pci": true, + "nic_vf": true, "usb": true, "vhci": true, "wifi": true, @@ -323,6 +324,7 @@ func TestParseFeaturesFlags(t *testing.T) { "binfmt_misc": true, "close_fds": true, "devlink_pci": true, + "nic_vf": true, "usb": true, "vhci": true, "wifi": true, @@ -339,6 +341,7 @@ func TestParseFeaturesFlags(t *testing.T) { "binfmt_misc": true, "close_fds": true, "devlink_pci": true, + "nic_vf": true, "usb": true, "vhci": true, "wifi": true, @@ -355,6 +358,7 @@ func TestParseFeaturesFlags(t *testing.T) { "binfmt_misc": true, "close_fds": true, "devlink_pci": true, + "nic_vf": true, "usb": true, "vhci": true, "wifi": true, |
