From nobody Thu Feb 16 22:39:32 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PHqd11rw5z3qRm3; Thu, 16 Feb 2023 22:39:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PHqd11QqFz4H4Y; Thu, 16 Feb 2023 22:39:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676587173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wy7EJCx6FOwT82ihHX3d1hEMa+pXBXkgv0zB4B+vQ+w=; b=jguFaJHfUS11QnTgmFnZLTiceRMbRL1GoLP9Zefyob7rrt0ZyeIMigi9+Y7aAQYi/v95Nf LGJZnlQp3EUFIHUv50t4f8LNqPncjFQpYqpfYDvocmZ+lhjI7QDj2WJR9cVkzQ1w5dntE/ dgywKEz/jVRYB1AzPXkV56he1/vqM5jDeYXg8N4PMLB69OwX4WqRzuErwP5oF6ZV+pvcjj uIfmKbguZ1ziPuNX2YyrdrzSJFZRm+domjOfoSxGIQ50PG/xfu7J4jGBQBXP7v5a6FM352 E+S//kDrXn/BxwcbPs7A2ZSZbDRv1P7VOISf2dslfJDT9qWH3+L+0HbvQNzESg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676587173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wy7EJCx6FOwT82ihHX3d1hEMa+pXBXkgv0zB4B+vQ+w=; b=cwqFoqibhV/8W5XWJo7zUNSmSWMNBNaqhYkOzb84LpxXbOtexvQnm7FzApXrW1oNZEcoqU lwmFiEl9U/R/U30wCAl6koO1NreklHJzkVtle26UAmQ/p1ZJ4uqf4BgMLwZ6LhxAy1sVon GsXY5AR7fHgo25LQACEywkEs9rMyb6CDU5bqrxlFOcKV23Zt/nRMwpcfJ4MdfYgpycHxvT UeC2msi2dO7b6olLORZ0eWbAUW9M9P5dIIQU1Cx5gICeIbTCVxZ9cF98AVS4X1KD3fQwB3 jxjOkyVjY1dGw/Ja3kKLAFEFUfm8KNFvOfEzb29QMUDjucXNIrDImY0IKGMFLQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676587173; a=rsa-sha256; cv=none; b=K5nlPudn6cQPGkKf/1+HpaHkchGO5HNqTJ35RIrUGvkLQGTuDaqStoVmCcq3Ys1HLlPwgD NX5HC/i2m7SCZEg0euz5y2ytHIEcG8b2JahQUUziRr8q5EvI2omq+sgaEVWadzwTwp2gEb evIQ0D+TNYVV0a5OCLRxHL7RvdoLP1007QQAck/218RfnJwqrFWX/k3Aq0LZY2jdRSa8Ak yu/Nzv1jsE3fISYodHmQjKDDL7y91myBn8wcAa3Gn0u/MKPWmYmCYh/mhfooqjD6muZ1H8 ilPmMaUTfxqAUeoCLP+7QU7mhLh43hROZL5PfmC4cAnlWTwGYmhmDz4U262Nrw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PHqd10J1TzLVJ; Thu, 16 Feb 2023 22:39:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31GMdWOK075022; Thu, 16 Feb 2023 22:39:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31GMdWKD075021; Thu, 16 Feb 2023 22:39:32 GMT (envelope-from git) Date: Thu, 16 Feb 2023 22:39:32 GMT Message-Id: <202302162239.31GMdWKD075021@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3e554a0ebf0a - stable/13 - atomic: Fix the atomic_load_ptr() *SAN interceptor List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3e554a0ebf0af4dcb95c5e3ffb7e32001b458dbb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3e554a0ebf0af4dcb95c5e3ffb7e32001b458dbb commit 3e554a0ebf0af4dcb95c5e3ffb7e32001b458dbb Author: Mark Johnston AuthorDate: 2023-02-09 14:54:52 +0000 Commit: Mark Johnston CommitDate: 2023-02-16 21:55:27 +0000 atomic: Fix the atomic_load_ptr() *SAN interceptor The interceptor didn't handle a pointer of type "foo * const *" and in that case we'd get compiler errors 1) an invalid cast to volatile uintptr_t, and 2) an assignment to a variable of type "foo * const" (__retptr). Reported by: mjg MFC after: 1 week (cherry picked from commit 08b0c98006b6b9f3722df0ce462f6a4aa8ee06f2) --- sys/sys/atomic_san.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sys/sys/atomic_san.h b/sys/sys/atomic_san.h index beeea82a666b..3a72cb4b4980 100644 --- a/sys/sys/atomic_san.h +++ b/sys/sys/atomic_san.h @@ -267,17 +267,11 @@ ATOMIC_SAN_THREAD_FENCE(SAN_INTERCEPTOR_PREFIX); #define atomic_fcmpset_acq_ptr ATOMIC_SAN(fcmpset_acq_ptr) #define atomic_fcmpset_rel_ptr ATOMIC_SAN(fcmpset_rel_ptr) #define atomic_fetchadd_ptr ATOMIC_SAN(fetchadd_ptr) -#define atomic_load_ptr(x) ({ \ - __typeof(*x) __retptr; \ - __retptr = (void *)ATOMIC_SAN(load_ptr)((volatile uintptr_t *)(x)); \ - __retptr; \ -}) +#define atomic_load_ptr(x) \ + ((void *)ATOMIC_SAN(load_ptr)(__DECONST(volatile uintptr_t *, (x)))) #define atomic_load_acq_ptr ATOMIC_SAN(load_acq_ptr) -#define atomic_load_consume_ptr(x) ({ \ - __typeof(*x) __retptr; \ - __retptr = (void *)atomic_load_acq_ptr((volatile uintptr_t *)(x));\ - __retptr; \ -}) +#define atomic_load_consume_ptr(x) \ + ((void *)atomic_load_acq_ptr((volatile uintptr_t *)(x))) #define atomic_readandclear_ptr ATOMIC_SAN(readandclear_ptr) #define atomic_set_ptr ATOMIC_SAN(set_ptr) #define atomic_set_acq_ptr ATOMIC_SAN(set_acq_ptr)