From cf8dc3c7fc65aa91a5a94906682af3acc9dca98b Mon Sep 17 00:00:00 2001 From: dsmith Date: Fri, 14 Sep 2007 16:46:00 +0000 Subject: 2007-09-14 David Smith PR 1154 * tapsets.cxx (procfs_var_expanding_copy_visitor::visit_target_symbol): Disallows reading from $value in a procfs read probe. (procfs_derived_probe_group::emit_module_init): Updated previous fix. --- ChangeLog | 7 +++++++ tapsets.cxx | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 49784b37..2cc24a96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-09-14 David Smith + + PR 1154 + * tapsets.cxx + (procfs_var_expanding_copy_visitor::visit_target_symbol): + Disallows reading from $value in a procfs read probe. + 2007-09-14 David Smith PR 1154 diff --git a/tapsets.cxx b/tapsets.cxx index 38067a7b..042612da 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -4707,7 +4707,7 @@ procfs_derived_probe_group::emit_module_init (systemtap_session& s) if (has_write_probes) { - s.op->newline(-1) << "if (spp->write_pp)"; + s.op->newline() << "if (spp->write_pp)"; s.op->newline(1) << "_stp_procfs_files[i]->write_proc = &_stp_procfs_write;"; s.op->newline(-1) << "else"; s.op->newline(1) << "_stp_procfs_files[i]->write_proc = NULL;"; @@ -4743,6 +4743,8 @@ procfs_var_expanding_copy_visitor::visit_target_symbol (target_symbol* e) bool lvalue = is_active_lvalue(e); if (write_probe && lvalue) throw semantic_error("procfs $value variable is read-only in a procfs write probe", e->tok); + else if (! write_probe && ! lvalue) + throw semantic_error("procfs $value variable cannot be read in a procfs read probe", e->tok); // Remember that we've seen a target variable. target_symbol_seen = true; -- cgit