Linux-Next Archive on lore.kernel.org
 help / color / Atom feed
* linux-next: manual merge of the bpf-next tree with Linus' tree
@ 2019-08-08  2:53 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2019-08-08  2:53 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Networking
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Andrii Nakryiko

[-- Attachment #1: Type: text/plain, Size: 2054 bytes --]

Hi all,

Today's linux-next merge of the bpf-next tree got a conflict in:

  tools/lib/bpf/libbpf.c

between commit:

  1d4126c4e119 ("libbpf: sanitize VAR to conservative 1-byte INT")

from Linus' tree and commit:

  b03bc6853c0e ("libbpf: convert libbpf code to use new btf helpers")

from the bpf-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/lib/bpf/libbpf.c
index 2b57d7ea7836,3abf2dd1b3b5..000000000000
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@@ -1370,22 -1374,16 +1372,21 @@@ static void bpf_object__sanitize_btf(st
  
  	for (i = 1; i <= btf__get_nr_types(btf); i++) {
  		t = (struct btf_type *)btf__type_by_id(btf, i);
- 		kind = BTF_INFO_KIND(t->info);
  
- 		if (!has_datasec && kind == BTF_KIND_VAR) {
+ 		if (!has_datasec && btf_is_var(t)) {
  			/* replace VAR with INT */
  			t->info = BTF_INFO_ENC(BTF_KIND_INT, 0, 0);
 -			t->size = sizeof(int);
 -			*(int *)(t + 1) = BTF_INT_ENC(0, 0, 32);
 +			/*
 +			 * using size = 1 is the safest choice, 4 will be too
 +			 * big and cause kernel BTF validation failure if
 +			 * original variable took less than 4 bytes
 +			 */
 +			t->size = 1;
- 			*(int *)(t+1) = BTF_INT_ENC(0, 0, 8);
- 		} else if (!has_datasec && kind == BTF_KIND_DATASEC) {
++			*(int *)(t + 1) = BTF_INT_ENC(0, 0, 8);
+ 		} else if (!has_datasec && btf_is_datasec(t)) {
  			/* replace DATASEC with STRUCT */
- 			struct btf_var_secinfo *v = (void *)(t + 1);
- 			struct btf_member *m = (void *)(t + 1);
+ 			const struct btf_var_secinfo *v = btf_var_secinfos(t);
+ 			struct btf_member *m = btf_members(t);
  			struct btf_type *vt;
  			char *name;
  

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linux-next: manual merge of the bpf-next tree with Linus' tree
@ 2018-12-21  2:36 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2018-12-21  2:36 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Networking
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Jakub Kicinski

[-- Attachment #1: Type: text/plain, Size: 7845 bytes --]

Hi all,

Today's linux-next merge of the bpf-next tree got a conflict in:

  tools/testing/selftests/bpf/test_verifier.c

between commits:

  7640ead93924 ("bpf: verifier: make sure callees don't prune with caller differences")
  14507e35bd9d ("selftests: bpf: verifier: add tests for JSET interpretation")

from Linus' tree and commit:

  5a8d5209ac02 ("selftests: bpf: add trivial JSET tests")

from the bpf-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/testing/selftests/bpf/test_verifier.c
index c3b799c1ee97,dbd31750b214..000000000000
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@@ -14098,34 -14169,198 +14169,225 @@@ static struct bpf_test tests[] = 
  		.errstr = "invalid bpf_context access",
  		.errstr_unpriv = "R1 leaks addr",
  		.result = REJECT,
 +	},
 +		"calls: cross frame pruning",
 +		.insns = {
 +			/* r8 = !!random();
 +			 * call pruner()
 +			 * if (r8)
 +			 *     do something bad;
 +			 */
 +			BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
 +				     BPF_FUNC_get_prandom_u32),
 +			BPF_MOV64_IMM(BPF_REG_8, 0),
 +			BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1),
 +			BPF_MOV64_IMM(BPF_REG_8, 1),
 +			BPF_MOV64_REG(BPF_REG_1, BPF_REG_8),
 +			BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 4),
 +			BPF_JMP_IMM(BPF_JEQ, BPF_REG_8, 1, 1),
 +			BPF_LDX_MEM(BPF_B, BPF_REG_9, BPF_REG_1, 0),
 +			BPF_MOV64_IMM(BPF_REG_0, 0),
 +			BPF_EXIT_INSN(),
 +			BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 0),
 +			BPF_EXIT_INSN(),
 +		},
 +		.prog_type = BPF_PROG_TYPE_SOCKET_FILTER,
 +		.errstr_unpriv = "function calls to other bpf functions are allowed for root only",
 +		.result_unpriv = REJECT,
 +		.errstr = "!read_ok",
 +		.result = REJECT,
  	},
+ 	{
+ 		"jset: functional",
+ 		.insns = {
+ 			/* r0 = 0 */
+ 			BPF_MOV64_IMM(BPF_REG_0, 0),
+ 			/* prep for direct packet access via r2 */
+ 			BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
+ 				    offsetof(struct __sk_buff, data)),
+ 			BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,
+ 				    offsetof(struct __sk_buff, data_end)),
+ 			BPF_MOV64_REG(BPF_REG_4, BPF_REG_2),
+ 			BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 8),
+ 			BPF_JMP_REG(BPF_JLE, BPF_REG_4, BPF_REG_3, 1),
+ 			BPF_EXIT_INSN(),
+ 
+ 			BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
+ 
+ 			/* reg, bit 63 or bit 0 set, taken */
+ 			BPF_LD_IMM64(BPF_REG_8, 0x8000000000000001),
+ 			BPF_JMP_REG(BPF_JSET, BPF_REG_7, BPF_REG_8, 1),
+ 			BPF_EXIT_INSN(),
+ 
+ 			/* reg, bit 62, not taken */
+ 			BPF_LD_IMM64(BPF_REG_8, 0x4000000000000000),
+ 			BPF_JMP_REG(BPF_JSET, BPF_REG_7, BPF_REG_8, 1),
+ 			BPF_JMP_IMM(BPF_JA, 0, 0, 1),
+ 			BPF_EXIT_INSN(),
+ 
+ 			/* imm, any bit set, taken */
+ 			BPF_JMP_IMM(BPF_JSET, BPF_REG_7, -1, 1),
+ 			BPF_EXIT_INSN(),
+ 
+ 			/* imm, bit 31 set, taken */
+ 			BPF_JMP_IMM(BPF_JSET, BPF_REG_7, 0x80000000, 1),
+ 			BPF_EXIT_INSN(),
+ 
+ 			/* all good - return r0 == 2 */
+ 			BPF_MOV64_IMM(BPF_REG_0, 2),
+ 			BPF_EXIT_INSN(),
+ 		},
+ 		.prog_type = BPF_PROG_TYPE_SCHED_CLS,
+ 		.result = ACCEPT,
+ 		.runs = 7,
+ 		.retvals = {
+ 			{ .retval = 2,
+ 			  .data64 = { (1ULL << 63) | (1U << 31) | (1U << 0), }
+ 			},
+ 			{ .retval = 2,
+ 			  .data64 = { (1ULL << 63) | (1U << 31), }
+ 			},
+ 			{ .retval = 2,
+ 			  .data64 = { (1ULL << 31) | (1U << 0), }
+ 			},
+ 			{ .retval = 2,
+ 			  .data64 = { (__u32)-1, }
+ 			},
+ 			{ .retval = 2,
+ 			  .data64 = { ~0x4000000000000000ULL, }
+ 			},
+ 			{ .retval = 0,
+ 			  .data64 = { 0, }
+ 			},
+ 			{ .retval = 0,
+ 			  .data64 = { ~0ULL, }
+ 			},
+ 		},
+ 	},
+ 	{
+ 		"jset: sign-extend",
+ 		.insns = {
+ 			/* r0 = 0 */
+ 			BPF_MOV64_IMM(BPF_REG_0, 0),
+ 			/* prep for direct packet access via r2 */
+ 			BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
+ 				    offsetof(struct __sk_buff, data)),
+ 			BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,
+ 				    offsetof(struct __sk_buff, data_end)),
+ 			BPF_MOV64_REG(BPF_REG_4, BPF_REG_2),
+ 			BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 8),
+ 			BPF_JMP_REG(BPF_JLE, BPF_REG_4, BPF_REG_3, 1),
+ 			BPF_EXIT_INSN(),
+ 
+ 			BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
+ 
+ 			BPF_JMP_IMM(BPF_JSET, BPF_REG_7, 0x80000000, 1),
+ 			BPF_EXIT_INSN(),
+ 
+ 			BPF_MOV64_IMM(BPF_REG_0, 2),
+ 			BPF_EXIT_INSN(),
+ 		},
+ 		.prog_type = BPF_PROG_TYPE_SCHED_CLS,
+ 		.result = ACCEPT,
+ 		.retval = 2,
+ 		.data = { 1, 0, 0, 0, 0, 0, 0, 1, },
+ 	},
+ 	{
+ 		"jset: known const compare",
+ 		.insns = {
+ 			BPF_MOV64_IMM(BPF_REG_0, 1),
+ 			BPF_JMP_IMM(BPF_JSET, BPF_REG_0, 1, 1),
+ 			BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0),
+ 			BPF_EXIT_INSN(),
+ 		},
+ 		.prog_type = BPF_PROG_TYPE_SOCKET_FILTER,
+ 		.retval_unpriv = 1,
+ 		.result_unpriv = ACCEPT,
+ 		.retval = 1,
+ 		.result = ACCEPT,
+ 	},
+ 	{
+ 		"jset: known const compare bad",
+ 		.insns = {
+ 			BPF_MOV64_IMM(BPF_REG_0, 0),
+ 			BPF_JMP_IMM(BPF_JSET, BPF_REG_0, 1, 1),
+ 			BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0),
+ 			BPF_EXIT_INSN(),
+ 		},
+ 		.prog_type = BPF_PROG_TYPE_SOCKET_FILTER,
+ 		.errstr_unpriv = "!read_ok",
+ 		.result_unpriv = REJECT,
+ 		.errstr = "!read_ok",
+ 		.result = REJECT,
+ 	},
+ 	{
+ 		"jset: unknown const compare taken",
+ 		.insns = {
+ 			BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
+ 				     BPF_FUNC_get_prandom_u32),
+ 			BPF_JMP_IMM(BPF_JSET, BPF_REG_0, 1, 1),
+ 			BPF_JMP_IMM(BPF_JA, 0, 0, 1),
+ 			BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0),
+ 			BPF_EXIT_INSN(),
+ 		},
+ 		.prog_type = BPF_PROG_TYPE_SOCKET_FILTER,
+ 		.errstr_unpriv = "!read_ok",
+ 		.result_unpriv = REJECT,
+ 		.errstr = "!read_ok",
+ 		.result = REJECT,
+ 	},
+ 	{
+ 		"jset: unknown const compare not taken",
+ 		.insns = {
+ 			BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
+ 				     BPF_FUNC_get_prandom_u32),
+ 			BPF_JMP_IMM(BPF_JSET, BPF_REG_0, 1, 1),
+ 			BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0),
+ 			BPF_EXIT_INSN(),
+ 		},
+ 		.prog_type = BPF_PROG_TYPE_SOCKET_FILTER,
+ 		.errstr_unpriv = "!read_ok",
+ 		.result_unpriv = REJECT,
+ 		.errstr = "!read_ok",
+ 		.result = REJECT,
+ 	},
+ 	{
+ 		"jset: half-known const compare",
+ 		.insns = {
+ 			BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
+ 				     BPF_FUNC_get_prandom_u32),
+ 			BPF_ALU64_IMM(BPF_OR, BPF_REG_0, 2),
+ 			BPF_JMP_IMM(BPF_JSET, BPF_REG_0, 3, 1),
+ 			BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0),
+ 			BPF_MOV64_IMM(BPF_REG_0, 0),
+ 			BPF_EXIT_INSN(),
+ 		},
+ 		.prog_type = BPF_PROG_TYPE_SOCKET_FILTER,
+ 		.result_unpriv = ACCEPT,
+ 		.result = ACCEPT,
+ 	},
+ 	{
+ 		"jset: range",
+ 		.insns = {
+ 			BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
+ 				     BPF_FUNC_get_prandom_u32),
+ 			BPF_MOV64_REG(BPF_REG_1, BPF_REG_0),
+ 			BPF_MOV64_IMM(BPF_REG_0, 0),
+ 			BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0xff),
+ 			BPF_JMP_IMM(BPF_JSET, BPF_REG_1, 0xf0, 3),
+ 			BPF_JMP_IMM(BPF_JLT, BPF_REG_1, 0x10, 1),
+ 			BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0),
+ 			BPF_EXIT_INSN(),
+ 			BPF_JMP_IMM(BPF_JSET, BPF_REG_1, 0x10, 1),
+ 			BPF_EXIT_INSN(),
+ 			BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0x10, 1),
+ 			BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0),
+ 			BPF_EXIT_INSN(),
+ 		},
+ 		.prog_type = BPF_PROG_TYPE_SOCKET_FILTER,
+ 		.result_unpriv = ACCEPT,
+ 		.result = ACCEPT,
+ 	},
  };
  
  static int probe_filter_length(const struct bpf_insn *fp)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linux-next: manual merge of the bpf-next tree with Linus' tree
@ 2018-09-24  0:19 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2018-09-24  0:19 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Networking
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List,
	Arnaldo Carvalho de Melo, Yonghong Song

[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]

Hi all,

Today's linux-next merge of the bpf-next tree got a conflict in:

  tools/lib/bpf/Build

between commit:

  6d41907c630d ("tools lib bpf: Provide wrapper for strerror_r to build in !_GNU_SOURCE systems")

from Linus' tree and commit:

  f7010770fbac ("tools/bpf: move bpf/lib netlink related functions into a new file")

from the bpf-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/lib/bpf/Build
index 6eb9bacd1948,512b2c0ba0d2..000000000000
--- a/tools/lib/bpf/Build
+++ b/tools/lib/bpf/Build
@@@ -1,1 -1,1 +1,1 @@@
- libbpf-y := libbpf.o bpf.o nlattr.o btf.o libbpf_errno.o str_error.o
 -libbpf-y := libbpf.o bpf.o nlattr.o btf.o libbpf_errno.o netlink.o
++libbpf-y := libbpf.o bpf.o nlattr.o btf.o libbpf_errno.o str_error.o netlink.o

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linux-next: manual merge of the bpf-next tree with Linus' tree
@ 2018-01-15  0:15 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2018-01-15  0:15 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Networking
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List,
	David Woodhouse, Thomas Gleixner, Masami Hiramatsu

Hi all,

Today's linux-next merge of the bpf-next tree got a conflict in:

  arch/x86/lib/Makefile

between commit:

  76b043848fd2 ("x86/retpoline: Add initial retpoline support")

from Linus' tree and commit:

  540adea3809f ("error-injection: Separate error-injection from kprobe")

from the bpf-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/x86/lib/Makefile
index f23934bbaf4e,171377b83be1..000000000000
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@@ -26,7 -26,7 +26,8 @@@ lib-y += memcpy_$(BITS).
  lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
  lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o insn-eval.o
  lib-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
 +lib-$(CONFIG_RETPOLINE) += retpoline.o
+ lib-$(CONFIG_FUNCTION_ERROR_INJECTION)	+= error-inject.o
  
  obj-y += msr.o msr-reg.o msr-reg-export.o hweight.o
  

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08  2:53 linux-next: manual merge of the bpf-next tree with Linus' tree Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2018-12-21  2:36 Stephen Rothwell
2018-09-24  0:19 Stephen Rothwell
2018-01-15  0:15 Stephen Rothwell

Linux-Next Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-next/0 linux-next/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-next linux-next/ https://lore.kernel.org/linux-next \
		linux-next@vger.kernel.org linux-next@archiver.kernel.org
	public-inbox-index linux-next


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-next


AGPL code for this site: git clone https://public-inbox.org/ public-inbox