* [PATCH v2 5/7] bpf: Add verifier test case for alignment.
From: David Miller @ 2017-05-11 16:06 UTC (permalink / raw)
To: daniel; +Cc: ast, alexei.starovoitov, netdev
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
---
tools/testing/selftests/bpf/Makefile | 3 +-
tools/testing/selftests/bpf/test_align.c | 417 +++++++++++++++++++++++++++++++
2 files changed, 419 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/bpf/test_align.c
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 91edd05..f92f27d 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -11,7 +11,8 @@ endif
CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
LDLIBS += -lcap -lelf
-TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs
+TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \
+ test_align
TEST_GEN_FILES = test_pkt_access.o test_xdp.o test_l4lb.o test_tcp_estats.o
diff --git a/tools/testing/selftests/bpf/test_align.c b/tools/testing/selftests/bpf/test_align.c
new file mode 100644
index 0000000..9dd9794
--- /dev/null
+++ b/tools/testing/selftests/bpf/test_align.c
@@ -0,0 +1,417 @@
+#include <asm/types.h>
+#include <linux/types.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdbool.h>
+
+#include <linux/unistd.h>
+#include <linux/filter.h>
+#include <linux/bpf_perf_event.h>
+#include <linux/bpf.h>
+
+#include <bpf/bpf.h>
+
+#include "../../../include/linux/filter.h"
+
+#ifndef ARRAY_SIZE
+# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
+#define MAX_INSNS 512
+#define MAX_MATCHES 16
+
+struct bpf_align_test {
+ const char *descr;
+ struct bpf_insn insns[MAX_INSNS];
+ enum {
+ UNDEF,
+ ACCEPT,
+ REJECT
+ } result;
+ enum bpf_prog_type prog_type;
+ const char *matches[MAX_MATCHES];
+};
+
+static struct bpf_align_test tests[] = {
+ {
+ .descr = "mov",
+ .insns = {
+ BPF_MOV64_IMM(BPF_REG_3, 2),
+ BPF_MOV64_IMM(BPF_REG_3, 4),
+ BPF_MOV64_IMM(BPF_REG_3, 8),
+ BPF_MOV64_IMM(BPF_REG_3, 16),
+ BPF_MOV64_IMM(BPF_REG_3, 32),
+ BPF_MOV64_IMM(BPF_REG_0, 0),
+ BPF_EXIT_INSN(),
+ },
+ .prog_type = BPF_PROG_TYPE_SCHED_CLS,
+ .matches = {
+ "1: R1=ctx R3=imm2,min_value=2,max_value=2,min_align=2 R10=fp",
+ "2: R1=ctx R3=imm4,min_value=4,max_value=4,min_align=4 R10=fp",
+ "3: R1=ctx R3=imm8,min_value=8,max_value=8,min_align=8 R10=fp",
+ "4: R1=ctx R3=imm16,min_value=16,max_value=16,min_align=16 R10=fp",
+ "5: R1=ctx R3=imm32,min_value=32,max_value=32,min_align=32 R10=fp",
+ },
+ },
+ {
+ .descr = "shift",
+ .insns = {
+ BPF_MOV64_IMM(BPF_REG_3, 1),
+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1),
+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1),
+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1),
+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1),
+ BPF_ALU64_IMM(BPF_RSH, BPF_REG_3, 4),
+ BPF_MOV64_IMM(BPF_REG_4, 32),
+ BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1),
+ BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1),
+ BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1),
+ BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1),
+ BPF_MOV64_IMM(BPF_REG_0, 0),
+ BPF_EXIT_INSN(),
+ },
+ .prog_type = BPF_PROG_TYPE_SCHED_CLS,
+ .matches = {
+ "1: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R10=fp",
+ "2: R1=ctx R3=imm2,min_value=2,max_value=2,min_align=2 R10=fp",
+ "3: R1=ctx R3=imm4,min_value=4,max_value=4,min_align=4 R10=fp",
+ "4: R1=ctx R3=imm8,min_value=8,max_value=8,min_align=8 R10=fp",
+ "5: R1=ctx R3=imm16,min_value=16,max_value=16,min_align=16 R10=fp",
+ "6: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R10=fp",
+ "7: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R4=imm32,min_value=32,max_value=32,min_align=32 R10=fp",
+ "8: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R4=imm16,min_value=16,max_value=16,min_align=16 R10=fp",
+ "9: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R4=imm8,min_value=8,max_value=8,min_align=8 R10=fp",
+ "10: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R4=imm4,min_value=4,max_value=4,min_align=4 R10=fp",
+ "11: R1=ctx R3=imm1,min_value=1,max_value=1,min_align=1 R4=imm2,min_value=2,max_value=2,min_align=2 R10=fp",
+ },
+ },
+ {
+ .descr = "addsub",
+ .insns = {
+ BPF_MOV64_IMM(BPF_REG_3, 4),
+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, 4),
+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, 2),
+ BPF_MOV64_IMM(BPF_REG_4, 8),
+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 4),
+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 2),
+ BPF_MOV64_IMM(BPF_REG_0, 0),
+ BPF_EXIT_INSN(),
+ },
+ .prog_type = BPF_PROG_TYPE_SCHED_CLS,
+ .matches = {
+ "1: R1=ctx R3=imm4,min_value=4,max_value=4,min_align=4 R10=fp",
+ "2: R1=ctx R3=imm8,min_value=8,max_value=8,min_align=4 R10=fp",
+ "3: R1=ctx R3=imm10,min_value=10,max_value=10,min_align=2 R10=fp",
+ "4: R1=ctx R3=imm10,min_value=10,max_value=10,min_align=2 R4=imm8,min_value=8,max_value=8,min_align=8 R10=fp",
+ "5: R1=ctx R3=imm10,min_value=10,max_value=10,min_align=2 R4=imm12,min_value=12,max_value=12,min_align=4 R10=fp",
+ "6: R1=ctx R3=imm10,min_value=10,max_value=10,min_align=2 R4=imm14,min_value=14,max_value=14,min_align=2 R10=fp",
+ },
+ },
+ {
+ .descr = "mul",
+ .insns = {
+ BPF_MOV64_IMM(BPF_REG_3, 7),
+ BPF_ALU64_IMM(BPF_MUL, BPF_REG_3, 1),
+ BPF_ALU64_IMM(BPF_MUL, BPF_REG_3, 2),
+ BPF_ALU64_IMM(BPF_MUL, BPF_REG_3, 4),
+ BPF_MOV64_IMM(BPF_REG_0, 0),
+ BPF_EXIT_INSN(),
+ },
+ .prog_type = BPF_PROG_TYPE_SCHED_CLS,
+ .matches = {
+ "1: R1=ctx R3=imm7,min_value=7,max_value=7,min_align=1 R10=fp",
+ "2: R1=ctx R3=imm7,min_value=7,max_value=7,min_align=1 R10=fp",
+ "3: R1=ctx R3=imm14,min_value=14,max_value=14,min_align=2 R10=fp",
+ "4: R1=ctx R3=imm56,min_value=56,max_value=56,min_align=4 R10=fp",
+ },
+ },
+
+#define PREP_PKT_POINTERS \
+ 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))
+
+#define LOAD_UNKNOWN(DST_REG) \
+ PREP_PKT_POINTERS, \
+ BPF_MOV64_REG(BPF_REG_0, BPF_REG_2), \
+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8), \
+ BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_0, 1), \
+ BPF_EXIT_INSN(), \
+ BPF_LDX_MEM(BPF_B, DST_REG, BPF_REG_2, 0)
+
+ {
+ .descr = "unknown shift",
+ .insns = {
+ LOAD_UNKNOWN(BPF_REG_3),
+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1),
+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1),
+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1),
+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_3, 1),
+ LOAD_UNKNOWN(BPF_REG_4),
+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_4, 5),
+ BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1),
+ BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1),
+ BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1),
+ BPF_ALU64_IMM(BPF_RSH, BPF_REG_4, 1),
+ BPF_MOV64_IMM(BPF_REG_0, 0),
+ BPF_EXIT_INSN(),
+ },
+ .prog_type = BPF_PROG_TYPE_SCHED_CLS,
+ .matches = {
+ "7: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R10=fp",
+ "8: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv55,min_align=2 R10=fp",
+ "9: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv54,min_align=4 R10=fp",
+ "10: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv53,min_align=8 R10=fp",
+ "11: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv52,min_align=16 R10=fp",
+ "18: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv56 R10=fp",
+ "19: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv51,min_align=32 R10=fp",
+ "20: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv52,min_align=16 R10=fp",
+ "21: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv53,min_align=8 R10=fp",
+ "22: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv54,min_align=4 R10=fp",
+ "23: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv55,min_align=2 R10=fp",
+ },
+ },
+ {
+ .descr = "unknown mul",
+ .insns = {
+ LOAD_UNKNOWN(BPF_REG_3),
+ BPF_MOV64_REG(BPF_REG_4, BPF_REG_3),
+ BPF_ALU64_IMM(BPF_MUL, BPF_REG_4, 1),
+ BPF_MOV64_REG(BPF_REG_4, BPF_REG_3),
+ BPF_ALU64_IMM(BPF_MUL, BPF_REG_4, 2),
+ BPF_MOV64_REG(BPF_REG_4, BPF_REG_3),
+ BPF_ALU64_IMM(BPF_MUL, BPF_REG_4, 4),
+ BPF_MOV64_REG(BPF_REG_4, BPF_REG_3),
+ BPF_ALU64_IMM(BPF_MUL, BPF_REG_4, 8),
+ BPF_ALU64_IMM(BPF_MUL, BPF_REG_4, 2),
+ BPF_MOV64_IMM(BPF_REG_0, 0),
+ BPF_EXIT_INSN(),
+ },
+ .prog_type = BPF_PROG_TYPE_SCHED_CLS,
+ .matches = {
+ "7: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R10=fp",
+ "8: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv56 R10=fp",
+ "9: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv55,min_align=1 R10=fp",
+ "10: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv56 R10=fp",
+ "11: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv54,min_align=2 R10=fp",
+ "12: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv56 R10=fp",
+ "13: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv53,min_align=4 R10=fp",
+ "14: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv56 R10=fp",
+ "15: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv52,min_align=8 R10=fp",
+ "16: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=inv56 R4=inv50,min_align=8 R10=fp"
+ },
+ },
+ {
+ .descr = "packet const offset",
+ .insns = {
+ PREP_PKT_POINTERS,
+ BPF_MOV64_REG(BPF_REG_5, BPF_REG_2),
+
+ BPF_MOV64_IMM(BPF_REG_0, 0),
+
+ /* Skip over ethernet header. */
+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_5, 14),
+ BPF_MOV64_REG(BPF_REG_4, BPF_REG_5),
+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 4),
+ BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_4, 1),
+ BPF_EXIT_INSN(),
+
+ BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_5, 0),
+ BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_5, 1),
+ BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_5, 2),
+ BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_5, 3),
+ BPF_LDX_MEM(BPF_H, BPF_REG_4, BPF_REG_5, 0),
+ BPF_LDX_MEM(BPF_H, BPF_REG_4, BPF_REG_5, 2),
+ BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_5, 0),
+
+ BPF_MOV64_IMM(BPF_REG_0, 0),
+ BPF_EXIT_INSN(),
+ },
+ .prog_type = BPF_PROG_TYPE_SCHED_CLS,
+ .matches = {
+ "4: R0=imm0,min_value=0,max_value=0,min_align=2147483648 R1=ctx R2=pkt(id=0,off=0,r=0) R3=pkt_end R5=pkt(id=0,off=0,r=0) R10=fp",
+ "5: R0=imm0,min_value=0,max_value=0,min_align=2147483648 R1=ctx R2=pkt(id=0,off=0,r=0) R3=pkt_end R5=pkt(id=0,off=14,r=0) R10=fp",
+ "6: R0=imm0,min_value=0,max_value=0,min_align=2147483648 R1=ctx R2=pkt(id=0,off=0,r=0) R3=pkt_end R4=pkt(id=0,off=14,r=0) R5=pkt(id=0,off=14,r=0) R10=fp",
+ "10: R0=imm0,min_value=0,max_value=0,min_align=2147483648 R1=ctx R2=pkt(id=0,off=0,r=18) R3=pkt_end R4=inv56 R5=pkt(id=0,off=14,r=18) R10=fp",
+ "14: R0=imm0,min_value=0,max_value=0,min_align=2147483648 R1=ctx R2=pkt(id=0,off=0,r=18) R3=pkt_end R4=inv48 R5=pkt(id=0,off=14,r=18) R10=fp",
+ "15: R0=imm0,min_value=0,max_value=0,min_align=2147483648 R1=ctx R2=pkt(id=0,off=0,r=18) R3=pkt_end R4=inv48 R5=pkt(id=0,off=14,r=18) R10=fp",
+ },
+ },
+ {
+ .descr = "packet variable offset",
+ .insns = {
+ LOAD_UNKNOWN(BPF_REG_6),
+ BPF_ALU64_IMM(BPF_LSH, BPF_REG_6, 2),
+
+ /* First, add a constant to the R5 packet pointer,
+ * then a variable with a known alignment.
+ */
+ BPF_MOV64_REG(BPF_REG_5, BPF_REG_2),
+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_5, 14),
+ BPF_ALU64_REG(BPF_ADD, BPF_REG_5, BPF_REG_6),
+ BPF_MOV64_REG(BPF_REG_4, BPF_REG_5),
+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 4),
+ BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_4, 1),
+ BPF_EXIT_INSN(),
+ BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_5, 0),
+
+ /* Now, test in the other direction. Adding first
+ * the variable offset to R5, then the constant.
+ */
+ BPF_MOV64_REG(BPF_REG_5, BPF_REG_2),
+ BPF_ALU64_REG(BPF_ADD, BPF_REG_5, BPF_REG_6),
+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_5, 14),
+ BPF_MOV64_REG(BPF_REG_4, BPF_REG_5),
+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 4),
+ BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_4, 1),
+ BPF_EXIT_INSN(),
+ BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_5, 0),
+
+ BPF_MOV64_IMM(BPF_REG_0, 0),
+ BPF_EXIT_INSN(),
+ },
+ .prog_type = BPF_PROG_TYPE_SCHED_CLS,
+ .matches = {
+ /* Calculated offset in R6 has unknown value, but known
+ * alignment of 4.
+ */
+ "8: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R6=inv54,min_align=4 R10=fp",
+
+ /* Offset is added to packet pointer R5, resulting in known
+ * auxiliary alignment and offset.
+ */
+ "11: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R5=pkt(id=1,off=0,r=0),aux_off=14,aux_off_align=4 R6=inv54,min_align=4 R10=fp",
+
+ /* At the time the word size load is performed from R5,
+ * it's total offset is NET_IP_ALIGN + reg->off (0) +
+ * reg->aux_off (14) which is 16. Then the variable
+ * offset is considered using reg->aux_off_align which
+ * is 4 and meets the load's requirements.
+ */
+ "15: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=pkt(id=1,off=4,r=4),aux_off=14,aux_off_align=4 R5=pkt(id=1,off=0,r=4),aux_off=14,aux_off_align=4 R6=inv54,min_align=4 R10=fp",
+
+
+ /* Variable offset is added to R5 packet pointer,
+ * resulting in auxiliary alignment of 4.
+ */
+ "18: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv,aux_off=14,aux_off_align=4 R5=pkt(id=2,off=0,r=0),aux_off_align=4 R6=inv54,min_align=4 R10=fp",
+
+ /* Constant offset is added to R5, resulting in
+ * reg->off of 14.
+ */
+ "19: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=inv,aux_off=14,aux_off_align=4 R5=pkt(id=2,off=14,r=0),aux_off_align=4 R6=inv54,min_align=4 R10=fp",
+
+ /* At the time the word size load is performed from R5,
+ * it's total offset is NET_IP_ALIGN + reg->off (14) which
+ * is 16. Then the variable offset is considered using
+ * reg->aux_off_align which is 4 and meets the load's
+ * requirements.
+ */
+ "23: R0=pkt(id=0,off=8,r=8) R1=ctx R2=pkt(id=0,off=0,r=8) R3=pkt_end R4=pkt(id=2,off=18,r=18),aux_off_align=4 R5=pkt(id=2,off=14,r=18),aux_off_align=4 R6=inv54,min_align=4 R10=fp",
+ },
+ },
+};
+
+static int probe_filter_length(const struct bpf_insn *fp)
+{
+ int len;
+
+ for (len = MAX_INSNS - 1; len > 0; --len)
+ if (fp[len].code != 0 || fp[len].imm != 0)
+ break;
+ return len + 1;
+}
+
+static char bpf_vlog[32768];
+
+static int do_test_single(struct bpf_align_test *test)
+{
+ struct bpf_insn *prog = test->insns;
+ int prog_type = test->prog_type;
+ int prog_len, i;
+ int fd_prog;
+ int ret;
+
+ prog_len = probe_filter_length(prog);
+ fd_prog = bpf_verify_program(prog_type ? : BPF_PROG_TYPE_SOCKET_FILTER,
+ prog, prog_len, 1, "GPL", 0,
+ bpf_vlog, sizeof(bpf_vlog));
+ if (fd_prog < 0) {
+ printf("Failed to load program.\n");
+ printf("%s", bpf_vlog);
+ ret = 1;
+ } else {
+ ret = 0;
+ for (i = 0; i < MAX_MATCHES; i++) {
+ const char *t, *m = test->matches[i];
+
+ if (!m)
+ break;
+ t = strstr(bpf_vlog, m);
+ if (!t) {
+ printf("Failed to find match: %s\n", m);
+ ret = 1;
+ printf("%s", bpf_vlog);
+ break;
+ }
+ }
+ /* printf("%s", bpf_vlog); */
+ close(fd_prog);
+ }
+ return ret;
+}
+
+static int do_test(unsigned int from, unsigned int to)
+{
+ int all_pass = 0;
+ int all_fail = 0;
+ unsigned int i;
+
+ for (i = from; i < to; i++) {
+ struct bpf_align_test *test = &tests[i];
+ int fail;
+
+ printf("Test %3d: %s ... ",
+ i, test->descr);
+ fail = do_test_single(test);
+ if (fail) {
+ all_fail++;
+ printf("FAIL\n");
+ } else {
+ all_pass++;
+ printf("PASS\n");
+ }
+ }
+ printf("Results: %d pass %d fail\n",
+ all_pass, all_fail);
+ return 0;
+}
+
+int main(int argc, char **argv)
+{
+ unsigned int from = 0, to = ARRAY_SIZE(tests);
+
+ if (argc == 3) {
+ unsigned int l = atoi(argv[argc - 2]);
+ unsigned int u = atoi(argv[argc - 1]);
+
+ if (l < to && u < to) {
+ from = l;
+ to = u + 1;
+ }
+ } else if (argc == 2) {
+ unsigned int t = atoi(argv[argc - 1]);
+
+ if (t < to) {
+ from = t;
+ to = t + 1;
+ }
+ }
+ return do_test(from, to);
+}
--
2.7.4
^ permalink raw reply related
* [PATCH v2 6/7] bpf: Make use of alignment information in check_val_ptr_alignment().
From: David Miller @ 2017-05-11 16:06 UTC (permalink / raw)
To: daniel; +Cc: ast, alexei.starovoitov, netdev
We can validate PTR_TO_MAP_VALUE_ADJ accesses in the same way that we
do for PTR_TO_PACKET. The only difference is that we don't plug
NET_IP_ALIGN into the equation.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
kernel/bpf/verifier.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index e74fb1b..cdbf282 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -823,10 +823,27 @@ static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg,
}
static int check_val_ptr_alignment(const struct bpf_reg_state *reg,
- int size, bool strict)
+ int off, int size, bool strict)
{
- if (strict && size != 1) {
- verbose("Unknown alignment. Only byte-sized access allowed in value access.\n");
+ int reg_off;
+
+ /* Byte size accesses are always allowed. */
+ if (!strict || size == 1)
+ return 0;
+
+ reg_off = reg->off;
+ if (reg->id) {
+ if (reg->aux_off_align % size) {
+ verbose("Value access is only %u byte aligned, %d byte access not allowed\n",
+ reg->aux_off_align, size);
+ return -EACCES;
+ }
+ reg_off += reg->aux_off;
+ }
+
+ if ((reg_off + off) % size != 0) {
+ verbose("misaligned value access off %d+%d size %d\n",
+ reg_off, off, size);
return -EACCES;
}
@@ -846,7 +863,7 @@ static int check_ptr_alignment(struct bpf_verifier_env *env,
case PTR_TO_PACKET:
return check_pkt_ptr_alignment(reg, off, size, strict);
case PTR_TO_MAP_VALUE_ADJ:
- return check_val_ptr_alignment(reg, size, strict);
+ return check_val_ptr_alignment(reg, off, size, strict);
default:
if (off % size != 0) {
verbose("misaligned access off %d size %d\n",
--
2.1.2.532.g19b5d50
^ permalink raw reply related
* [PATCH v2 4/7] bpf: Add bpf_verify_program() to the library.
From: David Miller @ 2017-05-11 16:05 UTC (permalink / raw)
To: daniel; +Cc: ast, alexei.starovoitov, netdev
This allows a test case to load a BPF program and unconditionally
acquire the verifier log.
It also allows specification of the strict alignment flag.
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
---
tools/lib/bpf/bpf.c | 22 ++++++++++++++++++++++
tools/lib/bpf/bpf.h | 4 ++++
2 files changed, 26 insertions(+)
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 4fe444b80..6e17898 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -117,6 +117,28 @@ int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns,
return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr));
}
+int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns,
+ size_t insns_cnt, int strict_alignment,
+ const char *license, __u32 kern_version,
+ char *log_buf, size_t log_buf_sz)
+{
+ union bpf_attr attr;
+
+ bzero(&attr, sizeof(attr));
+ attr.prog_type = type;
+ attr.insn_cnt = (__u32)insns_cnt;
+ attr.insns = ptr_to_u64(insns);
+ attr.license = ptr_to_u64(license);
+ attr.log_buf = ptr_to_u64(log_buf);
+ attr.log_size = log_buf_sz;
+ attr.log_level = 2;
+ log_buf[0] = 0;
+ attr.kern_version = kern_version;
+ attr.prog_flags = strict_alignment ? BPF_F_STRICT_ALIGNMENT : 0;
+
+ return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr));
+}
+
int bpf_map_update_elem(int fd, const void *key, const void *value,
__u64 flags)
{
diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index edb4dae..972bd83 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -35,6 +35,10 @@ int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns,
size_t insns_cnt, const char *license,
__u32 kern_version, char *log_buf,
size_t log_buf_sz);
+int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns,
+ size_t insns_cnt, int strict_alignment,
+ const char *license, __u32 kern_version,
+ char *log_buf, size_t log_buf_sz);
int bpf_map_update_elem(int fd, const void *key, const void *value,
__u64 flags);
--
2.7.4
^ permalink raw reply related
* [PATCH v2 3/7] bpf: Add strict alignment flag for BPF_PROG_LOAD.
From: David Miller @ 2017-05-11 16:05 UTC (permalink / raw)
To: daniel; +Cc: ast, alexei.starovoitov, netdev
Add a new field, "prog_flags", and an initial flag value
BPF_F_STRCIT_ALIGNMENT.
When set, the verifier will enforce strict pointer alignment
regardless of the setting of CONFIG_EFFICIENT_UNALIGNED_ACCESS.
The verifier, in this mode, will also use a fixed value of "2" in
place of NET_IP_ALIGN.
This facilitates test cases that will exercise and validate this part
of the verifier even when run on architectures where alignment doesn't
matter.
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
---
include/linux/bpf_verifier.h | 1 +
include/uapi/linux/bpf.h | 8 ++++++++
kernel/bpf/syscall.c | 5 ++++-
kernel/bpf/verifier.c | 23 +++++++++++++++++------
tools/build/feature/test-bpf.c | 1 +
tools/include/uapi/linux/bpf.h | 11 +++++++++--
6 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index 7c6a519..d5093b5 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -90,6 +90,7 @@ struct bpf_verifier_env {
struct bpf_prog *prog; /* eBPF program being verified */
struct bpf_verifier_stack_elem *head; /* stack of verifier states to be processed */
int stack_size; /* number of states to be processed */
+ bool strict_alignment; /* perform strict pointer alignment checks */
struct bpf_verifier_state cur_state; /* current verifier state */
struct bpf_verifier_state_list **explored_states; /* search pruning optimization */
const struct bpf_ext_analyzer_ops *analyzer_ops; /* external analyzer ops */
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 945a1f5..94dfa9d 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -132,6 +132,13 @@ enum bpf_attach_type {
*/
#define BPF_F_ALLOW_OVERRIDE (1U << 0)
+/* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the
+ * verifier will perform strict alignment checking as if the kernel
+ * has been built with CONFIG_EFFICIENT_UNALIGNED_ACCESS not set,
+ * and NET_IP_ALIGN defined to 2.
+ */
+#define BPF_F_STRICT_ALIGNMENT (1U << 0)
+
#define BPF_PSEUDO_MAP_FD 1
/* flags for BPF_MAP_UPDATE_ELEM command */
@@ -177,6 +184,7 @@ union bpf_attr {
__u32 log_size; /* size of user buffer */
__aligned_u64 log_buf; /* user supplied buffer */
__u32 kern_version; /* checked when prog_type=kprobe */
+ __u32 prog_flags;
};
struct { /* anonymous struct used by BPF_OBJ_* commands */
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index fd2411f..265a0d8 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -783,7 +783,7 @@ struct bpf_prog *bpf_prog_get_type(u32 ufd, enum bpf_prog_type type)
EXPORT_SYMBOL_GPL(bpf_prog_get_type);
/* last field in 'union bpf_attr' used by this command */
-#define BPF_PROG_LOAD_LAST_FIELD kern_version
+#define BPF_PROG_LOAD_LAST_FIELD prog_flags
static int bpf_prog_load(union bpf_attr *attr)
{
@@ -796,6 +796,9 @@ static int bpf_prog_load(union bpf_attr *attr)
if (CHECK_ATTR(BPF_PROG_LOAD))
return -EINVAL;
+ if (attr->prog_flags & ~BPF_F_STRICT_ALIGNMENT)
+ return -EINVAL;
+
/* copy eBPF program license from user space */
if (strncpy_from_user(license, u64_to_user_ptr(attr->license),
sizeof(license) - 1) < 0)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index ff2bfe1..e74fb1b 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -791,6 +791,7 @@ static bool is_pointer_value(struct bpf_verifier_env *env, int regno)
static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg,
int off, int size, bool strict)
{
+ int ip_align;
int reg_off;
/* Byte size accesses are always allowed. */
@@ -807,10 +808,14 @@ static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg,
reg_off += reg->aux_off;
}
- /* skb->data is NET_IP_ALIGN-ed */
- if ((NET_IP_ALIGN + reg_off + off) % size != 0) {
+ /* skb->data is NET_IP_ALIGN-ed, but for strict alignment checking
+ * we force this to 2 which is universally what architectures use
+ * when they don't set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.
+ */
+ ip_align = strict ? 2 : NET_IP_ALIGN;
+ if ((ip_align + reg_off + off) % size != 0) {
verbose("misaligned packet access off %d+%d+%d size %d\n",
- NET_IP_ALIGN, reg_off, off, size);
+ ip_align, reg_off, off, size);
return -EACCES;
}
@@ -828,10 +833,11 @@ static int check_val_ptr_alignment(const struct bpf_reg_state *reg,
return 0;
}
-static int check_ptr_alignment(const struct bpf_reg_state *reg,
+static int check_ptr_alignment(struct bpf_verifier_env *env,
+ const struct bpf_reg_state *reg,
int off, int size)
{
- bool strict = false;
+ bool strict = env->strict_alignment;
if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))
strict = true;
@@ -873,7 +879,7 @@ static int check_mem_access(struct bpf_verifier_env *env, u32 regno, int off,
if (size < 0)
return size;
- err = check_ptr_alignment(reg, off, size);
+ err = check_ptr_alignment(env, reg, off, size);
if (err)
return err;
@@ -3568,6 +3574,10 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr)
} else {
log_level = 0;
}
+ if (attr->prog_flags & BPF_F_STRICT_ALIGNMENT)
+ env->strict_alignment = true;
+ else
+ env->strict_alignment = false;
ret = replace_map_fd_with_map_ptr(env);
if (ret < 0)
@@ -3673,6 +3683,7 @@ int bpf_analyzer(struct bpf_prog *prog, const struct bpf_ext_analyzer_ops *ops,
mutex_lock(&bpf_verifier_lock);
log_level = 0;
+ env->strict_alignment = false;
env->explored_states = kcalloc(env->prog->len,
sizeof(struct bpf_verifier_state_list *),
diff --git a/tools/build/feature/test-bpf.c b/tools/build/feature/test-bpf.c
index ebc6dce..7598361 100644
--- a/tools/build/feature/test-bpf.c
+++ b/tools/build/feature/test-bpf.c
@@ -29,6 +29,7 @@ int main(void)
attr.log_size = 0;
attr.log_level = 0;
attr.kern_version = 0;
+ attr.prog_flags = 0;
/*
* Test existence of __NR_bpf and BPF_PROG_LOAD.
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index e553529..94dfa9d 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -132,6 +132,13 @@ enum bpf_attach_type {
*/
#define BPF_F_ALLOW_OVERRIDE (1U << 0)
+/* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the
+ * verifier will perform strict alignment checking as if the kernel
+ * has been built with CONFIG_EFFICIENT_UNALIGNED_ACCESS not set,
+ * and NET_IP_ALIGN defined to 2.
+ */
+#define BPF_F_STRICT_ALIGNMENT (1U << 0)
+
#define BPF_PSEUDO_MAP_FD 1
/* flags for BPF_MAP_UPDATE_ELEM command */
@@ -177,6 +184,7 @@ union bpf_attr {
__u32 log_size; /* size of user buffer */
__aligned_u64 log_buf; /* user supplied buffer */
__u32 kern_version; /* checked when prog_type=kprobe */
+ __u32 prog_flags;
};
struct { /* anonymous struct used by BPF_OBJ_* commands */
@@ -481,8 +489,7 @@ union bpf_attr {
* u32 bpf_get_socket_uid(skb)
* Get the owner uid of the socket stored inside sk_buff.
* @skb: pointer to skb
- * Return: uid of the socket owner on success or 0 if the socket pointer
- * inside sk_buff is NULL
+ * Return: uid of the socket owner on success or overflowuid if failed.
*/
#define __BPF_FUNC_MAPPER(FN) \
FN(unspec), \
--
2.7.4
^ permalink raw reply related
* [PATCH v2 2/7] bpf: Do per-instruction state dumping in verifier when log_level > 1.
From: David Miller @ 2017-05-11 16:05 UTC (permalink / raw)
To: daniel; +Cc: ast, alexei.starovoitov, netdev
If log_level > 1, do a state dump every instruction and emit it in
a more compact way (without a leading newline).
This will facilitate more sophisticated test cases which inspect the
verifier log for register state.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
kernel/bpf/verifier.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index cc7b626..ff2bfe1 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -2926,8 +2926,12 @@ static int do_check(struct bpf_verifier_env *env)
goto process_bpf_exit;
}
- if (log_level && do_print_state) {
- verbose("\nfrom %d to %d:", prev_insn_idx, insn_idx);
+ if (log_level > 1 || (log_level && do_print_state)) {
+ if (log_level > 1)
+ verbose("%d:", insn_idx);
+ else
+ verbose("\nfrom %d to %d:",
+ prev_insn_idx, insn_idx);
print_verifier_state(&env->cur_state);
do_print_state = false;
}
--
2.7.4
^ permalink raw reply related
* [PATCH v2 1/7] bpf: Track alignment of register values in the verifier.
From: David Miller @ 2017-05-11 16:05 UTC (permalink / raw)
To: daniel; +Cc: ast, alexei.starovoitov, netdev
Currently if we add only constant values to pointers we can fully
validate the alignment, and properly check if we need to reject the
program on !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS architectures.
However, once an unknown value is introduced we only allow byte sized
memory accesses which is too restrictive.
Add logic to track the known minimum alignment of register values,
and propagate this state into registers containing pointers.
The most common paradigm that makes use of this new logic is computing
the transport header using the IP header length field. For example:
struct ethhdr *ep = skb->data;
struct iphdr *iph = (struct iphdr *) (ep + 1);
struct tcphdr *th;
...
n = iph->ihl;
th = ((void *)iph + (n * 4));
port = th->dest;
The existing code will reject the load of th->dest because it cannot
validate that the alignment is at least 2 once "n * 4" is added the
the packet pointer.
In the new code, the register holding "n * 4" will have a reg->min_align
value of 4, because any value multiplied by 4 will be at least 4 byte
aligned. (actually, the eBPF code emitted by the compiler in this case
is most likely to use a shift left by 2, but the end result is identical)
At the critical addition:
th = ((void *)iph + (n * 4));
The register holding 'th' will start with reg->off value of 14. The
pointer addition will transform that reg into something that looks like:
reg->aux_off = 14
reg->aux_off_align = 4
Next, the verifier will look at the th->dest load, and it will see
a load offset of 2, and first check:
if (reg->aux_off_align % size)
which will pass because aux_off_align is 4. reg_off will be computed:
reg_off = reg->off;
...
reg_off += reg->aux_off;
plus we have off==2, and it will thus check:
if ((NET_IP_ALIGN + reg_off + off) % size != 0)
which evaluates to:
if ((NET_IP_ALIGN + 14 + 2) % size != 0)
On strict alignment architectures, NET_IP_ALIGN is 2, thus:
if ((2 + 14 + 2) % size != 0)
which passes.
These pointer transformations and checks work regardless of whether
the constant offset or the variable with known alignment is added
first to the pointer register.
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
---
include/linux/bpf_verifier.h | 3 ++
kernel/bpf/verifier.c | 108 +++++++++++++++++++++++++++++++++++--------
2 files changed, 92 insertions(+), 19 deletions(-)
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index 5efb4db..7c6a519 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -40,6 +40,9 @@ struct bpf_reg_state {
*/
s64 min_value;
u64 max_value;
+ u32 min_align;
+ u32 aux_off;
+ u32 aux_off_align;
};
enum bpf_stack_slot_type {
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index c5b56c9..cc7b626 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -241,6 +241,12 @@ static void print_verifier_state(struct bpf_verifier_state *state)
if (reg->max_value != BPF_REGISTER_MAX_RANGE)
verbose(",max_value=%llu",
(unsigned long long)reg->max_value);
+ if (reg->min_align)
+ verbose(",min_align=%u", reg->min_align);
+ if (reg->aux_off)
+ verbose(",aux_off=%u", reg->aux_off);
+ if (reg->aux_off_align)
+ verbose(",aux_off_align=%u", reg->aux_off_align);
}
for (i = 0; i < MAX_BPF_STACK; i += BPF_REG_SIZE) {
if (state->stack_slot_type[i] == STACK_SPILL)
@@ -466,6 +472,9 @@ static void init_reg_state(struct bpf_reg_state *regs)
regs[i].imm = 0;
regs[i].min_value = BPF_REGISTER_MIN_RANGE;
regs[i].max_value = BPF_REGISTER_MAX_RANGE;
+ regs[i].min_align = 0;
+ regs[i].aux_off = 0;
+ regs[i].aux_off_align = 0;
}
/* frame pointer */
@@ -492,6 +501,7 @@ static void reset_reg_range_values(struct bpf_reg_state *regs, u32 regno)
{
regs[regno].min_value = BPF_REGISTER_MIN_RANGE;
regs[regno].max_value = BPF_REGISTER_MAX_RANGE;
+ regs[regno].min_align = 0;
}
static void mark_reg_unknown_value_and_range(struct bpf_reg_state *regs,
@@ -779,17 +789,28 @@ static bool is_pointer_value(struct bpf_verifier_env *env, int regno)
}
static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg,
- int off, int size)
+ int off, int size, bool strict)
{
- if (reg->id && size != 1) {
- verbose("Unknown alignment. Only byte-sized access allowed in packet access.\n");
- return -EACCES;
+ int reg_off;
+
+ /* Byte size accesses are always allowed. */
+ if (!strict || size == 1)
+ return 0;
+
+ reg_off = reg->off;
+ if (reg->id) {
+ if (reg->aux_off_align % size) {
+ verbose("Packet access is only %u byte aligned, %d byte access not allowed\n",
+ reg->aux_off_align, size);
+ return -EACCES;
+ }
+ reg_off += reg->aux_off;
}
/* skb->data is NET_IP_ALIGN-ed */
- if ((NET_IP_ALIGN + reg->off + off) % size != 0) {
+ if ((NET_IP_ALIGN + reg_off + off) % size != 0) {
verbose("misaligned packet access off %d+%d+%d size %d\n",
- NET_IP_ALIGN, reg->off, off, size);
+ NET_IP_ALIGN, reg_off, off, size);
return -EACCES;
}
@@ -797,9 +818,9 @@ static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg,
}
static int check_val_ptr_alignment(const struct bpf_reg_state *reg,
- int size)
+ int size, bool strict)
{
- if (size != 1) {
+ if (strict && size != 1) {
verbose("Unknown alignment. Only byte-sized access allowed in value access.\n");
return -EACCES;
}
@@ -810,13 +831,16 @@ static int check_val_ptr_alignment(const struct bpf_reg_state *reg,
static int check_ptr_alignment(const struct bpf_reg_state *reg,
int off, int size)
{
+ bool strict = false;
+
+ if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))
+ strict = true;
+
switch (reg->type) {
case PTR_TO_PACKET:
- return IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) ? 0 :
- check_pkt_ptr_alignment(reg, off, size);
+ return check_pkt_ptr_alignment(reg, off, size, strict);
case PTR_TO_MAP_VALUE_ADJ:
- return IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) ? 0 :
- check_val_ptr_alignment(reg, size);
+ return check_val_ptr_alignment(reg, size, strict);
default:
if (off % size != 0) {
verbose("misaligned access off %d size %d\n",
@@ -883,6 +907,8 @@ static int check_mem_access(struct bpf_verifier_env *env, u32 regno, int off,
value_regno);
/* note that reg.[id|off|range] == 0 */
state->regs[value_regno].type = reg_type;
+ state->regs[value_regno].aux_off = 0;
+ state->regs[value_regno].aux_off_align = 0;
}
} else if (reg->type == FRAME_PTR || reg->type == PTR_TO_STACK) {
@@ -1455,6 +1481,8 @@ static int check_packet_ptr_add(struct bpf_verifier_env *env,
*/
dst_reg->off += imm;
} else {
+ bool had_id;
+
if (src_reg->type == PTR_TO_PACKET) {
/* R6=pkt(id=0,off=0,r=62) R7=imm22; r7 += r6 */
tmp_reg = *dst_reg; /* save r7 state */
@@ -1488,14 +1516,23 @@ static int check_packet_ptr_add(struct bpf_verifier_env *env,
src_reg->imm);
return -EACCES;
}
+
+ had_id = (dst_reg->id != 0);
+
/* dst_reg stays as pkt_ptr type and since some positive
* integer value was added to the pointer, increment its 'id'
*/
dst_reg->id = ++env->id_gen;
- /* something was added to pkt_ptr, set range and off to zero */
+ /* something was added to pkt_ptr, set range to zero */
+ dst_reg->aux_off = dst_reg->off;
dst_reg->off = 0;
dst_reg->range = 0;
+ if (had_id)
+ dst_reg->aux_off_align = min(dst_reg->aux_off_align,
+ src_reg->min_align);
+ else
+ dst_reg->aux_off_align = src_reg->min_align;
}
return 0;
}
@@ -1669,6 +1706,13 @@ static void check_reg_overflow(struct bpf_reg_state *reg)
reg->min_value = BPF_REGISTER_MIN_RANGE;
}
+static u32 calc_align(u32 imm)
+{
+ if (!imm)
+ return 1U << 31;
+ return imm - ((imm - 1) & imm);
+}
+
static void adjust_reg_min_max_vals(struct bpf_verifier_env *env,
struct bpf_insn *insn)
{
@@ -1676,8 +1720,10 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env,
s64 min_val = BPF_REGISTER_MIN_RANGE;
u64 max_val = BPF_REGISTER_MAX_RANGE;
u8 opcode = BPF_OP(insn->code);
+ u32 dst_align, src_align;
dst_reg = ®s[insn->dst_reg];
+ src_align = 0;
if (BPF_SRC(insn->code) == BPF_X) {
check_reg_overflow(®s[insn->src_reg]);
min_val = regs[insn->src_reg].min_value;
@@ -1693,12 +1739,18 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env,
regs[insn->src_reg].type != UNKNOWN_VALUE) {
min_val = BPF_REGISTER_MIN_RANGE;
max_val = BPF_REGISTER_MAX_RANGE;
+ src_align = 0;
+ } else {
+ src_align = regs[insn->src_reg].min_align;
}
} else if (insn->imm < BPF_REGISTER_MAX_RANGE &&
(s64)insn->imm > BPF_REGISTER_MIN_RANGE) {
min_val = max_val = insn->imm;
+ src_align = calc_align(insn->imm);
}
+ dst_align = dst_reg->min_align;
+
/* We don't know anything about what was done to this register, mark it
* as unknown.
*/
@@ -1723,18 +1775,21 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env,
dst_reg->min_value += min_val;
if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE)
dst_reg->max_value += max_val;
+ dst_reg->min_align = min(src_align, dst_align);
break;
case BPF_SUB:
if (dst_reg->min_value != BPF_REGISTER_MIN_RANGE)
dst_reg->min_value -= min_val;
if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE)
dst_reg->max_value -= max_val;
+ dst_reg->min_align = min(src_align, dst_align);
break;
case BPF_MUL:
if (dst_reg->min_value != BPF_REGISTER_MIN_RANGE)
dst_reg->min_value *= min_val;
if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE)
dst_reg->max_value *= max_val;
+ dst_reg->min_align = max(src_align, dst_align);
break;
case BPF_AND:
/* Disallow AND'ing of negative numbers, ain't nobody got time
@@ -1746,17 +1801,23 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env,
else
dst_reg->min_value = 0;
dst_reg->max_value = max_val;
+ dst_reg->min_align = max(src_align, dst_align);
break;
case BPF_LSH:
/* Gotta have special overflow logic here, if we're shifting
* more than MAX_RANGE then just assume we have an invalid
* range.
*/
- if (min_val > ilog2(BPF_REGISTER_MAX_RANGE))
+ if (min_val > ilog2(BPF_REGISTER_MAX_RANGE)) {
dst_reg->min_value = BPF_REGISTER_MIN_RANGE;
- else if (dst_reg->min_value != BPF_REGISTER_MIN_RANGE)
- dst_reg->min_value <<= min_val;
-
+ dst_reg->min_align = 1;
+ } else {
+ if (dst_reg->min_value != BPF_REGISTER_MIN_RANGE)
+ dst_reg->min_value <<= min_val;
+ if (!dst_reg->min_align)
+ dst_reg->min_align = 1;
+ dst_reg->min_align <<= min_val;
+ }
if (max_val > ilog2(BPF_REGISTER_MAX_RANGE))
dst_reg->max_value = BPF_REGISTER_MAX_RANGE;
else if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE)
@@ -1766,11 +1827,19 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env,
/* RSH by a negative number is undefined, and the BPF_RSH is an
* unsigned shift, so make the appropriate casts.
*/
- if (min_val < 0 || dst_reg->min_value < 0)
+ if (min_val < 0 || dst_reg->min_value < 0) {
dst_reg->min_value = BPF_REGISTER_MIN_RANGE;
- else
+ } else {
dst_reg->min_value =
(u64)(dst_reg->min_value) >> min_val;
+ }
+ if (min_val < 0) {
+ dst_reg->min_align = 1;
+ } else {
+ dst_reg->min_align >>= (u64) min_val;
+ if (!dst_reg->min_align)
+ dst_reg->min_align = 1;
+ }
if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE)
dst_reg->max_value >>= max_val;
break;
@@ -1872,6 +1941,7 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn)
regs[insn->dst_reg].imm = insn->imm;
regs[insn->dst_reg].max_value = insn->imm;
regs[insn->dst_reg].min_value = insn->imm;
+ regs[insn->dst_reg].min_align = calc_align(insn->imm);
}
} else if (opcode > BPF_END) {
--
2.7.4
^ permalink raw reply related
* [PATCH v2 0/7] bpf: Add alignment tracker to verifier.
From: David Miller @ 2017-05-11 16:05 UTC (permalink / raw)
To: daniel; +Cc: ast, alexei.starovoitov, netdev
First we add the alignment tracking logic to the verifier.
Next, we work on building up infrastructure to facilitate regression
testing of this facility.
Next, we add the "test_align" test case.
Finally, we let the map value pointer checks use the new
infrastructure and adjust test_verifier to match.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
v1 -->v2:
Adjustments based upon Daniel's feedback
Add map value and test_verifier changes
^ permalink raw reply
* Re: [PATCH v2 1/2] net: Added mtu parameter to dev_forward_skb calls
From: Stephen Hemminger @ 2017-05-11 16:01 UTC (permalink / raw)
To: Fredrik Markstrom
Cc: Eric Dumazet, David S. Miller, Alexei Starovoitov,
Daniel Borkmann, netdev, linux-kernel, bridge
In-Reply-To: <20170511134629.139528-2-fredrik.markstrom@gmail.com>
On Thu, 11 May 2017 15:46:27 +0200
Fredrik Markstrom <fredrik.markstrom@gmail.com> wrote:
> From: Fredrik Markström <fredrik.markstrom@gmail.com>
>
> is_skb_forwardable() currently checks if the packet size is <= mtu of
> the receiving interface. This is not consistent with most of the hardware
> ethernet drivers that happily receives packets larger then MTU.
Wrong.
Hardware interfaces are free to drop any packet greater than MTU (actually MTU + VLAN).
The actual limit is a function of the hardware. Some hardware can only limit by
power of 2; some can only limit frames larger than 1500; some have no limiting at all.
Any application that should:
* not expect packets larger than MTU to be received
* not send packets larger than MTU
* check actual receive size. IP protocols will do truncation of padded packets
^ permalink raw reply
* Re: arch: arm: bpf: Converting cBPF to eBPF for arm 32 bit
From: Kees Cook @ 2017-05-11 15:30 UTC (permalink / raw)
To: Shubham Bansal
Cc: David Miller, Mircea Gherzan, Network Development,
kernel-hardening@lists.openwall.com,
linux-arm-kernel@lists.infradead.org, ast, Daniel Borkmann
In-Reply-To: <CAHgaXdLJoVUXXGTYs7FYXay5wx=sA-O+=dYhX+r7AQT7vSNfGQ@mail.gmail.com>
On Thu, May 11, 2017 at 2:32 AM, Shubham Bansal
<illusionist.neo@gmail.com> wrote:
> What do you guys suggest i should implement it? I am almost done with
> my current implementation but if you think I should change it to the
> way David suggested, its better to suggest now before I send the
> patch.
I'd say send what you have right now, as it's a good starting point
for future work. I'll be curious to see the benchmarks, etc. It can be
a base for further optimization.
Thanks for chipping away at this!
-Kees
--
Kees Cook
Pixel Security
^ permalink raw reply
* [Problem] Broadcom BCM5762 Ethernet tg3 times out with stack trace
From: Daniel Kim @ 2017-05-11 15:25 UTC (permalink / raw)
To: siva.kallam, prashant, mchan; +Cc: netdev
Summary:
Broadcom BCM5762 Ethernet tg3 times out with stack trace
Description:
The ethernet device will disconnect with dmesg reporting a stack trace
and a time out (visible in DMesg Output below). The ethernet device
will periodically reconnect and disconnect and the driver will output
a lot of hex values into logs.
The computer doesn't have to have network activity in order to trigger
this to happen, but I believe it can trigger faster if there was. It
usually occurs as soon as a few minutes after bootup to upwards of a
few hours in my test cases.
Kernel version:
Linux version 4.11.0-041100-generic (kernel@tangerine) (gcc version
6.3.0 20170415 (Ubuntu 6.3.0-14ubuntu3) ) #201705041534 SMP Thu May 4
19:36:05 UTC 2017
Full DMesg Output:
https://launchpadlibrarian.net/319135862/error_dmesg.txt
Bug has been reported with additional information at:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1689383
Please let me know if there is other data or logs that you may need.
Cut DMesg Output:
[ 6244.283996] ------------[ cut here ]------------
[ 6244.284051] WARNING: CPU: 0 PID: 0 at
/home/kernel/COD/linux/net/sched/sch_generic.c:316
dev_watchdog+0x22c/0x230
[ 6244.284058] NETDEV WATCHDOG: enp4s0 (tg3): transmit queue 0 timed out
[ 6244.284064] Modules linked in: snd_hda_codec_hdmi hp_wmi
snd_hda_codec_realtek snd_hda_codec_generic sparse_keymap
snd_hda_intel snd_hda_codec edac_mce_amd edac_core crct10dif_pclmul
crc32_pclmul snd_hda_core snd_hwdep ghash_clmulni_intel pcbc joydev
input_leds snd_pcm aesni_intel aes_x86_64 snd_seq_midi
snd_seq_midi_event snd_rawmidi crypto_simd snd_seq snd_seq_device
snd_timer glue_helper snd cryptd soundcore serio_raw k10temp shpchp
i2c_piix4 mac_hid tpm_infineon wmi parport_pc ppdev lp parport autofs4
hid_generic usbhid hid psmouse tg3 ptp pps_core ahci libahci video
[ 6244.284129] CPU: 0 PID: 0 Comm: swapper/0 Not tainted
4.11.0-041100-generic #201705041534
[ 6244.284131] Hardware name: Hewlett-Packard HP EliteDesk 705 G1
MT/2215, BIOS L06 v02.17 12/11/2014
[ 6244.284132] Call Trace:
[ 6244.284135] <IRQ>
[ 6244.284141] dump_stack+0x63/0x81
[ 6244.284143] __warn+0xcb/0xf0
[ 6244.284146] warn_slowpath_fmt+0x5a/0x80
[ 6244.284149] ? cpu_load_update+0xdd/0x150
[ 6244.284155] dev_watchdog+0x22c/0x230
[ 6244.284159] ? qdisc_rcu_free+0x50/0x50
[ 6244.284162] call_timer_fn+0x35/0x140
[ 6244.284165] run_timer_softirq+0x1db/0x440
[ 6244.284168] ? ktime_get+0x41/0xb0
[ 6244.284172] ? lapic_next_event+0x1d/0x30
[ 6244.284175] ? clockevents_program_event+0x7f/0x120
[ 6244.284179] __do_softirq+0x104/0x2af
[ 6244.284183] irq_exit+0xb6/0xc0
[ 6244.284187] smp_apic_timer_interrupt+0x3d/0x50
[ 6244.284190] apic_timer_interrupt+0x89/0x90
[ 6244.284193] RIP: 0010:cpuidle_enter_state+0x122/0x2c0
[ 6244.284195] RSP: 0018:ffffffff86203dc8 EFLAGS: 00000246 ORIG_RAX:
ffffffffffffff10
[ 6244.284198] RAX: 0000000000000000 RBX: 0000000000000002 RCX: 000000000000001f
[ 6244.284200] RDX: 000005addc53de33 RSI: ffffa01a2ec189d8 RDI: 0000000000000000
[ 6244.284202] RBP: ffffffff86203e08 R08: 000000000000cd01 R09: 0000000000000018
[ 6244.284203] R10: ffffffff86203d98 R11: 0000000000000ef9 R12: ffffa01a1d6ab200
[ 6244.284205] R13: ffffffff862f92d8 R14: 0000000000000002 R15: ffffffff862f92c0
[ 6244.284207] </IRQ>
[ 6244.284211] ? cpuidle_enter_state+0x110/0x2c0
[ 6244.284213] cpuidle_enter+0x17/0x20
[ 6244.284218] call_cpuidle+0x23/0x40
[ 6244.284221] do_idle+0x189/0x200
[ 6244.284224] cpu_startup_entry+0x71/0x80
[ 6244.284227] rest_init+0x77/0x80
[ 6244.284230] start_kernel+0x455/0x476
[ 6244.284235] ? early_idt_handler_array+0x120/0x120
[ 6244.284239] x86_64_start_reservations+0x24/0x26
[ 6244.284243] x86_64_start_kernel+0x14d/0x170
[ 6244.284246] start_cpu+0x14/0x14
[ 6244.284251] ---[ end trace b14ec0a8b1e2a4e8 ]---
[ 6244.284259] tg3 0000:04:00.0 enp4s0: transmit timed out, resetting
[ 6244.398892] hrtimer: interrupt took 65509334 ns
[ 6247.090588] tg3 0000:04:00.0 enp4s0: 0x00000000: 0x168714e4,
0x00100506, 0x02000010, 0x00000010
[ 6247.090601] tg3 0000:04:00.0 enp4s0: 0x00000010: 0xe212000c,
0x00000000, 0xe211000c, 0x00000000
[ 6247.090607] tg3 0000:04:00.0 enp4s0: 0x00000020: 0xe210000c,
0x00000000, 0x00000000, 0x2215103c
[ 6247.090610] tg3 0000:04:00.0 enp4s0: 0x00000030: 0x00000000,
0x00000048, 0x00000000, 0x0000010a
[ 6247.090613] tg3 0000:04:00.0 enp4s0: 0x00000040: 0x00000000,
0x39000000, 0xc8035001, 0x16002008
[ 6247.090617] tg3 0000:04:00.0 enp4s0: 0x00000050: 0x00005803,
0x00000000, 0x0086a005, 0x00000000
[ 6247.090622] tg3 0000:04:00.0 enp4s0: 0x00000060: 0x00000000,
0x00000000, 0xf1000298, 0x01f802d1
[ 6247.090625] tg3 0000:04:00.0 enp4s0: 0x00000070: 0x00071010,
0xf6001500, 0x00000000, 0x00000000
[ 6247.090628] tg3 0000:04:00.0 enp4s0: 0x00000080: 0x168714e4,
0x00000018, 0x00000000, 0x00000800
[ 6247.090632] tg3 0000:04:00.0 enp4s0: 0x00000090: 0x00000000,
0x00000171, 0x00000000, 0x0000021d
[ 6247.090636] tg3 0000:04:00.0 enp4s0: 0x000000a0: 0x8005ac11,
0x00000004, 0x00000122, 0x00020010
[ 6247.090639] tg3 0000:04:00.0 enp4s0: 0x000000b0: 0x10008d82,
0x00115400, 0x00475c12, 0x10120043
[ 6247.090643] tg3 0000:04:00.0 enp4s0: 0x000000d0: 0x0008081f,
0x00000000, 0x00000000, 0x00010001
[ 6247.090649] tg3 0000:04:00.0 enp4s0: 0x000000f0: 0x00000000,
0x05762100, 0x00000000, 0xffffffff
[ 6247.090652] tg3 0000:04:00.0 enp4s0: 0x00000100: 0x13c10001,
0x00000000, 0x00000000, 0x00062030
[ 6247.090654] tg3 0000:04:00.0 enp4s0: 0x00000110: 0x00001000,
0x00002000, 0x000000a0, 0x00000000
[ 6247.090658] tg3 0000:04:00.0 enp4s0: 0x00000130: 0x00000000,
0x00000000, 0x00000000, 0x15010003
[ 6247.090660] tg3 0000:04:00.0 enp4s0: 0x00000140: 0xd45792bf,
0x00008cdc, 0x00000000, 0x00000000
[ 6247.090663] tg3 0000:04:00.0 enp4s0: 0x00000150: 0x16010004,
0x00000000, 0x00078116, 0x00000001
[ 6247.090666] tg3 0000:04:00.0 enp4s0: 0x00000160: 0x1b010002,
0x00000000, 0x00000000, 0x00000000
[ 6247.090669] tg3 0000:04:00.0 enp4s0: 0x00000170: 0x00000000,
0x80000001, 0x00000000, 0x00000000
[ 6247.090672] tg3 0000:04:00.0 enp4s0: 0x000001b0: 0x23010018,
0x00000000, 0x00000000, 0x00000000
[ 6247.090676] tg3 0000:04:00.0 enp4s0: 0x00000200: 0x00000000,
0x39000000, 0x00000000, 0xc3000000
[ 6247.090679] tg3 0000:04:00.0 enp4s0: 0x00000210: 0x00000000,
0x51000000, 0x00000000, 0x00000001
[ 6247.090682] tg3 0000:04:00.0 enp4s0: 0x00000220: 0x00000000,
0x00000001, 0x00000000, 0x00000000
[ 6247.090685] tg3 0000:04:00.0 enp4s0: 0x00000260: 0x00000000,
0x00000000, 0x00000000, 0x0000021d
[ 6247.090689] tg3 0000:04:00.0 enp4s0: 0x00000280: 0x00000000,
0x00000800, 0x00000000, 0x00000955
[ 6247.090692] tg3 0000:04:00.0 enp4s0: 0x00000300: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090695] tg3 0000:04:00.0 enp4s0: 0x00000310: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090698] tg3 0000:04:00.0 enp4s0: 0x00000320: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090701] tg3 0000:04:00.0 enp4s0: 0x00000330: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090704] tg3 0000:04:00.0 enp4s0: 0x00000340: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090707] tg3 0000:04:00.0 enp4s0: 0x00000350: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090710] tg3 0000:04:00.0 enp4s0: 0x00000360: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090713] tg3 0000:04:00.0 enp4s0: 0x00000370: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090716] tg3 0000:04:00.0 enp4s0: 0x00000380: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090718] tg3 0000:04:00.0 enp4s0: 0x00000390: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090721] tg3 0000:04:00.0 enp4s0: 0x000003a0: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090724] tg3 0000:04:00.0 enp4s0: 0x000003b0: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090727] tg3 0000:04:00.0 enp4s0: 0x000003c0: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090730] tg3 0000:04:00.0 enp4s0: 0x000003d0: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090733] tg3 0000:04:00.0 enp4s0: 0x000003e0: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090736] tg3 0000:04:00.0 enp4s0: 0x000003f0: 0x00000000,
0x00000171, 0x00000000, 0x00000171
[ 6247.090738] tg3 0000:04:00.0 enp4s0: 0x00000400: 0x18e04808,
0x00400000, 0x00001000, 0x00009b00
[ 6247.090741] tg3 0000:04:00.0 enp4s0: 0x00000410: 0x00008cdc,
0xd45792bf, 0x00008cdc, 0xd45792bf
[ 6247.090744] tg3 0000:04:00.0 enp4s0: 0x00000420: 0x00008cdc,
0xd45792bf, 0x00008cdc, 0xd45792bf
[ 6247.090747] tg3 0000:04:00.0 enp4s0: 0x00000430: 0x00000000,
0x00000000, 0x00000008, 0x000005f2
[ 6247.090750] tg3 0000:04:00.0 enp4s0: 0x00000440: 0x00000000,
0x00000000, 0x00000000, 0x082e0006
[ 6247.090753] tg3 0000:04:00.0 enp4s0: 0x00000450: 0x00000001,
0x00008000, 0x00000000, 0x00000112
[ 6247.090756] tg3 0000:04:00.0 enp4s0: 0x00000460: 0x0000000b,
0x00002620, 0x03ff0006, 0x00000000
[ 6247.090759] tg3 0000:04:00.0 enp4s0: 0x00000470: 0xa0000000,
0x00000000, 0x00000000, 0x50000001
[ 6247.090762] tg3 0000:04:00.0 enp4s0: 0x00000480: 0x42000000,
0x7fffffff, 0x06000004, 0x7fffffff
[ 6247.090765] tg3 0000:04:00.0 enp4s0: 0x00000500: 0x00000008,
0x00000002, 0x00000000, 0x00000000
[ 6247.090768] tg3 0000:04:00.0 enp4s0: 0x00000590: 0x00901001,
0x00000000, 0x00000000, 0x00000000
[ 6247.090771] tg3 0000:04:00.0 enp4s0: 0x00000600: 0xffffffff,
0x00f80011, 0x00000000, 0x40001f0c
[ 6247.090774] tg3 0000:04:00.0 enp4s0: 0x00000610: 0xffffffff,
0x00000000, 0x00000044, 0x00000000
[ 6247.090777] tg3 0000:04:00.0 enp4s0: 0x00000620: 0x00000040,
0x00000000, 0x00000000, 0x00000000
[ 6247.090780] tg3 0000:04:00.0 enp4s0: 0x00000630: 0x01010101,
0x01010101, 0x01010101, 0x01010101
[ 6247.090782] tg3 0000:04:00.0 enp4s0: 0x00000640: 0x01010101,
0x01010101, 0x01010101, 0x01010101
[ 6247.090785] tg3 0000:04:00.0 enp4s0: 0x00000650: 0x01010101,
0x01010101, 0x01010101, 0x01010101
[ 6247.090788] tg3 0000:04:00.0 enp4s0: 0x00000660: 0x01010101,
0x01010101, 0x01010101, 0x01010101
[ 6247.090790] tg3 0000:04:00.0 enp4s0: 0x00000670: 0x43cb3b20,
0x0defd9a3, 0x767fe840, 0x1442a189
[ 6247.090793] tg3 0000:04:00.0 enp4s0: 0x00000680: 0xf210c361,
0xdb0f8709, 0xee76c0a3, 0x3753b863
[ 6247.090796] tg3 0000:04:00.0 enp4s0: 0x00000690: 0x8c5ffafc,
0xba4254bd, 0x00000000, 0x00000000
[ 6247.090798] tg3 0000:04:00.0 enp4s0: 0x000006c0: 0x00000000,
0x00000000, 0x04000000, 0x00000000
[ 6247.090801] tg3 0000:04:00.0 enp4s0: 0x00000800: 0x00000000,
0xffffffff, 0x00000000, 0x00000000
[ 6247.090804] tg3 0000:04:00.0 enp4s0: 0x00000810: 0x00000000,
0xffffffff, 0x00000000, 0x00000000
[ 6247.090806] tg3 0000:04:00.0 enp4s0: 0x00000820: 0x00000000,
0x00000000, 0xffffffff, 0x00000000
[ 6247.090809] tg3 0000:04:00.0 enp4s0: 0x00000830: 0x00000000,
0xffffffff, 0xffffffff, 0xffffffff
[ 6247.090812] tg3 0000:04:00.0 enp4s0: 0x00000840: 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff
[ 6247.090815] tg3 0000:04:00.0 enp4s0: 0x00000850: 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff
[ 6247.090817] tg3 0000:04:00.0 enp4s0: 0x00000860: 0xffffffff,
0xffffffff, 0xffffffff, 0x00000000
[ 6247.090820] tg3 0000:04:00.0 enp4s0: 0x00000880: 0x00000754,
0x00001633, 0x00000000, 0x00000000
[ 6247.090822] tg3 0000:04:00.0 enp4s0: 0x00000890: 0x00000005,
0x0000000c, 0x00000000, 0x00000000
[ 6247.090825] tg3 0000:04:00.0 enp4s0: 0x000008f0: 0x007c0001,
0x00000000, 0x00000000, 0x00000000
[ 6247.090828] tg3 0000:04:00.0 enp4s0: 0x00000900: 0x00095b83,
0xffffffff, 0x00000000, 0x00000000
[ 6247.090831] tg3 0000:04:00.0 enp4s0: 0x00000910: 0x00000002,
0xffffffff, 0x00000000, 0x00000000
[ 6247.090834] tg3 0000:04:00.0 enp4s0: 0x00000920: 0x00000000,
0x00000000, 0xffffffff, 0x00000000
[ 6247.090837] tg3 0000:04:00.0 enp4s0: 0x00000930: 0x00000000,
0xffffffff, 0xffffffff, 0xffffffff
[ 6247.090840] tg3 0000:04:00.0 enp4s0: 0x00000940: 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff
[ 6247.090843] tg3 0000:04:00.0 enp4s0: 0x00000950: 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff
[ 6247.090846] tg3 0000:04:00.0 enp4s0: 0x00000960: 0xffffffff,
0xffffffff, 0xffffffff, 0x000015d7
[ 6247.090849] tg3 0000:04:00.0 enp4s0: 0x00000970: 0x00000036,
0x00000164, 0x00000000, 0x00000000
[ 6247.090852] tg3 0000:04:00.0 enp4s0: 0x00000980: 0x010a92c7,
0x00001633, 0x00000000, 0x000015c8
[ 6247.090855] tg3 0000:04:00.0 enp4s0: 0x00000990: 0x0000a81a,
0x00019e10, 0x00000000, 0x00000000
[ 6247.090858] tg3 0000:04:00.0 enp4s0: 0x00000c00: 0x0000000a,
0x00000000, 0x00000003, 0x00000001
[ 6247.090861] tg3 0000:04:00.0 enp4s0: 0x00000c10: 0x00000000,
0x00000000, 0x00000000, 0x00620000
[ 6247.090864] tg3 0000:04:00.0 enp4s0: 0x00000c80: 0x00001771,
0x00000000, 0x00000000, 0x00000000
[ 6247.090867] tg3 0000:04:00.0 enp4s0: 0x00000ce0: 0xffd07a02,
0x00000000, 0x00000062, 0x00040028
[ 6247.090870] tg3 0000:04:00.0 enp4s0: 0x00000cf0: 0x00000000,
0x50000071, 0x00000000, 0x00000000
[ 6247.090873] tg3 0000:04:00.0 enp4s0: 0x00001000: 0x00000002,
0x00000000, 0xa000e5e6, 0x00000000
[ 6247.090876] tg3 0000:04:00.0 enp4s0: 0x00001010: 0x01711711,
0x0000e5e6, 0x00000000, 0x00000000
[ 6247.090879] tg3 0000:04:00.0 enp4s0: 0x00001400: 0x00000006,
0x00000000, 0x00000000, 0x00000001
[ 6247.090881] tg3 0000:04:00.0 enp4s0: 0x00001440: 0x00000171,
0x00000171, 0x00000171, 0x00000171
[ 6247.090884] tg3 0000:04:00.0 enp4s0: 0x00001450: 0x00000171,
0x00000171, 0x00000171, 0x00000171
[ 6247.090887] tg3 0000:04:00.0 enp4s0: 0x00001460: 0x00000171,
0x00000171, 0x00000171, 0x00000171
[ 6247.090890] tg3 0000:04:00.0 enp4s0: 0x00001470: 0x00000171,
0x00000171, 0x00000171, 0x00000171
[ 6247.090893] tg3 0000:04:00.0 enp4s0: 0x00001800: 0x00000016,
0x00000000, 0x00000171, 0x00000000
[ 6247.090896] tg3 0000:04:00.0 enp4s0: 0x00001840: 0x00000000,
0x00000000, 0x00000200, 0x00000010
[ 6247.090899] tg3 0000:04:00.0 enp4s0: 0x00001850: 0x0000001f,
0x00000000, 0x00004300, 0x01710171
[ 6247.090902] tg3 0000:04:00.0 enp4s0: 0x00001860: 0x01000000,
0x00000000, 0x00000000, 0x00000000
[ 6247.090904] tg3 0000:04:00.0 enp4s0: 0x00001c00: 0x00000002,
0x00000000, 0x00000000, 0x00000000
[ 6247.090907] tg3 0000:04:00.0 enp4s0: 0x00002000: 0x00000002,
0x00000000, 0x00000000, 0x00000000
[ 6247.090910] tg3 0000:04:00.0 enp4s0: 0x00002010: 0x00000181,
0x00000001, 0x007bfffd, 0x00000000
[ 6247.090913] tg3 0000:04:00.0 enp4s0: 0x00002100: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090916] tg3 0000:04:00.0 enp4s0: 0x00002110: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090918] tg3 0000:04:00.0 enp4s0: 0x00002120: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090921] tg3 0000:04:00.0 enp4s0: 0x00002130: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090924] tg3 0000:04:00.0 enp4s0: 0x00002140: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090928] tg3 0000:04:00.0 enp4s0: 0x00002150: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090931] tg3 0000:04:00.0 enp4s0: 0x00002160: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090934] tg3 0000:04:00.0 enp4s0: 0x00002170: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090937] tg3 0000:04:00.0 enp4s0: 0x00002180: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090940] tg3 0000:04:00.0 enp4s0: 0x00002190: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090942] tg3 0000:04:00.0 enp4s0: 0x000021a0: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090945] tg3 0000:04:00.0 enp4s0: 0x000021b0: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090948] tg3 0000:04:00.0 enp4s0: 0x000021c0: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090951] tg3 0000:04:00.0 enp4s0: 0x000021d0: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090953] tg3 0000:04:00.0 enp4s0: 0x000021e0: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090956] tg3 0000:04:00.0 enp4s0: 0x000021f0: 0x000d62b3,
0x0008dc6f, 0x0000009e, 0x00000000
[ 6247.090959] tg3 0000:04:00.0 enp4s0: 0x00002200: 0x00025b63,
0x00000000, 0x00000000, 0x00000000
[ 6247.090962] tg3 0000:04:00.0 enp4s0: 0x00002250: 0x00009a2d,
0x00000000, 0x00000000, 0x00000000
[ 6247.090965] tg3 0000:04:00.0 enp4s0: 0x00002400: 0x00010012,
0x00000000, 0x00000000, 0x00000000
[ 6247.090968] tg3 0000:04:00.0 enp4s0: 0x00002440: 0x00000000,
0x00000000, 0x00000002, 0x00000000
[ 6247.090970] tg3 0000:04:00.0 enp4s0: 0x00002450: 0x00000000,
0xfffe0000, 0x08001800, 0x00006000
[ 6247.090973] tg3 0000:04:00.0 enp4s0: 0x00002470: 0x00000000,
0x0000015f, 0x00000000, 0x00000000
[ 6247.090976] tg3 0000:04:00.0 enp4s0: 0x000024c0: 0x02005101,
0x00000000, 0x00000000, 0x00000000
[ 6247.090979] tg3 0000:04:00.0 enp4s0: 0x00002800: 0x00000006,
0x00000000, 0x00000000, 0x00000000
[ 6247.090982] tg3 0000:04:00.0 enp4s0: 0x00002c00: 0x00000006,
0x00000000, 0x00000000, 0x000001d5
[ 6247.090985] tg3 0000:04:00.0 enp4s0: 0x00002c10: 0x00000000,
0x00000000, 0x00000019, 0x0000000c
[ 6247.090988] tg3 0000:04:00.0 enp4s0: 0x00002c20: 0x00020002,
0x00000000, 0x00000000, 0x00000000
[ 6247.090990] tg3 0000:04:00.0 enp4s0: 0x00002d00: 0x00000080,
0x00000040, 0x00000000, 0x00000000
[ 6247.090993] tg3 0000:04:00.0 enp4s0: 0x00003000: 0x00000006,
0x00000000, 0x00000000, 0x000001d5
[ 6247.090997] tg3 0000:04:00.0 enp4s0: 0x00003600: 0x00034400,
0x00130000, 0x00110000, 0x00000000
[ 6247.090999] tg3 0000:04:00.0 enp4s0: 0x00003610: 0x00131100,
0x00130000, 0x00130000, 0x00000000
[ 6247.091002] tg3 0000:04:00.0 enp4s0: 0x00003620: 0x80110011,
0x00000000, 0x00000004, 0x3c822080
[ 6247.091005] tg3 0000:04:00.0 enp4s0: 0x00003630: 0x00000000,
0x80008000, 0x00001080, 0x00000000
[ 6247.091008] tg3 0000:04:00.0 enp4s0: 0x00003640: 0x0000000a,
0x33f00003, 0x00000020, 0x00000019
[ 6247.091010] tg3 0000:04:00.0 enp4s0: 0x00003650: 0x00000171,
0x00000bff, 0x05762100, 0x00000000
[ 6247.091014] tg3 0000:04:00.0 enp4s0: 0x00003660: 0x00000000,
0x00000000, 0x000400a3, 0x00000202
[ 6247.091017] tg3 0000:04:00.0 enp4s0: 0x00003670: 0x0000002a,
0xfeffff63, 0x0000000a, 0x00000000
[ 6247.091020] tg3 0000:04:00.0 enp4s0: 0x000036b0: 0x001003cc,
0x07ff07ff, 0x07ff07ff, 0x01000004
[ 6247.091022] tg3 0000:04:00.0 enp4s0: 0x000036c0: 0xffffffff,
0x0000a441, 0x00c84caa, 0x0000a558
[ 6247.091025] tg3 0000:04:00.0 enp4s0: 0x000036d0: 0x0000019d,
0x00000000, 0x00000000, 0x00000000
[ 6247.091028] tg3 0000:04:00.0 enp4s0: 0x000036e0: 0x80000b19,
0xa0800799, 0x00500799, 0x00000000
[ 6247.091031] tg3 0000:04:00.0 enp4s0: 0x000036f0: 0x19090900,
0x13180600, 0x00000301, 0x00000001
[ 6247.091034] tg3 0000:04:00.0 enp4s0: 0x00003700: 0x00000000,
0x00000000, 0x00000000, 0x00001388
[ 6247.091037] tg3 0000:04:00.0 enp4s0: 0x00003710: 0x87fffffd,
0x00000000, 0x00000000, 0x000010dc
[ 6247.091039] tg3 0000:04:00.0 enp4s0: 0x00003720: 0x00000000,
0x00002040, 0x88006000, 0xa0002000
[ 6247.091042] tg3 0000:04:00.0 enp4s0: 0x00003750: 0x00000000,
0x00000000, 0x0000080b, 0x00000000
[ 6247.091045] tg3 0000:04:00.0 enp4s0: 0x00003780: 0x0000bff9,
0x00000000, 0x00000000, 0x00000000
[ 6247.091049] tg3 0000:04:00.0 enp4s0: 0x00003c00: 0x00000306,
0x00000000, 0x00000000, 0x00000048
[ 6247.091052] tg3 0000:04:00.0 enp4s0: 0x00003c10: 0x00000000,
0x00000035, 0x00000000, 0x00000000
[ 6247.091055] tg3 0000:04:00.0 enp4s0: 0x00003c20: 0x00000000,
0x00000005, 0x00000000, 0x00000000
[ 6247.091058] tg3 0000:04:00.0 enp4s0: 0x00003c30: 0x00000000,
0x00000000, 0x00000000, 0xffffc000
[ 6247.091061] tg3 0000:04:00.0 enp4s0: 0x00003c40: 0x00000000,
0x00000b00, 0x00000000, 0x00000000
[ 6247.091064] tg3 0000:04:00.0 enp4s0: 0x00003c50: 0x00000000,
0x00000155, 0x00000000, 0x00000000
[ 6247.091066] tg3 0000:04:00.0 enp4s0: 0x00003c80: 0x00000800,
0x00000955, 0x00000000, 0x00000000
[ 6247.091069] tg3 0000:04:00.0 enp4s0: 0x00003cc0: 0x00000171,
0x00000000, 0x00000000, 0x00000000
[ 6247.091072] tg3 0000:04:00.0 enp4s0: 0x00003cd0: 0x00000000,
0x0000000f, 0x00000000, 0x00000000
[ 6247.091075] tg3 0000:04:00.0 enp4s0: 0x00003d00: 0x00000000,
0xffffb000, 0x00000000, 0xffffa000
[ 6247.091078] tg3 0000:04:00.0 enp4s0: 0x00003d80: 0x00000014,
0x00000000, 0x00000005, 0x00000000
[ 6247.091080] tg3 0000:04:00.0 enp4s0: 0x00003d90: 0x00000005,
0x00000000, 0x00000014, 0x00000000
[ 6247.091083] tg3 0000:04:00.0 enp4s0: 0x00003da0: 0x00000005,
0x00000000, 0x00000005, 0x00000000
[ 6247.091086] tg3 0000:04:00.0 enp4s0: 0x00004000: 0x00000002,
0x00000000, 0x00000000, 0x00000000
[ 6247.091088] tg3 0000:04:00.0 enp4s0: 0x00004010: 0x00000000,
0x0026f012, 0x00800420, 0x01006222
[ 6247.091091] tg3 0000:04:00.0 enp4s0: 0x00004020: 0x00000000,
0x00000010, 0x00000010, 0x00000050
[ 6247.091094] tg3 0000:04:00.0 enp4s0: 0x00004030: 0x00000000,
0x01086020, 0x00296010, 0x00000002
[ 6247.091096] tg3 0000:04:00.0 enp4s0: 0x00004040: 0x00400000,
0x00000000, 0x00000010, 0x004e5062
[ 6247.091100] tg3 0000:04:00.0 enp4s0: 0x00004400: 0x00000016,
0x00000000, 0x00010000, 0x0000a000
[ 6247.091103] tg3 0000:04:00.0 enp4s0: 0x00004410: 0x00000000,
0x0000002a, 0x000000a0, 0x00000000
[ 6247.091106] tg3 0000:04:00.0 enp4s0: 0x00004420: 0x000000fd,
0x00000000, 0x00000000, 0x00000000
[ 6247.091109] tg3 0000:04:00.0 enp4s0: 0x00004440: 0x00000000,
0x00000000, 0x00000000, 0x0e5398e8
[ 6247.091112] tg3 0000:04:00.0 enp4s0: 0x00004450: 0x02340226,
0x00970071, 0x00000000, 0x00000000
[ 6247.091116] tg3 0000:04:00.0 enp4s0: 0x00004700: 0x00030002,
0x00100000, 0x00100010, 0xc1250000
[ 6247.091119] tg3 0000:04:00.0 enp4s0: 0x00004710: 0xfffff6e0,
0x00060484, 0x00100010, 0x00000000
[ 6247.091121] tg3 0000:04:00.0 enp4s0: 0x00004720: 0x00000000,
0x00000000, 0xf02c0000, 0xfffff710
[ 6247.091124] tg3 0000:04:00.0 enp4s0: 0x00004770: 0x000c0404,
0x00000002, 0x00000010, 0x00000000
[ 6247.091127] tg3 0000:04:00.0 enp4s0: 0x00004800: 0x380303fe,
0x00000000, 0x00000000, 0x00000100
[ 6247.091130] tg3 0000:04:00.0 enp4s0: 0x00004810: 0x00000000,
0x00000008, 0x00429f80, 0x00008000
[ 6247.091133] tg3 0000:04:00.0 enp4s0: 0x00004820: 0x000000dd,
0x00000000, 0x00000000, 0x00000000
[ 6247.091136] tg3 0000:04:00.0 enp4s0: 0x00004860: 0x000000dd,
0x11400062, 0x001ff800, 0x62000008
[ 6247.091139] tg3 0000:04:00.0 enp4s0: 0x00004870: 0x05ea0080,
0x003e1820, 0x003e1820, 0x00000000
[ 6247.091141] tg3 0000:04:00.0 enp4s0: 0x00004890: 0x280c0c04,
0x00305400, 0x00000000, 0x00000000
[ 6247.091144] tg3 0000:04:00.0 enp4s0: 0x000048a0: 0x000f0010,
0x00000000, 0x00000000, 0x00000000
[ 6247.091147] tg3 0000:04:00.0 enp4s0: 0x00004900: 0x18030002,
0x00000003, 0x30000000, 0x00000120
[ 6247.091149] tg3 0000:04:00.0 enp4s0: 0x00004910: 0x00000040,
0x00000003, 0x0000df94, 0x00000008
[ 6247.091152] tg3 0000:04:00.0 enp4s0: 0x00004920: 0x000000e7,
0x02728000, 0xffd07a01, 0x0f000068
[ 6247.091155] tg3 0000:04:00.0 enp4s0: 0x00004930: 0xffd31201,
0x0f000068, 0xffcdf401, 0x0f000068
[ 6247.091158] tg3 0000:04:00.0 enp4s0: 0x00004940: 0xffebcc01,
0x0f000068, 0x4f4f1212, 0x3e3ea3a3
[ 6247.091161] tg3 0000:04:00.0 enp4s0: 0x00004950: 0xf0330000,
0xffd07a68, 0xaf000000, 0xe7e500e6
[ 6247.091164] tg3 0000:04:00.0 enp4s0: 0x00004960: 0x00000000,
0xffd31268, 0xaf000000, 0x40000171
[ 6247.091167] tg3 0000:04:00.0 enp4s0: 0x00004970: 0x00028202,
0x00205400, 0x0000001c, 0x000000ff
[ 6247.091170] tg3 0000:04:00.0 enp4s0: 0x00004980: 0x000000e7,
0x00000000, 0x00000000, 0x00000000
[ 6247.091172] tg3 0000:04:00.0 enp4s0: 0x00004990: 0x00000000,
0x00000000, 0xffcdf468, 0xaf000000
[ 6247.091175] tg3 0000:04:00.0 enp4s0: 0x000049a0: 0x00f00049,
0x000000e7, 0x00000000, 0x00000000
[ 6247.091178] tg3 0000:04:00.0 enp4s0: 0x000049b0: 0xffd09601,
0xffd2c401, 0xffce7e01, 0xffec7e01
[ 6247.091181] tg3 0000:04:00.0 enp4s0: 0x000049c0: 0xffd07a02,
0xffd31202, 0xffcdf402, 0xffebcc02
[ 6247.091183] tg3 0000:04:00.0 enp4s0: 0x000049d0: 0xffd09602,
0xffd2c402, 0xffce7e02, 0xffec7e02
[ 6247.091186] tg3 0000:04:00.0 enp4s0: 0x000049f0: 0xf0330000,
0xffebcc68, 0xaf000000, 0x0000ffff
[ 6247.091190] tg3 0000:04:00.0 enp4s0: 0x00004c00: 0x200003fe,
0x00000020, 0x00000000, 0x00000000
[ 6247.091193] tg3 0000:04:00.0 enp4s0: 0x00004c10: 0x0000003f,
0x00000000, 0x00000006, 0x00000000
[ 6247.091196] tg3 0000:04:00.0 enp4s0: 0x00004c20: 0x00000000,
0x00000000, 0x00000000, 0x00000006
[ 6247.091199] tg3 0000:04:00.0 enp4s0: 0x00004c30: 0x00000000,
0x00200000, 0x0000007c, 0x0000007c
[ 6247.091201] tg3 0000:04:00.0 enp4s0: 0x00004c40: 0x00000000,
0x09550000, 0x00000000, 0x095407ff
[ 6247.091204] tg3 0000:04:00.0 enp4s0: 0x00004c50: 0x0fff0fff,
0x01550fff, 0x00000000, 0x00553939
[ 6247.091207] tg3 0000:04:00.0 enp4s0: 0x00004c60: 0x00000020,
0x00000000, 0x00000000, 0x00000000
[ 6247.091210] tg3 0000:04:00.0 enp4s0: 0x00005000: 0x00009800,
0x80000000, 0x00000000, 0x00000000
[ 6247.091213] tg3 0000:04:00.0 enp4s0: 0x00005010: 0x00000000,
0x00000000, 0x00000000, 0x08001028
[ 6247.091216] tg3 0000:04:00.0 enp4s0: 0x00005020: 0x30840fff,
0x00000000, 0x00000000, 0x40000020
[ 6247.091218] tg3 0000:04:00.0 enp4s0: 0x00005030: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 6247.091222] tg3 0000:04:00.0 enp4s0: 0x00005040: 0x00000000,
0x00000000, 0x080011f4, 0x00000000
[ 6247.091225] tg3 0000:04:00.0 enp4s0: 0x00005080: 0x00009800,
0x80004000, 0x00000000, 0x00000000
[ 6247.091227] tg3 0000:04:00.0 enp4s0: 0x00005090: 0x00000000,
0x00000000, 0x00000000, 0x08001028
[ 6247.091230] tg3 0000:04:00.0 enp4s0: 0x000050a0: 0x30840fff,
0x00000000, 0x00000000, 0x40000020
[ 6247.091233] tg3 0000:04:00.0 enp4s0: 0x000050b0: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 6247.091236] tg3 0000:04:00.0 enp4s0: 0x000050c0: 0x00000000,
0x00000000, 0x080011f4, 0x00000000
[ 6247.091238] tg3 0000:04:00.0 enp4s0: 0x00005100: 0x00009800,
0x80000000, 0x00000000, 0x00000000
[ 6247.091241] tg3 0000:04:00.0 enp4s0: 0x00005110: 0x00000000,
0x00000000, 0x00000000, 0x08001028
[ 6247.091244] tg3 0000:04:00.0 enp4s0: 0x00005120: 0x30840fff,
0x00000000, 0x00000000, 0x40000020
[ 6247.091247] tg3 0000:04:00.0 enp4s0: 0x00005130: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 6247.091250] tg3 0000:04:00.0 enp4s0: 0x00005140: 0x00000000,
0x00000000, 0x080011f4, 0x00000000
[ 6247.091253] tg3 0000:04:00.0 enp4s0: 0x00005180: 0x00009800,
0x80000000, 0x00000000, 0x00000000
[ 6247.091256] tg3 0000:04:00.0 enp4s0: 0x00005190: 0x00000000,
0x00000000, 0x00000000, 0x08001028
[ 6247.091258] tg3 0000:04:00.0 enp4s0: 0x000051a0: 0x30840fff,
0x00000000, 0x00000000, 0x40000020
[ 6247.091261] tg3 0000:04:00.0 enp4s0: 0x000051b0: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 6247.091264] tg3 0000:04:00.0 enp4s0: 0x000051c0: 0x00000000,
0x00000000, 0x080011f4, 0x00000000
[ 6247.091266] tg3 0000:04:00.0 enp4s0: 0x00005200: 0x05762100,
0x00000000, 0x21100010, 0x00000000
[ 6247.091270] tg3 0000:04:00.0 enp4s0: 0x00005210: 0x00010000,
0x00831824, 0xc0000000, 0x14400016
[ 6247.091273] tg3 0000:04:00.0 enp4s0: 0x00005220: 0xc0000000,
0x21100010, 0x00000000, 0x00000000
[ 6247.091276] tg3 0000:04:00.0 enp4s0: 0x00005230: 0x080012bc,
0x03608821, 0x14400016, 0x14830018
[ 6247.091279] tg3 0000:04:00.0 enp4s0: 0x00005240: 0x0800150c,
0x00000000, 0x3c038000, 0x54000003
[ 6247.091282] tg3 0000:04:00.0 enp4s0: 0x00005250: 0x03608821,
0x00010000, 0x14830018, 0x21100010
[ 6247.091285] tg3 0000:04:00.0 enp4s0: 0x00005260: 0x00000000,
0x3c038000, 0x54000003, 0x03608821
[ 6247.091288] tg3 0000:04:00.0 enp4s0: 0x00005270: 0xc0010000,
0x14830018, 0x21100010, 0x00000000
[ 6247.091291] tg3 0000:04:00.0 enp4s0: 0x00005280: 0x00009800,
0x80004000, 0x00000000, 0x00000000
[ 6247.091294] tg3 0000:04:00.0 enp4s0: 0x00005290: 0x00000000,
0x00000000, 0x00000000, 0x0800102c
[ 6247.091297] tg3 0000:04:00.0 enp4s0: 0x000052a0: 0x3c04ff00,
0x00000000, 0x00000000, 0x40000020
[ 6247.091300] tg3 0000:04:00.0 enp4s0: 0x000052b0: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 6247.091302] tg3 0000:04:00.0 enp4s0: 0x000052c0: 0x00000000,
0x00000000, 0x08000110, 0x00000000
[ 6247.091305] tg3 0000:04:00.0 enp4s0: 0x00005300: 0x00009800,
0x80004000, 0x00000000, 0x00000000
[ 6247.091308] tg3 0000:04:00.0 enp4s0: 0x00005310: 0x00000000,
0x00000000, 0x00000000, 0x08000100
[ 6247.091311] tg3 0000:04:00.0 enp4s0: 0x00005320: 0x3c04ff00,
0x00000000, 0x00000000, 0x40000020
[ 6247.091314] tg3 0000:04:00.0 enp4s0: 0x00005330: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 6247.091317] tg3 0000:04:00.0 enp4s0: 0x00005340: 0x00000000,
0x00000000, 0x08000110, 0x00000000
[ 6247.091320] tg3 0000:04:00.0 enp4s0: 0x00005380: 0x00009800,
0x80004000, 0x00000000, 0x00000000
[ 6247.091323] tg3 0000:04:00.0 enp4s0: 0x00005390: 0x00000000,
0x00000000, 0x00000000, 0x080000f8
[ 6247.091325] tg3 0000:04:00.0 enp4s0: 0x000053a0: 0x3c04ff00,
0x00000000, 0x00000000, 0x40000020
[ 6247.091328] tg3 0000:04:00.0 enp4s0: 0x000053b0: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 6247.091331] tg3 0000:04:00.0 enp4s0: 0x000053c0: 0x00000000,
0x00000000, 0x080011f4, 0x00000000
[ 6247.091334] tg3 0000:04:00.0 enp4s0: 0x00005800: 0x00000000,
0x39000000, 0x00000000, 0xc3000000
[ 6247.091337] tg3 0000:04:00.0 enp4s0: 0x00005810: 0x00000000,
0x51000000, 0x00000000, 0x00000001
[ 6247.091340] tg3 0000:04:00.0 enp4s0: 0x00005820: 0x00000000,
0x00000001, 0x00000000, 0x00000000
[ 6247.091342] tg3 0000:04:00.0 enp4s0: 0x00005860: 0x00000000,
0x00000000, 0x00000000, 0x0000021d
[ 6247.091345] tg3 0000:04:00.0 enp4s0: 0x00005880: 0x00000000,
0x00000800, 0x00000000, 0x00000955
[ 6247.091348] tg3 0000:04:00.0 enp4s0: 0x00005900: 0x00000000,
0x00000171, 0x00000000, 0x00000000
[ 6247.091350] tg3 0000:04:00.0 enp4s0: 0x00005980: 0x00000171,
0x00000000, 0x00000000, 0x00000000
[ 6247.091353] tg3 0000:04:00.0 enp4s0: 0x00005a00: 0x000f601f,
0x00000000, 0x00010000, 0x00000000
[ 6247.091356] tg3 0000:04:00.0 enp4s0: 0x00006000: 0x20010082,
0x00000000, 0x00000000, 0x00000000
[ 6247.091359] tg3 0000:04:00.0 enp4s0: 0x00006400: 0x00000000,
0x00000000, 0x00010091, 0xc0000000
[ 6247.091362] tg3 0000:04:00.0 enp4s0: 0x00006410: 0x05000016,
0x05000016, 0x00000000, 0x00000000
[ 6247.091364] tg3 0000:04:00.0 enp4s0: 0x00006430: 0x00000000,
0x14e41687, 0x2215103c, 0x10020000
[ 6247.091367] tg3 0000:04:00.0 enp4s0: 0x00006440: 0x0000304f,
0x000002e4, 0x00000000, 0x00000080
[ 6247.091371] tg3 0000:04:00.0 enp4s0: 0x000064c0: 0x00000005,
0x00000004, 0x00000122, 0x00000000
[ 6247.091374] tg3 0000:04:00.0 enp4s0: 0x000064d0: 0x00000040,
0x10008d82, 0x00000000, 0x00d75e12
[ 6247.091377] tg3 0000:04:00.0 enp4s0: 0x000064e0: 0x00000031,
0x0008001f, 0x00000000, 0x00000000
[ 6247.091379] tg3 0000:04:00.0 enp4s0: 0x000064f0: 0x00000002,
0x00000031, 0x00000000, 0x00000000
[ 6247.091382] tg3 0000:04:00.0 enp4s0: 0x00006500: 0x03e10003,
0xd45792bf, 0x00008cdc, 0x00000003
[ 6247.091385] tg3 0000:04:00.0 enp4s0: 0x00006510: 0x00078116,
0x0005810b, 0x00046105, 0x00000000
[ 6247.091388] tg3 0000:04:00.0 enp4s0: 0x00006530: 0x00000001,
0x00000000, 0x00000000, 0x00000000
[ 6247.091390] tg3 0000:04:00.0 enp4s0: 0x00006540: 0x0028081f,
0x0001001e, 0x00000000, 0x00000000
[ 6247.091393] tg3 0000:04:00.0 enp4s0: 0x00006550: 0x00000001,
0x02800000, 0x0000000f, 0x00000000
[ 6247.091396] tg3 0000:04:00.0 enp4s0: 0x00006560: 0x0000000f,
0x00000000, 0x00000000, 0x00000000
[ 6247.091399] tg3 0000:04:00.0 enp4s0: 0x000065f0: 0x00000000,
0x00000059, 0x00000000, 0x00000000
[ 6247.091402] tg3 0000:04:00.0 enp4s0: 0x00006800: 0x141b0034,
0x20081082, 0x00029118, 0x730cfbb9
[ 6247.091405] tg3 0000:04:00.0 enp4s0: 0x00006810: 0x21100010,
0xffffffff, 0x00000000, 0x000000f0
[ 6247.091408] tg3 0000:04:00.0 enp4s0: 0x00006880: 0x77fff020,
0x00000040, 0x00801687, 0x00000000
[ 6247.091410] tg3 0000:04:00.0 enp4s0: 0x00006890: 0x00800000,
0x00000000, 0x00000000, 0x00000000
[ 6247.091413] tg3 0000:04:00.0 enp4s0: 0x000068a0: 0x00000000,
0x00010001, 0x00000000, 0x00000000
[ 6247.091416] tg3 0000:04:00.0 enp4s0: 0x000068b0: 0x00040000,
0x00000000, 0x00000000, 0x00000000
[ 6247.091419] tg3 0000:04:00.0 enp4s0: 0x000068c0: 0x00000044,
0x00000000, 0x00000000, 0x00000000
[ 6247.091422] tg3 0000:04:00.0 enp4s0: 0x000068f0: 0x00000000,
0x00000000, 0x00000000, 0x04444444
[ 6247.091424] tg3 0000:04:00.0 enp4s0: 0x00006900: 0x6f95a788,
0x14bd0ec2, 0x00000000, 0x00000000
[ 6247.091427] tg3 0000:04:00.0 enp4s0: 0x00006920: 0x00000000,
0x00000000, 0x00000001, 0x00000000
[ 6247.091430] tg3 0000:04:00.0 enp4s0: 0x00006c00: 0x168714e4,
0x00100506, 0x02000010, 0x00000010
[ 6247.091433] tg3 0000:04:00.0 enp4s0: 0x00006c10: 0xe212000c,
0x00000000, 0xe211000c, 0x00000000
[ 6247.091436] tg3 0000:04:00.0 enp4s0: 0x00006c20: 0xe210000c,
0x00000000, 0x00000000, 0x2215103c
[ 6247.091438] tg3 0000:04:00.0 enp4s0: 0x00006c30: 0x00000000,
0x00000048, 0x00000000, 0x0000010a
[ 6247.091441] tg3 0000:04:00.0 enp4s0: 0x00006c40: 0x00000000,
0x00000000, 0xc8035001, 0x16002008
[ 6247.091444] tg3 0000:04:00.0 enp4s0: 0x00006c50: 0x00005803,
0x00000000, 0x0086a005, 0x00000000
[ 6247.091447] tg3 0000:04:00.0 enp4s0: 0x00006c60: 0x00000000,
0x00000000, 0xf1000298, 0x01f802d1
[ 6247.091450] tg3 0000:04:00.0 enp4s0: 0x00006c70: 0x00071010,
0xf6001500, 0x00000000, 0x00000000
[ 6247.091453] tg3 0000:04:00.0 enp4s0: 0x00006ca0: 0x8005ac11,
0x00000004, 0x00000122, 0x00020010
[ 6247.091456] tg3 0000:04:00.0 enp4s0: 0x00006cb0: 0x10008d82,
0x00115400, 0x00475c12, 0x10120043
[ 6247.091459] tg3 0000:04:00.0 enp4s0: 0x00006cd0: 0x0008081f,
0x00000000, 0x00000000, 0x00010001
[ 6247.091462] tg3 0000:04:00.0 enp4s0: 0x00006cf0: 0x00000000,
0x05762100, 0x00000000, 0x00000000
[ 6247.091464] tg3 0000:04:00.0 enp4s0: 0x00006d00: 0x13c10001,
0x00000000, 0x00000000, 0x00062030
[ 6247.091467] tg3 0000:04:00.0 enp4s0: 0x00006d10: 0x00001000,
0x00002000, 0x000000a0, 0x00000000
[ 6247.091470] tg3 0000:04:00.0 enp4s0: 0x00006d30: 0x00000000,
0x00000000, 0x00000000, 0x15010003
[ 6247.091473] tg3 0000:04:00.0 enp4s0: 0x00006d40: 0xd45792bf,
0x00008cdc, 0x00000000, 0x00000000
[ 6247.091476] tg3 0000:04:00.0 enp4s0: 0x00006d50: 0x16010004,
0x00000000, 0x00078116, 0x00000001
[ 6247.091479] tg3 0000:04:00.0 enp4s0: 0x00006d60: 0x1b010002,
0x00000000, 0x00000000, 0x00000000
[ 6247.091482] tg3 0000:04:00.0 enp4s0: 0x00006d70: 0x00000000,
0x80000001, 0x00000000, 0x00000000
[ 6247.091484] tg3 0000:04:00.0 enp4s0: 0x00006db0: 0x23010018,
0x00000000, 0x00000000, 0x00000000
[ 6247.091487] tg3 0000:04:00.0 enp4s0: 0x00006e30: 0x00010017,
0x00050403, 0x00000000, 0x00000000
[ 6247.091490] tg3 0000:04:00.0 enp4s0: 0x00007000: 0x08000008,
0x00000000, 0x00000000, 0x000038d4
[ 6247.091493] tg3 0000:04:00.0 enp4s0: 0x00007010: 0x9928504d,
0x02808083, 0x800500db, 0x03000a00
[ 6247.091496] tg3 0000:04:00.0 enp4s0: 0x00007020: 0x00000000,
0x00000008, 0x00000406, 0x10004000
[ 6247.091499] tg3 0000:04:00.0 enp4s0: 0x00007030: 0x000e0000,
0x000038d8, 0x00230030, 0x80000000
[ 6247.091502] tg3 0000:04:00.0 enp4s0: 0x00007500: 0x00000000,
0x00000000, 0x00000081, 0x00000000
[ 6247.091505] tg3 0000:04:00.0 enp4s0: 0x00007510: 0x00000000,
0xffffdfff, 0x00000000, 0x00000000
[ 6247.091510] tg3 0000:04:00.0 enp4s0: 0: Host status block
[00000001:00000039:(0000:0145:0000):(0000:0167)]
[ 6247.091514] tg3 0000:04:00.0 enp4s0: 0: NAPI info
[00000039:00000039:(0171:0167:01ff):0000:(021d:0000:0000:0000)]
[ 6247.091518] tg3 0000:04:00.0 enp4s0: 1: Host status block
[00000001:000000c3:(0000:0000:0000):(0800:0000)]
[ 6247.091521] tg3 0000:04:00.0 enp4s0: 1: NAPI info
[000000c3:000000c3:(0000:0000:01ff):0800:(0000:0000:0000:0000)]
[ 6247.091524] tg3 0000:04:00.0 enp4s0: 2: Host status block
[00000001:00000051:(0955:0000:0000):(0000:0000)]
[ 6247.091528] tg3 0000:04:00.0 enp4s0: 2: NAPI info
[00000051:00000051:(0000:0000:01ff):0955:(0155:0155:0000:0000)]
[ 6247.135111] tg3 0000:04:00.0 enp4s0: Link is down
[ 6250.868825] tg3 0000:04:00.0 enp4s0: Link is up at 1000 Mbps, full duplex
[ 6250.868845] tg3 0000:04:00.0 enp4s0: Flow control is on for TX and on for RX
[ 6250.868849] tg3 0000:04:00.0 enp4s0: EEE is enabled
^ permalink raw reply
* [PATCH net] macvlan: Fix performance issues with vlan tagged packets
From: Vladislav Yasevich @ 2017-05-11 15:09 UTC (permalink / raw)
To: netdev; +Cc: jasowang, mst, Vladislav Yasevich
Macvlan always turns on offload features that have sofware
fallback (NETIF_GSO_SOFTWARE). This allows much higher guest-guest
communications over macvtap.
However, macvtap does not turn on these features for vlan tagged traffic.
As a result, depending on the HW that mactap is configured on, the
performance of guest-guest communication over a vlan is very
inconsistent. If the HW supports TSO/UFO over vlans, then the
performance will be fine. If not, the the performance will suffer
greatly since the VM may continue using TSO/UFO, and will force the host
segment the traffic and possibly overlow the macvtap queue.
This patch adds the always on offloads to vlan_features. This
makes sure that any vlan tagged traffic between 2 guest will not
be segmented needlessly.
Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
---
drivers/net/macvlan.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index b34eaaa..346ad2f 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -789,10 +789,12 @@ static int macvlan_change_mtu(struct net_device *dev, int new_mtu)
*/
static struct lock_class_key macvlan_netdev_addr_lock_key;
-#define ALWAYS_ON_FEATURES \
- (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE | NETIF_F_LLTX | \
+#define ALWAYS_ON_OFFLOADS \
+ (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE | \
NETIF_F_GSO_ROBUST)
+#define ALWAYS_ON_FEATURES (ALWAYS_ON_OFFLOADS | NETIF_F_LLTX)
+
#define MACVLAN_FEATURES \
(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_LRO | \
@@ -827,6 +829,7 @@ static int macvlan_init(struct net_device *dev)
dev->features |= ALWAYS_ON_FEATURES;
dev->hw_features |= NETIF_F_LRO;
dev->vlan_features = lowerdev->vlan_features & MACVLAN_FEATURES;
+ dev->vlan_features |= ALWAYS_ON_OFFLOADS;
dev->gso_max_size = lowerdev->gso_max_size;
dev->gso_max_segs = lowerdev->gso_max_segs;
dev->hard_header_len = lowerdev->hard_header_len;
--
2.7.4
^ permalink raw reply related
* Re: [PATCH] qed: fix uninitialized data in aRFS intrastructure
From: Arnd Bergmann @ 2017-05-11 15:01 UTC (permalink / raw)
To: Mintz, Yuval
Cc: David S. Miller, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <BLUPR0701MB20046B7EA7273C97047B02F28DED0@BLUPR0701MB2004.namprd07.prod.outlook.com>
On Thu, May 11, 2017 at 4:37 PM, Mintz, Yuval <Yuval.Mintz@cavium.com> wrote:
>> > For the most part - I'm almost all in favor of this change.
>> > But just to make it clear - the actual fix could have been a one-liner, right?
>> > The rest are style changes.
>
>> Correct. Having the correct length in the memset is a sufficient fix for the warning,
>> but it felt wrong to send it since the root of the problem seems to be the
>> complexity of the code that was hiding it.
>
> ...
>
>> Generally speaking, feel free to treat any of my compile-time warning fix
>> patches as simple bug reports and apply a different fix that seems more
>> appropriate. I mainly send it in patch form since that seems to be the
>> quickest way to address any issues.
>
> Sure.
>
> Once net-next is re-opened I intend to push our next FW version which
> is also going to change some of the aRFS related configurations.
>
> So I think we should stick to the single-liner fix for now,
> and I'll revise the style [if still needed; I'll have to check] on that submission.
Sounds good, thanks!
Arnd
^ permalink raw reply
* Re: [PATCH] net/smc: mark as BROKEN due to remote memory exposure
From: Bart Van Assche @ 2017-05-11 14:57 UTC (permalink / raw)
To: hch@lst.de, davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
stable@vger.kernel.org, ubraun@linux.vnet.ibm.com
In-Reply-To: <20170510072627.12060-1-hch@lst.de>
On Wed, 2017-05-10 at 09:26 +0200, Christoph Hellwig wrote:
> The driver has a lot of quality issues due to the lack of RDMA-side
> review, and explicitly bypasses APIs to register all memory once a
> connection is made, and thus allows remote access to memoery.
>
> Mark it as broken until at least that part is fixed.
Since this is the only way to get the BROKEN marker in the v4.11 stable
kernel series:
Acked-by: Bart Van Assche <bart.vanassche@sandisk.com>
^ permalink raw reply
* Re: [PATCH 5/5] bpf: Add verifier test case for alignment.
From: David Miller @ 2017-05-11 14:55 UTC (permalink / raw)
To: daniel; +Cc: ast, alexei.starovoitov, netdev
In-Reply-To: <5914609A.9040709@iogearbox.net>
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Thu, 11 May 2017 15:01:14 +0200
> On 05/10/2017 09:10 PM, David Miller wrote:
>>
>> Signed-off-by: David S. Miller <davem@davemloft.net>
>
> Thanks for all the tests! Did you check whether it also allows
> to lift some of the F_NEEDS_EFFICIENT_UNALIGNED_ACCESS flagged
> tests in test_verifier? I think we should now be able to rework
> that a bit, but not subject to this patch set, of course.
I'll have to take a look at that and test it out on Sparc.
^ permalink raw reply
* Re: [PATCH 3/5] bpf: Add strict alignment flag for BPF_PROG_LOAD.
From: David Miller @ 2017-05-11 14:53 UTC (permalink / raw)
To: daniel; +Cc: ast, alexei.starovoitov, netdev
In-Reply-To: <59145EE6.3030409@iogearbox.net>
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Thu, 11 May 2017 14:53:58 +0200
> On 05/10/2017 09:09 PM, David Miller wrote:
>> @@ -3574,6 +3581,10 @@ int bpf_check(struct bpf_prog **prog, union
>> bpf_attr *attr)
>> } else {
>> log_level = 0;
>> }
>> + if (attr->prog_flags & BPF_F_STRICT_ALIGNMENT)
>> + strict_alignment = true;
>> + else
>> + strict_alignment = false;
>
> Just minor nit: Can we move this into struct bpf_verifier_env
> here instead of global var? The only change it would need is
> in check_ptr_alignment() to pass the env from check_mem_access().
> check_ptr_alignment() can then infer this from env.
I was just being lazy and doing it the way bpf_log is done. :-)
I've moved it into bpf_verifier_env, no problem.
> Rest looks good:
>
> Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Thanks again for review.
^ permalink raw reply
* Re: [PATCH 1/5] bpf: Track alignment of register values in the verifier.
From: David Miller @ 2017-05-11 14:49 UTC (permalink / raw)
To: daniel; +Cc: ast, alexei.starovoitov, netdev
In-Reply-To: <59145BEC.9040804@iogearbox.net>
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Thu, 11 May 2017 14:41:16 +0200
> On 05/10/2017 09:09 PM, David Miller wrote:
>>
>> Currently if we add only constant values to pointers we can fully
>> validate the alignment, and properly check if we need to reject the
>> program on CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS architectures.
>
> Should say: !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
Ok.
>>
>> The existing code will reject the load of th->dport because it cannot
>
> s/th->dport/th->dest/
Right :)
> In adjust_reg_min_max_vals(), don't we also need to call
> reset_reg_align() in the 'default' case for the cases where
> we use have ALU ops that we don't bother tracking (mod, div,
> endianess ops, etc)?
>
> Likewise, for other cases where we do reset_reg_range_values()
> which is BPF_LD as class and for the BPF_MOV in check_alu_op(),
> which I think, is only relevant when we move reg A to reg B
> in 32 bit mode. Perhaps it makes sense to consolidate the reset
> on alignment with the reset of min/max values, or do we have
> cases where this is undesirable (not that I'm currently aware
> of ...)?
I can't think of any situation where these two actions don't have
to both be performned, so I've moved the alignment clear into
reset_reg_range_values() and removed reset_reg_align() altogether.
> But other than that:
>
> Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Thanks for reviewing.
^ permalink raw reply
* RE: [PATCH] qed: fix uninitialized data in aRFS intrastructure
From: Mintz, Yuval @ 2017-05-11 14:37 UTC (permalink / raw)
To: Arnd Bergmann
Cc: David S. Miller, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <CAK8P3a2x8OxcoHyx_e1Tj7k5QP5nVvTt3mh5WZvdfMfrZqPw8g@mail.gmail.com>
> > For the most part - I'm almost all in favor of this change.
> > But just to make it clear - the actual fix could have been a one-liner, right?
> > The rest are style changes.
> Correct. Having the correct length in the memset is a sufficient fix for the warning,
> but it felt wrong to send it since the root of the problem seems to be the
> complexity of the code that was hiding it.
...
> Generally speaking, feel free to treat any of my compile-time warning fix
> patches as simple bug reports and apply a different fix that seems more
> appropriate. I mainly send it in patch form since that seems to be the
> quickest way to address any issues.
Sure.
Once net-next is re-opened I intend to push our next FW version which
is also going to change some of the aRFS related configurations.
So I think we should stick to the single-liner fix for now,
and I'll revise the style [if still needed; I'll have to check] on that submission.
^ permalink raw reply
* Re: [PATCH] qed: fix uninitialized data in aRFS intrastructure
From: Arnd Bergmann @ 2017-05-11 14:31 UTC (permalink / raw)
To: Mintz, Yuval
Cc: David S. Miller, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <BLUPR0701MB2004E8FA50C46973E09FBA298DED0@BLUPR0701MB2004.namprd07.prod.outlook.com>
On Thu, May 11, 2017 at 4:03 PM, Mintz, Yuval <Yuval.Mintz@cavium.com> wrote:
>> register, which went subtly wrong due to the wrong size in a memset():
>>
>> ethernet/qlogic/qed/qed_init_fw_funcs.c: In function
>> 'qed_set_rfs_mode_disable':
>> ethernet/qlogic/qed/qed_init_fw_funcs.c:993:3: error: '*((void
>> *)&ramline+4)' is used uninitialized in this function [-Werror=uninitialized]
>>
>> This removes the silly loop and memset, and instead directly writes the
>> correct value to the register.
>
> Hi Arnd,
>
> For the most part - I'm almost all in favor of this change.
> But just to make it clear - the actual fix could have been a one-liner, right?
> The rest are style changes.
Correct. Having the correct length in the memset is a sufficient fix for
the warning, but it felt wrong to send it since the root of the problem
seems to be the complexity of the code that was hiding it.
>> +#define CAM_REG(pf_id) (PRS_REG_GFT_CAM + CAM_LINE_SIZE * (pf_id))
>> +#define RAM_REG(pf_id) (PRS_REG_GFT_PROFILE_MASK_RAM +
>
> Not sure I'm a huge fan of this specific style change;
> Seems like we could easily manage without these macros.
I tried first and ended up with really long lines that I did not like.
Generally speaking, feel free to treat any of my compile-time warning
fix patches as simple bug reports and apply a different fix that seems
more appropriate. I mainly send it in patch form since that seems to be
the quickest way to address any issues.
Arnd
^ permalink raw reply
* [PATCH net 1/2] qlcnic: Fix link configuration with autoneg disabled
From: Manish Chopra @ 2017-05-11 14:12 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept-GELinuxNICDev
In-Reply-To: <20170511141248.996-1-manish.chopra@cavium.com>
Currently driver returns error on speed configurations
for 83xx adapter's non XGBE ports, due to this link doesn't
come up on the ports using 1000Base-T as a connector with
autoneg disabled. This patch fixes this with initializing
appropriate port type based on queried module/connector
types from hardware before any speed/autoneg configuration.
Signed-off-by: Manish Chopra <manish.chopra@cavium.com>
---
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 34 ++++++++++++++++++++++
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | 1 +
.../net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 3 ++
3 files changed, 38 insertions(+)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index 718bf58..4fb6879 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -3168,6 +3168,40 @@ int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr,
return 0;
}
+void qlcnic_83xx_get_port_type(struct qlcnic_adapter *adapter)
+{
+ struct qlcnic_hardware_context *ahw = adapter->ahw;
+ struct qlcnic_cmd_args cmd;
+ u32 config;
+ int err;
+
+ err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_LINK_STATUS);
+ if (err)
+ return;
+
+ err = qlcnic_issue_cmd(adapter, &cmd);
+ if (err) {
+ dev_info(&adapter->pdev->dev,
+ "Get Link Status Command failed: 0x%x\n", err);
+ goto out;
+ } else {
+ config = cmd.rsp.arg[3];
+
+ switch (QLC_83XX_SFP_MODULE_TYPE(config)) {
+ case QLC_83XX_MODULE_FIBRE_1000BASE_SX:
+ case QLC_83XX_MODULE_FIBRE_1000BASE_LX:
+ case QLC_83XX_MODULE_FIBRE_1000BASE_CX:
+ case QLC_83XX_MODULE_TP_1000BASE_T:
+ ahw->port_type = QLCNIC_GBE;
+ break;
+ default:
+ ahw->port_type = QLCNIC_XGBE;
+ }
+ }
+out:
+ qlcnic_free_mbx_args(&cmd);
+}
+
int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter)
{
u8 pci_func;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
index 3dfe8e2..b75a812 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
@@ -637,6 +637,7 @@ void qlcnic_83xx_get_pauseparam(struct qlcnic_adapter *,
int qlcnic_83xx_set_pauseparam(struct qlcnic_adapter *,
struct ethtool_pauseparam *);
int qlcnic_83xx_test_link(struct qlcnic_adapter *);
+void qlcnic_83xx_get_port_type(struct qlcnic_adapter *adapter);
int qlcnic_83xx_reg_test(struct qlcnic_adapter *);
int qlcnic_83xx_get_regs_len(struct qlcnic_adapter *);
int qlcnic_83xx_get_registers(struct qlcnic_adapter *, u32 *);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index 9a869c1..7f7deea 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -486,6 +486,9 @@ static int qlcnic_set_link_ksettings(struct net_device *dev,
u32 ret = 0;
struct qlcnic_adapter *adapter = netdev_priv(dev);
+ if (qlcnic_83xx_check(adapter))
+ qlcnic_83xx_get_port_type(adapter);
+
if (adapter->ahw->port_type != QLCNIC_GBE)
return -EOPNOTSUPP;
--
2.7.2
^ permalink raw reply related
* [PATCH net 2/2] qlcnic: Update version to 5.3.66
From: Manish Chopra @ 2017-05-11 14:12 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept-GELinuxNICDev
In-Reply-To: <20170511141248.996-1-manish.chopra@cavium.com>
Bumping up the version as couple of fixes added after 5.3.65
Signed-off-by: Manish Chopra <manish.chopra@cavium.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 49bad00..7245b10 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -37,8 +37,8 @@
#define _QLCNIC_LINUX_MAJOR 5
#define _QLCNIC_LINUX_MINOR 3
-#define _QLCNIC_LINUX_SUBVERSION 65
-#define QLCNIC_LINUX_VERSIONID "5.3.65"
+#define _QLCNIC_LINUX_SUBVERSION 66
+#define QLCNIC_LINUX_VERSIONID "5.3.66"
#define QLCNIC_DRV_IDC_VER 0x01
#define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\
(_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
--
2.7.2
^ permalink raw reply related
* [PATCH net 0/2] qlcnic: Bug fix and update version
From: Manish Chopra @ 2017-05-11 14:12 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept-GELinuxNICDev
Hi David,
This series has one fix and bumps up driver version.
Please consider applying to "net"
Thanks,
Manish
Manish Chopra (2):
qlcnic: Fix link configuration with autoneg disabled
qlcnic: Update version to 5.3.66
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 4 +--
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 34 ++++++++++++++++++++++
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | 1 +
.../net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 3 ++
4 files changed, 40 insertions(+), 2 deletions(-)
--
2.7.2
^ permalink raw reply
* RE: [PATCH] qed: fix uninitialized data in aRFS intrastructure
From: Mintz, Yuval @ 2017-05-11 14:03 UTC (permalink / raw)
To: Arnd Bergmann
Cc: David S. Miller, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <20170511121633.3591880-1-arnd@arndb.de>
> register, which went subtly wrong due to the wrong size in a memset():
>
> ethernet/qlogic/qed/qed_init_fw_funcs.c: In function
> 'qed_set_rfs_mode_disable':
> ethernet/qlogic/qed/qed_init_fw_funcs.c:993:3: error: '*((void
> *)&ramline+4)' is used uninitialized in this function [-Werror=uninitialized]
>
> This removes the silly loop and memset, and instead directly writes the
> correct value to the register.
Hi Arnd,
For the most part - I'm almost all in favor of this change.
But just to make it clear - the actual fix could have been a one-liner, right?
The rest are style changes.
> +#define CAM_REG(pf_id) (PRS_REG_GFT_CAM + CAM_LINE_SIZE * (pf_id))
> +#define RAM_REG(pf_id) (PRS_REG_GFT_PROFILE_MASK_RAM +
Not sure I'm a huge fan of this specific style change;
Seems like we could easily manage without these macros.
^ permalink raw reply
* Support for VETH_MRU in libnl
From: Fredrik Markstrom @ 2017-05-11 13:46 UTC (permalink / raw)
To: Eric Dumazet
Cc: Daniel Borkmann, netdev, bridge, linux-kernel, Alexei Starovoitov,
Fredrik Markstrom, David S. Miller
In-Reply-To: <20170511134629.139528-1-fredrik.markstrom@gmail.com>
---
include/linux/if_link.h | 1 +
include/netlink-private/types.h | 1 +
include/netlink/route/link/veth.h | 4 ++
lib/route/link.c | 4 ++
lib/route/link/veth.c | 141 +++++++++++++++++++++++++++++---------
5 files changed, 118 insertions(+), 33 deletions(-)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 8b84939..b9859bd 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -316,6 +316,7 @@ struct ifla_vxlan_port_range {
enum {
VETH_INFO_UNSPEC,
VETH_INFO_PEER,
+ VETH_MRU,
__VETH_INFO_MAX
#define VETH_INFO_MAX (__VETH_INFO_MAX - 1)
diff --git a/include/netlink-private/types.h b/include/netlink-private/types.h
index 3ff4fe1..c97090b 100644
--- a/include/netlink-private/types.h
+++ b/include/netlink-private/types.h
@@ -165,6 +165,7 @@ struct rtnl_link
uint32_t l_flags;
uint32_t l_change;
uint32_t l_mtu;
+ uint32_t l_mru;
uint32_t l_link;
uint32_t l_txqlen;
uint32_t l_weight;
diff --git a/include/netlink/route/link/veth.h b/include/netlink/route/link/veth.h
index 35c2345..58eeb98 100644
--- a/include/netlink/route/link/veth.h
+++ b/include/netlink/route/link/veth.h
@@ -29,6 +29,10 @@ extern struct rtnl_link *rtnl_link_veth_get_peer(struct rtnl_link *);
extern int rtnl_link_veth_add(struct nl_sock *sock, const char *name,
const char *peer, pid_t pid);
+extern int rtnl_link_veth_set_mru(struct rtnl_link *, uint32_t);
+
+extern uint32_t rtnl_link_veth_get_mru(struct rtnl_link *);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/route/link.c b/lib/route/link.c
index 3d31ffc..3cdacbb 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -61,6 +61,7 @@
#define LINK_ATTR_PHYS_PORT_ID (1 << 28)
#define LINK_ATTR_NS_FD (1 << 29)
#define LINK_ATTR_NS_PID (1 << 30)
+#define LINK_ATTR_MRU (1 << 31)
static struct nl_cache_ops rtnl_link_ops;
static struct nl_object_ops link_obj_ops;
@@ -1255,6 +1256,9 @@ int rtnl_link_fill_info(struct nl_msg *msg, struct rtnl_link *link)
if (link->ce_mask & LINK_ATTR_MTU)
NLA_PUT_U32(msg, IFLA_MTU, link->l_mtu);
+ if (link->ce_mask & LINK_ATTR_MRU)
+ NLA_PUT_U32(msg, IFLA_MTU, link->l_mru);
+
if (link->ce_mask & LINK_ATTR_TXQLEN)
NLA_PUT_U32(msg, IFLA_TXQLEN, link->l_txqlen);
diff --git a/lib/route/link/veth.c b/lib/route/link/veth.c
index e7e4a26..5dc15af 100644
--- a/lib/route/link/veth.c
+++ b/lib/route/link/veth.c
@@ -33,16 +33,62 @@
#include <linux/if_link.h>
+#define VETH_HAS_MRU (1<<0)
+
+struct veth_info
+{
+ struct rtnl_link *peer;
+ uint32_t vei_mru;
+ uint32_t vei_mask;
+};
+
static struct nla_policy veth_policy[VETH_INFO_MAX+1] = {
[VETH_INFO_PEER] = { .minlen = sizeof(struct ifinfomsg) },
+ [VETH_MRU] = { .type = NLA_U32 },
};
+static int veth_alloc(struct rtnl_link *link)
+{
+ struct rtnl_link *peer;
+ struct veth_info *vei = link->l_info;
+ int err;
+
+ /* return early if we are in recursion */
+ if (vei && vei->peer)
+ return 0;
+
+ if (!(peer = rtnl_link_alloc()))
+ return -NLE_NOMEM;
+
+ if ((vei = calloc(1, sizeof(*vei))) == NULL)
+ return -NLE_NOMEM;
+
+ /* We don't need to hold a reference here, as link and
+ * its peer should always be freed together.
+ */
+ vei->peer = link;
+
+ peer->l_info = vei;
+ if ((err = rtnl_link_set_type(peer, "veth")) < 0) {
+ rtnl_link_put(peer);
+ return err;
+ }
+
+ if ((vei = calloc(1, sizeof(*vei))) == NULL)
+ return -NLE_NOMEM;
+
+ vei->peer = peer;
+ link->l_info = vei;
+ return 0;
+}
+
static int veth_parse(struct rtnl_link *link, struct nlattr *data,
struct nlattr *xstats)
{
struct nlattr *tb[VETH_INFO_MAX+1];
struct nlattr *peer_tb[IFLA_MAX + 1];
- struct rtnl_link *peer = link->l_info;
+ struct veth_info *vei = link->l_info;
+ struct rtnl_link *peer = vei->peer;
int err;
NL_DBG(3, "Parsing veth link info");
@@ -50,6 +96,14 @@ static int veth_parse(struct rtnl_link *link, struct nlattr *data,
if ((err = nla_parse_nested(tb, VETH_INFO_MAX, data, veth_policy)) < 0)
goto errout;
+ if ((err = veth_alloc(link)) < 0)
+ goto errout;
+
+ if (tb[VETH_MRU]) {
+ vei->vei_mru = nla_get_u32(tb[VETH_MRU]);
+ vei->vei_mask |= VETH_HAS_MRU;
+ }
+
if (tb[VETH_INFO_PEER]) {
struct nlattr *nla_peer;
struct ifinfomsg *ifi;
@@ -86,7 +140,8 @@ static void veth_dump_line(struct rtnl_link *link, struct nl_dump_params *p)
static void veth_dump_details(struct rtnl_link *link, struct nl_dump_params *p)
{
- struct rtnl_link *peer = link->l_info;
+ struct veth_info *vei = link->l_info;
+ struct rtnl_link *peer = vei->peer;
char *name;
name = rtnl_link_get_name(peer);
nl_dump(p, " peer ");
@@ -98,7 +153,14 @@ static void veth_dump_details(struct rtnl_link *link, struct nl_dump_params *p)
static int veth_clone(struct rtnl_link *dst, struct rtnl_link *src)
{
- struct rtnl_link *dst_peer = NULL, *src_peer = src->l_info;
+ struct veth_info *src_vei = src->l_info;
+ struct veth_info *dst_vei = dst->l_info;
+ struct rtnl_link *dst_peer = NULL, *src_peer = src_vei->peer;
+
+
+ printf("veth_clone not implemented\n");
+
+ // FIXME:
/* we are calling nl_object_clone() recursively, this should
* happen only once */
@@ -116,7 +178,8 @@ static int veth_clone(struct rtnl_link *dst, struct rtnl_link *src)
static int veth_put_attrs(struct nl_msg *msg, struct rtnl_link *link)
{
- struct rtnl_link *peer = link->l_info;
+ struct veth_info *vei = link->l_info;
+ struct rtnl_link *peer = vei->peer;
struct ifinfomsg ifi;
struct nlattr *data, *info_peer;
@@ -135,44 +198,31 @@ static int veth_put_attrs(struct nl_msg *msg, struct rtnl_link *link)
return -NLE_MSGSIZE;
rtnl_link_fill_info(msg, peer);
nla_nest_end(msg, info_peer);
- nla_nest_end(msg, data);
- return 0;
-}
-
-static int veth_alloc(struct rtnl_link *link)
-{
- struct rtnl_link *peer;
- int err;
-
- /* return early if we are in recursion */
- if (link->l_info)
- return 0;
+ if (vei->vei_mask & VETH_HAS_MRU)
+ NLA_PUT_U32(msg, VETH_MRU, vei->vei_mru);
- if (!(peer = rtnl_link_alloc()))
- return -NLE_NOMEM;
+ nla_nest_end(msg, data);
- /* We don't need to hold a reference here, as link and
- * its peer should always be freed together.
- */
- peer->l_info = link;
- if ((err = rtnl_link_set_type(peer, "veth")) < 0) {
- rtnl_link_put(peer);
- return err;
- }
+nla_put_failure:
- link->l_info = peer;
return 0;
}
static void veth_free(struct rtnl_link *link)
{
- struct rtnl_link *peer = link->l_info;
- if (peer) {
+ struct veth_info *vei = link->l_info;
+ if (vei) {
+ struct rtnl_link *peer = vei->peer;
+ if (peer) {
+ vei->peer = NULL;
+ rtnl_link_put(peer);
+ /* avoid calling this recursively */
+ free(peer->l_info);
+ peer->l_info = NULL;
+ }
+ free(vei);
link->l_info = NULL;
- /* avoid calling this recursively */
- peer->l_info = NULL;
- rtnl_link_put(peer);
}
/* the caller should finally free link */
}
@@ -195,7 +245,7 @@ static struct rtnl_link_info_ops veth_info_ops = {
#define IS_VETH_LINK_ASSERT(link) \
if ((link)->l_info_ops != &veth_info_ops) { \
APPBUG("Link is not a veth link. set type \"veth\" first."); \
- return NULL; \
+ return -NLE_OPNOTSUPP; \
}
/** @endcond */
@@ -293,6 +343,31 @@ int rtnl_link_veth_add(struct nl_sock *sock, const char *name,
return err;
}
+int rtnl_link_veth_set_mru(struct rtnl_link *link, uint32_t mru)
+{
+ struct veth_info *vei = link->l_info;
+
+ IS_VETH_LINK_ASSERT(link);
+
+ vei->vei_mru = mru;
+ vei->vei_mask |= VETH_HAS_MRU;
+
+ return 0;
+}
+
+uint32_t rtnl_link_veth_get_mru(struct rtnl_link *link)
+{
+ struct veth_info *vei = link->l_info;
+
+ IS_VETH_LINK_ASSERT(link);
+
+ if (vei->vei_mask & VETH_HAS_MRU)
+ return vei->vei_mru;
+ else
+ return 0;
+}
+
+
/** @} */
static void __init veth_init(void)
--
2.10.1
^ permalink raw reply related
* [PATCH v2 2/2] veth: Added attribute to set maximum receive size on veth interfaces
From: Fredrik Markstrom @ 2017-05-11 13:46 UTC (permalink / raw)
To: Eric Dumazet
Cc: Daniel Borkmann, netdev, bridge, linux-kernel, Alexei Starovoitov,
Fredrik Markstrom, David S. Miller
In-Reply-To: <20170511134629.139528-1-fredrik.markstrom@gmail.com>
Currently veth drops all packet larger then the mtu set on the receiving
end of the pair. This is inconsistent with most hardware ethernet drivers.
This patch adds a new driver attribute to set the maximum size of received
packet to make it possible to create configurations similar to those
possible with (most) hardware ethernet interfaces.
Signed-off-by: Fredrik Markstrom <fredrik.markstrom@gmail.com>
---
drivers/net/veth.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
include/uapi/linux/veth.h | 1 +
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 561da3a63b8a..5669286dd531 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -33,6 +33,7 @@ struct veth_priv {
struct net_device __rcu *peer;
atomic64_t dropped;
unsigned requested_headroom;
+ int mru;
};
/*
@@ -106,6 +107,7 @@ static const struct ethtool_ops veth_ethtool_ops = {
static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct veth_priv *priv = netdev_priv(dev);
+ struct veth_priv *rcv_priv;
struct net_device *rcv;
int length = skb->len;
@@ -115,8 +117,10 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
kfree_skb(skb);
goto drop;
}
+ rcv_priv = netdev_priv(rcv);
- if (likely(dev_forward_skb(rcv, skb, 0) == NET_RX_SUCCESS)) {
+ if (likely(dev_forward_skb(rcv, skb, rcv_priv->mru) ==
+ NET_RX_SUCCESS)) {
struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats);
u64_stats_update_begin(&stats->syncp);
@@ -346,6 +350,11 @@ static int veth_validate(struct nlattr *tb[], struct nlattr *data[])
if (!is_valid_veth_mtu(nla_get_u32(tb[IFLA_MTU])))
return -EINVAL;
}
+
+ if (tb[VETH_MRU])
+ if (!is_valid_veth_mtu(nla_get_u32(tb[VETH_MRU])))
+ return -EINVAL;
+
return 0;
}
@@ -450,10 +459,15 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
*/
priv = netdev_priv(dev);
+ if (tb[VETH_MRU])
+ priv->mru = nla_get_u32(tb[VETH_MRU]);
rcu_assign_pointer(priv->peer, peer);
priv = netdev_priv(peer);
+ if (tbp[VETH_MRU])
+ priv->mru = nla_get_u32(tbp[VETH_MRU]);
rcu_assign_pointer(priv->peer, dev);
+
return 0;
err_register_dev:
@@ -489,8 +503,34 @@ static void veth_dellink(struct net_device *dev, struct list_head *head)
}
}
+static int veth_changelink(struct net_device *dev,
+ struct nlattr *tb[], struct nlattr *data[])
+{
+ struct veth_priv *priv = netdev_priv(dev);
+
+ if (data && data[VETH_MRU])
+ priv->mru = nla_get_u32(data[VETH_MRU]);
+ return 0;
+}
+
+static size_t veth_get_size(const struct net_device *dev)
+{
+ return nla_total_size(4);/* VETH_MRU */
+}
+
+static int veth_fill_info(struct sk_buff *skb,
+ const struct net_device *dev)
+{
+ struct veth_priv *priv = netdev_priv(dev);
+
+ if (nla_put_u32(skb, VETH_MRU, priv->mru))
+ return -EMSGSIZE;
+ return 0;
+}
+
static const struct nla_policy veth_policy[VETH_INFO_MAX + 1] = {
[VETH_INFO_PEER] = { .len = sizeof(struct ifinfomsg) },
+ [VETH_MRU] = { .type = NLA_U32 },
};
static struct net *veth_get_link_net(const struct net_device *dev)
@@ -508,9 +548,12 @@ static struct rtnl_link_ops veth_link_ops = {
.validate = veth_validate,
.newlink = veth_newlink,
.dellink = veth_dellink,
+ .changelink = veth_changelink,
.policy = veth_policy,
.maxtype = VETH_INFO_MAX,
.get_link_net = veth_get_link_net,
+ .get_size = veth_get_size,
+ .fill_info = veth_fill_info,
};
/*
diff --git a/include/uapi/linux/veth.h b/include/uapi/linux/veth.h
index 3354c1eb424e..8665b260f156 100644
--- a/include/uapi/linux/veth.h
+++ b/include/uapi/linux/veth.h
@@ -4,6 +4,7 @@
enum {
VETH_INFO_UNSPEC,
VETH_INFO_PEER,
+ VETH_MRU,
__VETH_INFO_MAX
#define VETH_INFO_MAX (__VETH_INFO_MAX - 1)
--
2.11.0
^ permalink raw reply related
* [PATCH v2 1/2] net: Added mtu parameter to dev_forward_skb calls
From: Fredrik Markstrom @ 2017-05-11 13:46 UTC (permalink / raw)
To: Eric Dumazet
Cc: Daniel Borkmann, netdev, bridge, linux-kernel, Alexei Starovoitov,
Fredrik Markström, David S. Miller
In-Reply-To: <20170511134629.139528-1-fredrik.markstrom@gmail.com>
From: Fredrik Markström <fredrik.markstrom@gmail.com>
is_skb_forwardable() currently checks if the packet size is <= mtu of
the receiving interface. This is not consistent with most of the hardware
ethernet drivers that happily receives packets larger then MTU.
This patch adds a parameter to dev_forward_skb and is_skb_forwardable so
that the caller can override this packet size limit.
Signed-off-by: Fredrik Markstrom <fredrik.markstrom@gmail.com>
---
drivers/net/ipvlan/ipvlan_core.c | 7 ++++---
drivers/net/macvlan.c | 4 ++--
drivers/net/veth.c | 2 +-
include/linux/netdevice.h | 10 +++++-----
net/bridge/br_forward.c | 4 ++--
net/core/dev.c | 17 +++++++++++------
net/core/filter.c | 4 ++--
net/l2tp/l2tp_eth.c | 2 +-
8 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index 1f3295e274d0..dbbe48ade204 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -234,7 +234,8 @@ void ipvlan_process_multicast(struct work_struct *work)
nskb->pkt_type = pkt_type;
nskb->dev = ipvlan->dev;
if (tx_pkt)
- ret = dev_forward_skb(ipvlan->dev, nskb);
+ ret = dev_forward_skb(ipvlan->dev,
+ nskb, 0);
else
ret = netif_rx(nskb);
}
@@ -301,7 +302,7 @@ static int ipvlan_rcv_frame(struct ipvl_addr *addr, struct sk_buff **pskb,
if (local) {
skb->pkt_type = PACKET_HOST;
- if (dev_forward_skb(ipvlan->dev, skb) == NET_RX_SUCCESS)
+ if (dev_forward_skb(ipvlan->dev, skb, 0) == NET_RX_SUCCESS)
success = true;
} else {
ret = RX_HANDLER_ANOTHER;
@@ -547,7 +548,7 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)
* the skb for the main-dev. At the RX side we just return
* RX_PASS for it to be processed further on the stack.
*/
- return dev_forward_skb(ipvlan->phy_dev, skb);
+ return dev_forward_skb(ipvlan->phy_dev, skb, 0);
} else if (is_multicast_ether_addr(eth->h_dest)) {
ipvlan_skb_crossing_ns(skb, NULL);
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 9261722960a7..4db2876c1e44 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -202,7 +202,7 @@ static int macvlan_broadcast_one(struct sk_buff *skb,
struct net_device *dev = vlan->dev;
if (local)
- return __dev_forward_skb(dev, skb);
+ return __dev_forward_skb(dev, skb, 0);
skb->dev = dev;
if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast))
@@ -495,7 +495,7 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
dest = macvlan_hash_lookup(port, eth->h_dest);
if (dest && dest->mode == MACVLAN_MODE_BRIDGE) {
/* send to lowerdev first for its network taps */
- dev_forward_skb(vlan->lowerdev, skb);
+ dev_forward_skb(vlan->lowerdev, skb, 0);
return NET_XMIT_SUCCESS;
}
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 8c39d6d690e5..561da3a63b8a 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -116,7 +116,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
goto drop;
}
- if (likely(dev_forward_skb(rcv, skb) == NET_RX_SUCCESS)) {
+ if (likely(dev_forward_skb(rcv, skb, 0) == NET_RX_SUCCESS)) {
struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats);
u64_stats_update_begin(&stats->syncp);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 97456b2539e4..f207b083ffec 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3282,16 +3282,16 @@ int dev_change_xdp_fd(struct net_device *dev, int fd, u32 flags);
struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
struct netdev_queue *txq, int *ret);
-int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
-int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
+int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb, int mtu);
+int dev_forward_skb(struct net_device *dev, struct sk_buff *skb, int mtu);
bool is_skb_forwardable(const struct net_device *dev,
- const struct sk_buff *skb);
+ const struct sk_buff *skb, int mtu);
static __always_inline int ____dev_forward_skb(struct net_device *dev,
- struct sk_buff *skb)
+ struct sk_buff *skb, int mtu)
{
if (skb_orphan_frags(skb, GFP_ATOMIC) ||
- unlikely(!is_skb_forwardable(dev, skb))) {
+ unlikely(!is_skb_forwardable(dev, skb, mtu))) {
atomic_long_inc(&dev->rx_dropped);
kfree_skb(skb);
return NET_RX_DROP;
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index 902af6ba481c..15ab57da5ef1 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -35,7 +35,7 @@ static inline int should_deliver(const struct net_bridge_port *p,
int br_dev_queue_push_xmit(struct net *net, struct sock *sk, struct sk_buff *skb)
{
- if (!is_skb_forwardable(skb->dev, skb))
+ if (!is_skb_forwardable(skb->dev, skb, 0))
goto drop;
skb_push(skb, ETH_HLEN);
@@ -96,7 +96,7 @@ static void __br_forward(const struct net_bridge_port *to,
net = dev_net(indev);
} else {
if (unlikely(netpoll_tx_running(to->br->dev))) {
- if (!is_skb_forwardable(skb->dev, skb)) {
+ if (!is_skb_forwardable(skb->dev, skb, 0)) {
kfree_skb(skb);
} else {
skb_push(skb, ETH_HLEN);
diff --git a/net/core/dev.c b/net/core/dev.c
index 533a6d6f6092..f7c53d7c8e26 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1767,14 +1767,18 @@ static inline void net_timestamp_set(struct sk_buff *skb)
__net_timestamp(SKB); \
} \
-bool is_skb_forwardable(const struct net_device *dev, const struct sk_buff *skb)
+bool is_skb_forwardable(const struct net_device *dev,
+ const struct sk_buff *skb, int mtu)
{
unsigned int len;
if (!(dev->flags & IFF_UP))
return false;
- len = dev->mtu + dev->hard_header_len + VLAN_HLEN;
+ if (mtu == 0)
+ mtu = dev->mtu;
+
+ len = mtu + dev->hard_header_len + VLAN_HLEN;
if (skb->len <= len)
return true;
@@ -1788,9 +1792,9 @@ bool is_skb_forwardable(const struct net_device *dev, const struct sk_buff *skb)
}
EXPORT_SYMBOL_GPL(is_skb_forwardable);
-int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
+int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb, int mtu)
{
- int ret = ____dev_forward_skb(dev, skb);
+ int ret = ____dev_forward_skb(dev, skb, mtu);
if (likely(!ret)) {
skb->protocol = eth_type_trans(skb, dev);
@@ -1806,6 +1810,7 @@ EXPORT_SYMBOL_GPL(__dev_forward_skb);
*
* @dev: destination network device
* @skb: buffer to forward
+ * @mtu: Maximum size to forward. If 0 dev->mtu is used.
*
* return values:
* NET_RX_SUCCESS (no congestion)
@@ -1819,9 +1824,9 @@ EXPORT_SYMBOL_GPL(__dev_forward_skb);
* we have to clear all information in the skb that could
* impact namespace isolation.
*/
-int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
+int dev_forward_skb(struct net_device *dev, struct sk_buff *skb, int mtu)
{
- return __dev_forward_skb(dev, skb) ?: netif_rx_internal(skb);
+ return __dev_forward_skb(dev, skb, mtu) ?: netif_rx_internal(skb);
}
EXPORT_SYMBOL_GPL(dev_forward_skb);
diff --git a/net/core/filter.c b/net/core/filter.c
index ebaeaf2e46e8..3f3eb26e7ea1 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -1632,13 +1632,13 @@ static const struct bpf_func_proto bpf_csum_update_proto = {
static inline int __bpf_rx_skb(struct net_device *dev, struct sk_buff *skb)
{
- return dev_forward_skb(dev, skb);
+ return dev_forward_skb(dev, skb, 0);
}
static inline int __bpf_rx_skb_no_mac(struct net_device *dev,
struct sk_buff *skb)
{
- int ret = ____dev_forward_skb(dev, skb);
+ int ret = ____dev_forward_skb(dev, skb, 0);
if (likely(!ret)) {
skb->dev = dev;
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index 6fd41d7afe1e..1258555b6578 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -164,7 +164,7 @@ static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb,
skb_dst_drop(skb);
nf_reset(skb);
- if (dev_forward_skb(dev, skb) == NET_RX_SUCCESS) {
+ if (dev_forward_skb(dev, skb, 0) == NET_RX_SUCCESS) {
atomic_long_inc(&priv->rx_packets);
atomic_long_add(data_len, &priv->rx_bytes);
} else {
--
2.11.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox