google / syzkaller

syzkaller is an unsupervised coverage-guided kernel fuzzer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

executor: slow network device initialization

a-nogikh opened this issue · comments

When executor restarts are frequent, we're observing increased executor startup times.

Some observations:

  • We spend ~4 seconds here. This time is stable and does not depend on the number of procs.

write_file("/sys/bus/netdevsim/del_device", "%u", addr);

I wonder if it can be replaced with a DEVLINK_CMD_RELOAD command.

In general, I've found little to nothing documentation about netdevsim, which does not make things easier.

  • We spend from 1 to 10 seconds here. It's very quick when procs=1 and gets 1-2 seconds slower with every extra proc.

static void initialize_netdevices(void)

Most time is spent here:

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.
char addr[32];
sprintf(addr, DEV_IPV4, i + 10);
netlink_add_addr4(&nlmsg, sock, devices[i].name, addr);
if (!devices[i].noipv6) {
sprintf(addr, DEV_IPV6, i + 10);
netlink_add_addr6(&nlmsg, sock, devices[i].name, addr);
}
uint64 macaddr = DEV_MAC + ((i + 10ull) << 40);
netlink_device_change(&nlmsg, sock, devices[i].name, true, 0, &macaddr, devices[i].macsize, NULL);
}

Note To get these observations under -debug, we need to remove setting procs=1 in the debug mode:

if *flagDebug {
fuzzerV = 100
procs = 1
}