summary refs log tree commit diff
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2021-05-29 13:10:05 +0000
committeredef <edef@unfathomable.blue>2021-05-29 13:10:05 +0000
commit9040519a9f03faef5ac6abea2146f28e0036963c (patch)
tree538085b3decd751f3832de3d4de9a4051e001d84
parentd6993000ed2f37f0a683c67a75efb5255b2eaef2 (diff)
downloadunf-legacy-9040519a9f03faef5ac6abea2146f28e0036963c.tar.zst
ripple/driver.pl: fix bpftrace argument passing
bpftrace takes a single argument to -c, and then simply does a naive
split_string(cmd, ' ') on that. This unfortunately makes it impossible
to pass arguments containing spaces to subprocesses.

Change-Id: Ib18a19f858b5acd87e54e00927173ccd4fe6ee49
-rwxr-xr-xripple/driver.pl3
1 files changed, 2 insertions, 1 deletions
diff --git a/ripple/driver.pl b/ripple/driver.pl
index 07be06f..7a8d164 100755
--- a/ripple/driver.pl
+++ b/ripple/driver.pl
@@ -6,6 +6,7 @@ use strict;
 use POSIX qw(mkfifo);
 
 @ARGV or die "Usage: $0 PROGRAM [ARG]... 2> [LOG FILE]";
+die "bpftrace does not support spaces in argv" if grep {/ /} @ARGV;
 
 unlink(my $fifo = "tracepipe");
 mkfifo($fifo, 0600) or die;
@@ -20,7 +21,7 @@ if (!$pid) {
         # NOTE: this expects bpftrace to be SUID-root,
         # and relies on shells dropping euid
         'bpftrace', '-o', $fifo, '-e', $script, '-c',
-        @ARGV
+        join(' ', @ARGV)
     ) or die;
 }