Skip to content

bpf: add support for KASAN checks in JITed programs - #8665

Open
kernel-patches-daemon-bpf-rc[bot] wants to merge 1 commit into
bpf-net_basefrom
series/1140279=>bpf-net
Open

bpf: add support for KASAN checks in JITed programs#8665
kernel-patches-daemon-bpf-rc[bot] wants to merge 1 commit into
bpf-net_basefrom
series/1140279=>bpf-net

Conversation

@kernel-patches-daemon-bpf-rc

Copy link
Copy Markdown

Pull request for series with
subject: bpf: add support for KASAN checks in JITed programs
version: 6
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1140279

@kernel-patches-daemon-bpf-rc

Copy link
Copy Markdown
Author

Upstream branch: bfa3d89
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1140279
version: 6

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

Cmd('git') failed due to: exit code(128)
  cmdline: git am --3way
  stdout: 'Applying: bpf: mark instructions accessing program stack
Using index info to reconstruct a base tree...
M	include/linux/bpf_verifier.h
M	kernel/bpf/fixups.c
M	kernel/bpf/verifier.c
Falling back to patching base and 3-way merge...
Auto-merging include/linux/bpf_verifier.h
Auto-merging kernel/bpf/fixups.c
Auto-merging kernel/bpf/verifier.c
CONFLICT (content): Merge conflict in kernel/bpf/verifier.c
Patch failed at 0001 bpf: mark instructions accessing program stack'
  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 set advice.mergeConflict false"'

conflict:

diff --cc kernel/bpf/verifier.c
index 7fb88e1cd7c4,3392d93c73f8..000000000000
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@@ -3501,7 -3213,12 +3501,16 @@@ static void mark_indirect_target(struc
  	env->insn_aux_data[idx].indirect_target = true;
  }
  
++<<<<<<< HEAD
 +#define LR_FRAMENO_BITS	3
++=======
+ static void mark_non_stack_access(struct bpf_verifier_env *env, int idx)
+ {
+ 	env->insn_aux_data[idx].non_stack_access = true;
+ }
+ 
+ #define LR_FRAMENO_BITS	4
++>>>>>>> bpf: mark instructions accessing program stack
  #define LR_SPI_BITS	6
  #define LR_ENTRY_BITS	(LR_SPI_BITS + LR_FRAMENO_BITS + 1)
  #define LR_SIZE_BITS	4
@@@ -6569,12 -6420,28 +6578,16 @@@ static int check_mem_access(struct bpf_
  
  	if (!err && size < BPF_REG_SIZE && value_regno >= 0 && t == BPF_READ &&
  	    regs[value_regno].type == SCALAR_VALUE) {
 -		if (!is_ldsx) {
 +		if (!is_ldsx)
  			/* b/h/w load zero-extends, mark upper bits as known 0 */
  			coerce_reg_to_size(&regs[value_regno], size);
 -		} else {
 -			/*
 -			 * Sign-extension can change the register value relative
 -			 * to a scalar it is linked with by id (e.g. a zero-
 -			 * extending fill of the same spilled stack slot), thus
 -			 * drop the shared id in that case.
 -			 */
 -			bool no_sext = reg_umax(&regs[value_regno]) <
 -					(1ULL << (size * BITS_PER_BYTE - 1));
 -
 +		else
  			coerce_reg_to_size_sx(&regs[value_regno], size);
 -			if (!no_sext)
 -				clear_scalar_id(&regs[value_regno]);
 -		}
  	}
+ 
+ 	if (!err && reg->type != PTR_TO_STACK)
+ 		mark_non_stack_access(env, insn_idx);
+ 
  	return err;
  }
  

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.

0 participants