Re: [PATCH bpf v1 4/4] selftests/bpf: Add autogenerated tests for raw_tp NULL args

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 10, 2024 at 6:02 PM Kumar Kartikeya Dwivedi
<memxor@xxxxxxxxx> wrote:
> +cat ../../../../kernel/bpf/btf.c  | grep RAW_TP_NULL_ARGS | grep -v "define RAW_TP" | ./gen_raw_tp_null.py | tee progs/raw_tp_null.c

This is a serious overkill for something that will be removed soon
when automation to analyse TP_fast_assign() is ready.

> +++ b/tools/testing/selftests/bpf/progs/raw_tp_null.c
> @@ -0,0 +1,417 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
> +
> +/* WARNING: This file is automatically generated, run gen_raw_tp_null.sh to update! */

let's not.

> +
> +#include <vmlinux.h>
> +#include <bpf/bpf_tracing.h>
> +#include "bpf_misc.h"
> +
> +char _license[] SEC("license") = "GPL";
> +
> +SEC("tp_btf/sched_pi_setprio")
> +__failure __msg("R1 invalid mem access 'trusted_ptr_or_null_'")
> +int test_raw_tp_null_sched_pi_setprio_arg_2(void *ctx) {
> +    asm volatile("r1 = *(u64 *)(r1 +8); r1 = *(u64 *)(r1 +0);" ::: __clobber_all);
> +    return 0;
> +}

This one is enough to test it.

Drop all below. They don't add value. Copy paste doesn't improve coverage.

> +
> +SEC("tp_btf/sched_stick_numa")
> +__failure __msg("R1 invalid mem access 'trusted_ptr_or_null_'")
> +int test_raw_tp_null_sched_stick_numa_arg_3(void *ctx) {
> +    asm volatile("r1 = *(u64 *)(r1 +16); r1 = *(u64 *)(r1 +0);" ::: __clobber_all);
> +    return 0;
> +}

...

pw-bot: cr





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux