arm64/sysreg: Update PIE permission encodings
authorShiqi Liu <shiqiliu@hust.edu.cn>
Sun, 21 Apr 2024 06:33:28 +0000 (14:33 +0800)
committerWill Deacon <will@kernel.org>
Sun, 28 Apr 2024 07:28:27 +0000 (08:28 +0100)
Fix left shift overflow issue when the parameter idx is greater than or
equal to 8 in the calculation of perm in PIRx_ELx_PERM macro.

Fix this by modifying the encoding to use a long integer type.

Signed-off-by: Shiqi Liu <shiqiliu@hust.edu.cn>
Acked-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20240421063328.29710-1-shiqiliu@hust.edu.cn
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/sysreg.h
tools/arch/arm64/include/asm/sysreg.h

index 9e8999592f3af5068b27717f137337e5af500165..af3b206fa42399c234d74b720daa91177b0acc34 100644 (file)
  * Permission Indirection Extension (PIE) permission encodings.
  * Encodings with the _O suffix, have overlays applied (Permission Overlay Extension).
  */
-#define PIE_NONE_O     0x0
-#define PIE_R_O                0x1
-#define PIE_X_O                0x2
-#define PIE_RX_O       0x3
-#define PIE_RW_O       0x5
-#define PIE_RWnX_O     0x6
-#define PIE_RWX_O      0x7
-#define PIE_R          0x8
-#define PIE_GCS                0x9
-#define PIE_RX         0xa
-#define PIE_RW         0xc
-#define PIE_RWX                0xe
+#define PIE_NONE_O     UL(0x0)
+#define PIE_R_O                UL(0x1)
+#define PIE_X_O                UL(0x2)
+#define PIE_RX_O       UL(0x3)
+#define PIE_RW_O       UL(0x5)
+#define PIE_RWnX_O     UL(0x6)
+#define PIE_RWX_O      UL(0x7)
+#define PIE_R          UL(0x8)
+#define PIE_GCS                UL(0x9)
+#define PIE_RX         UL(0xa)
+#define PIE_RW         UL(0xc)
+#define PIE_RWX                UL(0xe)
 
 #define PIRx_ELx_PERM(idx, perm)       ((perm) << ((idx) * 4))
 
index ccc13e9913760b5a6a85ec78430d873fe22ca51f..cd8420e8c3ad8c09499cca7d85a22e3dd60e6ded 100644 (file)
  * Permission Indirection Extension (PIE) permission encodings.
  * Encodings with the _O suffix, have overlays applied (Permission Overlay Extension).
  */
-#define PIE_NONE_O     0x0
-#define PIE_R_O                0x1
-#define PIE_X_O                0x2
-#define PIE_RX_O       0x3
-#define PIE_RW_O       0x5
-#define PIE_RWnX_O     0x6
-#define PIE_RWX_O      0x7
-#define PIE_R          0x8
-#define PIE_GCS                0x9
-#define PIE_RX         0xa
-#define PIE_RW         0xc
-#define PIE_RWX                0xe
+#define PIE_NONE_O     UL(0x0)
+#define PIE_R_O                UL(0x1)
+#define PIE_X_O                UL(0x2)
+#define PIE_RX_O       UL(0x3)
+#define PIE_RW_O       UL(0x5)
+#define PIE_RWnX_O     UL(0x6)
+#define PIE_RWX_O      UL(0x7)
+#define PIE_R          UL(0x8)
+#define PIE_GCS                UL(0x9)
+#define PIE_RX         UL(0xa)
+#define PIE_RW         UL(0xc)
+#define PIE_RWX                UL(0xe)
 
 #define PIRx_ELx_PERM(idx, perm)       ((perm) << ((idx) * 4))