summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/test_attach_kprobe_sleepable.c
blob: f548b74462189b31376614d8021bef8f06cf81d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017 Facebook

#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include <bpf/bpf_core_read.h>
#include "bpf_misc.h"

int kprobe_res = 0;

/**
 * This program will be manually made sleepable on the userspace side
 * and should thus be unattachable.
 */
SEC("kprobe/" SYS_PREFIX "sys_nanosleep")
int handle_kprobe_sleepable(struct pt_regs *ctx)
{
	kprobe_res = 1;
	return 0;
}

char _license[] SEC("license") = "GPL";