arm64: set UXN on swapper page tables
Subsystems (2)
Will Deacon
maintainerPATCH 1/1 arm64: set UXN on swapper page tables
From: Peter Collingbourne <[email protected]>
[ 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.
--- arch/arm64/include/asm/kernel-pgtable.h | 4 ++-- arch/arm64/kernel/head.S | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/include/asm/kernel-pgtable.h +2 -2
@@ -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)
arch/arm64/kernel/head.S +1 -1
@@ -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.
Signature · 1 line
2.37.1.559.g78731f0fdb-goog
Greg KH
maintainerQuoted 21 lines · Will Deacon
From: Peter Collingbourne <[email protected]>
[ 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_mappingspanics 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 <[email protected]> # 5.15Signed-off-by Peter Collingbourne <[email protected]>Acked-by Will Deacon <[email protected]>Cc Ard Biesheuvel <[email protected]>Cc Catalin Marinas <[email protected]>Signed-off-by Will Deacon <[email protected]>
Quoted 4 lines
--- 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
Will Deacon
maintainerQuoted 27 lines · Greg KH
Quoted 21 lines · Will Deacon
From: Peter Collingbourne <[email protected]>
[ 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_mappingspanics 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 <[email protected]> # 5.15Signed-off-by Peter Collingbourne <[email protected]>Acked-by Will Deacon <[email protected]>Cc Ard Biesheuvel <[email protected]>Cc Catalin Marinas <[email protected]>Signed-off-by Will Deacon <[email protected]>Quoted 4 lines
--- arch/arm64/include/asm/kernel-pgtable.h | 4 ++-- arch/arm64/kernel/head.S | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Quoted 1 line
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
Patch "arm64: set UXN on swapper page tables" has been added to the 5.15-stable tree
In reply to Will DeaconThis 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 <[email protected]> know about it.
From [email protected] Mon Aug 8 15:23:59 2022
From: Will Deacon <[email protected]>
Date: Mon, 8 Aug 2022 13:53:21 +0100
Subject: arm64: set UXN on swapper page tables
To: [email protected]
Cc: [email protected], [email protected], Peter Collingbourne <[email protected]>, [email protected], Will Deacon <[email protected]>, Ard Biesheuvel <[email protected]>, Catalin Marinas <[email protected]>
Message-ID: <[email protected]>
From: Peter Collingbourne <[email protected]>
[ 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.
--- arch/arm64/include/asm/kernel-pgtable.h | 4 ++-- arch/arm64/kernel/head.S | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/include/asm/kernel-pgtable.h +2 -2
@@ -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)
arch/arm64/kernel/head.S +1 -1
@@ -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 [email protected] 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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Patch "arm64: set UXN on swapper page tables" has been added to the 5.18-stable tree
In reply to Will DeaconThis 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 <[email protected]> know about it.
From [email protected] Mon Aug 8 15:23:59 2022
From: Will Deacon <[email protected]>
Date: Mon, 8 Aug 2022 13:53:21 +0100
Subject: arm64: set UXN on swapper page tables
To: [email protected]
Cc: [email protected], [email protected], Peter Collingbourne <[email protected]>, [email protected], Will Deacon <[email protected]>, Ard Biesheuvel <[email protected]>, Catalin Marinas <[email protected]>
Message-ID: <[email protected]>
From: Peter Collingbourne <[email protected]>
[ 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.
--- arch/arm64/include/asm/kernel-pgtable.h | 4 ++-- arch/arm64/kernel/head.S | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/include/asm/kernel-pgtable.h +2 -2
@@ -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)
arch/arm64/kernel/head.S +1 -1
@@ -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 [email protected] 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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Patch "arm64: set UXN on swapper page tables" has been added to the 5.19-stable tree
In reply to Will DeaconThis 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 <[email protected]> know about it.
From [email protected] Mon Aug 8 15:23:59 2022
From: Will Deacon <[email protected]>
Date: Mon, 8 Aug 2022 13:53:21 +0100
Subject: arm64: set UXN on swapper page tables
To: [email protected]
Cc: [email protected], [email protected], Peter Collingbourne <[email protected]>, [email protected], Will Deacon <[email protected]>, Ard Biesheuvel <[email protected]>, Catalin Marinas <[email protected]>
Message-ID: <[email protected]>
From: Peter Collingbourne <[email protected]>
[ 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.
--- arch/arm64/include/asm/kernel-pgtable.h | 4 ++-- arch/arm64/kernel/head.S | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/include/asm/kernel-pgtable.h +2 -2
@@ -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)
arch/arm64/kernel/head.S +1 -1
@@ -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 [email protected] 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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel