代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-os/systemd 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 17037ec625fca9e9a473a33954d011065f0088e3 Mon Sep 17 00:00:00 2001
From: Guorui Yu <GuoRui.Yu@linux.alibaba.com>
Date: Fri, 23 Jun 2023 13:01:24 +0800
Subject: [PATCH] util: introduce explicit_bzero_safe for explicit memset
(cherry picked from commit f441ae81ef70e9bdfddbb9e0a276bbb8ca2151d4)
Signed-off-by: Guorui Yu <GuoRui.Yu@linux.alibaba.com>
---
src/basic/util.c | 18 ++++++++++++++++++
src/basic/util.h | 11 +++++++++++
2 files changed, 29 insertions(+)
diff --git a/src/basic/util.c b/src/basic/util.c
index 548e3652cc..bdfaca4aed 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -684,3 +684,21 @@ void disable_coredumps(void) {
if (r < 0)
log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
}
+
+#if !HAVE_EXPLICIT_BZERO
+/*
+ * The pointer to memset() is volatile so that compiler must de-reference the pointer and can't assume that
+ * it points to any function in particular (such as memset(), which it then might further "optimize"). This
+ * approach is inspired by openssl's crypto/mem_clr.c.
+ */
+typedef void *(*memset_t)(void *,int,size_t);
+
+static volatile memset_t memset_func = memset;
+
+void* explicit_bzero_safe(void *p, size_t l) {
+ if (l > 0)
+ memset_func(p, '\0', l);
+
+ return p;
+}
+#endif
diff --git a/src/basic/util.h b/src/basic/util.h
index 195f02cf5f..ab3314f82e 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -240,3 +240,14 @@ int version(void);
int str_verscmp(const char *s1, const char *s2);
void disable_coredumps(void);
+
+#if HAVE_EXPLICIT_BZERO
+static inline void* explicit_bzero_safe(void *p, size_t l) {
+ if (l > 0)
+ explicit_bzero(p, l);
+
+ return p;
+}
+#else
+void *explicit_bzero_safe(void *p, size_t l);
+#endif
--
2.39.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。