| Message ID | 20250523074107.3655219-1-jiaying.song.cn@windriver.com |
|---|---|
| State | Changes Requested |
| Headers | show |
| Series | syscalls/semctl08: Skip semctl08 when __USE_TIME64_REDIRECTS is defined | expand |
| Context | Check | Description |
|---|---|---|
| ltpci/debian_stable_aarch64-linux-gnu-gcc_arm64 | success | success |
| ltpci/debian_stable_s390x-linux-gnu-gcc_s390x | success | success |
| ltpci/debian_stable_powerpc64le-linux-gnu-gcc_ppc64el | success | success |
| ltpci/debian_stable_gcc | success | success |
| ltpci/debian_stable_gcc | success | success |
| ltpci/ubuntu_jammy_gcc | success | success |
| ltpci/opensuse-archive_42-2_gcc | success | success |
| ltpci/ubuntu_bionic_gcc | success | success |
| ltpci/debian_testing_gcc | success | success |
| ltpci/alpine_latest_gcc | success | success |
| ltpci/quay-io-centos-centos_stream9_gcc | success | success |
| ltpci/fedora_latest_clang | success | success |
| ltpci/debian_testing_clang | success | success |
| ltpci/debian_oldstable_clang | success | success |
| ltpci/debian_oldstable_gcc | success | success |
| ltpci/opensuse-leap_latest_gcc | success | success |
Hi Jiaying, [ NOTE: Ricardo was wrongly set the sender by patchwork ] > From: Jiaying Song <jiaying.song.cn@windriver.com> > When __USE_TIME64_REDIRECTS is defined, glibc redirects struct semid_ds to a > 64-bit time-safe version that omits the sem_otime_high and sem_ctime_high > fields. As a result, the case becomes invalid and leads to incorrect behavior. > This patch adds a check to skip the test when __USE_TIME64_REDIRECTS is > defined, ensuring the test only runs when semid_ds structurally matches > semid64_ds and the *_high fields are accessible. Looking into this old patch. Depending on glibc specific internal definition is not a preferred approach (definition can be renamed). I wonder if this could be detected with m4 macro or otherwise (some kind of sizeof check). IMHO glibc has not switched to 64bit time-safe version by default yet, right? And it depends on glibc being compiled with -D_TIME_BITS=64 and -D_FILE_OFFSET_BITS=64, right? But these aren't detectable, right? Looking at glibc sources [1], _TIME_BITS and _FILE_OFFSET_BITS really determine __USE_TIME64_REDIRECTS: #if defined _TIME_BITS # if _TIME_BITS == 64 # if ! defined (_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64 # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64" # endif # define __USE_TIME_BITS64 1 # elif _TIME_BITS == 32 # if __TIMESIZE > 32 # error "_TIME_BITS=32 is not compatible with __TIMESIZE > 32" # endif # else # error Invalid _TIME_BITS value (can only be 32 or 64-bit) # endif #elif __TIMESIZE == 64 # define __USE_TIME_BITS64 1 #endif #if defined __USE_TIME_BITS64 && __TIMESIZE == 32 # define __USE_TIME64_REDIRECTS 1 #endif _TIME_BITS toolchain support is detected by configure.ac [2] and nowadays is probably 64 bit by default, see timezone/private.h [3]: #if !defined _TIME_BITS && _FILE_OFFSET_BITS == 64 # define _TIME_BITS 64 #endif And the same question applies to your other msgctl05 related patch [4]. Kind regards, Petr [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/features-time64.h;h=8d573cd23e48c0f771c72350168b04c6a38c7864;hb=a4ed0471d71739928a0d0fa3258b3ff3b158e9b9 [2] https://sourceware.org/git/?p=glibc.git;a=blob;f=configure.ac;h=af57b0cbae8c1b22bfdc7a4e47d46c4e5064873a;hb=HEAD#l1826 [3] https://sourceware.org/git/?p=glibc.git;a=blob;f=timezone/private.h;h=c33041049f4c8f40b874c23b6fe0556967069b2c;hb=HEAD#l167 [4] https://patchwork.ozlabs.org/project/ltp/patch/20250522093003.1958528-1-jiaying.song.cn@windriver.com/ > Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com> > --- > testcases/kernel/syscalls/ipc/semctl/semctl08.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl08.c b/testcases/kernel/syscalls/ipc/semctl/semctl08.c > index 1878bd4..3b799fa 100644 > --- a/testcases/kernel/syscalls/ipc/semctl/semctl08.c > +++ b/testcases/kernel/syscalls/ipc/semctl/semctl08.c > @@ -10,7 +10,11 @@ > #include "tst_test.h" > #include "libnewipc.h" > -#ifdef HAVE_SEMID64_DS_TIME_HIGH > +#if !defined(HAVE_SEMID64_DS_TIME_HIGH) > +TST_TEST_TCONF("test requires struct semid64_ds to have the time_high fields"); > +#elif defined(__USE_TIME64_REDIRECTS) > +TST_TEST_TCONF("test requires __USE_TIME64_REDIRECTS to be undefined"); > +#else > static void run(void) > { > @@ -47,6 +51,4 @@ static struct tst_test test = { > .test_all = run, > .needs_tmpdir = 1, > }; > -#else > -TST_TEST_TCONF("test requires struct semid64_ds to have the time_high fields"); > #endif
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl08.c b/testcases/kernel/syscalls/ipc/semctl/semctl08.c index 1878bd4..3b799fa 100644 --- a/testcases/kernel/syscalls/ipc/semctl/semctl08.c +++ b/testcases/kernel/syscalls/ipc/semctl/semctl08.c @@ -10,7 +10,11 @@ #include "tst_test.h" #include "libnewipc.h" -#ifdef HAVE_SEMID64_DS_TIME_HIGH +#if !defined(HAVE_SEMID64_DS_TIME_HIGH) +TST_TEST_TCONF("test requires struct semid64_ds to have the time_high fields"); +#elif defined(__USE_TIME64_REDIRECTS) +TST_TEST_TCONF("test requires __USE_TIME64_REDIRECTS to be undefined"); +#else static void run(void) { @@ -47,6 +51,4 @@ static struct tst_test test = { .test_all = run, .needs_tmpdir = 1, }; -#else -TST_TEST_TCONF("test requires struct semid64_ds to have the time_high fields"); #endif