aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--executor/common_linux.h293
-rw-r--r--executor/executor.cc2
-rw-r--r--pkg/csource/common.go1
-rw-r--r--pkg/csource/options.go4
-rw-r--r--pkg/csource/options_test.go4
-rw-r--r--pkg/host/features.go2
-rw-r--r--pkg/host/features_linux.go8
-rw-r--r--pkg/ipc/ipc.go1
-rw-r--r--pkg/repro/repro.go11
-rw-r--r--pkg/runtest/run.go3
-rw-r--r--sys/linux/socket.txt2
-rw-r--r--syz-fuzzer/fuzzer.go3
-rw-r--r--tools/syz-execprog/execprog.go3
-rw-r--r--tools/syz-prog2c/prog2c.go1
-rw-r--r--tools/syz-reprolist/reprolist.go4
-rw-r--r--tools/syz-stress/stress.go3
16 files changed, 268 insertions, 77 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h
index 4c525760a..d3f4b6ea1 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -109,7 +109,7 @@ static bool write_file(const char* file, const char* what, ...)
#endif
#if SYZ_EXECUTOR || SYZ_NET_DEVICES || SYZ_NET_INJECTION || SYZ_DEVLINK_PCI || SYZ_WIFI || SYZ_802154 || \
- __NR_syz_genetlink_get_family_id || __NR_syz_80211_inject_frame || __NR_syz_80211_join_ibss
+ __NR_syz_genetlink_get_family_id || __NR_syz_80211_inject_frame || __NR_syz_80211_join_ibss || SYZ_NIC_VF
#include <arpa/inet.h>
#include <net/if.h>
#include <netinet/in.h>
@@ -171,6 +171,87 @@ static void netlink_done(struct nlmsg* nlmsg)
struct nlattr* attr = nlmsg->nested[--nlmsg->nesting];
attr->nla_len = nlmsg->pos - (char*)attr;
}
+
+#if SYZ_EXECUTOR || SYZ_NIC_VF
+#include <ifaddrs.h>
+#include <linux/ethtool.h>
+#include <linux/sockios.h>
+#include <sys/ioctl.h>
+
+struct vf_intf {
+ char pass_thru_intf[IFNAMSIZ];
+ int ppid; // used by Child
+};
+
+static struct vf_intf vf_intf;
+
+static void find_vf_interface(void)
+{
+#if SYZ_EXECUTOR
+ if (!flag_nic_vf)
+ return;
+#endif
+ struct ifaddrs* addresses = NULL;
+ int pid = getpid();
+ int ret = 0;
+
+ memset(&vf_intf, 0, sizeof(struct vf_intf));
+
+ debug("Checking for VF pass-thru interface.\n");
+ if (getifaddrs(&addresses) == -1) {
+ debug("%s: getifaddrs() failed.\n", __func__);
+ return;
+ }
+
+ int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
+
+ if (fd < 0) {
+ debug("%s: socket() failed.\n", __func__);
+ return;
+ }
+ struct ifreq ifr;
+ struct ethtool_drvinfo drvinfo;
+ struct ifaddrs* address = addresses;
+
+ while (address) {
+ debug("ifa_name: %s\n", address->ifa_name);
+ memset(&ifr, 0, sizeof(struct ifreq));
+ strcpy(ifr.ifr_name, address->ifa_name);
+ memset(&drvinfo, 0, sizeof(struct ethtool_drvinfo));
+ drvinfo.cmd = ETHTOOL_GDRVINFO;
+ ifr.ifr_data = (caddr_t)&drvinfo;
+ ret = ioctl(fd, SIOCETHTOOL, &ifr);
+
+ if (ret < 0) {
+ debug("%s: ioctl() failed.\n", __func__);
+ } else if (strlen(drvinfo.bus_info)) {
+ debug("bus_info: %s, strlen(drvinfo.bus_info)=%zu\n",
+ drvinfo.bus_info, strlen(drvinfo.bus_info));
+ if (strcmp(drvinfo.bus_info, "0000:00:11.0") == 0) {
+ if (strlen(address->ifa_name) < IFNAMSIZ) {
+ strncpy(vf_intf.pass_thru_intf,
+ address->ifa_name, IFNAMSIZ);
+ vf_intf.ppid = pid;
+ } else {
+ debug("%s: %d strlen(%s) >= IFNAMSIZ.\n",
+ __func__, pid, address->ifa_name);
+ }
+ break;
+ }
+ }
+ address = address->ifa_next;
+ }
+ freeifaddrs(addresses);
+ if (!vf_intf.ppid) {
+ memset(&vf_intf, 0, sizeof(struct vf_intf));
+ debug("%s: %d could not find VF pass-thru interface.\n", __func__, pid);
+ return;
+ }
+ debug("%s: %d found VF pass-thru interface %s\n",
+ __func__, pid, vf_intf.pass_thru_intf);
+}
+#endif // SYZ_NIC_VF
+
#endif
static int netlink_send_ext(struct nlmsg* nlmsg, int sock,
@@ -1345,6 +1426,52 @@ error:
close(sock);
}
+#if SYZ_EXECUTOR || SYZ_NIC_VF
+static int runcmdline(char* cmdline)
+{
+ debug("%s\n", cmdline);
+ int ret = system(cmdline);
+ if (ret) {
+ debug("FAIL: %s\n", cmdline);
+ }
+ return ret;
+}
+
+static void netlink_nicvf_setup(void)
+{
+ char cmdline[256];
+
+#if SYZ_EXECUTOR
+ if (!flag_nic_vf)
+ return;
+#endif
+ if (!vf_intf.ppid)
+ return;
+
+ debug("ppid = %d, vf_intf.pass_thru_intf: %s\n",
+ vf_intf.ppid, vf_intf.pass_thru_intf);
+
+ sprintf(cmdline, "nsenter -t 1 -n ip link set %s netns %d",
+ vf_intf.pass_thru_intf, getpid());
+ if (runcmdline(cmdline))
+ return;
+
+ sprintf(cmdline, "ip a s %s", vf_intf.pass_thru_intf);
+ if (runcmdline(cmdline))
+ return;
+
+ sprintf(cmdline, "ip link set %s down", vf_intf.pass_thru_intf);
+ if (runcmdline(cmdline))
+ return;
+
+ sprintf(cmdline, "ip link set %s name nicvf0", vf_intf.pass_thru_intf);
+ if (runcmdline(cmdline))
+ return;
+
+ debug("nicvf0 VF pass-through setup complete.\n");
+}
+#endif // SYZ_NIC_VF
+
// We test in a separate namespace, which does not have any network devices initially (even lo).
// Create/up as many as we can.
static void initialize_netdevices(void)
@@ -1374,23 +1501,26 @@ static void initialize_netdevices(void)
const char* type;
const char* dev;
} devtypes[] = {
- // Note: ip6erspan device can't be added if ip6gretap exists in the same namespace.
- {"ip6gretap", "ip6gretap0"},
- {"bridge", "bridge0"},
- {"vcan", "vcan0"},
- {"bond", "bond0"},
- {"team", "team0"},
- {"dummy", "dummy0"},
- {"nlmon", "nlmon0"},
- {"caif", "caif0"},
- {"batadv", "batadv0"},
- // Note: this adds vxcan0/vxcan1 pair, similar to veth (creating vxcan0 would fail).
- {"vxcan", "vxcan1"},
- // This adds connected veth0 and veth1 devices.
- {"veth", 0},
- {"wireguard", "wg0"},
- {"wireguard", "wg1"},
- {"wireguard", "wg2"},
+ // Note: ip6erspan device can't be added if ip6gretap exists in the same namespace.
+ {"ip6gretap", "ip6gretap0"},
+ {"bridge", "bridge0"},
+ {"vcan", "vcan0"},
+ {"bond", "bond0"},
+ {"team", "team0"},
+ {"dummy", "dummy0"},
+#if SYZ_EXECUTOR || SYZ_NIC_VF
+ {"nicvf", "nicvf0"},
+#endif
+ {"nlmon", "nlmon0"},
+ {"caif", "caif0"},
+ {"batadv", "batadv0"},
+ // Note: this adds vxcan0/vxcan1 pair, similar to veth (creating vxcan0 would fail).
+ {"vxcan", "vxcan1"},
+ // This adds connected veth0 and veth1 devices.
+ {"veth", 0},
+ {"wireguard", "wg0"},
+ {"wireguard", "wg1"},
+ {"wireguard", "wg2"},
};
const char* devmasters[] = {"bridge", "bond", "team", "batadv"};
// If you extend this array, also update netdev_addr_id in vnet.txt
@@ -1400,64 +1530,67 @@ static void initialize_netdevices(void)
int macsize;
bool noipv6;
} devices[] = {
- {"lo", ETH_ALEN},
- {"sit0", 0},
- {"bridge0", ETH_ALEN},
- {"vcan0", 0, true},
- {"tunl0", 0},
- {"gre0", 0},
- {"gretap0", ETH_ALEN},
- {"ip_vti0", 0},
- {"ip6_vti0", 0},
- {"ip6tnl0", 0},
- {"ip6gre0", 0},
- {"ip6gretap0", ETH_ALEN},
- {"erspan0", ETH_ALEN},
- {"bond0", ETH_ALEN},
- {"veth0", ETH_ALEN},
- {"veth1", ETH_ALEN},
- {"team0", ETH_ALEN},
- {"veth0_to_bridge", ETH_ALEN},
- {"veth1_to_bridge", ETH_ALEN},
- {"veth0_to_bond", ETH_ALEN},
- {"veth1_to_bond", ETH_ALEN},
- {"veth0_to_team", ETH_ALEN},
- {"veth1_to_team", ETH_ALEN},
- {"veth0_to_hsr", ETH_ALEN},
- {"veth1_to_hsr", ETH_ALEN},
- {"hsr0", 0},
- {"dummy0", ETH_ALEN},
- {"nlmon0", 0},
- {"vxcan0", 0, true},
- {"vxcan1", 0, true},
- {"caif0", ETH_ALEN}, // TODO: up'ing caif fails with ENODEV
- {"batadv0", ETH_ALEN},
- {netdevsim, ETH_ALEN},
- {"xfrm0", ETH_ALEN},
- {"veth0_virt_wifi", ETH_ALEN},
- {"veth1_virt_wifi", ETH_ALEN},
- {"virt_wifi0", ETH_ALEN},
- {"veth0_vlan", ETH_ALEN},
- {"veth1_vlan", ETH_ALEN},
- {"vlan0", ETH_ALEN},
- {"vlan1", ETH_ALEN},
- {"macvlan0", ETH_ALEN},
- {"macvlan1", ETH_ALEN},
- {"ipvlan0", ETH_ALEN},
- {"ipvlan1", ETH_ALEN},
- {"veth0_macvtap", ETH_ALEN},
- {"veth1_macvtap", ETH_ALEN},
- {"macvtap0", ETH_ALEN},
- {"macsec0", ETH_ALEN},
- {"veth0_to_batadv", ETH_ALEN},
- {"veth1_to_batadv", ETH_ALEN},
- {"batadv_slave_0", ETH_ALEN},
- {"batadv_slave_1", ETH_ALEN},
- {"geneve0", ETH_ALEN},
- {"geneve1", ETH_ALEN},
- {"wg0", 0},
- {"wg1", 0},
- {"wg2", 0},
+ {"lo", ETH_ALEN},
+ {"sit0", 0},
+ {"bridge0", ETH_ALEN},
+ {"vcan0", 0, true},
+ {"tunl0", 0},
+ {"gre0", 0},
+ {"gretap0", ETH_ALEN},
+ {"ip_vti0", 0},
+ {"ip6_vti0", 0},
+ {"ip6tnl0", 0},
+ {"ip6gre0", 0},
+ {"ip6gretap0", ETH_ALEN},
+ {"erspan0", ETH_ALEN},
+ {"bond0", ETH_ALEN},
+ {"veth0", ETH_ALEN},
+ {"veth1", ETH_ALEN},
+ {"team0", ETH_ALEN},
+ {"veth0_to_bridge", ETH_ALEN},
+ {"veth1_to_bridge", ETH_ALEN},
+ {"veth0_to_bond", ETH_ALEN},
+ {"veth1_to_bond", ETH_ALEN},
+ {"veth0_to_team", ETH_ALEN},
+ {"veth1_to_team", ETH_ALEN},
+ {"veth0_to_hsr", ETH_ALEN},
+ {"veth1_to_hsr", ETH_ALEN},
+ {"hsr0", 0},
+ {"dummy0", ETH_ALEN},
+#if SYZ_EXECUTOR || SYZ_NIC_VF
+ {"nicvf0", 0, true},
+#endif
+ {"nlmon0", 0},
+ {"vxcan0", 0, true},
+ {"vxcan1", 0, true},
+ {"caif0", ETH_ALEN}, // TODO: up'ing caif fails with ENODEV
+ {"batadv0", ETH_ALEN},
+ {netdevsim, ETH_ALEN},
+ {"xfrm0", ETH_ALEN},
+ {"veth0_virt_wifi", ETH_ALEN},
+ {"veth1_virt_wifi", ETH_ALEN},
+ {"virt_wifi0", ETH_ALEN},
+ {"veth0_vlan", ETH_ALEN},
+ {"veth1_vlan", ETH_ALEN},
+ {"vlan0", ETH_ALEN},
+ {"vlan1", ETH_ALEN},
+ {"macvlan0", ETH_ALEN},
+ {"macvlan1", ETH_ALEN},
+ {"ipvlan0", ETH_ALEN},
+ {"ipvlan1", ETH_ALEN},
+ {"veth0_macvtap", ETH_ALEN},
+ {"veth1_macvtap", ETH_ALEN},
+ {"macvtap0", ETH_ALEN},
+ {"macsec0", ETH_ALEN},
+ {"veth0_to_batadv", ETH_ALEN},
+ {"veth1_to_batadv", ETH_ALEN},
+ {"batadv_slave_0", ETH_ALEN},
+ {"batadv_slave_1", ETH_ALEN},
+ {"geneve0", ETH_ALEN},
+ {"geneve1", ETH_ALEN},
+ {"wg0", 0},
+ {"wg1", 0},
+ {"wg2", 0},
};
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sock == -1)
@@ -1526,6 +1659,10 @@ static void initialize_netdevices(void)
netlink_wireguard_setup();
+#if SYZ_EXECUTOR || SYZ_NIC_VF
+ netlink_nicvf_setup();
+#endif
+
for (i = 0; i < sizeof(devices) / (sizeof(devices[0])); i++) {
// Assign some unique address to devices. Some devices won't up without this.
// Shift addresses by 10 because 0 subnet address can mean special things.
@@ -1582,6 +1719,10 @@ static void initialize_netdevices_init(void)
netlink_device_change(&nlmsg, sock, dev, !devtypes[i].noup, 0, &macaddr, macsize, NULL);
}
close(sock);
+
+#if SYZ_EXECUTOR || SYZ_NIC_VF
+ find_vf_interface();
+#endif
}
#endif
diff --git a/executor/executor.cc b/executor/executor.cc
index 3c76738d2..efd072a75 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -173,6 +173,7 @@ static bool flag_net_reset;
static bool flag_cgroups;
static bool flag_close_fds;
static bool flag_devlink_pci;
+static bool flag_nic_vf;
static bool flag_vhci_injection;
static bool flag_wifi;
static bool flag_delay_kcov_mmap;
@@ -621,6 +622,7 @@ void parse_env_flags(uint64 flags)
flag_vhci_injection = flags & (1 << 12);
flag_wifi = flags & (1 << 13);
flag_delay_kcov_mmap = flags & (1 << 14);
+ flag_nic_vf = flags & (1 << 15);
}
#if SYZ_EXECUTOR_USES_FORK_SERVER
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,
diff --git a/pkg/host/features.go b/pkg/host/features.go
index d2105b203..343e76783 100644
--- a/pkg/host/features.go
+++ b/pkg/host/features.go
@@ -29,6 +29,7 @@ const (
FeatureNetDevices
FeatureKCSAN
FeatureDevlinkPCI
+ FeatureNicVF
FeatureUSBEmulation
FeatureVhciInjection
FeatureWifiEmulation
@@ -71,6 +72,7 @@ func Check(target *prog.Target) (*Features, error) {
FeatureNetDevices: {Name: "net device setup", Reason: unsupported},
FeatureKCSAN: {Name: "concurrency sanitizer", Reason: unsupported},
FeatureDevlinkPCI: {Name: "devlink PCI setup", Reason: unsupported},
+ FeatureNicVF: {Name: "NIC VF setup", Reason: unsupported},
FeatureUSBEmulation: {Name: "USB emulation", Reason: unsupported},
FeatureVhciInjection: {Name: "hci packet injection", Reason: unsupported},
FeatureWifiEmulation: {Name: "wifi device emulation", Reason: unsupported},
diff --git a/pkg/host/features_linux.go b/pkg/host/features_linux.go
index de04e7a4d..acc7e0829 100644
--- a/pkg/host/features_linux.go
+++ b/pkg/host/features_linux.go
@@ -32,6 +32,7 @@ func init() {
checkFeature[FeatureNetDevices] = unconditionallyEnabled
checkFeature[FeatureKCSAN] = checkKCSAN
checkFeature[FeatureDevlinkPCI] = checkDevlinkPCI
+ checkFeature[FeatureNicVF] = checkNicVF
checkFeature[FeatureUSBEmulation] = checkUSBEmulation
checkFeature[FeatureVhciInjection] = checkVhciInjection
checkFeature[FeatureWifiEmulation] = checkWifiEmulation
@@ -260,6 +261,13 @@ func checkDevlinkPCI() string {
return ""
}
+func checkNicVF() string {
+ if err := osutil.IsAccessible("/sys/bus/pci/devices/0000:00:11.0/"); err != nil {
+ return "PCI device 0000:00:11.0 is not available"
+ }
+ return ""
+}
+
func checkWifiEmulation() string {
if err := osutil.IsAccessible("/sys/class/mac80211_hwsim/"); err != nil {
return err.Error()
diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go
index 5537ce0f8..33e87f706 100644
--- a/pkg/ipc/ipc.go
+++ b/pkg/ipc/ipc.go
@@ -43,6 +43,7 @@ const (
FlagEnableVhciInjection // setup and use /dev/vhci for hci packet injection
FlagEnableWifi // setup and use mac80211_hwsim for wifi emulation
FlagDelayKcovMmap // manage kcov memory in an optimized way
+ FlagEnableNicVF // setup NIC VF device
)
// Per-exec flags for ExecOpts.Flags.
diff --git a/pkg/repro/repro.go b/pkg/repro/repro.go
index fe20c7330..d614cdfb6 100644
--- a/pkg/repro/repro.go
+++ b/pkg/repro/repro.go
@@ -192,6 +192,9 @@ func createStartOptions(cfg *mgrconfig.Config, features *host.Features, crashTyp
if !features[host.FeatureDevlinkPCI].Enabled {
opts.DevlinkPCI = false
}
+ if !features[host.FeatureNicVF].Enabled {
+ opts.NicVF = false
+ }
if !features[host.FeatureUSBEmulation].Enabled {
opts.USB = false
}
@@ -759,6 +762,7 @@ var cSimplifies = append(progSimplifies, []Simplify{
opts.BinfmtMisc = false
opts.CloseFDs = false
opts.DevlinkPCI = false
+ opts.NicVF = false
opts.USB = false
opts.VhciInjection = false
opts.Wifi = false
@@ -816,6 +820,13 @@ var cSimplifies = append(progSimplifies, []Simplify{
return true
},
func(opts *csource.Options) bool {
+ if !opts.NicVF {
+ return false
+ }
+ opts.NicVF = false
+ return true
+ },
+ func(opts *csource.Options) bool {
if !opts.USB {
return false
}
diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go
index 985c5979c..e1c3ae1f8 100644
--- a/pkg/runtest/run.go
+++ b/pkg/runtest/run.go
@@ -428,6 +428,9 @@ func (ctx *Context) createSyzTest(p *prog.Prog, sandbox string, threaded, cov bo
if ctx.Features[host.FeatureDevlinkPCI].Enabled {
cfg.Flags |= ipc.FlagEnableDevlinkPCI
}
+ if ctx.Features[host.FeatureNicVF].Enabled {
+ cfg.Flags |= ipc.FlagEnableNicVF
+ }
if ctx.Features[host.FeatureVhciInjection].Enabled {
cfg.Flags |= ipc.FlagEnableVhciInjection
}
diff --git a/sys/linux/socket.txt b/sys/linux/socket.txt
index 4bf50c270..22c1f7292 100644
--- a/sys/linux/socket.txt
+++ b/sys/linux/socket.txt
@@ -383,7 +383,7 @@ rtentry {
# Note: lapb0, bpq0 and hwsim0 are only present in init namespace.
# Note: for roseN and nrN we should use proc type, but for simplicity we currently use N=0.
# Note: netdevsim0 and netpci0 are renamed in initialize_devlink_ports()
-devnames = "", "lo", "tunl0", "gre0", "gretap0", "ip_vti0", "ip6_vti0", "sit0", "ip6tnl0", "ip6gre0", "ip6gretap0", "bond0", "dummy0", "nr0", "rose0", "erspan0", "vlan0", "bridge0", "vcan0", "team0", "syz_tun", "veth0", "veth1", "veth0_to_bridge", "veth1_to_bridge", "veth0_to_bond", "veth1_to_bond", "veth0_to_team", "veth1_to_team", "bridge_slave_0", "bridge_slave_1", "bond_slave_0", "bond_slave_1", "team_slave_0", "team_slave_1", "syzkaller0", "syzkaller1", "veth0_to_hsr", "veth1_to_hsr", "hsr0", "ip6erspan0", "vxcan1", "caif0", "batadv0", "veth0_to_batadv", "veth1_to_batadv", "batadv_slave_0", "batadv_slave_1", "netdevsim0", "netpci0", "xfrm0", "veth0_virt_wifi", "veth1_virt_wifi", "virt_wifi0", "veth0_vlan", "veth1_vlan", "vlan0", "vlan1", "macvlan0", "macvlan1", "ipvlan0", "ipvlan1", "veth0_macvtap", "veth1_macvtap", "macvtap0", "macsec0", "geneve0", "geneve1", "wg0", "wg1", "wg2", "wlan0", "wlan1", "dvmrp0", "dvmrp1", "pimreg", "pimreg0", "pimreg1", "pim6reg", "pim6reg0", "pim6reg1"
+devnames = "", "lo", "tunl0", "gre0", "gretap0", "ip_vti0", "ip6_vti0", "sit0", "ip6tnl0", "ip6gre0", "ip6gretap0", "bond0", "dummy0", "nr0", "rose0", "erspan0", "vlan0", "bridge0", "vcan0", "team0", "syz_tun", "veth0", "veth1", "veth0_to_bridge", "veth1_to_bridge", "veth0_to_bond", "veth1_to_bond", "veth0_to_team", "veth1_to_team", "bridge_slave_0", "bridge_slave_1", "bond_slave_0", "bond_slave_1", "team_slave_0", "team_slave_1", "syzkaller0", "syzkaller1", "veth0_to_hsr", "veth1_to_hsr", "hsr0", "ip6erspan0", "vxcan1", "caif0", "batadv0", "veth0_to_batadv", "veth1_to_batadv", "batadv_slave_0", "batadv_slave_1", "netdevsim0", "netpci0", "nicvf0", "xfrm0", "veth0_virt_wifi", "veth1_virt_wifi", "virt_wifi0", "veth0_vlan", "veth1_vlan", "vlan0", "vlan1", "macvlan0", "macvlan1", "ipvlan0", "ipvlan1", "veth0_macvtap", "veth1_macvtap", "macvtap0", "macsec0", "geneve0", "geneve1", "wg0", "wg1", "wg2", "wlan0", "wlan1", "dvmrp0", "dvmrp1", "pimreg", "pimreg0", "pimreg1", "pim6reg", "pim6reg0", "pim6reg1"
type devname string[devnames, IFNAMSIZ]
diff --git a/syz-fuzzer/fuzzer.go b/syz-fuzzer/fuzzer.go
index 3b9a3325f..d281c38c6 100644
--- a/syz-fuzzer/fuzzer.go
+++ b/syz-fuzzer/fuzzer.go
@@ -128,6 +128,9 @@ func createIPCConfig(features *host.Features, config *ipc.Config) {
if features[host.FeatureDevlinkPCI].Enabled {
config.Flags |= ipc.FlagEnableDevlinkPCI
}
+ if features[host.FeatureNicVF].Enabled {
+ config.Flags |= ipc.FlagEnableNicVF
+ }
if features[host.FeatureVhciInjection].Enabled {
config.Flags |= ipc.FlagEnableVhciInjection
}
diff --git a/tools/syz-execprog/execprog.go b/tools/syz-execprog/execprog.go
index 8b5bd1103..b1d580d96 100644
--- a/tools/syz-execprog/execprog.go
+++ b/tools/syz-execprog/execprog.go
@@ -355,6 +355,9 @@ func createConfig(target *prog.Target, features *host.Features, featuresFlags cs
if featuresFlags["devlink_pci"].Enabled && features[host.FeatureDevlinkPCI].Enabled {
config.Flags |= ipc.FlagEnableDevlinkPCI
}
+ if featuresFlags["nic_vf"].Enabled && features[host.FeatureNicVF].Enabled {
+ config.Flags |= ipc.FlagEnableNicVF
+ }
if featuresFlags["vhci"].Enabled && features[host.FeatureVhciInjection].Enabled {
config.Flags |= ipc.FlagEnableVhciInjection
}
diff --git a/tools/syz-prog2c/prog2c.go b/tools/syz-prog2c/prog2c.go
index e7b1ae9b1..1fd5a6218 100644
--- a/tools/syz-prog2c/prog2c.go
+++ b/tools/syz-prog2c/prog2c.go
@@ -87,6 +87,7 @@ func main() {
CloseFDs: features["close_fds"].Enabled,
KCSAN: features["kcsan"].Enabled,
DevlinkPCI: features["devlink_pci"].Enabled,
+ NicVF: features["nic_vf"].Enabled,
USB: features["usb"].Enabled,
VhciInjection: features["vhci"].Enabled,
Wifi: features["wifi"].Enabled,
diff --git a/tools/syz-reprolist/reprolist.go b/tools/syz-reprolist/reprolist.go
index 30cde4f7c..449c1b50b 100644
--- a/tools/syz-reprolist/reprolist.go
+++ b/tools/syz-reprolist/reprolist.go
@@ -246,6 +246,10 @@ func createProg2CArgs(bug *dashapi.BugReport, opts csource.Options, file string)
enable = append(enable, "devlink_pci")
flags = append(flags, "-devlinkpci")
}
+ if opts.NicVF {
+ enable = append(enable, "nic_vf")
+ flags = append(flags, "-nic_vf")
+ }
if opts.VhciInjection {
enable = append(enable, "vhci")
flags = append(flags, "-vhci")
diff --git a/tools/syz-stress/stress.go b/tools/syz-stress/stress.go
index 0b12fc65b..15847df16 100644
--- a/tools/syz-stress/stress.go
+++ b/tools/syz-stress/stress.go
@@ -168,6 +168,9 @@ func createIPCConfig(target *prog.Target, features *host.Features, featuresFlags
if featuresFlags["devlink_pci"].Enabled && features[host.FeatureDevlinkPCI].Enabled {
config.Flags |= ipc.FlagEnableDevlinkPCI
}
+ if featuresFlags["nic_vf"].Enabled && features[host.FeatureNicVF].Enabled {
+ config.Flags |= ipc.FlagEnableNicVF
+ }
if featuresFlags["vhci"].Enabled && features[host.FeatureVhciInjection].Enabled {
config.Flags |= ipc.FlagEnableVhciInjection
}