* [PATCH] arm64/sysreg: Update PIE permission encodings
@ 2024-04-21 6:33 Shiqi Liu
2024-04-21 9:40 ` Marc Zyngier
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Shiqi Liu @ 2024-04-21 6:33 UTC (permalink / raw
To: catalin.marinas, will
Cc: broonie, anshuman.khandual, maz, suzuki.poulose, miguel.luis,
joey.gouly, shiqiliu, oliver.upton, jingzhangos, linux-arm-kernel,
linux-kernel
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>
---
arch/arm64/include/asm/sysreg.h | 24 ++++++++++++------------
tools/arch/arm64/include/asm/sysreg.h | 24 ++++++++++++------------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index 9e8999592f3a..af3b206fa423 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -1036,18 +1036,18 @@
* 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))
diff --git a/tools/arch/arm64/include/asm/sysreg.h b/tools/arch/arm64/include/asm/sysreg.h
index ccc13e991376..cd8420e8c3ad 100644
--- a/tools/arch/arm64/include/asm/sysreg.h
+++ b/tools/arch/arm64/include/asm/sysreg.h
@@ -701,18 +701,18 @@
* 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))
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64/sysreg: Update PIE permission encodings
2024-04-21 6:33 [PATCH] arm64/sysreg: Update PIE permission encodings Shiqi Liu
@ 2024-04-21 9:40 ` Marc Zyngier
2024-04-22 10:09 ` Catalin Marinas
2024-04-28 8:59 ` Will Deacon
2 siblings, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2024-04-21 9:40 UTC (permalink / raw
To: Shiqi Liu
Cc: catalin.marinas, will, broonie, anshuman.khandual, suzuki.poulose,
miguel.luis, joey.gouly, oliver.upton, jingzhangos,
linux-arm-kernel, linux-kernel
On Sun, 21 Apr 2024 07:33:28 +0100,
Shiqi Liu <shiqiliu@hust.edu.cn> wrote:
>
> 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>
Nice catch.
Acked-by: Marc Zyngier <maz@kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64/sysreg: Update PIE permission encodings
2024-04-21 6:33 [PATCH] arm64/sysreg: Update PIE permission encodings Shiqi Liu
2024-04-21 9:40 ` Marc Zyngier
@ 2024-04-22 10:09 ` Catalin Marinas
2024-04-28 8:59 ` Will Deacon
2 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2024-04-22 10:09 UTC (permalink / raw
To: Shiqi Liu
Cc: will, broonie, anshuman.khandual, maz, suzuki.poulose,
miguel.luis, joey.gouly, oliver.upton, jingzhangos,
linux-arm-kernel, linux-kernel
On Sun, Apr 21, 2024 at 02:33:28PM +0800, Shiqi Liu wrote:
> 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>
> ---
> arch/arm64/include/asm/sysreg.h | 24 ++++++++++++------------
> tools/arch/arm64/include/asm/sysreg.h | 24 ++++++++++++------------
> 2 files changed, 24 insertions(+), 24 deletions(-)
>
> diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
> index 9e8999592f3a..af3b206fa423 100644
> --- a/arch/arm64/include/asm/sysreg.h
> +++ b/arch/arm64/include/asm/sysreg.h
> @@ -1036,18 +1036,18 @@
> * 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))
Thanks. That's indeed the better way to write these constants, they also
match the POE_* macros further down in this file.
Currently nothing is broken since the PIE_E0 and PIE_E1 macros are only
used in assembly where the UL() doesn't have any effect but we may
change it in the future. I'll leave it with Will to pick up.
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64/sysreg: Update PIE permission encodings
2024-04-21 6:33 [PATCH] arm64/sysreg: Update PIE permission encodings Shiqi Liu
2024-04-21 9:40 ` Marc Zyngier
2024-04-22 10:09 ` Catalin Marinas
@ 2024-04-28 8:59 ` Will Deacon
2 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2024-04-28 8:59 UTC (permalink / raw
To: catalin.marinas, Shiqi Liu
Cc: kernel-team, Will Deacon, broonie, anshuman.khandual, maz,
suzuki.poulose, miguel.luis, joey.gouly, oliver.upton,
jingzhangos, linux-arm-kernel, linux-kernel
On Sun, 21 Apr 2024 14:33:28 +0800, Shiqi Liu wrote:
> 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.
>
>
Applied to arm64 (for-next/misc), thanks!
[1/1] arm64/sysreg: Update PIE permission encodings
https://git.kernel.org/arm64/c/12d712dc8e4f
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-28 8:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-21 6:33 [PATCH] arm64/sysreg: Update PIE permission encodings Shiqi Liu
2024-04-21 9:40 ` Marc Zyngier
2024-04-22 10:09 ` Catalin Marinas
2024-04-28 8:59 ` Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).