File Index
Files and directories
Sign in
FILE

stream_fail.c

File preview with syntax highlighting.

linux-6.19.14/tools/testing/selftests/bpf/progs/stream_fail.c C
 1// SPDX-License-Identifier: GPL-2.0
 2/* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */
 3#include <vmlinux.h>
 4#include <bpf/bpf_tracing.h>
 5#include <bpf/bpf_helpers.h>
 6#include <bpf/bpf_core_read.h>
 7#include "bpf_misc.h"
 8
 9SEC("syscall")
10__failure __msg("Possibly NULL pointer passed")
11int stream_vprintk_null_arg(void *ctx)
12{
13	bpf_stream_vprintk_impl(BPF_STDOUT, "", NULL, 0, NULL);
14	return 0;
15}
16
17SEC("syscall")
18__failure __msg("R3 type=scalar expected=")
19int stream_vprintk_scalar_arg(void *ctx)
20{
21	bpf_stream_vprintk_impl(BPF_STDOUT, "", (void *)46, 0, NULL);
22	return 0;
23}
24
25SEC("syscall")
26__failure __msg("arg#1 doesn't point to a const string")
27int stream_vprintk_string_arg(void *ctx)
28{
29	bpf_stream_vprintk_impl(BPF_STDOUT, ctx, NULL, 0, NULL);
30	return 0;
31}
32
33char _license[] SEC("license") = "GPL";
~/ Read-only file preview.