diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | tapsets.cxx | 7 | ||||
-rwxr-xr-x | testsuite/buildok/twenty.stp | 8 |
3 files changed, 24 insertions, 0 deletions
@@ -1,3 +1,12 @@ +2005-10-04 Graydon Hoare <graydon@redhat.com> + + PR 1131. + * tapsets.cxx + (target_variable_flavour_calculating_visitor::visit_target_symbol) + (var_expanding_copy_visitor::visit_target_symbol): + Require guru mode for writing to target vars. + * testsuite/buildok/twenty.stp: Test writing to target vars. + 2005-10-01 Frank Ch. Eigler <fche@elastic.org> * tapsets.cxx (get_module_dwarf): Add "required" parameter, which diff --git a/tapsets.cxx b/tapsets.cxx index 311c237d..5a7a0726 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -1583,6 +1583,9 @@ target_variable_flavour_calculating_visitor::visit_target_symbol (target_symbol try { bool lvalue = is_active_lvalue(e); + if (lvalue && !q.sess.guru_mode) + throw semantic_error("Writing to target variable outside of guru mode", e->tok); + flavour += lvalue ? 'w' : 'r'; exp_type ty; string expr = q.dw.literal_stmt_for_local(scope_die, @@ -2214,6 +2217,10 @@ var_expanding_copy_visitor::visit_target_symbol (target_symbol *e) embeddedcode *ec = new embeddedcode; ec->tok = e->tok; bool lvalue = is_active_lvalue(e); + + if (lvalue && !q.sess.guru_mode) + throw semantic_error("Illegal target variable access", e->tok); + string fname = (string(lvalue ? "set" : "get") + "_" + e->base_name.substr(1) + "_" + lex_cast<string>(tick++)); diff --git a/testsuite/buildok/twenty.stp b/testsuite/buildok/twenty.stp new file mode 100755 index 00000000..aa6287c4 --- /dev/null +++ b/testsuite/buildok/twenty.stp @@ -0,0 +1,8 @@ +#! stap -gp4 + +# Test for writing to target variables, PR 1131 + +probe kernel.function("vfs_readdir") +{ + $file->f_dentry->d_name->len = 1 +} |