mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-31 16:38:12 +00:00
eb0f1e0c7f
Convert test trace_printk to more aggressively validate and use rodata. Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20210514003623.28033-21-alexei.starovoitov@gmail.com
21 lines
467 B
C
21 lines
467 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
// Copyright (c) 2020, Oracle and/or its affiliates.
|
|
|
|
#include "vmlinux.h"
|
|
#include <bpf/bpf_helpers.h>
|
|
#include <bpf/bpf_tracing.h>
|
|
|
|
char _license[] SEC("license") = "GPL";
|
|
|
|
int trace_printk_ret = 0;
|
|
int trace_printk_ran = 0;
|
|
|
|
const char fmt[] = "Testing,testing %d\n";
|
|
|
|
SEC("fentry/__x64_sys_nanosleep")
|
|
int sys_enter(void *ctx)
|
|
{
|
|
trace_printk_ret = bpf_trace_printk(fmt, sizeof(fmt),
|
|
++trace_printk_ran);
|
|
return 0;
|
|
}
|