BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] Fix undefined symbol references for module build post cnum changes
@ 2026-04-27 11:22 Alan Maguire
  2026-04-27 12:08 ` Chengkaitao
  2026-04-27 16:44 ` Eduard Zingerman
  0 siblings, 2 replies; 6+ messages in thread
From: Alan Maguire @ 2026-04-27 11:22 UTC (permalink / raw)
  To: ast, eddyz87
  Cc: daniel, andrii, martin.lau, memxor, song, yonghong.song, jolsa,
	bpf, Alan Maguire, Kaitao Cheng

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-04-29 17:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27 11:22 [PATCH bpf-next] Fix undefined symbol references for module build post cnum changes Alan Maguire
2026-04-27 12:08 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox