/usr/share/systemtap/tapset
NameSizeModeActions
arm/-0755rm
arm64/-0755rm
bpf/-0755rm
dyninst/-0755rm
i386/-0755rm
ia64/-0755rm
linux/-0755rm
mips/-0755rm
powerpc/-0755rm
riscv/-0755rm
s390/-0755rm
x86_64/-0755rm
ansi.stp41780644editdlrm
argv.stp27210644editdlrm
choose_defined.stpm2080644editdlrm
container_of.stpm2350644editdlrm
context.stp61030644editdlrm
errno.stp91180644editdlrm
floatingpoint.stp69360644editdlrm
indent-default.stp590644editdlrm
indent.stp45900644editdlrm
init.stp2690644editdlrm
input.stp2630644editdlrm
java.stp13460644editdlrm
libperl5.26.3-64.stp13390644editdlrm
libpython2.7-64.stp5220644editdlrm
livepatch.stp30060644editdlrm
logging.stp41320644editdlrm
macros.stpm5620644editdlrm
null.stp170644editdlrm
offsetof.stpm1830644editdlrm
oneshot.stp380644editdlrm
pn.stp15880644editdlrm
print_stats.stpm17190644editdlrm
private30.stpm800644editdlrm
prometheus.stp1290644editdlrm
prometheus.stpm83800644editdlrm
python.stp4740644editdlrm
python2.stp294350644editdlrm
python3.stp366550644editdlrm
queue_stats.stp94870644editdlrm
random.stp4320644editdlrm
README3710644editdlrm
regex.stp41070644editdlrm
registers.stp110810644editdlrm
sizeof.stpm2120644editdlrm
speculative.stp17460644editdlrm
sreg_arch.stpm2630644editdlrm
stap_staticmarkers.stp96700644editdlrm
stopwatch.stp30630644editdlrm
string.stp75140644editdlrm
switchfile.stp6120644editdlrm
system.stp5930644editdlrm
this.stp1600644editdlrm
timers.stp9240644editdlrm
tls.stp80990644editdlrm
tokenize.stp21240644editdlrm
try_assign.stpm7680644editdlrm
type_defined.stpm3740644editdlrm
tzinfo.stp9300644editdlrm
uconversions-guru.stp60780644editdlrm
uconversions.stp366400644editdlrm
Edit: /usr/share/systemtap/tapset/livepatch.stp (3006B)
// livepatch tapset macros // Copyright (C) 2022 Red Hat Inc. // // This file is part of systemtap, and is free software. You can // redistribute it and/or modify it under the terms of the GNU General // Public License (GPL); either version 2, or (at your option) any // later version. private cve_id private cve_load_time global cve_notify_p = 1 global cve_fix_p = 1 global cve_trace_p = 1 global cve_enabled_p = 1 global cve_tmpdisabled_s = -1 probe begin { cve_id = module_name() cve_load_time = gettimeofday_s() if (cve_notify_p) printf("%s mitigation loaded\n", cve_id) } probe end,error { if (cve_notify_p) printf("%s mitigation unloaded\n", cve_id) } # Parameter reading and updating @define cve_probe_procfs_parameter (glbl, f_name) %( probe procfs(@f_name).read { $value = sprintf("%d\n", @glbl) } probe procfs(@f_name).write { @glbl = strtol($value, 10) } %) @cve_probe_procfs_parameter(cve_notify_p , "cve_notify_p") @cve_probe_procfs_parameter(cve_trace_p , "cve_trace_p") @cve_probe_procfs_parameter(cve_fix_p , "cve_fix_p") @cve_probe_procfs_parameter(cve_enabled_p , "cve_enabled_p") probe procfs("cve_tmpdisabled_s").read { $value = sprintf("%d\n", cve_tmpdisabled_s) } probe procfs("cve_tmpdisabled_s").write { cve_tmpdisabled_s = strtol($value, 10) if (cve_tmpdisabled_s > 0) cve_enabled_p = 0 # trigger temporary disable } # The metric accumulation and prometheus global cve_metrics /** * sfunction cve_count_metric - Increment the count of key * * @key: The metric * * Description: This function increments the count of the metric * key by 1. The metrics can be accessed in * /proc/systemtap/MODULE_NAME/__prometheus */ function cve_count_metric (key:string) { cve_metrics[key] ++ } /** * sfunction cve_record_metric - Set the value of key * * @key: The metric * @value: The new value * * Description: This function sets the value of the metric * key. The metrics can be accessed in * /proc/systemtap/MODULE_NAME/__prometheus */ function cve_record_metric (key:string, value:long) { cve_metrics[key] = value } probe prometheus { cve_record_metric("runtime", gettimeofday_s() - cve_load_time) @prometheus_dump_array1(cve_metrics, cve_id, "metric") } # Disabling the patch probe timer.s(1) { if(!cve_enabled_p && cve_tmpdisabled_s >= 0){ if(cve_tmpdisabled_s > 0){ cve_tmpdisabled_s-- }else{ if (cve_notify_p) printf("%s reenabling\n", cve_id) cve_enabled_p = 1 cve_tmpdisabled_s = -1 } } } /** * sfunction cve_tmpdisable - Disable the cve livepatch * * @duration: The number of seconds to disable * * Description: This function temporarily disables the * conditionals which use cve_enabled_p for duration seconds. * If duration is -1, disable the livepatch until reenabled. */ function cve_tmpdisable(duration:long){ if (cve_notify_p) printf("%s disabling temporarily\n", cve_id) cve_enabled_p = 0 cve_tmpdisabled_s = duration }