Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jun 2024 19:16:39 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 25878310adcb - stable/13 - LinuxKPI: implement memzero_explicit()
Message-ID:  <202406121916.45CJGdnN003674@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=25878310adcbb361b31bc89b34f744c0c5a29bb1

commit 25878310adcbb361b31bc89b34f744c0c5a29bb1
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-04-02 09:30:49 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-06-12 16:57:01 +0000

    LinuxKPI: implement memzero_explicit()
    
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    emaste
    Differential Revision: https://reviews.freebsd.org/D44586
    
    (cherry picked from commit 218b2ccf8cc90698487515c681f3e3453b0dcead)
---
 sys/compat/linuxkpi/common/include/linux/string.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h
index f745c2f6d343..06dcdbd97663 100644
--- a/sys/compat/linuxkpi/common/include/linux/string.h
+++ b/sys/compat/linuxkpi/common/include/linux/string.h
@@ -273,4 +273,11 @@ memcpy_and_pad(void *dst, size_t dstlen, const void *src, size_t len, int ch)
 	memset(_ptr + _o, _c, sizeof(*(ptr)) - _o);			\
 })
 
+static inline void
+memzero_explicit(void *p, size_t s)
+{
+	memset(p, 0, s);
+	__asm__ __volatile__("": :"r"(p) :"memory");
+}
+
 #endif	/* _LINUXKPI_LINUX_STRING_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406121916.45CJGdnN003674>