Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
authorDavid S. Miller <davem@davemloft.net>
Mon, 21 May 2018 20:01:54 +0000 (16:01 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 May 2018 20:01:54 +0000 (16:01 -0400)
S390 bpf_jit.S is removed in net-next and had changes in 'net',
since that code isn't used any more take the removal.

TLS data structures split the TX and RX components in 'net-next',
put the new struct members from the bug fix in 'net' into the RX
part.

The 'net-next' tree had some reworking of how the ERSPAN code works in
the GRE tunneling code, overlapping with a one-line headroom
calculation fix in 'net'.

Overlapping changes in __sock_map_ctx_update_elem(), keep the bits
that read the prog members via READ_ONCE() into local variables
before using them.

Signed-off-by: David S. Miller <davem@davemloft.net>
36 files changed:
1  2 
MAINTAINERS
arch/s390/net/bpf_jit_comp.c
drivers/net/ethernet/3com/3c59x.c
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
drivers/net/ethernet/mellanox/mlx4/main.c
drivers/net/ethernet/netronome/nfp/bpf/main.c
drivers/net/ethernet/qlogic/qede/qede_main.c
drivers/net/ethernet/renesas/sh_eth.h
drivers/net/phy/micrel.c
drivers/net/tun.c
drivers/net/vmxnet3/vmxnet3_drv.c
include/net/netfilter/nf_tables.h
include/net/tls.h
init/Kconfig
kernel/bpf/core.c
kernel/bpf/sockmap.c
net/core/dev.c
net/core/filter.c
net/core/sock.c
net/dsa/dsa2.c
net/ipv4/ip_gre.c
net/ipv4/ip_output.c
net/ipv4/netfilter/ip_tables.c
net/ipv4/tcp_output.c
net/ipv6/ip6_gre.c
net/ipv6/ip6_output.c
net/ipv6/netfilter/ip6_tables.c
net/netfilter/nf_tables_api.c
net/netfilter/nf_tables_core.c
net/packet/af_packet.c
net/tls/tls_sw.c
samples/bpf/Makefile
security/selinux/hooks.c
tools/lib/bpf/libbpf.c
tools/testing/selftests/bpf/test_verifier.c

diff --cc MAINTAINERS
Simple merge
index b020bea040b7acade56452207b0dc11253b285f8,dd2bcf0e7d00d45406c83e1254879e4f16db36fb..d2db8acb1a55480895e38fdf142c3d074610230d
@@@ -935,10 -1020,22 +989,15 @@@ static noinline int bpf_jit_insn(struc
                /* lg %w1,<d(imm)>(%l) */
                EMIT6_DISP_LH(0xe3000000, 0x0004, REG_W1, REG_0, REG_L,
                              EMIT_CONST_U64(func));
-               /* basr %r14,%w1 */
-               EMIT2(0x0d00, REG_14, REG_W1);
+               if (IS_ENABLED(CC_USING_EXPOLINE) && !nospec_disable) {
+                       /* brasl %r14,__s390_indirect_jump_r1 */
+                       EMIT6_PCREL_RILB(0xc0050000, REG_14, jit->r1_thunk_ip);
+               } else {
+                       /* basr %r14,%w1 */
+                       EMIT2(0x0d00, REG_14, REG_W1);
+               }
                /* lgr %b0,%r2: load return value into %b0 */
                EMIT4(0xb9040000, BPF_REG_0, REG_2);
 -              if ((jit->seen & SEEN_SKB) &&
 -                  bpf_helper_changes_pkt_data((void *)func)) {
 -                      /* lg %b1,ST_OFF_SKBP(%r15) */
 -                      EMIT6_DISP_LH(0xe3000000, 0x0004, BPF_REG_1, REG_0,
 -                                    REG_15, STK_OFF_SKBP);
 -                      emit_load_skb_data_hlen(jit);
 -              }
                break;
        }
        case BPF_JMP | BPF_TAIL_CALL:
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index ee78f339b4b374e9998f67041b5cbd1c129cee7a,f5fb16da38606ba07b392a667845847df9be95cc..70c273777fe9fe27b2ef1ba7c2c80970da8ea5c4
@@@ -103,50 -117,6 +103,54 @@@ struct tls_sw_context_tx 
        struct scatterlist sg_aead_out[2];
  };
  
 +struct tls_sw_context_rx {
 +      struct crypto_aead *aead_recv;
 +      struct crypto_wait async_wait;
 +
 +      struct strparser strp;
 +      void (*saved_data_ready)(struct sock *sk);
 +      unsigned int (*sk_poll)(struct file *file, struct socket *sock,
 +                              struct poll_table_struct *wait);
 +      struct sk_buff *recv_pkt;
 +      u8 control;
 +      bool decrypted;
++
++      char rx_aad_ciphertext[TLS_AAD_SPACE_SIZE];
++      char rx_aad_plaintext[TLS_AAD_SPACE_SIZE];
++
 +};
 +
 +struct tls_record_info {
 +      struct list_head list;
 +      u32 end_seq;
 +      int len;
 +      int num_frags;
 +      skb_frag_t frags[MAX_SKB_FRAGS];
 +};
 +
 +struct tls_offload_context {
 +      struct crypto_aead *aead_send;
 +      spinlock_t lock;        /* protects records list */
 +      struct list_head records_list;
 +      struct tls_record_info *open_record;
 +      struct tls_record_info *retransmit_hint;
 +      u64 hint_record_sn;
 +      u64 unacked_record_sn;
 +
 +      struct scatterlist sg_tx_data[MAX_SKB_FRAGS];
 +      void (*sk_destruct)(struct sock *sk);
 +      u8 driver_state[];
 +      /* The TLS layer reserves room for driver specific state
 +       * Currently the belief is that there is not enough
 +       * driver specific state to justify another layer of indirection
 +       */
 +#define TLS_DRIVER_STATE_SIZE (max_t(size_t, 8, sizeof(void *)))
 +};
 +
 +#define TLS_OFFLOAD_CONTEXT_SIZE                                               \
 +      (ALIGN(sizeof(struct tls_offload_context), sizeof(void *)) +           \
 +       TLS_DRIVER_STATE_SIZE)
 +
  enum {
        TLS_PENDING_CLOSED_RECORD
  };
diff --cc init/Kconfig
Simple merge
Simple merge
index c6de1393df63d74a80abd865e4a36c19c799a821,95a84b2f10cecf5c6bea495e3c07e3ffcefec82d..cd832250a47844e10041542518093f147da60189
@@@ -1816,20 -1789,26 +1816,20 @@@ static int __sock_map_ctx_update_elem(s
         * it with. Because we can only have a single set of programs if
         * old_sock has a strp we can stop it.
         */
 -      list_add_tail(&e->list, &psock->maps);
 -      write_unlock_bh(&sock->sk_callback_lock);
 -
 -      osock = xchg(&stab->sock_map[i], sock);
 -      if (osock) {
 -              struct smap_psock *opsock = smap_psock_sk(osock);
 -
 -              write_lock_bh(&osock->sk_callback_lock);
 -              smap_list_remove(opsock, &stab->sock_map[i]);
 -              smap_release_sock(opsock, osock);
 -              write_unlock_bh(&osock->sk_callback_lock);
 +      if (map_link) {
 +              e->entry = map_link;
 +              list_add_tail(&e->list, &psock->maps);
        }
 -      return 0;
 +      write_unlock_bh(&sock->sk_callback_lock);
 +      return err;
  out_free:
 +      kfree(e);
        smap_release_sock(psock, sock);
  out_progs:
-       if (verdict)
-               bpf_prog_put(verdict);
-       if (parse)
+       if (parse && verdict) {
                bpf_prog_put(parse);
+               bpf_prog_put(verdict);
+       }
        if (tx_msg)
                bpf_prog_put(tx_msg);
        write_unlock_bh(&sock->sk_callback_lock);
diff --cc net/core/dev.c
Simple merge
Simple merge
diff --cc net/core/sock.c
Simple merge
diff --cc net/dsa/dsa2.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index bede77f24784aa0ff746408596b781e989f4c259,458de353f5d9618f31d3fa28b7ae71c5a246f4a9..c8cf2fdbb13b88cc1bf6b494a75407cdc16977eb
@@@ -910,17 -949,7 +951,17 @@@ static netdev_tx_t ip6erspan_tunnel_xmi
                truncate = true;
        }
  
-       if (skb_cow_head(skb, dev->needed_headroom))
 +      nhoff = skb_network_header(skb) - skb_mac_header(skb);
 +      if (skb->protocol == htons(ETH_P_IP) &&
 +          (ntohs(ip_hdr(skb)->tot_len) > skb->len - nhoff))
 +              truncate = true;
 +
 +      thoff = skb_transport_header(skb) - skb_mac_header(skb);
 +      if (skb->protocol == htons(ETH_P_IPV6) &&
 +          (ntohs(ipv6_hdr(skb)->payload_len) > skb->len - thoff))
 +              truncate = true;
 +
+       if (skb_cow_head(skb, dev->needed_headroom ?: t->hlen))
                goto tx_err;
  
        t->parms.o_flags &= ~TUNNEL_KEY;
@@@ -1388,18 -1443,13 +1456,14 @@@ static int ip6gre_tunnel_init_common(st
                return -ENOMEM;
  
        ret = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
 -      if (ret) {
 -              free_percpu(dev->tstats);
 -              dev->tstats = NULL;
 -              return ret;
 -      }
 +      if (ret)
 +              goto cleanup_alloc_pcpu_stats;
 +
 +      ret = gro_cells_init(&tunnel->gro_cells, dev);
 +      if (ret)
 +              goto cleanup_dst_cache_init;
  
-       tunnel->tun_hlen = gre_calc_hlen(tunnel->parms.o_flags);
-       tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen;
-       t_hlen = tunnel->hlen + sizeof(struct ipv6hdr);
-       dev->hard_header_len = LL_MAX_HEADER + t_hlen;
+       t_hlen = ip6gre_calc_hlen(tunnel);
        dev->mtu = ETH_DATA_LEN - t_hlen;
        if (dev->type == ARPHRD_ETHER)
                dev->mtu -= ETH_HLEN;
@@@ -1766,19 -1822,13 +1843,14 @@@ static int ip6erspan_tap_init(struct ne
                return -ENOMEM;
  
        ret = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
 -      if (ret) {
 -              free_percpu(dev->tstats);
 -              dev->tstats = NULL;
 -              return ret;
 -      }
 +      if (ret)
 +              goto cleanup_alloc_pcpu_stats;
 +
 +      ret = gro_cells_init(&tunnel->gro_cells, dev);
 +      if (ret)
 +              goto cleanup_dst_cache_init;
  
-       tunnel->tun_hlen = 8;
-       tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen +
-                      erspan_hdr_len(tunnel->parms.erspan_ver);
-       t_hlen = tunnel->hlen + sizeof(struct ipv6hdr);
-       dev->hard_header_len = LL_MAX_HEADER + t_hlen;
+       t_hlen = ip6erspan_calc_hlen(tunnel);
        dev->mtu = ETH_DATA_LEN - t_hlen;
        if (dev->type == ARPHRD_ETHER)
                dev->mtu -= ETH_HLEN;
                dev->mtu -= 8;
  
        dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
-       ip6gre_tnl_link_config(tunnel, 1);
+       ip6erspan_tnl_link_config(tunnel, 1);
  
        return 0;
 +
 +cleanup_dst_cache_init:
 +      dst_cache_destroy(&tunnel->dst_cache);
 +cleanup_alloc_pcpu_stats:
 +      free_percpu(dev->tstats);
 +      dev->tstats = NULL;
 +      return ret;
  }
  
  static const struct net_device_ops ip6erspan_netdev_ops = {
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 62d1aa1a4cf3786da0d82a20e2937b96e22f2b49,092947676143c842ad19a18cf54ca7b7e7e7df24..62a99ab680e3f87e9e92fde3c8ce119fcb8ac885
@@@ -244,10 -253,9 +244,10 @@@ $(obj)/tracex5_kern.o: $(obj)/syscall_n
  # But, there is no easy way to fix it, so just exclude it since it is
  # useless for BPF samples.
  $(obj)/%.o: $(src)/%.c
 -      $(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) -I$(obj) \
 +      @echo "  CLANG-bpf " $@
 +      $(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) -I$(obj) \
                -I$(srctree)/tools/testing/selftests/bpf/ \
-               -D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \
+               -D__KERNEL__ -D__BPF_TRACING__ -Wno-unused-value -Wno-pointer-sign \
                -D__TARGET_ARCH_$(ARCH) -Wno-compare-distinct-pointer-types \
                -Wno-gnu-variable-sized-type-not-at-end \
                -Wno-address-of-packed-member -Wno-tautological-compare \
Simple merge
index 3dbe217bf23ea50561a1c08adc207943642aa1d7,0f9f06df49bce5bf16c6138ce403b21b1e4b2579..cbdf34a6fb9379fa241629a7cd34d3b48ba3ebb4
@@@ -2200,12 -2033,9 +2200,12 @@@ int bpf_prog_load_xattr(const struct bp
  
        if (!attr)
                return -EINVAL;
 +      if (!attr->file)
 +              return -EINVAL;
  
 -      obj = bpf_object__open(attr->file);
 +      obj = __bpf_object__open(attr->file, NULL, 0,
 +                               bpf_prog_type__needs_kver(attr->prog_type));
-       if (IS_ERR(obj))
+       if (IS_ERR_OR_NULL(obj))
                return -ENOENT;
  
        bpf_object__for_each_program(prog, obj) {