-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
selftests/bpf: Test for checking return code for the extended prog
This adds test to enforce same check for the return code for the extended prog as it is enforced for the target program. It asserts failure for a return code, which is permitted without the patch in this series, while it is restricted after the application of this patch. Signed-off-by: Udip Pant <udippant@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200825232003.2877030-4-udippant@fb.com
- Loading branch information
Udip Pant
authored and
Alexei Starovoitov
committed
Aug 26, 2020
1 parent
6dc03dc
commit 50d1973
Showing
2 changed files
with
59 additions
and
0 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
19 changes: 19 additions & 0 deletions
19
tools/testing/selftests/bpf/progs/freplace_connect_v4_prog.c
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,19 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
// Copyright (c) 2020 Facebook | ||
|
||
#include <linux/stddef.h> | ||
#include <linux/ipv6.h> | ||
#include <linux/bpf.h> | ||
#include <linux/in.h> | ||
#include <sys/socket.h> | ||
#include <bpf/bpf_helpers.h> | ||
#include <bpf/bpf_endian.h> | ||
|
||
SEC("freplace/connect_v4_prog") | ||
int new_connect_v4_prog(struct bpf_sock_addr *ctx) | ||
{ | ||
// return value thats in invalid range | ||
return 255; | ||
} | ||
|
||
char _license[] SEC("license") = "GPL"; |