BPF List
 help / color / mirror / Atom feed
From: Alan Maguire <alan.maguire@oracle.com>
To: ast@kernel.org, eddyz87@gmail.com
Cc: daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev,
	memxor@gmail.com, song@kernel.org, yonghong.song@linux.dev,
	jolsa@kernel.org, bpf@vger.kernel.org,
	Alan Maguire <alan.maguire@oracle.com>,
	Kaitao Cheng <pilgrimtao@gmail.com>
Subject: [PATCH bpf-next] Fix undefined symbol references for module build post cnum changes
Date: Mon, 27 Apr 2026 12:22:05 +0100	[thread overview]
Message-ID: <20260427112205.1346733-1-alan.maguire@oracle.com> (raw)

Seeing the following on bpf-next:

 DESCEND objtool
  DESCEND bpf/resolve_btfids
  INSTALL libsubcmd_headers
  INSTALL libsubcmd_headers
  MODPOST Module.symvers
ERROR: modpost: "cnum64_umin" [drivers/net/ethernet/netronome/nfp/nfp.ko] undefined!
ERROR: modpost: "cnum64_umax" [drivers/net/ethernet/netronome/nfp/nfp.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:147: Module.symvers] Error 1
make[1]: *** [bpf-next/Makefile:2089: modpost] Error 2
make: *** [Makefile:248: __sub-make] Error 2

Further investigation suggests nfp indeed does pull in those symbols,
likely due to references in include/linux/bpf_verifier.h:

static inline s64 reg_smax(const struct bpf_reg_state *reg)
{
        return cnum64_smax(reg->r64);
}

static inline u64 reg_umin(const struct bpf_reg_state *reg)
{
        return cnum64_umin(reg->r64);
}

...

Export symbols for these references.

Reported-by: Kaitao Cheng <pilgrimtao@gmail.com>
Fixes: bbc631085503 ("bpf: replace min/max fields with struct cnum{32,64}")
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
 kernel/bpf/cnum_defs.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/bpf/cnum_defs.h b/kernel/bpf/cnum_defs.h
index 3ebd8f723dbb..7d992ee6a8a4 100644
--- a/kernel/bpf/cnum_defs.h
+++ b/kernel/bpf/cnum_defs.h
@@ -6,6 +6,7 @@
 #endif
 
 #include <linux/cnum.h>
+#include <linux/kernel.h>
 #include <linux/limits.h>
 #include <linux/minmax.h>
 #include <linux/compiler_types.h>
@@ -23,6 +24,7 @@ struct cnum_t FN(from_urange)(ut min, ut max)
 {
 	return (struct cnum_t){ .base = min, .size = (ut)max - min };
 }
+EXPORT_SYMBOL_GPL(FN(from_urange));
 
 struct cnum_t FN(from_srange)(st min, st max)
 {
@@ -31,6 +33,7 @@ struct cnum_t FN(from_srange)(st min, st max)
 
 	return (struct cnum_t){ .base = base, .size = size };
 }
+EXPORT_SYMBOL_GPL(FN(from_srange));
 
 /* True if this cnum represents two unsigned ranges. */
 static inline bool FN(urange_overflow)(struct cnum_t cnum)
@@ -48,11 +51,13 @@ ut FN(umin)(struct cnum_t cnum)
 {
 	return FN(urange_overflow)(cnum) ? 0 : cnum.base;
 }
+EXPORT_SYMBOL_GPL(FN(umin));
 
 ut FN(umax)(struct cnum_t cnum)
 {
 	return FN(urange_overflow)(cnum) ? UT_MAX : cnum.base + cnum.size;
 }
+EXPORT_SYMBOL_GPL(FN(umax));
 
 /* True if this cnum represents two signed ranges. */
 static inline bool FN(srange_overflow)(struct cnum_t cnum)
@@ -71,6 +76,7 @@ st FN(smin)(struct cnum_t cnum)
 	       ? ST_MIN
 	       : min((st)cnum.base, (st)(cnum.base + cnum.size));
 }
+EXPORT_SYMBOL_GPL(FN(smin));
 
 st FN(smax)(struct cnum_t cnum)
 {
@@ -78,6 +84,7 @@ st FN(smax)(struct cnum_t cnum)
 	       ? ST_MAX
 	       : max((st)cnum.base, (st)(cnum.base + cnum.size));
 }
+EXPORT_SYMBOL_GPL(FN(smax));
 
 /*
  * Returns a possibly empty intersection of cnums 'a' and 'b'.
-- 
2.39.3


             reply	other threads:[~2026-04-27 11:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 11:22 Alan Maguire [this message]
2026-04-27 12:08 ` [PATCH bpf-next] Fix undefined symbol references for module build post cnum changes Chengkaitao
2026-04-27 16:44 ` Eduard Zingerman
2026-04-27 17:07   ` Eduard Zingerman
2026-04-27 17:11     ` Alexei Starovoitov
2026-04-29 17:10       ` Alan Maguire

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=20260427112205.1346733-1-alan.maguire@oracle.com \
    --to=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=pilgrimtao@gmail.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