SEC("tracepoint/syscalls/sys_enter_nanosleep") int probe(void *ctx)
{ /* This BPF program performs variable-offset reads and writes on a * stack-allocated buffer.
*/ char stack_buf[16]; unsignedlong len; unsignedlong last;
if ((bpf_get_current_pid_tgid() >> 32) != test_pid) return 0;
/* Copy the input to the stack. */
__builtin_memcpy(stack_buf, input, 4);
/* The first byte in the buffer indicates the length. */
len = stack_buf[0] & 0xf;
last = (len - 1) & 0xf;
/* Append something to the buffer. The offset where we write is not * statically known; this is a variable-offset stack write.
*/
stack_buf[len] = 42;
/* Index into the buffer at an unknown offset. This is a * variable-offset stack read. * * Note that if it wasn't for the preceding variable-offset write, this * read would be rejected because the stack slot cannot be verified as * being initialized. With the preceding variable-offset write, the * stack slot still cannot be verified, but the write inhibits the * respective check on the reasoning that, if there was a * variable-offset to a higher-or-equal spot, we're probably reading * what we just wrote.
*/
probe_res = stack_buf[last]; return 0;
}
char _license[] SEC("license") = "GPL";
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.