diff options
Diffstat (limited to 'tapsets.cxx')
-rw-r--r-- | tapsets.cxx | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index a105526c..b1ca2998 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -359,11 +359,14 @@ struct dwarf_derived_probe: public derived_probe // Pattern registration helpers. static void register_statement_variants(match_node * root, - dwarf_builder * dw); + dwarf_builder * dw, + bool unprivileged_ok_p = false); static void register_function_variants(match_node * root, - dwarf_builder * dw); + dwarf_builder * dw, + bool unprivileged_ok_p = false); static void register_function_and_statement_variants(match_node * root, - dwarf_builder * dw); + dwarf_builder * dw, + bool unprivileged_ok_p = false); static void register_patterns(systemtap_session& s); }; @@ -2463,6 +2466,9 @@ 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); @@ -2812,25 +2818,28 @@ dwarf_derived_probe::printargs(std::ostream &o) const void dwarf_derived_probe::register_statement_variants(match_node * root, - dwarf_builder * dw) + dwarf_builder * dw, + bool unprivileged_ok_p) { - root->bind(dw); + root->allow_unprivileged(unprivileged_ok_p)->bind(dw); } void dwarf_derived_probe::register_function_variants(match_node * root, - dwarf_builder * dw) -{ - root->bind(dw); - root->bind(TOK_INLINE)->bind(dw); - root->bind(TOK_CALL)->bind(dw); - root->bind(TOK_RETURN)->bind(dw); - root->bind(TOK_RETURN)->bind_num(TOK_MAXACTIVE)->bind(dw); + dwarf_builder * dw, + bool unprivileged_ok_p) +{ + root->allow_unprivileged(unprivileged_ok_p)->bind(dw); + root->bind(TOK_INLINE)->allow_unprivileged(unprivileged_ok_p)->bind(dw); + root->bind(TOK_CALL)->allow_unprivileged(unprivileged_ok_p)->bind(dw); + root->bind(TOK_RETURN)->allow_unprivileged(unprivileged_ok_p)->bind(dw); + root->bind(TOK_RETURN)->bind_num(TOK_MAXACTIVE)->allow_unprivileged(unprivileged_ok_p)->bind(dw); } void dwarf_derived_probe::register_function_and_statement_variants(match_node * root, - dwarf_builder * dw) + dwarf_builder * dw, + bool unprivileged_ok_p) { // Here we match 4 forms: // @@ -2839,10 +2848,10 @@ dwarf_derived_probe::register_function_and_statement_variants(match_node * root, // .statement("foo") // .statement(0xdeadbeef) - register_function_variants(root->bind_str(TOK_FUNCTION), dw); - register_function_variants(root->bind_num(TOK_FUNCTION), dw); - register_statement_variants(root->bind_str(TOK_STATEMENT), dw); - register_statement_variants(root->bind_num(TOK_STATEMENT), dw); + register_function_variants(root->bind_str(TOK_FUNCTION), dw, unprivileged_ok_p); + register_function_variants(root->bind_num(TOK_FUNCTION), dw, unprivileged_ok_p); + register_statement_variants(root->bind_str(TOK_STATEMENT), dw, unprivileged_ok_p); + register_statement_variants(root->bind_num(TOK_STATEMENT), dw, unprivileged_ok_p); } void @@ -2859,8 +2868,7 @@ dwarf_derived_probe::register_patterns(systemtap_session& s) root->bind(TOK_KERNEL)->bind_num(TOK_STATEMENT)->bind(TOK_ABSOLUTE)->bind(dw); root->bind(TOK_KERNEL)->bind_str(TOK_FUNCTION)->bind_str(TOK_LABEL)->bind(dw); root->bind_str(TOK_PROCESS)->bind_str(TOK_FUNCTION)->bind_str(TOK_LABEL)->bind(dw); - - register_function_and_statement_variants(root->bind_str(TOK_PROCESS), dw); + register_function_and_statement_variants(root->bind_str(TOK_PROCESS), dw, false/*!unprivileged_ok_p*/); root->bind_str(TOK_PROCESS)->bind_str(TOK_MARK)->bind(dw); root->bind_str(TOK_PROCESS)->bind_num(TOK_MARK)->bind(dw); } @@ -6093,7 +6101,6 @@ register_standard_tapsets(systemtap_session & s) register_tapset_timers(s); register_tapset_utrace(s); - // dwarf-based kprobe/uprobe parts dwarf_derived_probe::register_patterns(s); |