[LTP] Make sure 32-bit powerpc syscall defs don't leak to 64-bit powerpc systems
Martin Cermak
mcermak@redhat.com
Mon Aug 4 22:11:41 CEST 2025
Hello folks,
I think I see a problem in how generate_syscalls.sh generates the
syscalls.h header on 64-bit powerpc systems. I've filed [1] to
cover this. But folks seem to prefer the mailing list patch
submission, so let me try :) Please review the attached patch.
Thanks,
Martin
---------------
[1] https://github.com/linux-test-project/ltp/issues/1251
-------------- next part --------------
>From a90b2aac69028bd6b9e0fcc1e36760639b937b99 Mon Sep 17 00:00:00 2001
From: Martin Cermak <mcermak@redhat.com>
Date: Mon, 4 Aug 2025 21:46:52 +0200
Subject: [PATCH] Make sure 32-bit powerpc syscall defs don't leak to 64-bit
powerpc systems
generate_syscalls.sh generates the syscalls.h header at the configure
time. At the moment, that header has a set of 32-bit syscalls defined
with the __powerpc__ gate, plus another set of 64-bit syscalls defined
with the __powerpc64__ gate. For 32-bit powerpc systems that's fine.
But for a 64-bit powerpc system this means that both sets of syscalls
become defined, which isn't right.
Thing is that on a 64-bit powerpc system, both __powerpc__ and
__powerpc64__ are defined compiler macros, while on a 32-bit powerpc
system, only the former is defined while the latter is not.
That said, the correct gate for a 32-bit only powerpc code is:
#if defined(__powerpc__) && !defined(__powerpc64__)
Without this patch, e.g. __NR_clock_gettime64 def leaks to
64-bit powerpc systems, which is wrong. This patch fixes it.
---
include/lapi/syscalls/generate_syscalls.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/lapi/syscalls/generate_syscalls.sh b/include/lapi/syscalls/generate_syscalls.sh
index b17c72ddf..19f280dfb 100755
--- a/include/lapi/syscalls/generate_syscalls.sh
+++ b/include/lapi/syscalls/generate_syscalls.sh
@@ -78,6 +78,7 @@ while IFS= read -r arch; do
parisc) echo "#ifdef __hppa__" ;;
loongarch64) echo "#ifdef __loongarch__" ;;
arm64) echo "#ifdef __aarch64__" ;;
+ powerpc) echo "#if defined(__powerpc__) && !defined(__powerpc64__)" ;;
*) echo "#ifdef __${arch}__" ;;
esac
--
2.48.1
More information about the ltp
mailing list