All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][for-stable] arm64: set UXN on swapper page tables
@ 2022-08-08 12:53 ` Will Deacon
  0 siblings, 0 replies; 9+ messages in thread
From: Will Deacon @ 2022-08-08 12:53 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, linux-arm-kernel, Peter Collingbourne, stable,
	Will Deacon, Ard Biesheuvel, Catalin Marinas

From: Peter Collingbourne <pcc@google.com>

[ This issue was fixed upstream by accident in c3cee924bd85 ("arm64:
  head: cover entire kernel image in initial ID map") as part of a
  large refactoring of the arm64 boot flow. This simple fix is therefore
  preferred for -stable backporting ]

On a system that implements FEAT_EPAN, read/write access to the idmap
is denied because UXN is not set on the swapper PTEs. As a result,
idmap_kpti_install_ng_mappings panics the kernel when accessing
__idmap_kpti_flag. Fix it by setting UXN on these PTEs.

Fixes: 18107f8a2df6 ("arm64: Support execute-only permissions with Enhanced PAN")
Cc: <stable@vger.kernel.org> # 5.15
Link: https://linux-review.googlesource.com/id/Ic452fa4b4f74753e54f71e61027e7222a0fae1b1
Signed-off-by: Peter Collingbourne <pcc@google.com>
Acked-by: Will Deacon <will@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20220719234909.1398992-1-pcc@google.com
Signed-off-by: Will Deacon <will@kernel.org>
---
 arch/arm64/include/asm/kernel-pgtable.h | 4 ++--
 arch/arm64/kernel/head.S                | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h
index 96dc0f7da258..a971d462f531 100644
--- a/arch/arm64/include/asm/kernel-pgtable.h
+++ b/arch/arm64/include/asm/kernel-pgtable.h
@@ -103,8 +103,8 @@
 /*
  * Initial memory map attributes.
  */
-#define SWAPPER_PTE_FLAGS	(PTE_TYPE_PAGE | PTE_AF | PTE_SHARED)
-#define SWAPPER_PMD_FLAGS	(PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S)
+#define SWAPPER_PTE_FLAGS	(PTE_TYPE_PAGE | PTE_AF | PTE_SHARED | PTE_UXN)
+#define SWAPPER_PMD_FLAGS	(PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S | PMD_SECT_UXN)
 
 #if ARM64_KERNEL_USES_PMD_MAPS
 #define SWAPPER_MM_MMUFLAGS	(PMD_ATTRINDX(MT_NORMAL) | SWAPPER_PMD_FLAGS)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 6a98f1a38c29..8a93a0a7489b 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -285,7 +285,7 @@ SYM_FUNC_START_LOCAL(__create_page_tables)
 	subs	x1, x1, #64
 	b.ne	1b
 
-	mov	x7, SWAPPER_MM_MMUFLAGS
+	mov_q	x7, SWAPPER_MM_MMUFLAGS
 
 	/*
 	 * Create the identity mapping.
-- 
2.37.1.559.g78731f0fdb-goog


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH][for-stable] arm64: set UXN on swapper page tables
@ 2022-08-08 12:53 ` Will Deacon
  0 siblings, 0 replies; 9+ messages in thread
From: Will Deacon @ 2022-08-08 12:53 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, linux-arm-kernel, Peter Collingbourne, stable,
	Will Deacon, Ard Biesheuvel, Catalin Marinas

From: Peter Collingbourne <pcc@google.com>

[ This issue was fixed upstream by accident in c3cee924bd85 ("arm64:
  head: cover entire kernel image in initial ID map") as part of a
  large refactoring of the arm64 boot flow. This simple fix is therefore
  preferred for -stable backporting ]

On a system that implements FEAT_EPAN, read/write access to the idmap
is denied because UXN is not set on the swapper PTEs. As a result,
idmap_kpti_install_ng_mappings panics the kernel when accessing
__idmap_kpti_flag. Fix it by setting UXN on these PTEs.

Fixes: 18107f8a2df6 ("arm64: Support execute-only permissions with Enhanced PAN")
Cc: <stable@vger.kernel.org> # 5.15
Link: https://linux-review.googlesource.com/id/Ic452fa4b4f74753e54f71e61027e7222a0fae1b1
Signed-off-by: Peter Collingbourne <pcc@google.com>
Acked-by: Will Deacon <will@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20220719234909.1398992-1-pcc@google.com
Signed-off-by: Will Deacon <will@kernel.org>
---
 arch/arm64/include/asm/kernel-pgtable.h | 4 ++--
 arch/arm64/kernel/head.S                | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h
index 96dc0f7da258..a971d462f531 100644
--- a/arch/arm64/include/asm/kernel-pgtable.h
+++ b/arch/arm64/include/asm/kernel-pgtable.h
@@ -103,8 +103,8 @@
 /*
  * Initial memory map attributes.
  */
-#define SWAPPER_PTE_FLAGS	(PTE_TYPE_PAGE | PTE_AF | PTE_SHARED)
-#define SWAPPER_PMD_FLAGS	(PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S)
+#define SWAPPER_PTE_FLAGS	(PTE_TYPE_PAGE | PTE_AF | PTE_SHARED | PTE_UXN)
+#define SWAPPER_PMD_FLAGS	(PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S | PMD_SECT_UXN)
 
 #if ARM64_KERNEL_USES_PMD_MAPS
 #define SWAPPER_MM_MMUFLAGS	(PMD_ATTRINDX(MT_NORMAL) | SWAPPER_PMD_FLAGS)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 6a98f1a38c29..8a93a0a7489b 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -285,7 +285,7 @@ SYM_FUNC_START_LOCAL(__create_page_tables)
 	subs	x1, x1, #64
 	b.ne	1b
 
-	mov	x7, SWAPPER_MM_MMUFLAGS
+	mov_q	x7, SWAPPER_MM_MMUFLAGS
 
 	/*
 	 * Create the identity mapping.
-- 
2.37.1.559.g78731f0fdb-goog


_______________________________________________
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] 9+ messages in thread

* Re: [PATCH][for-stable] arm64: set UXN on swapper page tables
  2022-08-08 12:53 ` Will Deacon
@ 2022-08-08 13:23   ` Greg KH
  -1 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2022-08-08 13:23 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-kernel, linux-arm-kernel, Peter Collingbourne, stable,
	Ard Biesheuvel, Catalin Marinas

On Mon, Aug 08, 2022 at 01:53:21PM +0100, Will Deacon wrote:
> From: Peter Collingbourne <pcc@google.com>
> 
> [ This issue was fixed upstream by accident in c3cee924bd85 ("arm64:
>   head: cover entire kernel image in initial ID map") as part of a
>   large refactoring of the arm64 boot flow. This simple fix is therefore
>   preferred for -stable backporting ]
> 
> On a system that implements FEAT_EPAN, read/write access to the idmap
> is denied because UXN is not set on the swapper PTEs. As a result,
> idmap_kpti_install_ng_mappings panics the kernel when accessing
> __idmap_kpti_flag. Fix it by setting UXN on these PTEs.
> 
> Fixes: 18107f8a2df6 ("arm64: Support execute-only permissions with Enhanced PAN")
> Cc: <stable@vger.kernel.org> # 5.15
> Link: https://linux-review.googlesource.com/id/Ic452fa4b4f74753e54f71e61027e7222a0fae1b1
> Signed-off-by: Peter Collingbourne <pcc@google.com>
> Acked-by: Will Deacon <will@kernel.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Link: https://lore.kernel.org/r/20220719234909.1398992-1-pcc@google.com
> Signed-off-by: Will Deacon <will@kernel.org>
> ---
>  arch/arm64/include/asm/kernel-pgtable.h | 4 ++--
>  arch/arm64/kernel/head.S                | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)

So this should be added to 5.15.y, 5.18.y, and 5.19.y?  Or some subset?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH][for-stable] arm64: set UXN on swapper page tables
@ 2022-08-08 13:23   ` Greg KH
  0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2022-08-08 13:23 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-kernel, linux-arm-kernel, Peter Collingbourne, stable,
	Ard Biesheuvel, Catalin Marinas

On Mon, Aug 08, 2022 at 01:53:21PM +0100, Will Deacon wrote:
> From: Peter Collingbourne <pcc@google.com>
> 
> [ This issue was fixed upstream by accident in c3cee924bd85 ("arm64:
>   head: cover entire kernel image in initial ID map") as part of a
>   large refactoring of the arm64 boot flow. This simple fix is therefore
>   preferred for -stable backporting ]
> 
> On a system that implements FEAT_EPAN, read/write access to the idmap
> is denied because UXN is not set on the swapper PTEs. As a result,
> idmap_kpti_install_ng_mappings panics the kernel when accessing
> __idmap_kpti_flag. Fix it by setting UXN on these PTEs.
> 
> Fixes: 18107f8a2df6 ("arm64: Support execute-only permissions with Enhanced PAN")
> Cc: <stable@vger.kernel.org> # 5.15
> Link: https://linux-review.googlesource.com/id/Ic452fa4b4f74753e54f71e61027e7222a0fae1b1
> Signed-off-by: Peter Collingbourne <pcc@google.com>
> Acked-by: Will Deacon <will@kernel.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Link: https://lore.kernel.org/r/20220719234909.1398992-1-pcc@google.com
> Signed-off-by: Will Deacon <will@kernel.org>
> ---
>  arch/arm64/include/asm/kernel-pgtable.h | 4 ++--
>  arch/arm64/kernel/head.S                | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)

So this should be added to 5.15.y, 5.18.y, and 5.19.y?  Or some subset?

thanks,

greg k-h

_______________________________________________
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] 9+ messages in thread

* Patch "arm64: set UXN on swapper page tables" has been added to the 5.15-stable tree
  2022-08-08 12:53 ` Will Deacon
  (?)
  (?)
@ 2022-08-08 13:25 ` gregkh
  -1 siblings, 0 replies; 9+ messages in thread
From: gregkh @ 2022-08-08 13:25 UTC (permalink / raw)
  To: ardb, catalin.marinas, gregkh, linux-arm-kernel, pcc, will; +Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    arm64: set UXN on swapper page tables

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm64-set-uxn-on-swapper-page-tables.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From will@kernel.org  Mon Aug  8 15:23:59 2022
From: Will Deacon <will@kernel.org>
Date: Mon,  8 Aug 2022 13:53:21 +0100
Subject: arm64: set UXN on swapper page tables
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peter Collingbourne <pcc@google.com>, stable@vger.kernel.org, Will Deacon <will@kernel.org>, Ard Biesheuvel <ardb@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>
Message-ID: <20220808125321.32598-1-will@kernel.org>

From: Peter Collingbourne <pcc@google.com>

[ This issue was fixed upstream by accident in c3cee924bd85 ("arm64:
  head: cover entire kernel image in initial ID map") as part of a
  large refactoring of the arm64 boot flow. This simple fix is therefore
  preferred for -stable backporting ]

On a system that implements FEAT_EPAN, read/write access to the idmap
is denied because UXN is not set on the swapper PTEs. As a result,
idmap_kpti_install_ng_mappings panics the kernel when accessing
__idmap_kpti_flag. Fix it by setting UXN on these PTEs.

Fixes: 18107f8a2df6 ("arm64: Support execute-only permissions with Enhanced PAN")
Cc: <stable@vger.kernel.org> # 5.15
Link: https://linux-review.googlesource.com/id/Ic452fa4b4f74753e54f71e61027e7222a0fae1b1
Signed-off-by: Peter Collingbourne <pcc@google.com>
Acked-by: Will Deacon <will@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20220719234909.1398992-1-pcc@google.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm64/include/asm/kernel-pgtable.h |    4 ++--
 arch/arm64/kernel/head.S                |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

--- a/arch/arm64/include/asm/kernel-pgtable.h
+++ b/arch/arm64/include/asm/kernel-pgtable.h
@@ -103,8 +103,8 @@
 /*
  * Initial memory map attributes.
  */
-#define SWAPPER_PTE_FLAGS	(PTE_TYPE_PAGE | PTE_AF | PTE_SHARED)
-#define SWAPPER_PMD_FLAGS	(PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S)
+#define SWAPPER_PTE_FLAGS	(PTE_TYPE_PAGE | PTE_AF | PTE_SHARED | PTE_UXN)
+#define SWAPPER_PMD_FLAGS	(PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S | PMD_SECT_UXN)
 
 #if ARM64_KERNEL_USES_PMD_MAPS
 #define SWAPPER_MM_MMUFLAGS	(PMD_ATTRINDX(MT_NORMAL) | SWAPPER_PMD_FLAGS)
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -285,7 +285,7 @@ SYM_FUNC_START_LOCAL(__create_page_table
 	subs	x1, x1, #64
 	b.ne	1b
 
-	mov	x7, SWAPPER_MM_MMUFLAGS
+	mov_q	x7, SWAPPER_MM_MMUFLAGS
 
 	/*
 	 * Create the identity mapping.


Patches currently in stable-queue which might be from will@kernel.org are

queue-5.15/arm64-set-uxn-on-swapper-page-tables.patch
queue-5.15/crypto-arm64-poly1305-fix-a-read-out-of-bound.patch

_______________________________________________
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] 9+ messages in thread

* Patch "arm64: set UXN on swapper page tables" has been added to the 5.18-stable tree
  2022-08-08 12:53 ` Will Deacon
                   ` (2 preceding siblings ...)
  (?)
@ 2022-08-08 13:25 ` gregkh
  -1 siblings, 0 replies; 9+ messages in thread
From: gregkh @ 2022-08-08 13:25 UTC (permalink / raw)
  To: ardb, catalin.marinas, gregkh, linux-arm-kernel, pcc, will; +Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    arm64: set UXN on swapper page tables

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm64-set-uxn-on-swapper-page-tables.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From will@kernel.org  Mon Aug  8 15:23:59 2022
From: Will Deacon <will@kernel.org>
Date: Mon,  8 Aug 2022 13:53:21 +0100
Subject: arm64: set UXN on swapper page tables
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peter Collingbourne <pcc@google.com>, stable@vger.kernel.org, Will Deacon <will@kernel.org>, Ard Biesheuvel <ardb@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>
Message-ID: <20220808125321.32598-1-will@kernel.org>

From: Peter Collingbourne <pcc@google.com>

[ This issue was fixed upstream by accident in c3cee924bd85 ("arm64:
  head: cover entire kernel image in initial ID map") as part of a
  large refactoring of the arm64 boot flow. This simple fix is therefore
  preferred for -stable backporting ]

On a system that implements FEAT_EPAN, read/write access to the idmap
is denied because UXN is not set on the swapper PTEs. As a result,
idmap_kpti_install_ng_mappings panics the kernel when accessing
__idmap_kpti_flag. Fix it by setting UXN on these PTEs.

Fixes: 18107f8a2df6 ("arm64: Support execute-only permissions with Enhanced PAN")
Cc: <stable@vger.kernel.org> # 5.15
Link: https://linux-review.googlesource.com/id/Ic452fa4b4f74753e54f71e61027e7222a0fae1b1
Signed-off-by: Peter Collingbourne <pcc@google.com>
Acked-by: Will Deacon <will@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20220719234909.1398992-1-pcc@google.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm64/include/asm/kernel-pgtable.h |    4 ++--
 arch/arm64/kernel/head.S                |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

--- a/arch/arm64/include/asm/kernel-pgtable.h
+++ b/arch/arm64/include/asm/kernel-pgtable.h
@@ -103,8 +103,8 @@
 /*
  * Initial memory map attributes.
  */
-#define SWAPPER_PTE_FLAGS	(PTE_TYPE_PAGE | PTE_AF | PTE_SHARED)
-#define SWAPPER_PMD_FLAGS	(PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S)
+#define SWAPPER_PTE_FLAGS	(PTE_TYPE_PAGE | PTE_AF | PTE_SHARED | PTE_UXN)
+#define SWAPPER_PMD_FLAGS	(PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S | PMD_SECT_UXN)
 
 #if ARM64_KERNEL_USES_PMD_MAPS
 #define SWAPPER_MM_MMUFLAGS	(PMD_ATTRINDX(MT_NORMAL) | SWAPPER_PMD_FLAGS)
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -285,7 +285,7 @@ SYM_FUNC_START_LOCAL(__create_page_table
 	subs	x1, x1, #64
 	b.ne	1b
 
-	mov	x7, SWAPPER_MM_MMUFLAGS
+	mov_q	x7, SWAPPER_MM_MMUFLAGS
 
 	/*
 	 * Create the identity mapping.


Patches currently in stable-queue which might be from will@kernel.org are

queue-5.18/arm64-set-uxn-on-swapper-page-tables.patch
queue-5.18/crypto-arm64-poly1305-fix-a-read-out-of-bound.patch

_______________________________________________
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] 9+ messages in thread

* Patch "arm64: set UXN on swapper page tables" has been added to the 5.19-stable tree
  2022-08-08 12:53 ` Will Deacon
                   ` (3 preceding siblings ...)
  (?)
@ 2022-08-08 13:26 ` gregkh
  -1 siblings, 0 replies; 9+ messages in thread
From: gregkh @ 2022-08-08 13:26 UTC (permalink / raw)
  To: ardb, catalin.marinas, gregkh, linux-arm-kernel, pcc, will; +Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    arm64: set UXN on swapper page tables

to the 5.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm64-set-uxn-on-swapper-page-tables.patch
and it can be found in the queue-5.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From will@kernel.org  Mon Aug  8 15:23:59 2022
From: Will Deacon <will@kernel.org>
Date: Mon,  8 Aug 2022 13:53:21 +0100
Subject: arm64: set UXN on swapper page tables
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peter Collingbourne <pcc@google.com>, stable@vger.kernel.org, Will Deacon <will@kernel.org>, Ard Biesheuvel <ardb@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>
Message-ID: <20220808125321.32598-1-will@kernel.org>

From: Peter Collingbourne <pcc@google.com>

[ This issue was fixed upstream by accident in c3cee924bd85 ("arm64:
  head: cover entire kernel image in initial ID map") as part of a
  large refactoring of the arm64 boot flow. This simple fix is therefore
  preferred for -stable backporting ]

On a system that implements FEAT_EPAN, read/write access to the idmap
is denied because UXN is not set on the swapper PTEs. As a result,
idmap_kpti_install_ng_mappings panics the kernel when accessing
__idmap_kpti_flag. Fix it by setting UXN on these PTEs.

Fixes: 18107f8a2df6 ("arm64: Support execute-only permissions with Enhanced PAN")
Cc: <stable@vger.kernel.org> # 5.15
Link: https://linux-review.googlesource.com/id/Ic452fa4b4f74753e54f71e61027e7222a0fae1b1
Signed-off-by: Peter Collingbourne <pcc@google.com>
Acked-by: Will Deacon <will@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20220719234909.1398992-1-pcc@google.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm64/include/asm/kernel-pgtable.h |    4 ++--
 arch/arm64/kernel/head.S                |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

--- a/arch/arm64/include/asm/kernel-pgtable.h
+++ b/arch/arm64/include/asm/kernel-pgtable.h
@@ -103,8 +103,8 @@
 /*
  * Initial memory map attributes.
  */
-#define SWAPPER_PTE_FLAGS	(PTE_TYPE_PAGE | PTE_AF | PTE_SHARED)
-#define SWAPPER_PMD_FLAGS	(PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S)
+#define SWAPPER_PTE_FLAGS	(PTE_TYPE_PAGE | PTE_AF | PTE_SHARED | PTE_UXN)
+#define SWAPPER_PMD_FLAGS	(PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S | PMD_SECT_UXN)
 
 #if ARM64_KERNEL_USES_PMD_MAPS
 #define SWAPPER_MM_MMUFLAGS	(PMD_ATTRINDX(MT_NORMAL) | SWAPPER_PMD_FLAGS)
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -285,7 +285,7 @@ SYM_FUNC_START_LOCAL(__create_page_table
 	subs	x1, x1, #64
 	b.ne	1b
 
-	mov	x7, SWAPPER_MM_MMUFLAGS
+	mov_q	x7, SWAPPER_MM_MMUFLAGS
 
 	/*
 	 * Create the identity mapping.


Patches currently in stable-queue which might be from will@kernel.org are

queue-5.19/arm64-set-uxn-on-swapper-page-tables.patch
queue-5.19/crypto-arm64-poly1305-fix-a-read-out-of-bound.patch

_______________________________________________
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] 9+ messages in thread

* Re: [PATCH][for-stable] arm64: set UXN on swapper page tables
  2022-08-08 13:23   ` Greg KH
@ 2022-08-09  8:33     ` Will Deacon
  -1 siblings, 0 replies; 9+ messages in thread
From: Will Deacon @ 2022-08-09  8:33 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-kernel, linux-arm-kernel, Peter Collingbourne, stable,
	Ard Biesheuvel, Catalin Marinas

On Mon, Aug 08, 2022 at 03:23:55PM +0200, Greg KH wrote:
> On Mon, Aug 08, 2022 at 01:53:21PM +0100, Will Deacon wrote:
> > From: Peter Collingbourne <pcc@google.com>
> > 
> > [ This issue was fixed upstream by accident in c3cee924bd85 ("arm64:
> >   head: cover entire kernel image in initial ID map") as part of a
> >   large refactoring of the arm64 boot flow. This simple fix is therefore
> >   preferred for -stable backporting ]
> > 
> > On a system that implements FEAT_EPAN, read/write access to the idmap
> > is denied because UXN is not set on the swapper PTEs. As a result,
> > idmap_kpti_install_ng_mappings panics the kernel when accessing
> > __idmap_kpti_flag. Fix it by setting UXN on these PTEs.
> > 
> > Fixes: 18107f8a2df6 ("arm64: Support execute-only permissions with Enhanced PAN")
> > Cc: <stable@vger.kernel.org> # 5.15
> > Link: https://linux-review.googlesource.com/id/Ic452fa4b4f74753e54f71e61027e7222a0fae1b1
> > Signed-off-by: Peter Collingbourne <pcc@google.com>
> > Acked-by: Will Deacon <will@kernel.org>
> > Cc: Ard Biesheuvel <ardb@kernel.org>
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Link: https://lore.kernel.org/r/20220719234909.1398992-1-pcc@google.com
> > Signed-off-by: Will Deacon <will@kernel.org>
> > ---
> >  arch/arm64/include/asm/kernel-pgtable.h | 4 ++--
> >  arch/arm64/kernel/head.S                | 2 +-
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> So this should be added to 5.15.y, 5.18.y, and 5.19.y?  Or some subset?

Yes, all of them. Basically anything still being updated which is >= 5.15
and <= 5.19.

Thanks,

Will

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH][for-stable] arm64: set UXN on swapper page tables
@ 2022-08-09  8:33     ` Will Deacon
  0 siblings, 0 replies; 9+ messages in thread
From: Will Deacon @ 2022-08-09  8:33 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-kernel, linux-arm-kernel, Peter Collingbourne, stable,
	Ard Biesheuvel, Catalin Marinas

On Mon, Aug 08, 2022 at 03:23:55PM +0200, Greg KH wrote:
> On Mon, Aug 08, 2022 at 01:53:21PM +0100, Will Deacon wrote:
> > From: Peter Collingbourne <pcc@google.com>
> > 
> > [ This issue was fixed upstream by accident in c3cee924bd85 ("arm64:
> >   head: cover entire kernel image in initial ID map") as part of a
> >   large refactoring of the arm64 boot flow. This simple fix is therefore
> >   preferred for -stable backporting ]
> > 
> > On a system that implements FEAT_EPAN, read/write access to the idmap
> > is denied because UXN is not set on the swapper PTEs. As a result,
> > idmap_kpti_install_ng_mappings panics the kernel when accessing
> > __idmap_kpti_flag. Fix it by setting UXN on these PTEs.
> > 
> > Fixes: 18107f8a2df6 ("arm64: Support execute-only permissions with Enhanced PAN")
> > Cc: <stable@vger.kernel.org> # 5.15
> > Link: https://linux-review.googlesource.com/id/Ic452fa4b4f74753e54f71e61027e7222a0fae1b1
> > Signed-off-by: Peter Collingbourne <pcc@google.com>
> > Acked-by: Will Deacon <will@kernel.org>
> > Cc: Ard Biesheuvel <ardb@kernel.org>
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Link: https://lore.kernel.org/r/20220719234909.1398992-1-pcc@google.com
> > Signed-off-by: Will Deacon <will@kernel.org>
> > ---
> >  arch/arm64/include/asm/kernel-pgtable.h | 4 ++--
> >  arch/arm64/kernel/head.S                | 2 +-
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> So this should be added to 5.15.y, 5.18.y, and 5.19.y?  Or some subset?

Yes, all of them. Basically anything still being updated which is >= 5.15
and <= 5.19.

Thanks,

Will

_______________________________________________
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] 9+ messages in thread

end of thread, other threads:[~2022-08-09  8:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-08 12:53 [PATCH][for-stable] arm64: set UXN on swapper page tables Will Deacon
2022-08-08 12:53 ` Will Deacon
2022-08-08 13:23 ` Greg KH
2022-08-08 13:23   ` Greg KH
2022-08-09  8:33   ` Will Deacon
2022-08-09  8:33     ` Will Deacon
2022-08-08 13:25 ` Patch "arm64: set UXN on swapper page tables" has been added to the 5.15-stable tree gregkh
2022-08-08 13:25 ` Patch "arm64: set UXN on swapper page tables" has been added to the 5.18-stable tree gregkh
2022-08-08 13:26 ` Patch "arm64: set UXN on swapper page tables" has been added to the 5.19-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.