Commit e7e6a881 authored by Wei Li's avatar Wei Li Committed by Xie XiuQi
Browse files

arm64: irqflags: fix incomplete save & restore



hulk inclusion
category: bugfix
bugzilla: 12844
CVE: NA

-------------------------------------------------

To support the arm64 pseudo nmi, function arch_local_irq_save() and
arch_local_irq_restore() now operate ICC_PMR_EL1 instead of daif.
But i found the logic of the save and restore may be suspicious:

arch_local_irq_save():
daif.i_on  pmr_on   ->  flag.i_on
1           0       |   0
1           1       |   1
0           1       |   0		--[1]
0           0       |   0

arch_local_irq_restore():
daif.i_on  pmr_on  <-  flag.i_on
x           0       |   0
x           1       |   1

As we see, the condintion [1] will never be restored honestly. When doing
function_graph trace at gic_handle_irq(), calling local_irq_save() and
local_irq_restore() in trace_graph_entry() will just go into this
condintion. Therefore the irq can never be processed and lead to hang.

In this patch, we do the save & restore exactly, and make sure the
arch_irqs_disabled_flags() returns correctly.

Fixes: 3021bd9cb776 ("arm64: irqflags: Use ICC_PMR_EL1 for interrupt masking")
Signed-off-by: default avatarWei Li <liwei391@huawei.com>
Reviewed-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 21f7e8bb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment