All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pu Lehui" <pulehui@huaweicloud.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 4/7] bpf, sparc64: Fix memory leak in bpf_jit_free
Date: Sat, 25 Jul 2026 10:29:29 +0000	[thread overview]
Message-ID: <20260725102929.E47251F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260725102020.2287770-5-pulehui@huaweicloud.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch introduces fatal compilation errors by dereferencing an undefined struct `struct bpf_jit_data` and calling an undeclared function `bpf_jit_binary_hdr`.
--

--- Patch [4]: [PATCH bpf-next v2 4/7] bpf, sparc64: Fix memory leak in bpf_jit_free ---
commit 85bc88f184eccb691d35e9449a95fcc1e9059dca
Author: Pu Lehui <pulehui@huawei.com>

bpf, sparc64: Fix memory leak in bpf_jit_free

If a subprogram fails to JIT in jit_subprogs(), previously JITed
subprograms are freed. However, the generic bpf_jit_free() fails to
free their leftover jit_data, causing a memory leak.

> diff --git a/arch/sparc/net/bpf_jit_comp_64.c b/arch/sparc/net/bpf_jit_comp_64.c
> index 2fa0e93751276..3b72ff2dba9ce 100644
> --- a/arch/sparc/net/bpf_jit_comp_64.c
> +++ b/arch/sparc/net/bpf_jit_comp_64.c
> @@ -1611,3 +1611,22 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr
>  	}
>  	goto out_off;
>  }
> +
> +void bpf_jit_free(struct bpf_prog *fp)
> +{
> +	if (fp->jited) {
> +		struct bpf_jit_data *jit_data = fp->aux->jit_data;
> +		struct bpf_binary_header *hdr = bpf_jit_binary_hdr(fp);

[Severity: Low]
Does this code introduce a build regression for sparc64? The
architecture-specific struct appears to be struct sparc64_jit_data rather
than struct bpf_jit_data, which would cause an incomplete type error when
dereferencing jit_data->ctx.offset below.

Also, is bpf_jit_binary_hdr() available in this context? It appears to be a
static inline function defined locally in kernel/bpf/core.c, which would cause
an implicit declaration error during compilation here in
arch/sparc/net/bpf_jit_comp_64.c.

> +
> +		/* Cleanup for earlier subprogs if jit_subprogs() aborts */
> +		if (jit_data) {
> +			kfree(jit_data->ctx.offset);
> +			kfree(jit_data);
> +		}
> +
> +		bpf_jit_binary_free(hdr);
> +		WARN_ON_ONCE(!bpf_prog_kallsyms_verify_off(fp));
> +	}
> +
> +	bpf_prog_unlock_free(fp);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260725102020.2287770-1-pulehui@huaweicloud.com?part=4

  reply	other threads:[~2026-07-25 10:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-25 10:20 [PATCH bpf-next v2 0/7] Fixes for bpf_jit_free Pu Lehui
2026-07-25 10:20 ` [PATCH bpf-next v2 1/7] bpf, arm64: Fix memory leak in bpf_jit_free Pu Lehui
2026-07-25 10:31   ` sashiko-bot
2026-07-25 10:20 ` [PATCH bpf-next v2 2/7] s390/bpf: " Pu Lehui
2026-07-25 10:27   ` sashiko-bot
2026-07-25 10:20 ` [PATCH bpf-next v2 3/7] parisc: " Pu Lehui
2026-07-25 10:28   ` sashiko-bot
2026-07-25 10:20 ` [PATCH bpf-next v2 4/7] bpf, sparc64: " Pu Lehui
2026-07-25 10:29   ` sashiko-bot [this message]
2026-07-25 10:20 ` [PATCH bpf-next v2 5/7] ARC, bpf: " Pu Lehui
2026-07-25 10:29   ` sashiko-bot
2026-07-25 10:20 ` [PATCH bpf-next v2 6/7] riscv, bpf: Adjust bpf_func to account for CFI offset " Pu Lehui
2026-07-25 10:27   ` sashiko-bot
2026-07-25 10:20 ` [PATCH bpf-next v2 7/7] bpf: Fix double-free RO header " Pu Lehui

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=20260725102929.E47251F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=pulehui@huaweicloud.com \
    --cc=sashiko-reviews@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.