Skip to contentSkip to conversation

bpf: Avoid unnecessary audit log for CPU security mitigations

PATCH Applied Yafang Shao 2 participants 2 messages Oct 13, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: Avoid unnecessary audit log for CPU security mitigations

Check cpu_mitigations_off() first to avoid calling capable() if it is off. This can avoid unnecessary audit log.

---
 include/linux/bpf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/bpf.h +2 -2
index 61bde45..f0891ba 100644
@@ -2164,12 +2164,12 @@ static inline bool bpf_allow_uninit_stack(void)
 
 static inline bool bpf_bypass_spec_v1(void)
 {
-	return perfmon_capable() || cpu_mitigations_off();
+	return cpu_mitigations_off() || perfmon_capable();
 }
 
 static inline bool bpf_bypass_spec_v4(void)
 {
-	return perfmon_capable() || cpu_mitigations_off();
+	return cpu_mitigations_off() || perfmon_capable();
 }
 
 int bpf_map_new_fd(struct bpf_map *map, int flags);
Signature · 1 line
1.8.3.1
#1 lore raw
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Quoted 9 lines · On Fri, 13 Oct 2023 08:39:16 +0000 you wrote:

Check cpu_mitigations_off() first to avoid calling capable() if it is off. This can avoid unnecessary audit log.

[...]

Here is the summary with links:
- [bpf-next] bpf: Avoid unnecessary audit log for CPU security mitigations

    https://git.kernel.org/bpf/bpf-next/c/236334aeec0f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html