Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'bpf-mm-related-minor-changes'

Yafang Shao says:
====================
These two minor patches were developed during the implementation of
BPF-THP:
https://lwn.net/Articles/1042138/

As suggested by Andrii, they are being submitted separately.
====================

Link: https://patch.msgid.link/20251016063929.13830-1-laoar.shao@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

+14 -3
+9
kernel/bpf/verifier.c
··· 7054 7054 /* RCU trusted: these fields are trusted in RCU CS and can be NULL */ 7055 7055 BTF_TYPE_SAFE_RCU_OR_NULL(struct mm_struct) { 7056 7056 struct file __rcu *exe_file; 7057 + #ifdef CONFIG_MEMCG 7058 + struct task_struct __rcu *owner; 7059 + #endif 7057 7060 }; 7058 7061 7059 7062 /* skb->sk, req->sk are not RCU protected, but we mark them as such ··· 7094 7091 7095 7092 BTF_TYPE_SAFE_TRUSTED_OR_NULL(struct socket) { 7096 7093 struct sock *sk; 7094 + }; 7095 + 7096 + BTF_TYPE_SAFE_TRUSTED_OR_NULL(struct vm_area_struct) { 7097 + struct mm_struct *vm_mm; 7098 + struct file *vm_file; 7097 7099 }; 7098 7100 7099 7101 static bool type_is_rcu(struct bpf_verifier_env *env, ··· 7142 7134 { 7143 7135 BTF_TYPE_EMIT(BTF_TYPE_SAFE_TRUSTED_OR_NULL(struct socket)); 7144 7136 BTF_TYPE_EMIT(BTF_TYPE_SAFE_TRUSTED_OR_NULL(struct dentry)); 7137 + BTF_TYPE_EMIT(BTF_TYPE_SAFE_TRUSTED_OR_NULL(struct vm_area_struct)); 7145 7138 7146 7139 return btf_nested_type_is_trusted(&env->log, reg, field_name, btf_id, 7147 7140 "__safe_trusted_or_null");
+5 -3
tools/testing/selftests/bpf/progs/lsm.c
··· 89 89 int BPF_PROG(test_int_hook, struct vm_area_struct *vma, 90 90 unsigned long reqprot, unsigned long prot, int ret) 91 91 { 92 - if (ret != 0) 92 + struct mm_struct *mm = vma->vm_mm; 93 + 94 + if (ret != 0 || !mm) 93 95 return ret; 94 96 95 97 __s32 pid = bpf_get_current_pid_tgid() >> 32; 96 98 int is_stack = 0; 97 99 98 - is_stack = (vma->vm_start <= vma->vm_mm->start_stack && 99 - vma->vm_end >= vma->vm_mm->start_stack); 100 + is_stack = (vma->vm_start <= mm->start_stack && 101 + vma->vm_end >= mm->start_stack); 100 102 101 103 if (is_stack && monitored_pid == pid) { 102 104 mprotect_count++;