-
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.
bpf/selftests: Test that kernel rejects a TCP CC with an invalid license
This adds a selftest to check that the verifier rejects a TCP CC struct_ops with a non-GPL license. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/bpf/20210326100314.121853-2-toke@redhat.com
- Loading branch information
Toke Høiland-Jørgensen
authored and
Daniel Borkmann
committed
Mar 26, 2021
1 parent
12aa8a9
commit d8e8052
Showing
2 changed files
with
63 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
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 | ||
|
||
#include <linux/bpf.h> | ||
#include <linux/types.h> | ||
#include <bpf/bpf_helpers.h> | ||
#include <bpf/bpf_tracing.h> | ||
#include "bpf_tcp_helpers.h" | ||
|
||
char _license[] SEC("license") = "X"; | ||
|
||
void BPF_STRUCT_OPS(nogpltcp_init, struct sock *sk) | ||
{ | ||
} | ||
|
||
SEC(".struct_ops") | ||
struct tcp_congestion_ops bpf_nogpltcp = { | ||
.init = (void *)nogpltcp_init, | ||
.name = "bpf_nogpltcp", | ||
}; |