diff options
author | Andrew G. Morgan <morgan@kernel.org> | 2021-11-14 20:38:30 -0800 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2021-11-14 20:38:30 -0800 |
commit | e9414f540a82b5348a12cfaddff229241564e1f3 (patch) | |
tree | 54660b2051f01140d51f0df531751b8a8611f3c3 | |
parent | c234bf90839f19e0332b586335411cb626a25a18 (diff) | |
download | libcap-e9414f540a82b5348a12cfaddff229241564e1f3.tar.gz |
Work around musl not hard-coding the ABI for Linux x86_64.
There seems to be a subtle difference between glibc and musl over
whether or not a runnable *.so needs to start out with its stack
aligned to 16 bytes or not. Since Linux ABIs for x86 (both 32 and
64 bit varieties) require 16 byte alignment, just force it on both
these architectures.
This addresses:
https://bugzilla.kernel.org/show_bug.cgi?id=215009
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
-rw-r--r-- | libcap/execable.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libcap/execable.h b/libcap/execable.h index 229dd2f..7cf9b34 100644 --- a/libcap/execable.h +++ b/libcap/execable.h @@ -71,15 +71,19 @@ static void __execable_parse_args(int *argc_p, char ***argv_p) } /* - * Note, to avoid any runtime confusion, SO_MAIN is a void static - * function. + * Linux x86 ABI requires the stack be 16 byte aligned. Keep things + * simple and just force it. */ -#if defined(__i386__) +#if defined(__i386__) || defined(__x86_64__) #define __SO_FORCE_ARG_ALIGNMENT __attribute__((force_align_arg_pointer)) #else #define __SO_FORCE_ARG_ALIGNMENT -#endif /* def __i386 */ +#endif /* def some x86 */ +/* + * Note, to avoid any runtime confusion, SO_MAIN is a void static + * function. + */ #define SO_MAIN \ static void __execable_main(int, char**); \ extern void __so_start(void); \ |