Skip to content
Commit 8681e95d authored by Elliot Berman's avatar Elliot Berman Committed by Sasha Levin
Browse files

cfi: Use rcu_read_{un}lock_sched_notrace



[ Upstream commit 14c4c8e4 ]

If rcu_read_lock_sched tracing is enabled, the tracing subsystem can
perform a jump which needs to be checked by CFI. For example, stm_ftrace
source is enabled as a module and hooks into enabled ftrace events. This
can cause an recursive loop where find_shadow_check_fn ->
rcu_read_lock_sched -> (call to stm_ftrace generates cfi slowpath) ->
find_shadow_check_fn -> rcu_read_lock_sched -> ...

To avoid the recursion, either the ftrace codes needs to be marked with
__no_cfi or CFI should not trace. Use the "_notrace" in CFI to avoid
tracing so that CFI can guard ftrace.

Signed-off-by: default avatarElliot Berman <quic_eberman@quicinc.com>
Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
Cc: stable@vger.kernel.org
Fixes: cf68fffb ("add support for Clang CFI")
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210811155914.19550-1-quic_eberman@quicinc.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 82d1ea87
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment