diff --git a/dev-libs/libtraceevent/files/libtraceevent-1.9.0-32-bit-tests-deux.patch b/dev-libs/libtraceevent/files/libtraceevent-1.9.0-32-bit-tests-deux.patch new file mode 100644 index 0000000000000..36930d3681ca5 --- /dev/null +++ b/dev-libs/libtraceevent/files/libtraceevent-1.9.0-32-bit-tests-deux.patch @@ -0,0 +1,49 @@ +https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/commit/?id=7f9698364b2617ed343e7736904b75cff943132a + +From 7f9698364b2617ed343e7736904b75cff943132a Mon Sep 17 00:00:00 2001 +From: Emil Thorsoe +Date: Thu, 7 May 2026 17:23:22 +0300 +Subject: libtraceevent utest: Fix type of args in test_btf_read + +On 32-bit system args contains values that do not fit in 32 long, +use uint64_t. + +Link: https://lore.kernel.org/7940a891-2af7-4ae1-ad5f-3cf7960df529@tuxera.com +Signed-off-by: Emil Thorsoe +Signed-off-by: Steven Rostedt +--- + utest/traceevent-utest.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/utest/traceevent-utest.c b/utest/traceevent-utest.c +index 7d09bf2..ea64166 100644 +--- a/utest/traceevent-utest.c ++++ b/utest/traceevent-utest.c +@@ -8,6 +8,7 @@ + */ + #include + #include ++#include + #include + #include + #include +@@ -382,7 +383,7 @@ static void test_parse_sizeof_undef(void) + + static void test_btf_read(void) + { +- unsigned long args[] = {0x7ffe7d33f3d0, 0, 0, 0, 0, 0}; ++ uint64_t args[] = {0x7ffe7d33f3d0, 0, 0, 0, 0, 0}; + const char *func = "getname_flags"; + struct trace_seq *s = test_seq; + struct stat st; +@@ -420,7 +421,7 @@ static void test_btf_read(void) + trace_seq_init(s); + trace_seq_printf(s, "%s(", func); + +- CU_TEST(tep_btf_print_args(test_tep, s, args, nr, sizeof(long), func) == 0); ++ CU_TEST(tep_btf_print_args(test_tep, s, args, nr, sizeof(*args), func) == 0); + + trace_seq_puts(s, ")\n"); + trace_seq_terminate(s); +-- +cgit 1.3-korg diff --git a/dev-libs/libtraceevent/files/libtraceevent-1.9.0-32-bit-tests.patch b/dev-libs/libtraceevent/files/libtraceevent-1.9.0-32-bit-tests.patch new file mode 100644 index 0000000000000..9b2ad30242f0c --- /dev/null +++ b/dev-libs/libtraceevent/files/libtraceevent-1.9.0-32-bit-tests.patch @@ -0,0 +1,60 @@ +https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/commit/?id=5b44859765fc10920cfde68f8e327e6c92fc23ee + +From 5b44859765fc10920cfde68f8e327e6c92fc23ee Mon Sep 17 00:00:00 2001 +From: Emil Thorsoe +Date: Wed, 6 May 2026 22:11:51 +0300 +Subject: libtraceevent utest: Read btf file in utest if mmap fails + +When mmap of the btf file fails in utest, fall back to malloc and +read. + +This mmap fails with ENODEV on i686 nix build on nixos-unstable. + +Link: https://lore.kernel.org/d6e07cd6-cb78-4119-a048-920ca58b4830@tuxera.com +Signed-off-by: Emil Thorsoe +Signed-off-by: Steven Rostedt +--- + utest/traceevent-utest.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/utest/traceevent-utest.c b/utest/traceevent-utest.c +index b62411c..7d09bf2 100644 +--- a/utest/traceevent-utest.c ++++ b/utest/traceevent-utest.c +@@ -388,6 +388,7 @@ static void test_btf_read(void) + struct stat st; + void *buf; + int fd, nr = 6; ++ bool malloced = false; + + fd = open("/sys/kernel/btf/vmlinux", O_RDONLY); + if (fd < 0) { +@@ -397,11 +398,23 @@ static void test_btf_read(void) + CU_TEST(fstat(fd, &st) == 0); + + buf = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); +- CU_TEST(buf != MAP_FAILED); +- ++ if (buf == MAP_FAILED) { ++ malloced = true; ++ buf = malloc(st.st_size); ++ if (buf == NULL) { ++ printf("[FAILED TO ALLOCATE MEMORY FOR BTF FILE CONTENTS] ..."); ++ close(fd); ++ return; ++ } ++ CU_TEST(read(fd, buf, st.st_size) == st.st_size); ++ } + CU_TEST(tep_load_btf(test_tep, buf, st.st_size) == 0); + +- munmap(buf, st.st_size); ++ if (malloced) { ++ free(buf); ++ } else { ++ munmap(buf, st.st_size); ++ } + close(fd); + + trace_seq_init(s); +-- +cgit 1.3-korg diff --git a/dev-libs/libtraceevent/libtraceevent-1.9.0.ebuild b/dev-libs/libtraceevent/libtraceevent-1.9.0.ebuild index c961359b5195f..ccf1210114ba5 100644 --- a/dev-libs/libtraceevent/libtraceevent-1.9.0.ebuild +++ b/dev-libs/libtraceevent/libtraceevent-1.9.0.ebuild @@ -30,6 +30,11 @@ BDEPEND=" test? ( dev-util/cunit ) " +PATCHES=( + "${FILESDIR}"/${P}-32-bit-tests.patch + "${FILESDIR}"/${P}-32-bit-tests-deux.patch +) + src_configure() { local emesonargs=( -Dasciidoctor=false