git: b5ed3ef802eb - main - ck/aarch64: Specify output operands for ck_pr_md_store_*

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 08 Feb 2024 16:36:30 UTC
The branch main has been updated by markj:

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

commit b5ed3ef802ebfed6f08008bff602834b18f83a11
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-02-08 15:53:10 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-02-08 16:35:03 +0000

    ck/aarch64: Specify output operands for ck_pr_md_store_*
    
    This is a backport of upstream commit d1e9f03b89:
    
        ck_pr/aarch64: Specify output operands for ck_pr_md_store_*
    
        As in commit 2f9acab, we want to specify output operand widths so that
        MSAN compiler instrumentation correctly updates the shadow map.  In
        particular, LLVM's implementation depends on having type information for
        output operands, even when that's not otherwise necessary.  Without it,
        KMSAN in FreeBSD generates false positives on aarch64.
    
    Reviewed by:    cognet
    MFC after:      2 weeks
    Sponsored by:   Klara, Inc.
    Sponsored by:   Juniper Networks, Inc.
---
 sys/contrib/ck/include/gcc/aarch64/ck_pr.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/contrib/ck/include/gcc/aarch64/ck_pr.h b/sys/contrib/ck/include/gcc/aarch64/ck_pr.h
index 0a473072fffd..3d269a5066c2 100644
--- a/sys/contrib/ck/include/gcc/aarch64/ck_pr.h
+++ b/sys/contrib/ck/include/gcc/aarch64/ck_pr.h
@@ -137,8 +137,8 @@ CK_PR_LOAD_S_64(double, double, "ldr")
 	CK_CC_INLINE static void				\
 	ck_pr_md_store_##S(M *target, T v)			\
 	{							\
-		__asm__ __volatile__(I " %w1, [%0]"		\
-					:			\
+		__asm__ __volatile__(I " %w2, [%1]"		\
+					: "=m" (*(T *)target)	\
 					: "r" (target),		\
 					  "r" (v)		\
 					: "memory");		\
@@ -148,8 +148,8 @@ CK_PR_LOAD_S_64(double, double, "ldr")
 	CK_CC_INLINE static void				\
 	ck_pr_md_store_##S(M *target, T v)			\
 	{							\
-		__asm__ __volatile__(I " %1, [%0]"		\
-					:			\
+		__asm__ __volatile__(I " %2, [%1]"		\
+					: "=m" (*(T *)target)	\
 					: "r" (target),		\
 					  "r" (v)		\
 					: "memory");		\