[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/6] Implement fallback for explicit_bzero using jump to volatile
From: |
roucaries . bastien |
Subject: |
[PATCH 5/6] Implement fallback for explicit_bzero using jump to volatile pointer |
Date: |
Mon, 13 Apr 2020 01:09:17 +0200 |
From: Bastien Roucariès <address@hidden>
Signed-off-by: Bastien Roucariès <address@hidden>
---
lib/explicit_bzero.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
index bb52d11de..03968acbf 100644
--- a/lib/explicit_bzero.c
+++ b/lib/explicit_bzero.c
@@ -54,9 +54,8 @@ explicit_bzero (void *s, size_t len)
explicit_memset (s, 0, len);
#elif HAVE_MEMSET_S
(void) memset_s (s, len, '\0', len);
-#else
+#elif defined __GNUC__
memset (s, '\0', len);
-#if defined __GNUC__
# if !defined __clang__
/* Compiler barrier. */
asm volatile ("" ::: "memory");
@@ -64,5 +63,8 @@ explicit_bzero (void *s, size_t len)
/* https://bugs.llvm.org/show_bug.cgi?id=15495#c11 */
__asm__ volatile("" : : "g"(s) : "memory");
# endif
+#else
+ static void * (* const volatile volatile_memset)(void *, int, size_t) =
memset;
+ (void) volatile_memset1(s, '\0', len);
#endif
}
--
2.25.1
- [V3][0/6] explicit_bzero, roucaries . bastien, 2020/04/12
- [PATCH 1/6] Fix test in case of canaries on heap buffer after free, roucaries . bastien, 2020/04/12
- [PATCH 2/6] Use memset_s if possible for explicit_bzero, roucaries . bastien, 2020/04/12
- [PATCH 3/6] Use SecureZeroMemory on windows for explicit_bzero, roucaries . bastien, 2020/04/12
- [PATCH 4/6] Support clang for explicit_bzero, roucaries . bastien, 2020/04/12
- [PATCH 5/6] Implement fallback for explicit_bzero using jump to volatile pointer,
roucaries . bastien <=
- [PATCH 6/6] Improve styling in explicit_bzero, roucaries . bastien, 2020/04/12