Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fortitudepub/3a3d7d1b57b005b12f00a0aace64deaf to your computer and use it in GitHub Desktop.
Save fortitudepub/3a3d7d1b57b005b12f00a0aace64deaf to your computer and use it in GitHub Desktop.
skbmem systemtap example
function string_ops:string (val) %{
strlcpy (STAP_RETVALUE, (char*)STAP_ARG_val, MAXSTRINGLEN);
%}
probe kernel.function("__dev_queue_xmit") {
if (execname() =~ "keepalived") {
printf("__dev_queue_xmit %d %s(%d/%d) %s\n", gettimeofday_us(), execname(), pid(), cpu(), $$vars);
i = 0;
printf("dump begin, skb->gso %d\n", @cast($skb->head+$skb->end, "skb_shared_info", "")->gso_size);
for (; i< 14; i++) {
printf("%02x:", $skb->data[i]);
}
// give a backtrace to see which path the function called...
print(sprint_backtrace());
print("dump end\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment