Skip to content

Commit 12d712d

Browse files
erhadewilldeacon
authored andcommitted
arm64/sysreg: Update PIE permission encodings
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 <[email protected]> Acked-by: Marc Zyngier <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent f4d9d9d commit 12d712d

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

arch/arm64/include/asm/sysreg.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,18 +1036,18 @@
10361036
* Permission Indirection Extension (PIE) permission encodings.
10371037
* Encodings with the _O suffix, have overlays applied (Permission Overlay Extension).
10381038
*/
1039-
#define PIE_NONE_O 0x0
1040-
#define PIE_R_O 0x1
1041-
#define PIE_X_O 0x2
1042-
#define PIE_RX_O 0x3
1043-
#define PIE_RW_O 0x5
1044-
#define PIE_RWnX_O 0x6
1045-
#define PIE_RWX_O 0x7
1046-
#define PIE_R 0x8
1047-
#define PIE_GCS 0x9
1048-
#define PIE_RX 0xa
1049-
#define PIE_RW 0xc
1050-
#define PIE_RWX 0xe
1039+
#define PIE_NONE_O UL(0x0)
1040+
#define PIE_R_O UL(0x1)
1041+
#define PIE_X_O UL(0x2)
1042+
#define PIE_RX_O UL(0x3)
1043+
#define PIE_RW_O UL(0x5)
1044+
#define PIE_RWnX_O UL(0x6)
1045+
#define PIE_RWX_O UL(0x7)
1046+
#define PIE_R UL(0x8)
1047+
#define PIE_GCS UL(0x9)
1048+
#define PIE_RX UL(0xa)
1049+
#define PIE_RW UL(0xc)
1050+
#define PIE_RWX UL(0xe)
10511051

10521052
#define PIRx_ELx_PERM(idx, perm) ((perm) << ((idx) * 4))
10531053

tools/arch/arm64/include/asm/sysreg.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -701,18 +701,18 @@
701701
* Permission Indirection Extension (PIE) permission encodings.
702702
* Encodings with the _O suffix, have overlays applied (Permission Overlay Extension).
703703
*/
704-
#define PIE_NONE_O 0x0
705-
#define PIE_R_O 0x1
706-
#define PIE_X_O 0x2
707-
#define PIE_RX_O 0x3
708-
#define PIE_RW_O 0x5
709-
#define PIE_RWnX_O 0x6
710-
#define PIE_RWX_O 0x7
711-
#define PIE_R 0x8
712-
#define PIE_GCS 0x9
713-
#define PIE_RX 0xa
714-
#define PIE_RW 0xc
715-
#define PIE_RWX 0xe
704+
#define PIE_NONE_O UL(0x0)
705+
#define PIE_R_O UL(0x1)
706+
#define PIE_X_O UL(0x2)
707+
#define PIE_RX_O UL(0x3)
708+
#define PIE_RW_O UL(0x5)
709+
#define PIE_RWnX_O UL(0x6)
710+
#define PIE_RWX_O UL(0x7)
711+
#define PIE_R UL(0x8)
712+
#define PIE_GCS UL(0x9)
713+
#define PIE_RX UL(0xa)
714+
#define PIE_RW UL(0xc)
715+
#define PIE_RWX UL(0xe)
716716

717717
#define PIRx_ELx_PERM(idx, perm) ((perm) << ((idx) * 4))
718718

0 commit comments

Comments
 (0)