From 1be4d04f4e8384ff0afaafbf629733581afe5c33 Mon Sep 17 00:00:00 2001 From: Wiktor Garbacz Date: Tue, 23 Mar 2021 03:50:39 -0700 Subject: [PATCH] Avoid tail-call optimization in "violate" testcase PiperOrigin-RevId: 364523883 Change-Id: I5e43534d7db37b4c16f18fc3326714664ab0ae00 --- sandboxed_api/examples/stringop/lib/stringop.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sandboxed_api/examples/stringop/lib/stringop.cc b/sandboxed_api/examples/stringop/lib/stringop.cc index f78772b..fd15abf 100644 --- a/sandboxed_api/examples/stringop/lib/stringop.cc +++ b/sandboxed_api/examples/stringop/lib/stringop.cc @@ -77,4 +77,9 @@ extern "C" const void* get_raw_c_string() { return "Ten chars."; } extern "C" void nop() {} -extern "C" void violate() { ptrace((__ptrace_request)990, 991, 992, 993); } +extern "C" void violate() { + ptrace((__ptrace_request)990, 991, 992, 993); + // Once more to avoid tail-call optimization, so that violate is in the + // stacktrace. + ptrace((__ptrace_request)990, 991, 992, 993); +}