Date: Fri, 12 Apr 2024 23:09:55 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 218b2ccf8cc9 - main - LinuxKPI: implement memzero_explicit() Message-ID: <202404122309.43CN9tJp070677@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=218b2ccf8cc90698487515c681f3e3453b0dcead commit 218b2ccf8cc90698487515c681f3e3453b0dcead Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2024-04-02 09:30:49 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2024-04-12 23:09:19 +0000 LinuxKPI: implement memzero_explicit() Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D44586 --- 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 1365b7d7823a..9e1818a38594 100644 --- a/sys/compat/linuxkpi/common/include/linux/string.h +++ b/sys/compat/linuxkpi/common/include/linux/string.h @@ -289,4 +289,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?202404122309.43CN9tJp070677>