From 4cc40e829870dd6a1d9714706d38f5fd4b2ec982 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 1 Apr 2009 14:49:12 -0700 Subject: PR10016: Purge stap of all pgrp and system() usage We hereby no longer try to manipulate process groups in any way. We don't set a private process group, and we never kill() our entire group either. Instead of using system(), we now have a stap_system() which saves the child PID, so when we get a terminating signal we can pass it along to the child. Signals sent through the TTY have always worked, since the TTY sends it to the entire pgrp. However, if we're running as part of a wrapper script or GUI, which may not have a separate process group for stap, we still would like to allow "kill -TERM $STAPPID" to terminate stap nicely. There's still a short window of failure in the time that staprun is active, because we can't kill a setuid process from a user process. Once staprun drops privileges and execs to stapio though, everything should work fine. --- buildrun.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 97357692..71a34c96 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -56,7 +56,7 @@ run_make_cmd(systemtap_session& s, string& make_cmd) make_cmd += " -s >/dev/null 2>&1"; if (s.verbose > 1) clog << "Running " << make_cmd << endl; - rc = system (make_cmd.c_str()); + rc = stap_system (make_cmd.c_str()); return rc; } @@ -223,7 +223,7 @@ kernel_built_uprobes (systemtap_session& s) { string grep_cmd = string ("/bin/grep -q unregister_uprobe ") + s.kernel_build_tree + string ("/Module.symvers"); - int rc = system (grep_cmd.c_str()); + int rc = stap_system (grep_cmd.c_str()); return (rc == 0); } @@ -274,7 +274,7 @@ copy_uprobes_symbols (systemtap_session& s) string uprobes_home = s.runtime_path + "/uprobes"; string cp_cmd = string("/bin/cp ") + uprobes_home + string("/Module.symvers ") + s.tmpdir; - int rc = system (cp_cmd.c_str()); + int rc = stap_system (cp_cmd.c_str()); return rc; } @@ -339,7 +339,7 @@ run_pass (systemtap_session& s) if (s.verbose>1) clog << "Running " << staprun_cmd << endl; - rc = system (staprun_cmd.c_str ()); + rc = stap_system (staprun_cmd.c_str ()); return rc; } -- cgit From b51455af34a99768cc3a6ce50b251132f5fe752e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 2 Apr 2009 12:16:12 -0700 Subject: Disable ccache during kernel module builds Our module builds always have a 0% ccache hit rate, because the compiler commands always include the randomized tmpdir. Thus, I'm setting CCACHE_DISABLE=1 so ccache never saves these one-use objects. (Besides, we already have our own caching in place for this stuff...) --- buildrun.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 71a34c96..bcd4c1fe 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -48,6 +48,12 @@ run_make_cmd(systemtap_session& s, string& make_cmd) cerr << "unsetenv failed: " << e << endl; } + // Disable ccache to avoid saving files that will never be reused. + // (ccache is useless to us, because our compiler commands always + // include the randomized tmpdir path.) + // It's not critical if this fails, so the return is ignored. + (void) setenv("CCACHE_DISABLE", "1", 0); + if (s.verbose > 2) make_cmd += " V=1"; else if (s.verbose > 1) -- cgit From d5cd287f7860df8752f93de93fcd1cc68884d56b Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 9 Apr 2009 12:06:05 -0500 Subject: Uses when available. 2009-04-09 David Smith * buildrun.cxx (compile_pass): Compile autoconf test for . * runtime/autoconf-asm-syscall.c: New "autoconf" test the presence of . * runtime/syscall.h: If exists, use it. Otherwise, use our private copy of the functions for each architecture. (syscall_get_nr): Renamed from __stp_user_syscall_nr(). (syscall_get_return_value): Renamed from __stp_user_syscall_return_value(). (syscall_get_arguments): Renamed from __stp_user_syscall_arg(). * runtime/task_finder.c (__stp_utrace_task_finder_target_syscall_exit): Uses new syscall.h functions. * tapset/utrace.stp: Ditto. --- buildrun.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index bcd4c1fe..82ac9d4e 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -165,6 +165,8 @@ compile_pass (systemtap_session& s) #endif output_autoconf(s, o, "autoconf-save-stack-trace.c", "STAPCONF_KERNEL_STACKTRACE", NULL); + output_autoconf(s, o, "autoconf-asm-syscall.c", + "STAPCONF_ASM_SYSCALL_H", NULL); o << module_cflags << " += -include $(STAPCONF_HEADER)" << endl; -- cgit