From 8f805d3329e985f0ea0851fa1522ab447765af27 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 9 Oct 2009 17:32:26 -0700 Subject: PR10750: Enforce a reasonable limit on # of varargs If we leave the number of args unbounded, then an excessively-sized printf could cause a kernel stack overflow. I've arbitrarily chosen 32 as our new maximum. * translate.cxx (c_unparser::visit_print_format): Throw if >32 args. * testsuite/transko/varargs.stp: Assert that 33 args aren't allowed. * testsuite/transok/varargs.stp: Assert that 32 args are ok. --- testsuite/transko/varargs.stp | 10 ++++++++++ testsuite/transok/varargs.stp | 9 +++++++++ 2 files changed, 19 insertions(+) create mode 100755 testsuite/transko/varargs.stp create mode 100755 testsuite/transok/varargs.stp (limited to 'testsuite') diff --git a/testsuite/transko/varargs.stp b/testsuite/transko/varargs.stp new file mode 100755 index 00000000..f38309ad --- /dev/null +++ b/testsuite/transko/varargs.stp @@ -0,0 +1,10 @@ +#! stap -p3 + +probe begin { + // PR10750 enforces at most 32 print args + println(1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, + 33) +} diff --git a/testsuite/transok/varargs.stp b/testsuite/transok/varargs.stp new file mode 100755 index 00000000..216166f6 --- /dev/null +++ b/testsuite/transok/varargs.stp @@ -0,0 +1,9 @@ +#! stap -p3 + +probe begin { + // PR10750 enforces at most 32 print args + println(1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32) +} -- cgit From 712d12ca4c74b824e7afbb273c0975eb0a30847c Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 22 Oct 2009 09:03:44 -0500 Subject: PR 10822 fixed by waiting for the procfs file. * testsuite/systemtap.base/onoffprobe.exp: Wait for up to 10 seconds for the procfs file to be created. --- testsuite/systemtap.base/onoffprobe.exp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'testsuite') diff --git a/testsuite/systemtap.base/onoffprobe.exp b/testsuite/systemtap.base/onoffprobe.exp index 1b39dab5..c6d83d5d 100644 --- a/testsuite/systemtap.base/onoffprobe.exp +++ b/testsuite/systemtap.base/onoffprobe.exp @@ -10,9 +10,27 @@ proc advance {} { global expect_out global ok global modname + set procfs_file "/proc/systemtap/$modname/switch" + pass "$test $expect_out(1,string)" + + # If this is the first time, wait until the procfs file exists + # (for up to 10 seconds). + if {$ok == 0} { + set i 0 + while {![file exists $procfs_file]} { + sleep 1 + incr i + if {$i >= 10} { break } + } + # If the procfs file still doesn't exist, fail. + if {![file exists $procfs_file]} { + fail "$test (missing procfs file)" + } + } + incr ok - exec echo $ok > /proc/systemtap/$modname/switch + if {[file exists $procfs_file]} { exec echo $ok > $procfs_file } exec echo dummy > /dev/null exp_continue } -- cgit