mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: slava.imameev@crowdstrike.com,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org
Cc: martin.lau@linux.dev,eddyz87@gmail.com,song@kernel.org,yonghong.song@linux.dev,john.fastabend@gmail.com,kpsingh@kernel.org,sdf@fomichev.me,haoluo@google.com,jolsa@kernel.org,davem@davemloft.net,edumazet@google.com,kuba@kernel.org,pabeni@redhat.com,horms@kernel.org,shuah@kernel.org,linux-kernel@vger.kernel.org,bpf@vger.kernel.org,netdev@vger.kernel.org,linux-kselftest@vger.kernel.org,linux-open-source@crowdstrike.com,slava.imameev@crowdstrike.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,clm@meta.com,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v2 2/2] selftests/bpf: Add trampolines multi-level pointer params test coverage
Date: Tue, 17 Feb 2026 22:47:59 +0000 (UTC)	[thread overview]
Message-ID: <c0aa6a42eb9fa557fc375b858d91dbadd74bbd6534be1b32fc9e0d05e540ee63@mail.kernel.org> (raw)
In-Reply-To: <20260217221357.18215-3-slava.imameev@crowdstrike.com>

[-- Attachment #1: Type: text/plain, Size: 2741 bytes --]

> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> index 178c4738e63b..19c82ae9bfe6 100644
> --- a/net/bpf/test_run.c
> +++ b/net/bpf/test_run.c

[ ... ]

> +static void *create_bad_kaddr(void)
> +{
> +	/*
> +	 * Try to get an address that passes kernel range checks but causes
> +	 * a page fault handler invocation if accessed from a BPF program.
> +	 */
> +#if defined(CONFIG_ARCH_HAS_SET_MEMORY) && defined(CONFIG_X86)

The first branch requires both CONFIG_ARCH_HAS_SET_MEMORY and
CONFIG_X86.  The second branch requires CONFIG_ARCH_HAS_SET_DIRECT_MAP.

PowerPC selects ARCH_HAS_SET_MEMORY (arch/powerpc/Kconfig) but not
ARCH_HAS_SET_DIRECT_MAP, so neither branch compiles in and the function
always returns NULL on that architecture.

> +	void *addr = vmalloc(PAGE_SIZE);
> +
> +	if (!addr)
> +		return NULL;
> +	/* Make it non-present - any access will fault */
> +	if (set_memory_np((unsigned long)addr, 1)) {
> +		vfree(addr);
> +		return NULL;
> +	}
> +	return addr;
> +#elif defined(CONFIG_ARCH_HAS_SET_DIRECT_MAP)

[ ... ]

> +#endif
> +	return NULL;
> +}

[ ... ]

> +static void free_bad_kaddr(void *addr)
> +{
> +	if (!addr)
> +		return;
> +
> +	/*
> +	 * Free an invalid test address created by get_invalid_address().
> +	 * Restores the page to present state before freeing.
> +	 */

The comment references get_invalid_address() but the function that
creates the address is create_bad_kaddr().

> +#if defined(CONFIG_ARCH_HAS_SET_MEMORY) && defined(CONFIG_X86)

[ ... ]

> +#endif
> +}

[ ... ]

> +		} else if (!strcmp(attach_name, "bpf_fentry_test13_pptr")) {
> +			kaddr = create_bad_kaddr();
> +			WARN_ON(!kaddr);

Since create_bad_kaddr() returns NULL on PowerPC (which supports BPF
trampolines via HAVE_DYNAMIC_FTRACE_WITH_ARGS), would this WARN_ON fire
every time the bpf_fentry_test13_pptr test runs on that architecture?

> +			CONSUME(bpf_fentry_test13_pptr(kaddr));
> +			CONSUME(bpf_fentry_test13_pptr((void **)19));
> +			CONSUME(bpf_fentry_test13_pptr(ERR_PTR(-ENOMEM)));
> +			break;

[ ... ]


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/22118172993

AI-authorship-score: low
AI-authorship-explanation: Stale comment referencing a renamed function and an architecture coverage gap with WARN_ON are characteristic of human-authored code that underwent refactoring.
issues-found: 2
issue-severity-score: medium
issue-severity-explanation: WARN_ON(!kaddr) fires unconditionally on PowerPC where create_bad_kaddr() always returns NULL, producing kernel warnings on every test run and potential panics with panic_on_warn.

  reply	other threads:[~2026-02-17 22:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-17 22:13 [PATCH bpf-next v2 0/2] bpf: Add multi-level pointer parameter support for trampolines Slava Imameev
2026-02-17 22:13 ` [PATCH bpf-next v2 1/2] bpf: Support multi-level pointer params via PTR_TO_MEM " Slava Imameev
2026-02-17 22:13 ` [PATCH bpf-next v2 2/2] selftests/bpf: Add trampolines multi-level pointer params test coverage Slava Imameev
2026-02-17 22:47   ` bot+bpf-ci [this message]
2026-02-18  9:25   ` kernel test robot
2026-02-18  1:48 ` [PATCH bpf-next v2 0/2] bpf: Add multi-level pointer parameter support for trampolines Eduard Zingerman
2026-02-18 10:43   ` Re: [PATCH bpf-next v2 0/2] bpf: Add multi-level pointer parameter Slava Imameev
2026-02-18 16:16     ` David Windsor
2026-02-19  3:15     ` Alexei Starovoitov
2026-02-19  5:17       ` Yonghong Song
2026-02-23  9:44       ` Re: " Slava Imameev

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=c0aa6a42eb9fa557fc375b858d91dbadd74bbd6534be1b32fc9e0d05e540ee63@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=haoluo@google.com \
    --cc=horms@kernel.org \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-open-source@crowdstrike.com \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=slava.imameev@crowdstrike.com \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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

all inboxes | Powered by JetHome®