Skip to content

Conversation

@kernel-patches-daemon-bpf-rc
Copy link

Pull request for series with
subject: bpf: verifier: initialize imm in kfunc_tab in add_kfunc_call()
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1022898

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 21f43f4
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1022898
version: 2

Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/project/netdevbpf/list/?series=1022898
error message:

Cmd('git') failed due to: exit code(128)
  cmdline: git am --3way
  stdout: 'Applying: bpf: verifier: initialize imm in kfunc_tab in add_kfunc_call()
Using index info to reconstruct a base tree...
M	kernel/bpf/verifier.c
Falling back to patching base and 3-way merge...
Auto-merging kernel/bpf/verifier.c
CONFLICT (content): Merge conflict in kernel/bpf/verifier.c
Patch failed at 0001 bpf: verifier: initialize imm in kfunc_tab in add_kfunc_call()'
  stderr: 'error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"'

conflict:

diff --cc kernel/bpf/verifier.c
index ff40e5e65c43,31136f9c418b..000000000000
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@@ -3242,8 -3273,7 +3242,12 @@@ static int add_kfunc_call(struct bpf_ve
  	struct bpf_kfunc_desc *desc;
  	const char *func_name;
  	struct btf *desc_btf;
++<<<<<<< HEAD
 +	unsigned long call_imm;
 +	unsigned long addr;
++=======
+ 	unsigned long addr, call_imm;
++>>>>>>> bpf: verifier: initialize imm in kfunc_tab in add_kfunc_call()
  	int err;
  
  	prog_aux = env->prog->aux;
@@@ -3346,6 -3363,23 +3350,26 @@@
  			return err;
  	}
  
++<<<<<<< HEAD
++=======
+ 	err = btf_distill_func_proto(&env->log, desc_btf,
+ 				     func_proto, func_name,
+ 				     &func_model);
+ 	if (err)
+ 		return err;
+ 
+ 	if (bpf_jit_supports_far_kfunc_call()) {
+ 		call_imm = func_id;
+ 	} else {
+ 		call_imm = BPF_CALL_IMM(addr);
+ 		/* Check whether the relative offset overflows desc->imm */
+ 		if ((unsigned long)(s32)call_imm != call_imm) {
+ 			verbose(env, "address of kernel func_id %u is out of range\n", func_id);
+ 			return -EINVAL;
+ 		}
+ 	}
+ 
++>>>>>>> bpf: verifier: initialize imm in kfunc_tab in add_kfunc_call()
  	desc = &tab->descs[tab->nr_descs++];
  	desc->func_id = func_id;
  	desc->imm = call_imm;
@@@ -21837,15 -22353,29 +21861,41 @@@ static void specialize_kfunc(struct bpf
  		 * may_access_direct_pkt_data mutates it
  		 */
  		env->seen_direct_write = seen_direct_write;
++<<<<<<< HEAD
 +	}
 +
 +	if (func_id == special_kfunc_list[KF_bpf_set_dentry_xattr] &&
 +	    bpf_lsm_has_d_inode_locked(prog))
 +		*addr = (unsigned long)bpf_set_dentry_xattr_locked;
 +
 +	if (func_id == special_kfunc_list[KF_bpf_remove_dentry_xattr] &&
 +	    bpf_lsm_has_d_inode_locked(prog))
 +		*addr = (unsigned long)bpf_remove_dentry_xattr_locked;
++=======
+ 	} else if (func_id == special_kfunc_list[KF_bpf_set_dentry_xattr]) {
+ 		if (bpf_lsm_has_d_inode_locked(prog))
+ 			addr = (unsigned long)bpf_set_dentry_xattr_locked;
+ 	} else if (func_id == special_kfunc_list[KF_bpf_remove_dentry_xattr]) {
+ 		if (bpf_lsm_has_d_inode_locked(prog))
+ 			addr = (unsigned long)bpf_remove_dentry_xattr_locked;
+ 	} else if (func_id == special_kfunc_list[KF_bpf_dynptr_from_file]) {
+ 		if (!env->insn_aux_data[insn_idx].non_sleepable)
+ 			addr = (unsigned long)bpf_dynptr_from_file_sleepable;
+ 	}
+ 
+ set_imm:
+ 	if (!bpf_jit_supports_far_kfunc_call()) {
+ 		call_imm = BPF_CALL_IMM(addr);
+ 		/* Check whether the relative offset overflows desc->imm */
+ 		if ((unsigned long)(s32)call_imm != call_imm) {
+ 			verbose(env, "address of kernel func_id %u is out of range\n", func_id);
+ 			return -EINVAL;
+ 		}
+ 		desc->imm = call_imm;
+ 	}
+ 	desc->addr = addr;
+ 	return 0;
++>>>>>>> bpf: verifier: initialize imm in kfunc_tab in add_kfunc_call()
  }
  
  static void __fixup_collection_insert_kfunc(struct bpf_insn_aux_data *insn_aux,

@kernel-patches-daemon-bpf-rc
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1022898 expired. Closing PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant