31 lines
741 B
Plaintext
Executable File
31 lines
741 B
Plaintext
Executable File
#!/usr/bin/stap -g
|
|
|
|
global sshd_fork_count
|
|
global fork_to_fail=1
|
|
|
|
probe begin {
|
|
printf("Started\n\n")
|
|
}
|
|
|
|
probe kernel.function("*kernel_clone").call {
|
|
if (execname() == "sshd") {
|
|
sshd_fork_count++
|
|
printf(">>>%s[%5d] %s\n", execname(), pid(), $$parms)
|
|
printf(" PPID=%d\n",ppid())
|
|
printf(" sshd_fork_count=%d\n",sshd_fork_count)
|
|
}
|
|
}
|
|
|
|
probe kernel.function("*kernel_clone").return {
|
|
if (execname() == "sshd") {
|
|
printf("<<<%s[%5d] %s\n", execname(), pid(), $$return)
|
|
printf(" PPID=%d\n",ppid())
|
|
printf(" RETURN:%d\n\n",$return)
|
|
if (sshd_fork_count == fork_to_fail) {
|
|
printf("!!! fork() will return -1\n")
|
|
$return = -1
|
|
}
|
|
}
|
|
}
|
|
|