aboutsummaryrefslogtreecommitdiffstats
path: root/vm/starnix
diff options
context:
space:
mode:
authorLaura Peskin <pesk@google.com>2024-01-08 16:42:35 -0800
committerAleksandr Nogikh <nogikh@google.com>2024-02-03 08:35:48 +0000
commitca50713d9930718a2f6998f143f5af443e397360 (patch)
tree760041541a8554448e2d8ebeb63620c0c8caf5dd /vm/starnix
parent624427e2e2bf16b96a2ee05cf6edfa3fd577fb96 (diff)
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.
Diffstat (limited to 'vm/starnix')
-rw-r--r--vm/starnix/starnix.go14
1 files changed, 14 insertions, 0 deletions
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(