x86: dovetail: Drop bogus local_irq_disable_full from __bad_area_nosemaphore
PATCH 1/1 x86: dovetail: Drop bogus local_irq_disable_full from __bad_area_nosemaphore
From: Jan Kiszka <[email protected]>
There is no technical reason to disable IRQs here again, neither when the IRQ pipeline is enable nor when it is off, which this change also causes. We are never passing this point from OOB because of the !running_inband check and jump earlier in function. The inband case is identical to the !IRQ_PIPELINE case, and that one does not need any additional IRQ disabling as well (upstream code path).
The addition was most likely a mismerged during the forward-port from 6.18 to 6.19. Remove it.
--- arch/x86/mm/fault.c | 2 -- 1 file changed, 2 deletions(-)
arch/x86/mm/fault.c +0 -2
@@ -886,8 +886,6 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,force_sig_pkuerr ((void __user *)address, pkey); else force_sig_fault(SIGSEGV, si_code, (void __user *)address); - -local_irq_disable_full (); out:oob_trap_unwind (X86_TRAP_PF , regs); }
Signature · 1 line
2.47.3
Quoted 22 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
There is no technical reason to disable IRQs here again, neither when the IRQ pipeline is enable nor when it is off, which this change also causes. We are never passing this point from OOB because of the !running_inband check and jump earlier in function. The inband case is identical to the !IRQ_PIPELINE case, and that one does not need any additional IRQ disabling as well (upstream code path).
The addition was most likely a mismerged during the forward-port from 6.18 to 6.19. Remove it.
Signed-off-by Jan Kiszka <[email protected]>--- arch/x86/mm/fault.c | 2 -- 1 file changed, 2 deletions(-)arch/x86/mm/fault.c +0
-0
arch/x86/mm/fault.c __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code, · line 891
Quoted 8 lines
arch/x86/mm/fault.c +0
-2@@ -886,8 +886,6 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,force_sig_pkuerr ((void __user *)address, pkey); else force_sig_fault(SIGSEGV, si_code, (void __user *)address); - -local_irq_disable_full (); out:oob_trap_unwind (X86_TRAP_PF , regs); }
When removing such code, replacing it by an assertion like WARN_ON_ONCE(irqs_pipelined() && !irqs_disabled()) would catch wrong moves.
Signature · 1 line
Philippe.
Quoted 28 lines · Philippe Gerum
Quoted 26 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
There is no technical reason to disable IRQs here again, neither when the IRQ pipeline is enable nor when it is off, which this change also causes. We are never passing this point from OOB because of the !running_inband check and jump earlier in function. The inband case is identical to the !IRQ_PIPELINE case, and that one does not need any additional IRQ disabling as well (upstream code path).
The addition was most likely a mismerged during the forward-port from 6.18 to 6.19. Remove it.
Signed-off-by Jan Kiszka <[email protected]>--- arch/x86/mm/fault.c | 2 -- 1 file changed, 2 deletions(-)arch/x86/mm/fault.c +0
-1@@ -886,8 +886,6 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,force_sig_pkuerr ((void __user *)address, pkey); else force_sig_fault(SIGSEGV, si_code, (void __user *)address); -
Quoted 9 lines
arch/x86/mm/fault.c __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code, · line 891
Quoted 4 lines
arch/x86/mm/fault.c +0
-1-local_irq_disable_full (); out:oob_trap_unwind (X86_TRAP_PF , regs); }When removing such code, replacing it by an assertion like
WARN_ON_ONCE(irqs_pipelined() && !irqs_disabled())would catch wrong moves.
IRQs are enabled at the point where local_irq_disable_full was located (-> cond_reenable_irqs_user / local_irq_enable), so this warning would always trigger.
Jan
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center
Quoted 39 lines · Jan Kiszka
Quoted 28 lines · Philippe Gerum
Quoted 26 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
There is no technical reason to disable IRQs here again, neither when the IRQ pipeline is enable nor when it is off, which this change also causes. We are never passing this point from OOB because of the !running_inband check and jump earlier in function. The inband case is identical to the !IRQ_PIPELINE case, and that one does not need any additional IRQ disabling as well (upstream code path).
The addition was most likely a mismerged during the forward-port from 6.18 to 6.19. Remove it.
Signed-off-by Jan Kiszka <[email protected]>--- arch/x86/mm/fault.c | 2 -- 1 file changed, 2 deletions(-)arch/x86/mm/fault.c +0
-1@@ -886,8 +886,6 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,force_sig_pkuerr ((void __user *)address, pkey); else force_sig_fault(SIGSEGV, si_code, (void __user *)address); -Quoted 9 lines
arch/x86/mm/fault.c __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code, · line 891
Quoted 4 lines
arch/x86/mm/fault.c +0
-1-local_irq_disable_full (); out:oob_trap_unwind (X86_TRAP_PF , regs); }When removing such code, replacing it by an assertion like
WARN_ON_ONCE(irqs_pipelined() && !irqs_disabled())would catch wrong moves.
Quoted 4 lines
IRQs are enabled at the point where
local_irq_disable_fullwas located (->cond_reenable_irqs_user/local_irq_enable), so this warning would always trigger.
See my previous answer.
Signature · 1 line
Philippe.
Quoted 41 lines · Philippe Gerum
Quoted 39 lines · Jan Kiszka
Quoted 37 lines · Philippe Gerum
Quoted 22 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
There is no technical reason to disable IRQs here again, neither when the IRQ pipeline is enable nor when it is off, which this change also causes. We are never passing this point from OOB because of the !running_inband check and jump earlier in function. The inband case is identical to the !IRQ_PIPELINE case, and that one does not need any additional IRQ disabling as well (upstream code path).
The addition was most likely a mismerged during the forward-port from 6.18 to 6.19. Remove it.
Signed-off-by Jan Kiszka <[email protected]>--- arch/x86/mm/fault.c | 2 -- 1 file changed, 2 deletions(-)arch/x86/mm/fault.c +0
-0arch/x86/mm/fault.c __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code, · line 891
Quoted 8 lines
arch/x86/mm/fault.c +0
-2@@ -886,8 +886,6 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,force_sig_pkuerr ((void __user *)address, pkey); else force_sig_fault(SIGSEGV, si_code, (void __user *)address); - -local_irq_disable_full (); out:oob_trap_unwind (X86_TRAP_PF , regs); }When removing such code, replacing it by an assertion like
WARN_ON_ONCE(irqs_pipelined() && !irqs_disabled())would catch wrong moves.
Quoted 7 lines
Quoted 4 lines
IRQs are enabled at the point where
local_irq_disable_fullwas located (->cond_reenable_irqs_user/local_irq_enable), so this warning would always trigger.See my previous answer.
OK, LLM may again help us out of this confusion, it likely found the source of it:
Before 614da1d3d4cdbd6e41aea06bc97ec15aacff6daf (late in 6.19), there was indeed a local_irq_disable() at the end of __bad_area_nosemaphore. But that commit moved it to handle_page_fault() where we also convert it to cond_disable_irqs(). And that commit was also backported to stable versions.
So, the current local_irq_disable_full() in 6.19+ became misplaced AND checking for irqs_disabled() at that point would be premature before they are actually disabled again in handle_page_fault().
I can try to rephrase the commit message accordingly.
Jan
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center