1*7391ec63SMenglong Dong // SPDX-License-Identifier: GPL-2.0
2*7391ec63SMenglong Dong // Copyright (c) 2017 Facebook
3*7391ec63SMenglong Dong 
4*7391ec63SMenglong Dong #include "vmlinux.h"
5*7391ec63SMenglong Dong #include <bpf/bpf_helpers.h>
6*7391ec63SMenglong Dong #include <bpf/bpf_tracing.h>
7*7391ec63SMenglong Dong #include <bpf/bpf_core_read.h>
8*7391ec63SMenglong Dong #include "bpf_misc.h"
9*7391ec63SMenglong Dong 
10*7391ec63SMenglong Dong int kprobe_res = 0;
11*7391ec63SMenglong Dong 
12*7391ec63SMenglong Dong /**
13*7391ec63SMenglong Dong  * This program will be manually made sleepable on the userspace side
14*7391ec63SMenglong Dong  * and should thus be unattachable.
15*7391ec63SMenglong Dong  */
16*7391ec63SMenglong Dong SEC("kprobe/" SYS_PREFIX "sys_nanosleep")
handle_kprobe_sleepable(struct pt_regs * ctx)17*7391ec63SMenglong Dong int handle_kprobe_sleepable(struct pt_regs *ctx)
18*7391ec63SMenglong Dong {
19*7391ec63SMenglong Dong 	kprobe_res = 1;
20*7391ec63SMenglong Dong 	return 0;
21*7391ec63SMenglong Dong }
22*7391ec63SMenglong Dong 
23*7391ec63SMenglong Dong char _license[] SEC("license") = "GPL";
24