From eaff70b5581c8f618cea0f3848471419ed41690b Mon Sep 17 00:00:00 2001 From: Christian Blichmann Date: Thu, 19 Nov 2020 06:46:58 -0800 Subject: [PATCH] Use actual `ptrace()` arguments in example The semantics of the example remain unchanged. This change is in preparation for the new Clang based header generator, which will parse most files in C++ mode. `ptrace`'s first argument cannot me implicitly converted from `int` in C++. PiperOrigin-RevId: 343280691 Change-Id: Ibc5318b19a48f1dad441e7dcdc318dc5ea6837f6 --- sandboxed_api/examples/sum/lib/sum.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sandboxed_api/examples/sum/lib/sum.c b/sandboxed_api/examples/sum/lib/sum.c index 5444387..e352f66 100644 --- a/sandboxed_api/examples/sum/lib/sum.c +++ b/sandboxed_api/examples/sum/lib/sum.c @@ -64,7 +64,9 @@ extern void crash(void) { } extern void violate(void) { - ptrace(990, 991, 992, 993); + // Issue a PTRACE_CONT that will always fail, since we are not in stopped + // state. The actual call should be caught by the sandbox policy. + ptrace(PTRACE_CONT, 0, NULL, NULL); } extern int sumarr(int* input, size_t nelem) {