Skip to content

Commit

Permalink
better replacements for fcalls backend
Browse files Browse the repository at this point in the history
Signed-off-by: Hugo Lefeuvre <[email protected]>
  • Loading branch information
hlef committed Dec 1, 2021
1 parent f26fbca commit 064f674
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kraft/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,10 @@ def simple_replace(template_path, path, marker, shstack_enabled=True):

# then generate cocci files dynamically from the template
gr_rule_template = get_sec_rule("gatereplacer.cocci.in")
cb_rule_template = get_sec_rule("callbackreplacer.cocci.in")
if FCALLS_enabled:
cb_rule_template = get_sec_rule("rmcallbacks.cocci.in")
else:
cb_rule_template = get_sec_rule("callbackreplacer.cocci.in")
gr_rule_template = gr_rule_template.replace("{{ comp_cur_nb }}",
str(lib.compartment.number))
cb_rule_template = cb_rule_template.replace("{{ comp_cur_nb }}",
Expand Down
9 changes: 9 additions & 0 deletions kraft/sec/rules/rmcallbacks.cocci.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@cbvoid{{ rule_nr }}@
identifier func;
type T;
@@

- __attribute__(({{ lib_from_name }}_callback))
T func(...) {
...
}

0 comments on commit 064f674

Please sign in to comment.