forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
selftests/bpf: Add a fexit/bpf2bpf test with target bpf prog no callees
The existing fexit_bpf2bpf test covers the target progrm with callees. This patch added a test for the target program without callees. Signed-off-by: Yonghong Song <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
- Loading branch information
1 parent
e9eeec5
commit 8f9081c
Showing
3 changed files
with
81 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Copyright (c) 2019 Facebook */ | ||
#include <linux/bpf.h> | ||
#include "bpf_helpers.h" | ||
#include "bpf_trace_helpers.h" | ||
|
||
struct sk_buff { | ||
unsigned int len; | ||
}; | ||
|
||
__u64 test_result = 0; | ||
BPF_TRACE_2("fexit/test_pkt_md_access", test_main2, | ||
struct sk_buff *, skb, int, ret) | ||
{ | ||
int len; | ||
|
||
__builtin_preserve_access_index(({ | ||
len = skb->len; | ||
})); | ||
if (len != 74 || ret != 0) | ||
return 0; | ||
|
||
test_result = 1; | ||
return 0; | ||
} | ||
char _license[] SEC("license") = "GPL"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters