mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-12 00:34:43 +08:00
95ebb37617
Convert 17 test_global_funcs subtests into test_loader framework for easier maintenance and more declarative way to define expected failures/successes. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Stanislav Fomichev <sdf@google.com> Link: https://lore.kernel.org/bpf/20230216045954.3002473-3-andrii@kernel.org
24 lines
421 B
C
24 lines
421 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
#include <stddef.h>
|
|
#include <linux/bpf.h>
|
|
#include <bpf/bpf_helpers.h>
|
|
#include "bpf_misc.h"
|
|
|
|
struct S;
|
|
|
|
__noinline int foo(const struct S *s)
|
|
{
|
|
if (s)
|
|
return bpf_get_prandom_u32() < *(const int *) s;
|
|
|
|
return 0;
|
|
}
|
|
|
|
SEC("cgroup_skb/ingress")
|
|
__failure __msg("reference type('FWD S') size cannot be determined")
|
|
int global_func14(struct __sk_buff *skb)
|
|
{
|
|
|
|
return foo(NULL);
|
|
}
|