Skip to contentSkip to conversation

ltrace: fix PRIb64 length modifier on LP64 musl

PATCH New Anuj Mittal 1 participant 4 messages Jul 24

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 ltrace: fix PRIb64 length modifier on LP64 musl

From: Alejandro Mery <[email protected]>

lens_default.c defines PRIb64 through a fallback that hardcodes __PRI64_PREFIX as "ll". That is only correct where uint64_t is unsigned long long (ILP32). On LP64 musl targets uint64_t is unsigned long, so the resulting "%llb" conversion does not match the argument and do_compile aborts under -Werror=format:

lens_default.c:90:48: error: format '%llb' expects argument of type 'long long unsigned int', but argument 3 has type 'uint64_t' {aka 'long unsigned int'}

glibc never reaches the fallback: it defines __PRI64_PREFIX itself, wordsize aware, in <inttypes.h>. musl provides the same modifier there under the name __PRI64 but not __PRI64_PREFIX, so the hardcoded "ll" is used and is wrong on 64-bit. Reuse musl's __PRI64 when __PRI64_PREFIX is absent, keeping "ll" as a last resort. glibc builds are unaffected: the block is skipped entirely.

(cherry picked from commit 09a7b1507297a437bb1119dac80613649cfa1886)
---
 ...t-fix-PRIb64-length-modifier-on-musl.patch | 49 +++++++++++++++++++
 .../recipes-devtools/ltrace/ltrace_0.8.1.bb   |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/ltrace/ltrace/0001-lens_default-fix-PRIb64-length-modifier-on-musl.patch
meta-oe/recipes-devtools/ltrace/ltrace/0001-lens_default-fix-PRIb64-length-modifier-on-musl.patch new file +49 -0
new file mode 100644
index 0000000000..b644efff94
@@ -0,0 +1,49 @@
+From 1a03dca3000616aa61d2c8137068706c9095a653 Mon Sep 17 00:00:00 2001
+From: Alejandro Mery <[email protected]>
+Date: Mon, 20 Jul 2026 20:13:56 +0000
+Subject: [PATCH] lens_default: fix PRIb64 length modifier on LP64 musl
+
+The fallback that defines PRIb64 hardcodes __PRI64_PREFIX as "ll", which
+is only correct where uint64_t is unsigned long long (ILP32). On LP64
+targets uint64_t is unsigned long, so the resulting "%llb" conversion
+does not match the argument and, with -Werror=format, aborts the build:
+
+    lens_default.c:90:48: error: format '%llb' expects argument of type
+    'long long unsigned int', but argument 3 has type 'uint64_t'
+    {aka 'long unsigned int'}
+
+glibc never reaches the fallback: it defines __PRI64_PREFIX itself,
+wordsize aware, in <inttypes.h>. musl provides the same modifier there
+under the name __PRI64 but not __PRI64_PREFIX, so the hardcoded "ll" is
+used and is wrong on 64-bit.
+
+Reuse musl's __PRI64 when __PRI64_PREFIX is absent, keeping the literal
+"ll" as a last resort for C libraries that expose neither.
+
+Upstream-Status: Submitted [https://gitlab.com/cespedes/ltrace/-/merge_requests/69]
+Signed-off-by: Alejandro Mery <[email protected]>
+---
+ lens_default.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/lens_default.c b/lens_default.c
+index 0de6f37..28df811 100644
+--- a/lens_default.c
++++ b/lens_default.c
+@@ -64,8 +64,13 @@ READER(read_double, double)
+ 
+ #ifndef PRIb64  // Underlying format supported by bookworm glibc, but macros not exposed until 2.38
+ #ifndef __PRI64_PREFIX
++/* glibc exposes the 64-bit length modifier as __PRI64_PREFIX; musl as __PRI64 */
++#ifdef __PRI64
++#define __PRI64_PREFIX __PRI64
++#else
+ #define __PRI64_PREFIX "ll"
+ #endif
++#endif
+ #define PRIb64 __PRI64_PREFIX "b"
+ #endif
+ #define HANDLE_WIDTH(BITS)						\
+-- 
+2.47.3
+
meta-oe/recipes-devtools/ltrace/ltrace_0.8.1.bb +1 -0
index 77bb61830b..aa377e2ec8 100644
@@ -27,6 +27,7 @@ SRC_URI = "git://gitlab.com/cespedes/ltrace.git;protocol=https;branch=main;tag=$
            file://0001-proc-Make-PROC_PID_FILE-not-use-variable-length-arra.patch \
            file://0001-dwarf_prototypes-return-NULL-from-NEXT_SIBLING-on-er.patch \
            file://0001-trace-fix-1-bit-bitfield-assignments-for-clang-Wsing.patch \
+           file://0001-lens_default-fix-PRIb64-length-modifier-on-musl.patch \
            "
 SRC_URI:append:libc-musl = " file://add_ppc64le.patch"
 
Signature · 1 line
2.54.0
#1 lore raw

PATCH 2/4 bpftool-native: Fix -Wdiscarded-qualifiers errors for glibc 2.42+

From: He Zhe <[email protected]>

Backport a patch from kernel to fix the following build errors.

bbpf.c: In function ‘kallsyms_cb’:

| libbpf.c:8192:13: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
|  8192 |         res = strstr(sym_name, ".llvm.");
|       |             ^
| libbpf.c: In function ‘avail_kallsyms_cb’:
| libbpf.c:11497:31: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
| 11497 |                 if (!(sym_sfx = strstr(sym_name, ".llvm.")))
|       |                               ^
| libbpf.c: In function ‘resolve_full_path’:
| libbpf.c:12085:35: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
| 12085 |                         next_path = strchr(s, ':');
|       |
(cherry picked from commit 0a3798eaed3f45a93463414c0f4752b54e8978de)
---
 .../bpftool/bpftool-native_6.16.bb            |  5 +-
 ...-Fix-Wdiscarded-qualifiers-under-C23.patch | 69 +++++++++++++++++++
 2 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-kernel/bpftool/bpftool/0001-libbpf-Fix-Wdiscarded-qualifiers-under-C23.patch
meta-oe/recipes-kernel/bpftool/bpftool-native_6.16.bb +4 -1
index fe3ad6138e..edc635517a 100644
@@ -9,7 +9,10 @@ DEPENDS = "binutils-native elfutils-native"
 
 inherit native bash-completion
 
-SRC_URI = "${KERNELORG_MIRROR}/linux/kernel/v6.x/linux-${PV}.tar.xz"
+SRC_URI = "\
+    ${KERNELORG_MIRROR}/linux/kernel/v6.x/linux-${PV}.tar.xz \
+    file://0001-libbpf-Fix-Wdiscarded-qualifiers-under-C23.patch \
+"
 SRC_URI[sha256sum] = "1a4be2fe6b5246aa4ac8987a8a4af34c42a8dd7d08b46ab48516bcc1befbcd83"
 
 S = "${UNPACKDIR}/linux-${PV}"
meta-oe/recipes-kernel/bpftool/bpftool/0001-libbpf-Fix-Wdiscarded-qualifiers-under-C23.patch new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
2.54.0
#2 lore raw

PATCH 3/4 python3-h11: set CVE_PRODUCT

In reply to Anuj Mittal

From: mark.yang <[email protected]>

The pypi class default python:h11 doesn't match how h11 is tracked in the CVE databases. NVD has no CPE for it yet; the only existing record (CVE-2025-43859) carries python-hyper:h11 in its CNA affected entry [1], so set that pair.

CVE-2025-43859 (request smuggling) is fixed in 0.16.0, the version we ship, so it resolves as not affected.

[1] https://www.cve.org/CVERecord?id=CVE-2025-43859

(cherry picked from commit a9bfe001bdfe740e89cf8afd41e6348e31a07211)
---
 meta-python/recipes-devtools/python/python3-h11_0.16.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-python/recipes-devtools/python/python3-h11_0.16.0.bb +2 -0
index a47e6ab61e..ed1702ff54 100644
@@ -7,4 +7,6 @@ inherit pypi setuptools3
 
 SRC_URI[sha256sum] = "4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"
 
+CVE_PRODUCT = "python-hyper:h11"
+
 RDEPENDS:${PN} += "python3-profile"
Signature · 1 line
2.54.0
#3 lore raw

PATCH 4/4 sysdig: Use LuaJIT headers to match the linked LuaJIT library

In reply to Anuj Mittal

From: Khem Raj <[email protected]>

csysdig fails to link when stock Lua is also present in the sysroot:

ld.lld: error: undefined symbol: luaL_openselectedlibs

Quoted 1 line
Quoted 1 line
Quoted 1 line

referenced by chisel.cpp:1190

ld.lld: error: undefined symbol: lua_pcallk
ld.lld: error: undefined symbol: lua_setglobal

sysdig's chisel code does #include "lua.h" and links against LuaJIT (lua${JIT}), but the recipe-sysroot also carries stock Lua headers (openembedded-core lua installs lua.h into ${includedir}). Those headers win the include search over ${includedir}/luajit-2.1, so the chisel objects are compiled against stock Lua while the binary links libluajit-5.1.so. In Lua >= 5.4.4 luaL_openlibs is a macro for luaL_openselectedlibs and lua_setglobal/lua_pcallk are real symbols, none of which LuaJIT (a Lua 5.1 ABI) provides, hence the undefined references. -DLUA_INCLUDE_DIR does not help: sysdig's luajit.cmake only consults it in its stock-Lua fallback, not when it finds LuaJIT.

Prepend ${STAGING_INCDIR}/luajit-2.1 to CFLAGS/CXXFLAGS. These land in CMAKE_CXX_FLAGS, which precede CMake's generated -I includes, so LuaJIT's lua.h is found first and matches the linked library.

(cherry picked from commit 00e7a9118097cbcf4677cbcfebb772357623f4cd)
---
 meta-oe/recipes-extended/sysdig/sysdig_0.39.0.bb | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
meta-oe/recipes-extended/sysdig/sysdig_0.39.0.bb +11 -2
index 6d754b9bd0..bea66ad17c 100644
@@ -62,9 +62,18 @@ EXTRA_OECMAKE = "\
                 -DCREATE_TEST_TARGETS=OFF \
 "
 
+# sysdig's chisel code does #include "lua.h". The recipe-sysroot also carries
+# stock Lua headers (openembedded-core lua installs lua.h into ${includedir}),
+# which are ABI-incompatible with the LuaJIT library sysdig links against: in
+# Lua >= 5.4.4 luaL_openlibs is a macro for luaL_openselectedlibs and
+# lua_setglobal/lua_pcallk are real symbols, none of which LuaJIT provides.
+# sysdig's luajit.cmake only honours LUA_INCLUDE_DIR in its stock-Lua fallback,
+# not when it finds LuaJIT, and the LuaJIT include dir does not win the search
+# order, so lua.h resolves to the stock header and the link fails. Put the
+# LuaJIT include dir first so its lua.h is used and matches the linked library.
 #Add include dir to find driver_config.h
-CXXFLAGS:append = " -I${WORKDIR}/driver_Make/driver/src"
-CFLAGS:append = " -I${WORKDIR}/driver_Make/driver/src"
+CXXFLAGS:append = " -I${STAGING_INCDIR}/luajit-2.1 -I${WORKDIR}/driver_Make/driver/src"
+CFLAGS:append = " -I${STAGING_INCDIR}/luajit-2.1 -I${WORKDIR}/driver_Make/driver/src"
 
 #To fix do_package QA Issue
 do_compile:append() {
Signature · 1 line
2.54.0