diff options
author | Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com> | 2022-07-08 15:36:57 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2022-07-19 22:51:35 +0300 |
commit | 1e6e826ffb7ac05f33fa123051c2fc2ddf0f68ea (patch) | |
tree | 86dc735702e15386745bbd4af5b9e8e617d08d89 /scripts | |
parent | 8f04c131cb71295d2f496fa7889d0e6995baf77c (diff) |
rseq: fix headers conflict on Mariner GNU/Linux
1. For some reason, Marier distribution headers
not correctly define __GLIBC_HAVE_KERNEL_RSEQ
compile-time constant. It remains undefined,
but in fact header files provides corresponding
rseq types declaration which leads to conflict.
2. Another issue, is that they use uint*_t types
instead of __u* types as in original rseq.h.
This leads to compile time issues like this:
format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'uint64_t' {aka 'long unsigned int'}
and we can't even replace %llx to %PRIx64 because it will break
compilation on other distros (like Fedora) with analogical error:
error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘__u64’ {aka ‘long long unsigned int’}
Let's use our-own struct rseq copy fully equal to the kernel one,
it's safe because this structure is a part of Linux Kernel ABI.
Fixes #1934
Reported-by: Nikola Bojanic
Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/feature-tests.mak | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak index 592552cb8..014e893a8 100644 --- a/scripts/feature-tests.mak +++ b/scripts/feature-tests.mak @@ -196,3 +196,22 @@ int main(void) return 0; } endef + +define FEATURE_TEST_NO_LIBC_RSEQ_DEFS + +#ifdef __has_include +#if __has_include(\"sys/rseq.h\") +#include <sys/rseq.h> +#endif +#endif + +enum rseq_cpu_id_state { + RSEQ_CPU_ID_UNINITIALIZED = -1, + RSEQ_CPU_ID_REGISTRATION_FAILED = -2, +}; + +int main(void) +{ + return 0; +} +endef |