arm64/entry: Fix arm64-specific rseq brokenness
Subsystems (2)
Mark Rutland
reviewerPATCH v2 1/1 arm64/entry: Fix arm64-specific rseq brokenness
Hi,
In all the confusion with the rseq fixes, it looks like the arm64 patch didn't get picked up into the tip tree. That was queued up in Thomas's devel/core/rseq branch, but it didn't get reposted and picked up into tip.
Thomas, Peter, are you happy to pick the below into the tip sched/urgent branch? It's the same as what what in Thomas's devel/core/rseq branch:
... which was taken from my arm64/rseq branch:
It applies cleanly and passes all tests.
Catalin, Will, you both mentioned off-list that you were happy for this to go via tip with the rest of the rseq fixes. Can either of you please confirm with an ack?
Mark.
---->8----
Mathias Stearn reports that since v6.19, there are two big issues affecting rseq:
(1) On arm64 specifically, rseq critical sections aren't aborted when they should be.
(2) The 'cpu_id_start' field is no longer written by the kernel in all cases it used to be, including some cases where TCMalloc depends on the kernel clobbering the field.
This patch fixes issue #1. This patch DOES NOT fix issue #2, which will need to be addressed by other patches.
The arm64-specific brokenness is a result of commits:
2fc0e4b4126c ("rseq: Record interrupt from user space") 39a167560a61 ("rseq: Optimize event setting")
The first commit failed to add a call to rseq_note_user_irq_entry() on arm64. Thus arm64 never sets rseq_event::user_irq to record that it may be necessary to abort an active rseq critical section upon return to userspace. On its own, this commit had no functional impact as the value of rseq_event::user_irq was not consumed.
The second commit relied upon rseq_event::user_irq to determine whether or not to bother to perform rseq work when returning to userspace. As rseq_event::user_irq wasn't set on arm64, this work would be skipped, and consequently an active rseq critical section would not be aborted.
Fix this by giving arm64 syscall-specific entry/exit paths, and performing the relevant logic in syscall and non-syscall paths, including calling rseq_note_user_irq_entry() for non-syscall entry.
Currently arm64 cannot use syscall_enter_from_user_mode(), syscall_exit_to_user_mode(), and irqentry_exit_to_user_mode(), due to ordering constraints with exception masking, and risk of ABI breakage for syscall tracing/audit/etc. For the moment the entry/exit logic is left as arm64-specific, directly using enter_from_user_mode() and exit_to_user_mode(), but mirroring the generic code.
I intend to follow up with refactoring/cleanup, as we did for kernel mode entry paths in commit:
041aa7a85390 ("entry: Split preemption from irqentry_exit_to_kernel_mode()")
... which will allow arm64 to use the GENERIC_IRQ_ENTRY functions directly.
--- arch/arm64/kernel/entry-common.c | 31 ++++++++++++++++++++++++------- include/linux/irq-entry-common.h | 8 -------- include/linux/rseq_entry.h | 19 ------------------- 3 files changed, 24 insertions(+), 34 deletions(-)
Since v1 [1]:
* Restore sme_{enter_from,exit_to}_user_mode()
* Describe use of enter_from_user_mode() in commit message
[1] https://lore.kernel.org/linux-arm-kernel/aeueE1I1OuVkOcEZ@J2N7QTR9R3/
arch/arm64/kernel/entry-common.c +24 -7
@@ -62,6 +62,13 @@ static void noinstr arm64_exit_to_kernel_mode(struct pt_regs *regs,irqentry_exit_to_kernel_mode_after_preempt (regs, state); } +static __always_inline void arm64_syscall_enter_from_user_mode(struct pt_regs *regs) +{ +enter_from_user_mode (regs); +mte_disable_tco_entry (current); +sme_enter_from_user_mode (); +} +/* * Handle IRQ/context state management when entering from user mode. * Before this function is called it is not safe to call regular kernel code,
@@ -70,20 +77,30 @@ static void noinstr arm64_exit_to_kernel_mode(struct pt_regs *regs, static __always_inline void arm64_enter_from_user_mode(struct pt_regs *regs) {enter_from_user_mode (regs); +rseq_note_user_irq_entry ();mte_disable_tco_entry (current);sme_enter_from_user_mode (); } +static __always_inline void arm64_syscall_exit_to_user_mode(struct pt_regs *regs) +{ +local_irq_disable (); +syscall_exit_to_user_mode_prepare (regs); +local_daif_mask (); +sme_exit_to_user_mode (); +mte_check_tfsr_exit (); +exit_to_user_mode (); +} +/* * Handle IRQ/context state management when exiting to user mode. * After this function returns it is not safe to call regular kernel code, * instrumentable code, or any code which may trigger an exception. */ - static __always_inline void arm64_exit_to_user_mode(struct pt_regs *regs) {local_irq_disable (); -exit_to_user_mode_prepare_legacy (regs); +irqentry_exit_to_user_mode_prepare (regs);local_daif_mask ();sme_exit_to_user_mode ();mte_check_tfsr_exit ();
@@ -92,7 +109,7 @@ static __always_inline void arm64_exit_to_user_mode(struct pt_regs *regs) asmlinkage void noinstr asm_exit_to_user_mode(struct pt_regs *regs) { -arm64_exit_to_user_mode (regs); +arm64_syscall_exit_to_user_mode (regs); }/*
@@ -716,12 +733,12 @@ static void noinstr el0_brk64(struct pt_regs *regs, unsigned long esr) static void noinstr el0_svc(struct pt_regs *regs) { -arm64_enter_from_user_mode (regs); +arm64_syscall_enter_from_user_mode (regs);cortex_a76_erratum_1463225_svc_handler ();fpsimd_syscall_enter ();local_daif_restore (DAIF_PROCCTX );do_el0_svc (regs); -arm64_exit_to_user_mode (regs); +arm64_syscall_exit_to_user_mode (regs);fpsimd_syscall_exit (); }
@@ -868,11 +885,11 @@ static void noinstr el0_cp15(struct pt_regs *regs, unsigned long esr) static void noinstr el0_svc_compat(struct pt_regs *regs) { -arm64_enter_from_user_mode (regs); +arm64_syscall_enter_from_user_mode (regs);cortex_a76_erratum_1463225_svc_handler ();local_daif_restore (DAIF_PROCCTX );do_el0_svc_compat (regs); -arm64_exit_to_user_mode (regs); +arm64_syscall_exit_to_user_mode (regs); } static void noinstr el0_bkpt32(struct pt_regs *regs, unsigned long esr)
include/linux/irq-entry-common.h +0 -8
@@ -218,14 +218,6 @@ static __always_inline void __exit_to_user_mode_validate(void)lockdep_sys_exit (); } -/* Temporary workaround to keep ARM64 alive */ -static __always_inline void exit_to_user_mode_prepare_legacy(struct pt_regs *regs) -{ -__exit_to_user_mode_prepare (regs,EXIT_TO_USER_MODE_WORK ); -rseq_exit_to_user_mode_legacy (); -__exit_to_user_mode_validate (); -} -/** * syscall_exit_to_user_mode_prepare - call exit_to_user_mode_loop() if required * @regs: Pointer to pt_regs on entry stack
include/linux/rseq_entry.h +0 -19
@@ -749,24 +749,6 @@ static __always_inline void rseq_irqentry_exit_to_user_mode(void) ev->events =0 ; } -/* Required to keep ARM64 working */ -static __always_inline void rseq_exit_to_user_mode_legacy(void) -{ -struct rseq_event *ev = ¤t->rseq.event; - -rseq_stat_inc (rseq_stats.exit); - -if (static_branch_unlikely (&rseq_debug_enabled)) -WARN_ON_ONCE (ev->sched_switch); - -/* -* Ensure that event (especially user_irq) is cleared when the -* interrupt did not result in a schedule and therefore the -* rseq processing did not clear it. -*/ - ev->events =0 ; -} -void __rseq_debug_syscall_return (struct pt_regs *regs); static __always_inline void rseq_debug_syscall_return(struct pt_regs *regs)
@@ -782,7 +764,6 @@ static inline bool rseq_exit_to_user_mode_restart(struct pt_regs *regs, unsigned }static inline void rseq_syscall_exit_to_user_mode (void ) { }static inline void rseq_irqentry_exit_to_user_mode (void ) { } -static inline void rseq_exit_to_user_mode_legacy (void ) { }static inline void rseq_debug_syscall_return (struct pt_regs *regs) { }static inline bool rseq_grant_slice_extension (unsigned long ti_work,unsigned long mask) {return false; }#endif /* !CONFIG_RSEQ */
Signature · 1 line
2.30.2
Quoted 47 lines · Mark Rutland
Mathias Stearn reports that since v6.19, there are two big issues affecting rseq:
(1) On arm64 specifically, rseq critical sections aren't aborted when they should be.
(2) The '
cpu_id_start' field is no longer written by the kernel in all cases it used to be, including some cases where TCMalloc depends on the kernel clobbering the field.This patch fixes issue #1. This patch DOES NOT fix issue #2, which will need to be addressed by other patches.
The arm64-specific brokenness is a result of commits:
2fc0e4b4126c("rseq: Record interrupt from user space")39a167560a61("rseq: Optimize event setting")The first commit failed to add a call to
rseq_note_user_irq_entry()on arm64. Thus arm64 never setsrseq_event::user_irqto record that it may be necessary to abort an active rseq critical section upon return to userspace. On its own, this commit had no functional impact as the value ofrseq_event::user_irqwas not consumed.The second commit relied upon
rseq_event::user_irqto determine whether or not to bother to perform rseq work when returning to userspace. Asrseq_event::user_irqwasn't set on arm64, this work would be skipped, and consequently an active rseq critical section would not be aborted.Fix this by giving arm64 syscall-specific entry/exit paths, and performing the relevant logic in syscall and non-syscall paths, including calling
rseq_note_user_irq_entry()for non-syscall entry.Currently arm64 cannot use
syscall_enter_from_user_mode(),syscall_exit_to_user_mode(), andirqentry_exit_to_user_mode(), due to ordering constraints with exception masking, and risk of ABI breakage for syscall tracing/audit/etc. For the moment the entry/exit logic is left as arm64-specific, directly usingenter_from_user_mode()andexit_to_user_mode(), but mirroring the generic code.I intend to follow up with refactoring/cleanup, as we did for kernel mode entry paths in commit:
041aa7a85390("entry: Split preemption fromirqentry_exit_to_kernel_mode()")... which will allow arm64 to use the
GENERIC_IRQ_ENTRYfunctions directly.
Quoted 12 lines
Fixes 39a167560a61 ("rseq: Optimize event setting")Reported-by Mathias Stearn <[email protected]>Link https://lore.kernel.org/regressions/CAHnCjA25b+nO2n5CeifknSKHssJpPrjnf+dtr7UgzRw4Zgu=oA@mail.gmail.com/ open hereSigned-off-by Mark Rutland <[email protected]>Cc Catalin Marinas <[email protected]>Cc Chris Kennelly <[email protected]>Cc Dmitry Vyukov <[email protected]>Cc Jinjie Ruan <[email protected]>Cc Mathieu Desnoyers <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Will Deacon <[email protected]>
The following commit has been merged into the sched/urgent branch of tip:
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: 411c1cf430392c905e39f12bc305dd994da0b426 Gitweb: https://git.kernel.org/tip/411c1cf430392c905e39f12bc305dd994da0b426 Author: Mark Rutland <[email protected]> AuthorDate: Fri, 08 May 2026 15:20:23 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 08 May 2026 17:00:44 +02:00
arm64/entry: Fix arm64-specific rseq brokenness
Mathias Stearn reports that since v6.19, there are two big issues affecting rseq:
(1) On arm64 specifically, rseq critical sections aren't aborted when they should be.
(2) The 'cpu_id_start' field is no longer written by the kernel in all cases it used to be, including some cases where TCMalloc depends on the kernel clobbering the field.
This patch fixes issue #1. This patch DOES NOT fix issue #2, which will need to be addressed by other patches.
The arm64-specific brokenness is a result of commits:
2fc0e4b4126c ("rseq: Record interrupt from user space") 39a167560a61 ("rseq: Optimize event setting")
The first commit failed to add a call to rseq_note_user_irq_entry() on arm64. Thus arm64 never sets rseq_event::user_irq to record that it may be necessary to abort an active rseq critical section upon return to userspace. On its own, this commit had no functional impact as the value of rseq_event::user_irq was not consumed.
The second commit relied upon rseq_event::user_irq to determine whether or not to bother to perform rseq work when returning to userspace. As rseq_event::user_irq wasn't set on arm64, this work would be skipped, and consequently an active rseq critical section would not be aborted.
Fix this by giving arm64 syscall-specific entry/exit paths, and performing the relevant logic in syscall and non-syscall paths, including calling rseq_note_user_irq_entry() for non-syscall entry.
Currently arm64 cannot use syscall_enter_from_user_mode(), syscall_exit_to_user_mode(), and irqentry_exit_to_user_mode(), due to ordering constraints with exception masking, and risk of ABI breakage for syscall tracing/audit/etc. For the moment the entry/exit logic is left as arm64-specific, directly using enter_from_user_mode() and exit_to_user_mode(), but mirroring the generic code.
I intend to follow up with refactoring/cleanup, as we did for kernel mode entry paths in commit:
041aa7a85390 ("entry: Split preemption from irqentry_exit_to_kernel_mode()")
... which will allow arm64 to use the GENERIC_IRQ_ENTRY functions directly.
--- arch/arm64/kernel/entry-common.c | 31 ++++++++++++++++++++++++------- include/linux/irq-entry-common.h | 8 +-------- include/linux/rseq_entry.h | 19 +------------------- 3 files changed, 24 insertions(+), 34 deletions(-)
arch/arm64/kernel/entry-common.c +24 -7
@@ -62,6 +62,13 @@ static void noinstr arm64_exit_to_kernel_mode(struct pt_regs *regs,irqentry_exit_to_kernel_mode_after_preempt (regs, state); } +static __always_inline void arm64_syscall_enter_from_user_mode(struct pt_regs *regs) +{ +enter_from_user_mode (regs); +mte_disable_tco_entry (current); +sme_enter_from_user_mode (); +} +/* * Handle IRQ/context state management when entering from user mode. * Before this function is called it is not safe to call regular kernel code,
@@ -70,20 +77,30 @@ static void noinstr arm64_exit_to_kernel_mode(struct pt_regs *regs, static __always_inline void arm64_enter_from_user_mode(struct pt_regs *regs) {enter_from_user_mode (regs); +rseq_note_user_irq_entry ();mte_disable_tco_entry (current);sme_enter_from_user_mode (); } +static __always_inline void arm64_syscall_exit_to_user_mode(struct pt_regs *regs) +{ +local_irq_disable (); +syscall_exit_to_user_mode_prepare (regs); +local_daif_mask (); +sme_exit_to_user_mode (); +mte_check_tfsr_exit (); +exit_to_user_mode (); +} +/* * Handle IRQ/context state management when exiting to user mode. * After this function returns it is not safe to call regular kernel code, * instrumentable code, or any code which may trigger an exception. */ - static __always_inline void arm64_exit_to_user_mode(struct pt_regs *regs) {local_irq_disable (); -exit_to_user_mode_prepare_legacy (regs); +irqentry_exit_to_user_mode_prepare (regs);local_daif_mask ();sme_exit_to_user_mode ();mte_check_tfsr_exit ();
@@ -92,7 +109,7 @@ static __always_inline void arm64_exit_to_user_mode(struct pt_regs *regs) asmlinkage void noinstr asm_exit_to_user_mode(struct pt_regs *regs) { -arm64_exit_to_user_mode (regs); +arm64_syscall_exit_to_user_mode (regs); }/*
@@ -716,12 +733,12 @@ static void noinstr el0_brk64(struct pt_regs *regs, unsigned long esr) static void noinstr el0_svc(struct pt_regs *regs) { -arm64_enter_from_user_mode (regs); +arm64_syscall_enter_from_user_mode (regs);cortex_a76_erratum_1463225_svc_handler ();fpsimd_syscall_enter ();local_daif_restore (DAIF_PROCCTX );do_el0_svc (regs); -arm64_exit_to_user_mode (regs); +arm64_syscall_exit_to_user_mode (regs);fpsimd_syscall_exit (); }
@@ -868,11 +885,11 @@ static void noinstr el0_cp15(struct pt_regs *regs, unsigned long esr) static void noinstr el0_svc_compat(struct pt_regs *regs) { -arm64_enter_from_user_mode (regs); +arm64_syscall_enter_from_user_mode (regs);cortex_a76_erratum_1463225_svc_handler ();local_daif_restore (DAIF_PROCCTX );do_el0_svc_compat (regs); -arm64_exit_to_user_mode (regs); +arm64_syscall_exit_to_user_mode (regs); } static void noinstr el0_bkpt32(struct pt_regs *regs, unsigned long esr)
include/linux/irq-entry-common.h +0 -8
@@ -218,14 +218,6 @@ static __always_inline void __exit_to_user_mode_validate(void)lockdep_sys_exit (); } -/* Temporary workaround to keep ARM64 alive */ -static __always_inline void exit_to_user_mode_prepare_legacy(struct pt_regs *regs) -{ -__exit_to_user_mode_prepare (regs,EXIT_TO_USER_MODE_WORK ); -rseq_exit_to_user_mode_legacy (); -__exit_to_user_mode_validate (); -} -/** * syscall_exit_to_user_mode_prepare - call exit_to_user_mode_loop() if required * @regs: Pointer to pt_regs on entry stack
include/linux/rseq_entry.h +0 -19
@@ -749,24 +749,6 @@ static __always_inline void rseq_irqentry_exit_to_user_mode(void) ev->events =0 ; } -/* Required to keep ARM64 working */ -static __always_inline void rseq_exit_to_user_mode_legacy(void) -{ -struct rseq_event *ev = ¤t->rseq.event; - -rseq_stat_inc (rseq_stats.exit); - -if (static_branch_unlikely (&rseq_debug_enabled)) -WARN_ON_ONCE (ev->sched_switch); - -/* -* Ensure that event (especially user_irq) is cleared when the -* interrupt did not result in a schedule and therefore the -* rseq processing did not clear it. -*/ - ev->events =0 ; -} -void __rseq_debug_syscall_return (struct pt_regs *regs); static __always_inline void rseq_debug_syscall_return(struct pt_regs *regs)
@@ -782,7 +764,6 @@ static inline bool rseq_exit_to_user_mode_restart(struct pt_regs *regs, unsigned }static inline void rseq_syscall_exit_to_user_mode (void ) { }static inline void rseq_irqentry_exit_to_user_mode (void ) { } -static inline void rseq_exit_to_user_mode_legacy (void ) { }static inline void rseq_debug_syscall_return (struct pt_regs *regs) { }static inline bool rseq_grant_slice_extension (unsigned long ti_work,unsigned long mask) {return false; }#endif /* !CONFIG_RSEQ */
Quoted 90 lines · Mark Rutland
Hi,
In all the confusion with the rseq fixes, it looks like the arm64 patch didn't get picked up into the tip tree. That was queued up in Thomas's devel/core/rseq branch, but it didn't get reposted and picked up into tip.
Thomas, Peter, are you happy to pick the below into the tip sched/urgent branch? It's the same as what what in Thomas's devel/core/rseq branch:
... which was taken from my arm64/rseq branch:
It applies cleanly and passes all tests.
Catalin, Will, you both mentioned off-list that you were happy for this to go via tip with the rest of the rseq fixes. Can either of you please confirm with an ack?
Mark.
---->8----
Mathias Stearn reports that since v6.19, there are two big issues affecting rseq:(1) On arm64 specifically, rseq critical sections aren't aborted when they should be.
(2) The '
cpu_id_start' field is no longer written by the kernel in all cases it used to be, including some cases where TCMalloc depends on the kernel clobbering the field.This patch fixes issue #1. This patch DOES NOT fix issue #2, which will need to be addressed by other patches.
The arm64-specific brokenness is a result of commits:
2fc0e4b4126c("rseq: Record interrupt from user space")39a167560a61("rseq: Optimize event setting")The first commit failed to add a call to
rseq_note_user_irq_entry()on arm64. Thus arm64 never setsrseq_event::user_irqto record that it may be necessary to abort an active rseq critical section upon return to userspace. On its own, this commit had no functional impact as the value ofrseq_event::user_irqwas not consumed.The second commit relied upon
rseq_event::user_irqto determine whether or not to bother to perform rseq work when returning to userspace. Asrseq_event::user_irqwasn't set on arm64, this work would be skipped, and consequently an active rseq critical section would not be aborted.Fix this by giving arm64 syscall-specific entry/exit paths, and performing the relevant logic in syscall and non-syscall paths, including calling
rseq_note_user_irq_entry()for non-syscall entry.Currently arm64 cannot use
syscall_enter_from_user_mode(),syscall_exit_to_user_mode(), andirqentry_exit_to_user_mode(), due to ordering constraints with exception masking, and risk of ABI breakage for syscall tracing/audit/etc. For the moment the entry/exit logic is left as arm64-specific, directly usingenter_from_user_mode()andexit_to_user_mode(), but mirroring the generic code.I intend to follow up with refactoring/cleanup, as we did for kernel mode entry paths in commit:
041aa7a85390("entry: Split preemption fromirqentry_exit_to_kernel_mode()")... which will allow arm64 to use the
GENERIC_IRQ_ENTRYfunctions directly.Fixes 39a167560a61 ("rseq: Optimize event setting")Reported-by Mathias Stearn <[email protected]>Link https://lore.kernel.org/regressions/CAHnCjA25b+nO2n5CeifknSKHssJpPrjnf+dtr7UgzRw4Zgu=oA@mail.gmail.com/ open hereSigned-off-by Mark Rutland <[email protected]>Cc Catalin Marinas <[email protected]>Cc Chris Kennelly <[email protected]>Cc Dmitry Vyukov <[email protected]>Cc Jinjie Ruan <[email protected]>Cc Mathieu Desnoyers <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Will Deacon <[email protected]>--- arch/arm64/kernel/entry-common.c | 31 ++++++++++++++++++++++++------- include/linux/irq-entry-common.h | 8 -------- include/linux/rseq_entry.h | 19 ------------------- 3 files changed, 24 insertions(+), 34 deletions(-)
Quoted 3 lines
Since v1 [1]:
* Restore sme_{enter_from,exit_to}_user_mode()
* Describe use ofenter_from_user_mode()in commit message
Quoted 148 lines
[1] https://lore.kernel.org/linux-arm-kernel/aeueE1I1OuVkOcEZ@J2N7QTR9R3/
arch/arm64/kernel/entry-common.c +24
-7@@ -62,6 +62,13 @@ static void noinstr arm64_exit_to_kernel_mode(struct pt_regs *regs,irqentry_exit_to_kernel_mode_after_preempt (regs, state); } +static __always_inline void arm64_syscall_enter_from_user_mode(struct pt_regs *regs) +{ +enter_from_user_mode (regs); +mte_disable_tco_entry (current); +sme_enter_from_user_mode (); +} +/* * Handle IRQ/context state management when entering from user mode. * Before this function is called it is not safe to call regular kernel code, @@ -70,20 +77,30 @@ static void noinstr arm64_exit_to_kernel_mode(struct pt_regs *regs, static __always_inline void arm64_enter_from_user_mode(struct pt_regs *regs) {enter_from_user_mode (regs); +rseq_note_user_irq_entry ();mte_disable_tco_entry (current);sme_enter_from_user_mode (); } +static __always_inline void arm64_syscall_exit_to_user_mode(struct pt_regs *regs) +{ +local_irq_disable (); +syscall_exit_to_user_mode_prepare (regs); +local_daif_mask (); +sme_exit_to_user_mode (); +mte_check_tfsr_exit (); +exit_to_user_mode (); +} +/* * Handle IRQ/context state management when exiting to user mode. * After this function returns it is not safe to call regular kernel code, * instrumentable code, or any code which may trigger an exception. */ - static __always_inline void arm64_exit_to_user_mode(struct pt_regs *regs) {local_irq_disable (); -exit_to_user_mode_prepare_legacy (regs); +irqentry_exit_to_user_mode_prepare (regs);local_daif_mask ();sme_exit_to_user_mode ();mte_check_tfsr_exit ();@@ -92,7 +109,7 @@ static __always_inline void arm64_exit_to_user_mode(struct pt_regs *regs) asmlinkage void noinstr asm_exit_to_user_mode(struct pt_regs *regs) { -arm64_exit_to_user_mode (regs); +arm64_syscall_exit_to_user_mode (regs); }/* @@ -716,12 +733,12 @@ static void noinstr el0_brk64(struct pt_regs *regs, unsigned long esr) static void noinstr el0_svc(struct pt_regs *regs) { -arm64_enter_from_user_mode (regs); +arm64_syscall_enter_from_user_mode (regs);cortex_a76_erratum_1463225_svc_handler ();fpsimd_syscall_enter ();local_daif_restore (DAIF_PROCCTX );do_el0_svc (regs); -arm64_exit_to_user_mode (regs); +arm64_syscall_exit_to_user_mode (regs);fpsimd_syscall_exit (); }@@ -868,11 +885,11 @@ static void noinstr el0_cp15(struct pt_regs *regs, unsigned long esr) static void noinstr el0_svc_compat(struct pt_regs *regs) { -arm64_enter_from_user_mode (regs); +arm64_syscall_enter_from_user_mode (regs);cortex_a76_erratum_1463225_svc_handler ();local_daif_restore (DAIF_PROCCTX );do_el0_svc_compat (regs); -arm64_exit_to_user_mode (regs); +arm64_syscall_exit_to_user_mode (regs); } static void noinstr el0_bkpt32(struct pt_regs *regs, unsigned long esr)include/linux/irq-entry-common.h +0
-8@@ -218,14 +218,6 @@ static __always_inline void __exit_to_user_mode_validate(void)lockdep_sys_exit (); } -/* Temporary workaround to keep ARM64 alive */ -static __always_inline void exit_to_user_mode_prepare_legacy(struct pt_regs *regs) -{ -__exit_to_user_mode_prepare (regs,EXIT_TO_USER_MODE_WORK ); -rseq_exit_to_user_mode_legacy (); -__exit_to_user_mode_validate (); -} -/** * syscall_exit_to_user_mode_prepare - call exit_to_user_mode_loop() if required * @regs: Pointer to pt_regs on entry stack include/linux/rseq_entry.h +0
-19@@ -749,24 +749,6 @@ static __always_inline void rseq_irqentry_exit_to_user_mode(void) ev->events =0 ; } -/* Required to keep ARM64 working */ -static __always_inline void rseq_exit_to_user_mode_legacy(void) -{ -struct rseq_event *ev = ¤t->rseq.event; - -rseq_stat_inc (rseq_stats.exit); - -if (static_branch_unlikely (&rseq_debug_enabled)) -WARN_ON_ONCE (ev->sched_switch); - -/* -* Ensure that event (especially user_irq) is cleared when the -* interrupt did not result in a schedule and therefore the -* rseq processing did not clear it. -*/ - ev->events =0 ; -} -void __rseq_debug_syscall_return (struct pt_regs *regs); static __always_inline void rseq_debug_syscall_return(struct pt_regs *regs)@@ -782,7 +764,6 @@ static inline bool rseq_exit_to_user_mode_restart(struct pt_regs *regs, unsigned }static inline void rseq_syscall_exit_to_user_mode (void ) { }static inline void rseq_irqentry_exit_to_user_mode (void ) { } -static inline void rseq_exit_to_user_mode_legacy (void ) { }static inline void rseq_debug_syscall_return (struct pt_regs *regs) { }static inline bool rseq_grant_slice_extension (unsigned long ti_work,unsigned long mask) {return false; }#endif /* !CONFIG_RSEQ */
Did the arm64-specific fix to rseq not get backportted to 7.0? We just ran our test suite against 7.0.10 which has the other rseq fixes and everything was fine on x86_64, but arm64 was frequently segfaulting.
I had an AI agent look into this and it reported:
"""
The fix (commits b9eac6a9d93c, 82f572449cfe, 99428157dcf3, 411c1cf43039) first appeared in v7.1-rc1 and will be included in v7.1.0.
The three commits backported to linux-7.0.y:
- 663121edad54 — "rseq: Revert to historical performance killing behaviour"
- d242126fd21a — "rseq: Implement read only ABI enforcement for optimized RSEQ V2 mode"
- fb742945d61a — "rseq: Reenable performance optimizations conditionally"
The arm64-specific fix (411c1cf43039 "arm64/entry: Fix arm64-specific rseq brokenness") was not backported to any stable branch — it will only appear in v7.1.0.
"""
Is it possible to get 411c1cf43039 backported to 7.0 or was it omitted intentionally?
Will Deacon
maintainerQuoted 16 lines · Mathias Stearn
Did the arm64-specific fix to rseq not get backportted to 7.0? We just ran our test suite against 7.0.10 which has the other rseq fixes and everything was fine on
x86_64, but arm64 was frequently segfaulting.I had an AI agent look into this and it reported:
"""
The fix (commitsb9eac6a9d93c,82f572449cfe,99428157dcf3,411c1cf43039) first appeared in v7.1-rc1 and will be included in v7.1.0.The three commits backported to linux-7.0.y:
-663121edad54— "rseq: Revert to historical performance killing behaviour"
-d242126fd21a— "rseq: Implement read only ABI enforcement for optimized RSEQ V2 mode"
-fb742945d61a— "rseq: Reenable performance optimizations conditionally"
Quoted 7 lines
The arm64-specific fix (
411c1cf43039"arm64/entry: Fix arm64-specific rseq brokenness") was not backported to any stable branch — it will only appear in v7.1.0.
"""Is it possible to get
411c1cf43039backported to 7.0 or was it omitted intentionally?
You can send a backport to the stable maintainers:
(see option 3)
Will
Quoted 8 lines · Will Deacon
Quoted 2 lines · Mathias Stearn
Is it possible to get
411c1cf43039backported to 7.0 or was it omitted intentionally?You can send a backport to the stable maintainers:
Who was that "you" directed at? I'm not used to the kernel development process. Is that my responsibility as the bug reporter / interested party, or something that Mark Rutland, author of the patch, should do?
Mark Rutland
reviewerQuoted 6 lines · Mathias Stearn
Quoted 5 lines · Will Deacon
Quoted 2 lines · Mathias Stearn
Is it possible to get
411c1cf43039backported to 7.0 or was it omitted intentionally?
Quoted 7 lines
Quoted 3 lines
You can send a backport to the stable maintainers:
Who was that "you" directed at? I'm not used to the kernel development process. Is that my responsibility as the bug reporter / interested party, or something that Mark Rutland, author of the patch, should do?
I'll sort it out.
Mark.
Mark Rutland
reviewerQuoted 9 lines · Mark Rutland
Quoted 8 lines · Mathias Stearn
Quoted 7 lines · Will Deacon
Quoted 2 lines · Mathias Stearn
Is it possible to get
411c1cf43039backported to 7.0 or was it omitted intentionally?You can send a backport to the stable maintainers:
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Who was that "you" directed at? I'm not used to the kernel development process. Is that my responsibility as the bug reporter / interested party, or something that Mark Rutland, author of the patch, should do?
I'll sort it out.
I've send a backport for v7.0; when lore updates it should be visible at:
https://lore.kernel.org/stable/[email protected]/
Mark.