From b044e687af03eb87d614d511e43d3a2951c29597 Mon Sep 17 00:00:00 2001 From: carpet-crawler Date: Fri, 16 Aug 2024 19:36:34 -0300 Subject: [PATCH] Add zero_call_used_regs to sodium_memzero --- src/libsodium/sodium/utils.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libsodium/sodium/utils.c b/src/libsodium/sodium/utils.c index 055c1a5f..47f2ab8e 100644 --- a/src/libsodium/sodium/utils.c +++ b/src/libsodium/sodium/utils.c @@ -96,6 +96,10 @@ void *alloca (size_t); # define MADV_DONTDUMP MADV_NOCORE #endif +#if defined(__GNUC__) && __GNUC__ >= 11 +# define HAVE_ZERO_CALL_USED_REGS +#endif + #ifndef DEFAULT_PAGE_SIZE # ifdef PAGE_SIZE # define DEFAULT_PAGE_SIZE PAGE_SIZE @@ -122,6 +126,9 @@ _sodium_dummy_symbol_to_prevent_memzero_lto(void *const pnt, #endif /* LCOV_EXCL_STOP */ +#ifdef HAVE_ZERO_CALL_USED_REGS +__attribute__((zero_call_used_regs("all"))) +#endif void sodium_memzero(void * const pnt, const size_t len) {