From 50b6acf7d3f01248697bb2d380da25fb99d04026 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 3 Sep 2009 13:54:07 +0200 Subject: PR10589 followup. tapsets.cxx _stp_warn formatting fixlets. * tapsets.cxx (dwarf_derived_probe_group::emit_module_init): Cast _stp_warn arguments. (kprobe_derived_probe_group::emit_module_init): Likewise. --- tapsets.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 9651426e..027694df 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -3177,7 +3177,7 @@ dwarf_derived_probe_group::emit_module_init (systemtap_session& s) s.op->newline() << "if (rc) {"; // PR6749: tolerate a failed register_*probe. s.op->newline(1) << "sdp->registered_p = 0;"; s.op->newline() << "if (!sdp->optional_p)"; - s.op->newline(1) << "_stp_warn (\"probe %s (address 0x%lx) registration error (rc %d)\", probe_point, relocated_addr, rc);"; + s.op->newline(1) << "_stp_warn (\"probe %s (address 0x%lx) registration error (rc %d)\", probe_point, (unsigned long) relocated_addr, rc);"; s.op->newline(-1) << "rc = 0;"; // continue with other probes // XXX: shall we increment numskipped? s.op->newline(-1) << "}"; @@ -5125,7 +5125,7 @@ kprobe_derived_probe_group::emit_module_init (systemtap_session& s) s.op->newline() << "if (rc) {"; // PR6749: tolerate a failed register_*probe. s.op->newline(1) << "sdp->registered_p = 0;"; s.op->newline() << "if (!sdp->optional_p)"; - s.op->newline(1) << "_stp_warn (\"probe %s (address 0x%lx) registration error (rc %d)\", probe_point, addr, rc);"; + s.op->newline(1) << "_stp_warn (\"probe %s (address 0x%lx) registration error (rc %d)\", probe_point, (unsigned long) addr, rc);"; s.op->newline(-1) << "rc = 0;"; // continue with other probes // XXX: shall we increment numskipped? s.op->newline(-1) << "}"; -- cgit From ceca17997ef0a5310cf887d451651acec73b41da Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 3 Sep 2009 15:03:35 +0200 Subject: PR10589 followup. More tapsets.cxx _stp_warn formatting fixlets. struct kretprobe nmissed an int, but struct kprobe nmissed an unsigned long. * tapsets.cxx (dwarf_derived_probe_group::emit_module_exit): Adjust _stp_warn format string for kprobe nmissed argument. (kprobe_derived_probe_group::emit_module_init): Likewise. --- tapsets.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 027694df..fccb73c8 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -3254,7 +3254,7 @@ dwarf_derived_probe_group::emit_module_exit (systemtap_session& s) s.op->newline() << "atomic_add (kp->u.krp.kp.nmissed, & skipped_count);"; s.op->newline() << "#ifdef STP_TIMING"; s.op->newline() << "if (kp->u.krp.kp.nmissed)"; - s.op->newline(1) << "_stp_warn (\"Skipped due to missed kretprobe/2 on '%s': %d\\n\", sdp->pp, kp->u.krp.kp.nmissed);"; + s.op->newline(1) << "_stp_warn (\"Skipped due to missed kretprobe/2 on '%s': %lu\\n\", sdp->pp, kp->u.krp.kp.nmissed);"; s.op->newline(-1) << "#endif"; s.op->newline(-1) << "} else {"; s.op->newline() << "#if !defined(STAPCONF_UNREGISTER_KPROBES)"; @@ -3263,7 +3263,7 @@ dwarf_derived_probe_group::emit_module_exit (systemtap_session& s) s.op->newline() << "atomic_add (kp->u.kp.nmissed, & skipped_count);"; s.op->newline() << "#ifdef STP_TIMING"; s.op->newline() << "if (kp->u.kp.nmissed)"; - s.op->newline(1) << "_stp_warn (\"Skipped due to missed kprobe on '%s': %d\\n\", sdp->pp, kp->u.kp.nmissed);"; + s.op->newline(1) << "_stp_warn (\"Skipped due to missed kprobe on '%s': %lu\\n\", sdp->pp, kp->u.kp.nmissed);"; s.op->newline(-1) << "#endif"; s.op->newline(-1) << "}"; s.op->newline() << "#if !defined(STAPCONF_UNREGISTER_KPROBES) && defined(__ia64__)"; @@ -5185,7 +5185,7 @@ kprobe_derived_probe_group::emit_module_exit (systemtap_session& s) s.op->newline() << "atomic_add (kp->u.krp.kp.nmissed, & skipped_count);"; s.op->newline() << "#ifdef STP_TIMING"; s.op->newline() << "if (kp->u.krp.kp.nmissed)"; - s.op->newline(1) << "_stp_warn (\"Skipped due to missed kretprobe/2 on '%s': %d\\n\", sdp->pp, kp->u.krp.kp.nmissed);"; + s.op->newline(1) << "_stp_warn (\"Skipped due to missed kretprobe/2 on '%s': %lu\\n\", sdp->pp, kp->u.krp.kp.nmissed);"; s.op->newline(-1) << "#endif"; s.op->newline(-1) << "} else {"; s.op->newline() << "#if !defined(STAPCONF_UNREGISTER_KPROBES)"; @@ -5194,7 +5194,7 @@ kprobe_derived_probe_group::emit_module_exit (systemtap_session& s) s.op->newline() << "atomic_add (kp->u.kp.nmissed, & skipped_count);"; s.op->newline() << "#ifdef STP_TIMING"; s.op->newline() << "if (kp->u.kp.nmissed)"; - s.op->newline(1) << "_stp_warn (\"Skipped due to missed kprobe on '%s': %d\\n\", sdp->pp, kp->u.kp.nmissed);"; + s.op->newline(1) << "_stp_warn (\"Skipped due to missed kprobe on '%s': %lu\\n\", sdp->pp, kp->u.kp.nmissed);"; s.op->newline(-1) << "#endif"; s.op->newline(-1) << "}"; s.op->newline() << "#if !defined(STAPCONF_UNREGISTER_KPROBES) && defined(__ia64__)"; -- cgit From 5e8a3b7b558273fa06525f642fdf2d678dde85eb Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Thu, 3 Sep 2009 16:13:30 -0400 Subject: Allow process begin/end probes for unprivileged users. 2009-09-03 Dave Brolley * tapsets.cxx (visit_cast_op): Don't disallow unprivileged users. Annotate synthesized function with /* unprivileged */. * tapset-utrace.cxx (register_tapset_utrace): Call allow_unprivileged for process begin and end probes. * translate.cxx (translate_pass): Generate '#define STP_PRIVILEGED 1' unless --unprivileged was specified. * runtime/transport/transport.c: Don't define _stp_unprivileged_user. * runtime/task_finder.c (__stp_utrace_attach_match_filename): Check that _stp_uid equals the task euid when STP_PRIVILEGED is not defined. (stap_start_task_finder): Likewise. * runtime/staprun/staprun.c (insert_stap_module): Don't generate module option _stp_unprivileged_user. --- tapsets.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index fccb73c8..6a52050c 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2510,9 +2510,6 @@ void dwarf_cast_expanding_visitor::filter_special_modules(string& module) void dwarf_cast_expanding_visitor::visit_cast_op (cast_op* e) { - if (s.unprivileged) - throw semantic_error("typecasting may not be used when --unprivileged is specified", e->tok); - bool lvalue = is_active_lvalue(e); if (lvalue && !s.guru_mode) throw semantic_error("write to typecast value not permitted", e->tok); @@ -2618,6 +2615,8 @@ void dwarf_cast_expanding_visitor::visit_cast_op (cast_op* e) else ec->code += "/* pure */"; + ec->code += "/* unprivileged */"; + s.functions[fdecl->name] = fdecl; // Synthesize a functioncall. -- cgit