summaryrefslogtreecommitdiffstats
path: root/translate.cxx
diff options
context:
space:
mode:
authorfche <fche>2005-12-01 21:10:30 +0000
committerfche <fche>2005-12-01 21:10:30 +0000
commitc253c2ea9ff3ff0169c191c20418066c9cf94caa (patch)
tree84ec4376fa5803297baf0793eeae8daf400adf97 /translate.cxx
parent39e57ce01790506b9e6a85cc126c032907fd9197 (diff)
downloadsystemtap-steved-c253c2ea9ff3ff0169c191c20418066c9cf94caa.tar.gz
systemtap-steved-c253c2ea9ff3ff0169c191c20418066c9cf94caa.tar.xz
systemtap-steved-c253c2ea9ff3ff0169c191c20418066c9cf94caa.zip
2005-12-01 Frank Ch. Eigler <fche@redhat.com>
PR 1944 quick hack. * translator.cxx (translate_pass): Reduce default MAXNESTING to 10. (emit_module_init): Add a paranoid check against oversize contexts. * stap.1.in: Document MAXNESTING change. 2005-12-01 Frank Ch. Eigler <fche@redhat.com> PR 1944 quick hack. * testsuite/systemtap.sample/control_limits.*: Adapt to new MAXNESTING default.
Diffstat (limited to 'translate.cxx')
-rw-r--r--translate.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/translate.cxx b/translate.cxx
index 67c79c4b..a55d48a8 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -888,7 +888,7 @@ c_unparser::emit_common_header ()
}
o->newline(-1) << "} locals [MAXNESTING];";
o->newline(-1) << "};" << endl;
- o->newline() << "void *contexts; /* alloc_percpu */" << endl;
+ o->newline() << "void *contexts = NULL; /* alloc_percpu */" << endl;
emit_map_type_instantiations ();
@@ -936,8 +936,9 @@ c_unparser::emit_module_init ()
// terminate. These may set STAP_SESSION_ERROR!
// per-cpu context
- o->newline() << "contexts = alloc_percpu (struct context);";
- o->newline() << "if (contexts == NULL) {";
+ o->newline() << "if (sizeof (struct context) <= 131072)";
+ o->newline(1) << "contexts = alloc_percpu (struct context);";
+ o->newline(-1) << "if (contexts == NULL) {";
o->newline() << "_stp_error (\"percpu context (size %lu) allocation failed\", sizeof (struct context));";
o->newline(1) << "rc = -ENOMEM;";
o->newline() << "goto out;";
@@ -3212,7 +3213,7 @@ translate_pass (systemtap_session& s)
s.op->line() << "#define TEST_MODE " << (s.test_mode ? 1 : 0) << endl;
s.op->newline() << "#ifndef MAXNESTING";
- s.op->newline() << "#define MAXNESTING 30";
+ s.op->newline() << "#define MAXNESTING 10";
s.op->newline() << "#endif";
s.op->newline() << "#ifndef MAXSTRINGLEN";
s.op->newline() << "#define MAXSTRINGLEN 128";