[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XTF PATCH v1 04/15] common: harden type checks in ACCESS_ONCE()


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: dmukhin@xxxxxxxx
  • Date: Wed, 4 Nov 2026 17:38:06 -0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 148.163.138.245) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=ford.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ford.com; dkim=pass (signature was verified) header.d=saarlouis.ford.com; dkim=pass (signature was verified) header.d=ford.com; arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1d8+XzUZdonsIHMia6oE4cdHIDpUnF1JMunvXbneVCc=; b=Geq7il4+3qJhoGXvNmPaCgNodzKe0bvu7I7AIBACX8HRLEuHqonOek9JuHh7MknW/jwAuZoybTn+aWJc142YRJu1EYEo2cgrShuvyhROEZJatABr3YS7nun1uw9CwzOGmZcI+In5dI22knicGSWALOyEJBQSFK3VFX0yrXZ21oy7UDFb/dbsf988qBrHgOgcv15LxsKIVKf/5FdhfQDOFo+r+CIwqwteXlGSqxJvl655/WQQ9Pl4mCaTdWgbYNHaAJsVpvm+yXgCR8AQ0LTL0P0yjdO7BH0Vrz2n63bZtl3ISxfk1bOyQJ15MNuOezCX8fMpmHeIEXyMZ/l65m4jIA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UyBoGwEYrQVoqR661tKCRVlKPbdiyMBKmVJc2b+gNDa5To1yc6JcxDt/n7FgnVQPrpjvOAFkgAjUwzh3uau4+n7+2VkChIkZUwig9hSWY7YcAYP2PJ00v6y3ENuWIWR5Bl1zM/WJrfji0hc71VtR7oy60s269a+4ruRO1AAIb5iDntsZdImhFqwxevKon875QDxWYYMSx0Ods+IU7hnvhTVg9TQ52ZuuSb563uYH/80aKQras9dB70iXsIV+xFr4s4uDaH5WOloqyGDCA4WYI/GH5mth1iaG3BNhi4qAJpiZwEdNTxBr8UtCpBfct/AtRqzGCercAg6ff56rCtN8sA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=ppford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=selector2-azureford-onmicrosoft-com header.d=azureford.onmicrosoft.com header.i="@azureford.onmicrosoft.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=ppserprodsaar header.d=saarlouis.ford.com header.i="@saarlouis.ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=ppfserpocford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"
  • Cc: andrew.cooper3@xxxxxxxxxx, anthony.perard@xxxxxxxxxx, jbeulich@xxxxxxxx, julien@xxxxxxx, michal.orzel@xxxxxxx, roger@xxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, dmukhin@xxxxxxx, Denis Mukhin <dmukhin@xxxxxxxx>
  • Delivery-date: Thu, 05 Nov 2026 01:38:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Pser-m365-app: SER-APP

From: Denis Mukhin <dmukhin@xxxxxxxx>

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
 include/xtf/lib.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/xtf/lib.h b/include/xtf/lib.h
index 9ced1e795258..629de4904d60 100644
--- a/include/xtf/lib.h
+++ b/include/xtf/lib.h
@@ -7,7 +7,11 @@
 
 #define ARRAY_SIZE(a)    (sizeof(a) / sizeof(*a))
 
-#define ACCESS_ONCE(x)   (*(volatile typeof(x) *)&(x))
+#define __ACCESS_ONCE(x) ({ \
+    (void)(typeof(x))0; \
+    (volatile typeof(x) *)&(x); \
+})
+#define ACCESS_ONCE(x)   (*__ACCESS_ONCE(x))
 
 void __noreturn panic(const char *fmt, ...) __printf(1, 2);
 
-- 
2.55.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.