From ca50713d9930718a2f6998f143f5af443e397360 Mon Sep 17 00:00:00 2001 From: Laura Peskin Date: Mon, 8 Jan 2024 16:42:35 -0800 Subject: vm/starnix: run adbd as root This is the simplest way to push binaries and scripts to /data on target, now that permissions are implemented. --- vm/starnix/starnix.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'vm') diff --git a/vm/starnix/starnix.go b/vm/starnix/starnix.go index f5da7faf6..321dad489 100644 --- a/vm/starnix/starnix.go +++ b/vm/starnix/starnix.go @@ -142,6 +142,10 @@ func (inst *instance) boot() error { return fmt.Errorf("could not start and connect to the adb server: %w", err) } + if err := inst.restartAdbAsRoot(); err != nil { + return fmt.Errorf("could not restart adb with root access: %w", err) + } + if err := inst.createAdbScript(); err != nil { return fmt.Errorf("could not create adb script: %w", err) } @@ -243,6 +247,16 @@ func (inst *instance) connectToAdb(timeout time.Duration) error { } } +func (inst *instance) restartAdbAsRoot() error { + err := inst.runCommand( + "adb", + "-s", + fmt.Sprintf("127.0.0.1:%d", inst.port), + "root", + ) + return err +} + // Script for telling syz-fuzzer how to connect to syz-executor. func (inst *instance) createAdbScript() error { adbScript := fmt.Sprintf( -- cgit mrf-deployment