ANDROID: adding __nocfi to cpuidle_enter_state
Background: When CPU is going to idle state, it would inform RCU that current CPU is entering idle through rcu_idle_enter(), and RCU will ignore read-side critical sections of this CPU. However, there is CFI check mechanism inside idle flow and calls rcu_read_lock(), so "rcu_read_lock() used illegally while idle" in rcu_read_lock() will be triggered because rcu_idle_enter() was already called before. Beside, the pointer of rcu_dereference() might be invalid due to the RCU read-side critical sections will be ignoring in this going idle CPU, it might cause problems like: access the wrong data/address, kernel exception... Based on above description: We will add __nocfi to cpuidle_enter_state to avoid “rcu_read_lock() used illegally while idle!” and avoid the usage of invalid pointer of rcu_dereference() in this situation. Bug: 169017431 Change-Id: I8bbe25704e18cfde351a8f4277dd4b44b07421f5 Signed-off-by: rogercl.yang <rogercl.yang@mediatek.com> Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
This commit is contained in:
committed by
Bruno Martins
parent
9bafb37470
commit
b891b37591
@@ -199,7 +199,7 @@ int cpuidle_enter_s2idle(struct cpuidle_driver *drv, struct cpuidle_device *dev)
|
||||
* @drv: cpuidle driver for this cpu
|
||||
* @index: index into the states table in @drv of the state to enter
|
||||
*/
|
||||
int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
|
||||
int __nocfi cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
|
||||
int index)
|
||||
{
|
||||
int entered_state;
|
||||
|
||||
Reference in New Issue
Block a user