netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: David Vernet <void@manifault.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@kernel.org>,
	Dave Marchevsky <davemarchevsky@meta.com>,
	Tejun Heo <tj@kernel.org>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Network Development <netdev@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>, Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v3 bpf-next 5/5] selftests/bpf: Tweak cgroup kfunc test.
Date: Tue, 28 Feb 2023 16:29:18 -0800	[thread overview]
Message-ID: <CAADnVQLGweandRXT4dmk71f5MwpebMhmrdTfEkY=wG41AZ7ZAQ@mail.gmail.com> (raw)
In-Reply-To: <Y/405fRuemfgdC3l@maniforge>

On Tue, Feb 28, 2023 at 9:07 AM David Vernet <void@manifault.com> wrote:
> libbpf: prog 'on_lookup': failed to load: -13
> libbpf: failed to load object 'cgrp_ls_recursion'
> libbpf: failed to load BPF skeleton 'cgrp_ls_recursion': -13
> test_recursion:FAIL:skel_open_and_load unexpected error: -13
> #43/3    cgrp_local_storage/recursion:FAIL
> #43      cgrp_local_storage:FAIL
>
> All error logs:
> test_cgrp_local_storage:PASS:join_cgroup /cgrp_local_storage 0 nsec
> libbpf: prog 'on_lookup': BPF program load failed: Permission denied
> libbpf: prog 'on_lookup': -- BEGIN PROG LOAD LOG --
> reg type unsupported for arg#0 function on_lookup#16
> 0: R1=ctx(off=0,imm=0) R10=fp0
> ; struct task_struct *task = bpf_get_current_task_btf();
> 0: (85) call bpf_get_current_task_btf#158     ; R0_w=trusted_ptr_task_struct(off=0,imm=0)
> 1: (bf) r6 = r0                       ; R0_w=trusted_ptr_task_struct(off=0,imm=0) R6_w=trusted_ptr_task_struct(off=0,imm=0)
> ; bpf_cgrp_storage_delete(&map_a, task->cgroups->dfl_cgrp);
> 2: (79) r1 = *(u64 *)(r6 +2296)       ; R1_w=rcu_ptr_or_null_css_set(off=0,imm=0) R6_w=trusted_ptr_task_struct(off=0,imm=0)
> ; bpf_cgrp_storage_delete(&map_a, task->cgroups->dfl_cgrp);
> 3: (79) r2 = *(u64 *)(r1 +120)
> R1 invalid mem access 'rcu_ptr_or_null_'

This one was tricky :)
Turned out btf_nested_type_is_trusted() was able to find
'cgroups' field in gcc compiled kernel and was failing on clang
compiled kernel because patch 2 did:
BTF_TYPE_SAFE_NESTED(struct task_struct) {
        const cpumask_t *cpus_ptr;
        struct css_set *cgroups;
};
instead of
BTF_TYPE_SAFE_NESTED(struct task_struct) {
        const cpumask_t *cpus_ptr;
        struct css_set __rcu *cgroups;
};
The missing tag was causing a miscompare.
Something to keep in mind.
This ugliness will go away once GCC supports btf tag.

  reply	other threads:[~2023-03-01  0:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-28  4:01 [PATCH v3 bpf-next 0/5] bpf: Introduce kptr_rcu Alexei Starovoitov
2023-02-28  4:01 ` [PATCH v3 bpf-next 1/5] bpf: Rename __kptr_ref -> __kptr and __kptr -> __kptr_untrusted Alexei Starovoitov
2023-02-28 15:16   ` David Vernet
2023-02-28  4:01 ` [PATCH v3 bpf-next 2/5] bpf: Mark cgroups and dfl_cgrp fields as trusted Alexei Starovoitov
2023-02-28 16:45   ` David Vernet
2023-02-28 19:32   ` Tejun Heo
2023-02-28  4:01 ` [PATCH v3 bpf-next 3/5] bpf: Introduce kptr_rcu Alexei Starovoitov
2023-02-28 16:45   ` David Vernet
2023-02-28 19:49     ` Alexei Starovoitov
2023-02-28 20:05       ` David Vernet
2023-02-28 19:39   ` Tejun Heo
2023-02-28  4:01 ` [PATCH v3 bpf-next 4/5] selftests/bpf: Add a test case for kptr_rcu Alexei Starovoitov
2023-02-28 16:52   ` David Vernet
2023-02-28  4:01 ` [PATCH v3 bpf-next 5/5] selftests/bpf: Tweak cgroup kfunc test Alexei Starovoitov
2023-02-28 17:07   ` David Vernet
2023-03-01  0:29     ` Alexei Starovoitov [this message]
2023-03-01  2:22       ` David Vernet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAADnVQLGweandRXT4dmk71f5MwpebMhmrdTfEkY=wG41AZ7ZAQ@mail.gmail.com' \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=davemarchevsky@meta.com \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).