From 274bfdcec9b3acca02438362cefac2b94d6b9856 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 27 Jun 2017 10:28:22 +0200 Subject: vm/adb: add an option to disable battery check Add a new VM option: // Ensure that a device battery level is at 20+% before fuzzing. // Sometimes we observe that a device can't charge during heavy fuzzing // and eventually powers down (which then requires manual intervention). // This option is enabled by default. Turn it off if your devices // don't have battery service, or it causes problems otherwise. Battery_Check bool Fixes #258 --- vm/adb/adb.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'vm') diff --git a/vm/adb/adb.go b/vm/adb/adb.go index 0daad7fd6..fb9cd93bd 100644 --- a/vm/adb/adb.go +++ b/vm/adb/adb.go @@ -30,6 +30,13 @@ func init() { type Config struct { Adb string // adb binary name ("adb" by default) Devices []string // list of adb device IDs to use + + // Ensure that a device battery level is at 20+% before fuzzing. + // Sometimes we observe that a device can't charge during heavy fuzzing + // and eventually powers down (which then requires manual intervention). + // This option is enabled by default. Turn it off if your devices + // don't have battery service, or it causes problems otherwise. + Battery_Check bool } type Pool struct { @@ -47,7 +54,8 @@ type instance struct { func ctor(env *vmimpl.Env) (vmimpl.Pool, error) { cfg := &Config{ - Adb: "adb", + Adb: "adb", + Battery_Check: true, } if err := config.LoadData(env.Config, cfg); err != nil { return nil, fmt.Errorf("failed to parse adb vm config: %v", err) @@ -95,8 +103,10 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) { return nil, err } inst.console = findConsole(inst.adbBin, inst.device) - if err := inst.checkBatteryLevel(); err != nil { - return nil, err + if pool.cfg.Battery_Check { + if err := inst.checkBatteryLevel(); err != nil { + return nil, err + } } // Remove temp files from previous runs. if _, err := inst.adb("shell", "rm -Rf /data/syzkaller*"); err != nil { -- cgit mrf-deployment