1. 02 Sep, 2016 8 commits
    • Alexei Starovoitov's avatar
      bpf: introduce BPF_PROG_TYPE_PERF_EVENT program type · 0515e599
      Alexei Starovoitov authored
      Introduce BPF_PROG_TYPE_PERF_EVENT programs that can be attached to
      HW and SW perf events (PERF_TYPE_HARDWARE and PERF_TYPE_SOFTWARE
      correspondingly in uapi/linux/perf_event.h)
      
      The program visible context meta structure is
      struct bpf_perf_event_data {
          struct pt_regs regs;
           __u64 sample_period;
      };
      which is accessible directly from the program:
      int bpf_prog(struct bpf_perf_event_data *ctx)
      {
        ... ctx->sample_period ...
        ... ctx->regs.ip ...
      }
      
      The bpf verifier rewrites the accesses into kernel internal
      struct bpf_perf_event_data_kern which allows changing
      struct perf_sample_data without affecting bpf programs.
      New fields can be added to the end of struct bpf_perf_event_data
      in the future.
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0515e599
    • Alexei Starovoitov's avatar
      bpf: support 8-byte metafield access · ea2e7ce5
      Alexei Starovoitov authored
      The verifier supported only 4-byte metafields in
      struct __sk_buff and struct xdp_md. The metafields in upcoming
      struct bpf_perf_event are 8-byte to match register width in struct pt_regs.
      Teach verifier to recognize 8-byte metafield access.
      The patch doesn't affect safety of sockets and xdp programs.
      They check for 4-byte only ctx access before these conditions are hit.
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ea2e7ce5
    • Baoyou Xie's avatar
      mISDN: mark symbols static where possible · 569e937e
      Baoyou Xie authored
      We get a few warnings when building kernel with W=1:
      drivers/isdn/hardware/mISDN/hfcmulti.c:568:1: warning: no previous declaration for 'enablepcibridge' [-Wmissing-declarations]
      drivers/isdn/hardware/mISDN/hfcmulti.c:574:1: warning: no previous declaration for 'disablepcibridge' [-Wmissing-declarations]
      drivers/isdn/hardware/mISDN/hfcmulti.c:580:1: warning: no previous declaration for 'readpcibridge' [-Wmissing-declarations]
      drivers/isdn/hardware/mISDN/hfcmulti.c:608:1: warning: no previous declaration for 'writepcibridge' [-Wmissing-declarations]
      drivers/isdn/hardware/mISDN/hfcmulti.c:638:1: warning: no previous declaration for 'cpld_set_reg' [-Wmissing-declarations]
      drivers/isdn/hardware/mISDN/hfcmulti.c:645:1: warning: no previous declaration for 'cpld_write_reg' [-Wmissing-declarations]
      drivers/isdn/hardware/mISDN/hfcmulti.c:657:1: warning: no previous declaration for 'cpld_read_reg' [-Wmissing-declarations]
      drivers/isdn/hardware/mISDN/hfcmulti.c:674:1: warning: no previous declaration for 'vpm_write_address' [-Wmissing-declarations]
      drivers/isdn/hardware/mISDN/hfcmulti.c:681:1: warning: no previous declaration for 'vpm_read_address' [-Wmissing-declarations]
      drivers/isdn/hardware/mISDN/hfcmulti.c:695:1: warning: no previous declaration for 'vpm_in' [-Wmissing-declarations]
      drivers/isdn/hardware/mISDN/hfcmulti.c:716:1: warning: no previous declaration for 'vpm_out' [-Wmissing-declarations]
      drivers/isdn/hardware/mISDN/hfcmulti.c:1028:1: warning: no previous declaration for 'plxsd_checksync' [-Wmissing-declarations]
      ....
      
      In fact, these functions are only used in the file in which they are
      declared and don't need a declaration, but can be made static.
      so this patch marks these functions with 'static'.
      Signed-off-by: default avatarBaoyou Xie <baoyou.xie@linaro.org>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      569e937e
    • Timur Tabi's avatar
      net: emac: emac gigabit ethernet controller driver · b9b17deb
      Timur Tabi authored
      Add support for the Qualcomm Technologies, Inc. EMAC gigabit Ethernet
      controller.
      
      This driver supports the following features:
      1) Checksum offload.
      2) Interrupt coalescing support.
      3) SGMII phy.
      4) phylib interface for external phy
      
      Based on original work by
      	Niranjana Vishwanathapura <nvishwan@codeaurora.org>
      	Gilad Avidov <gavidov@codeaurora.org>
      Signed-off-by: default avatarTimur Tabi <timur@codeaurora.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b9b17deb
    • Vivien Didelot's avatar
      net: dsa: remove ds_to_priv · 04bed143
      Vivien Didelot authored
      Access the priv member of the dsa_switch structure directly, instead of
      having an unnecessary helper.
      Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      04bed143
    • David S. Miller's avatar
      Merge branch 'br-next' · 278ed676
      David S. Miller authored
      Nikolay Aleksandrov says:
      
      ====================
      net: bridge: add per-port unknown multicast flood control
      
      The first patch prepares the forwarding path by having the exact packet
      type passed down so we can later filter based on it and the per-port
      unknown mcast flood flag introduced in the second patch. It is similar to
      how the per-port unknown unicast flood flag works.
      Nice side-effects of patch 01 are the slight reduction of tests in the
      fast-path and a few minor checkpatch fixes.
      
      v3: don't change br_auto_mask as that will change user-visible behaviour
      v2: make pkt_type an enum as per Stephen's comment
      ====================
      Acked-by: default avatarStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      278ed676
    • Nikolay Aleksandrov's avatar
      net: bridge: add per-port multicast flood flag · b6cb5ac8
      Nikolay Aleksandrov authored
      Add a per-port flag to control the unknown multicast flood, similar to the
      unknown unicast flood flag and break a few long lines in the netlink flag
      exports.
      Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b6cb5ac8
    • Nikolay Aleksandrov's avatar
      net: bridge: change unicast boolean to exact pkt_type · 8addd5e7
      Nikolay Aleksandrov authored
      Remove the unicast flag and introduce an exact pkt_type. That would help us
      for the upcoming per-port multicast flood flag and also slightly reduce the
      tests in the input fast path.
      Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8addd5e7
  2. 01 Sep, 2016 30 commits
  3. 31 Aug, 2016 2 commits
    • David S. Miller's avatar
      Merge branch 'ppp-recursion' · 127661a4
      David S. Miller authored
      Guillaume Nault says:
      
      ====================
      ppp: fix deadlock upon recursive xmit
      
      This series fixes the issue reported by Feng where packets looping
      through a ppp device makes the module deadlock:
      https://marc.info/?l=linux-netdev&m=147134567319038&w=2
      
      The problem can occur on virtual interfaces (e.g. PPP over L2TP, or
      PPPoE on vxlan devices), when a PPP packet is routed back to the PPP
      interface.
      
      PPP's xmit path isn't reentrant, so patch #1 uses a per-cpu variable
      to detect and break recursion. Patch #2 sets the NETIF_F_LLTX flag to
      avoid lock inversion issues between ppp and txqueue locks.
      
      There are multiple entry points to the PPP xmit path. This series has
      been tested with lockdep and should address recursion issues no matter
      how the packet entered the path.
      
      A similar issue in L2TP is not covered by this series:
      l2tp_xmit_skb() also isn't reentrant, and it can be called as part of
      PPP's xmit path (pppol2tp_xmit()), or directly from the L2TP socket
      (l2tp_ppp_sendmsg()). If a packet is sent by l2tp_ppp_sendmsg() and
      routed to the parent PPP interface, then it's going to hit
      l2tp_xmit_skb() again.
      
      Breaking recursion as done in ppp_generic is not enough, because we'd
      still have a lock inversion issue (locking in l2tp_xmit_skb() can
      happen before or after locking in ppp_generic). The best approach would
      be to use the ip_tunnel functions and remove the socket locking in
      l2tp_xmit_skb(). But that'd be something for net-next.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      127661a4
    • Guillaume Nault's avatar
      ppp: declare PPP devices as LLTX · 07712770
      Guillaume Nault authored
      ppp_xmit_process() already locks the xmit path. If HARD_TX_LOCK() tries
      to hold the _xmit_lock we can get lock inversion.
      
      [  973.726130] ======================================================
      [  973.727311] [ INFO: possible circular locking dependency detected ]
      [  973.728546] 4.8.0-rc2 #1 Tainted: G           O
      [  973.728986] -------------------------------------------------------
      [  973.728986] accel-pppd/1806 is trying to acquire lock:
      [  973.728986]  (&qdisc_xmit_lock_key){+.-...}, at: [<ffffffff8146f6fe>] sch_direct_xmit+0x8d/0x221
      [  973.728986]
      [  973.728986] but task is already holding lock:
      [  973.728986]  (l2tp_sock){+.-...}, at: [<ffffffffa0202c4a>] l2tp_xmit_skb+0x1e8/0x5d7 [l2tp_core]
      [  973.728986]
      [  973.728986] which lock already depends on the new lock.
      [  973.728986]
      [  973.728986]
      [  973.728986] the existing dependency chain (in reverse order) is:
      [  973.728986]
      -> #3 (l2tp_sock){+.-...}:
      [  973.728986]        [<ffffffff810b3130>] lock_acquire+0x150/0x217
      [  973.728986]        [<ffffffff815752f4>] _raw_spin_lock+0x2d/0x3c
      [  973.728986]        [<ffffffffa0202c4a>] l2tp_xmit_skb+0x1e8/0x5d7 [l2tp_core]
      [  973.728986]        [<ffffffffa01b2466>] pppol2tp_xmit+0x1f2/0x25e [l2tp_ppp]
      [  973.728986]        [<ffffffffa0184f59>] ppp_channel_push+0xb5/0x14a [ppp_generic]
      [  973.728986]        [<ffffffffa01853ed>] ppp_write+0x104/0x11c [ppp_generic]
      [  973.728986]        [<ffffffff811b2ec6>] __vfs_write+0x56/0x120
      [  973.728986]        [<ffffffff811b3f4c>] vfs_write+0xbd/0x11b
      [  973.728986]        [<ffffffff811b4cb2>] SyS_write+0x5e/0x96
      [  973.728986]        [<ffffffff81575ba5>] entry_SYSCALL_64_fastpath+0x18/0xa8
      [  973.728986]
      -> #2 (&(&pch->downl)->rlock){+.-...}:
      [  973.728986]        [<ffffffff810b3130>] lock_acquire+0x150/0x217
      [  973.728986]        [<ffffffff81575334>] _raw_spin_lock_bh+0x31/0x40
      [  973.728986]        [<ffffffffa01808e2>] ppp_push+0xa7/0x82d [ppp_generic]
      [  973.728986]        [<ffffffffa0184675>] __ppp_xmit_process+0x48/0x877 [ppp_generic]
      [  973.728986]        [<ffffffffa018505b>] ppp_xmit_process+0x4b/0xaf [ppp_generic]
      [  973.728986]        [<ffffffffa01853f7>] ppp_write+0x10e/0x11c [ppp_generic]
      [  973.728986]        [<ffffffff811b2ec6>] __vfs_write+0x56/0x120
      [  973.728986]        [<ffffffff811b3f4c>] vfs_write+0xbd/0x11b
      [  973.728986]        [<ffffffff811b4cb2>] SyS_write+0x5e/0x96
      [  973.728986]        [<ffffffff81575ba5>] entry_SYSCALL_64_fastpath+0x18/0xa8
      [  973.728986]
      -> #1 (&(&ppp->wlock)->rlock){+.-...}:
      [  973.728986]        [<ffffffff810b3130>] lock_acquire+0x150/0x217
      [  973.728986]        [<ffffffff81575334>] _raw_spin_lock_bh+0x31/0x40
      [  973.728986]        [<ffffffffa0184654>] __ppp_xmit_process+0x27/0x877 [ppp_generic]
      [  973.728986]        [<ffffffffa018505b>] ppp_xmit_process+0x4b/0xaf [ppp_generic]
      [  973.728986]        [<ffffffffa01852da>] ppp_start_xmit+0x21b/0x22a [ppp_generic]
      [  973.728986]        [<ffffffff8143f767>] dev_hard_start_xmit+0x1a9/0x43d
      [  973.728986]        [<ffffffff8146f747>] sch_direct_xmit+0xd6/0x221
      [  973.728986]        [<ffffffff814401e4>] __dev_queue_xmit+0x62a/0x912
      [  973.728986]        [<ffffffff814404d7>] dev_queue_xmit+0xb/0xd
      [  973.728986]        [<ffffffff81449978>] neigh_direct_output+0xc/0xe
      [  973.728986]        [<ffffffff8150e62b>] ip6_finish_output2+0x5a9/0x623
      [  973.728986]        [<ffffffff81512128>] ip6_output+0x15e/0x16a
      [  973.728986]        [<ffffffff8153ef86>] dst_output+0x76/0x7f
      [  973.728986]        [<ffffffff8153f737>] mld_sendpack+0x335/0x404
      [  973.728986]        [<ffffffff81541c61>] mld_send_initial_cr.part.21+0x99/0xa2
      [  973.728986]        [<ffffffff8154441d>] ipv6_mc_dad_complete+0x42/0x71
      [  973.728986]        [<ffffffff8151c4bd>] addrconf_dad_completed+0x1cf/0x2ea
      [  973.728986]        [<ffffffff8151e4fa>] addrconf_dad_work+0x453/0x520
      [  973.728986]        [<ffffffff8107a393>] process_one_work+0x365/0x6f0
      [  973.728986]        [<ffffffff8107aecd>] worker_thread+0x2de/0x421
      [  973.728986]        [<ffffffff810816fb>] kthread+0x121/0x130
      [  973.728986]        [<ffffffff81575dbf>] ret_from_fork+0x1f/0x40
      [  973.728986]
      -> #0 (&qdisc_xmit_lock_key){+.-...}:
      [  973.728986]        [<ffffffff810b28d6>] __lock_acquire+0x1118/0x1483
      [  973.728986]        [<ffffffff810b3130>] lock_acquire+0x150/0x217
      [  973.728986]        [<ffffffff815752f4>] _raw_spin_lock+0x2d/0x3c
      [  973.728986]        [<ffffffff8146f6fe>] sch_direct_xmit+0x8d/0x221
      [  973.728986]        [<ffffffff814401e4>] __dev_queue_xmit+0x62a/0x912
      [  973.728986]        [<ffffffff814404d7>] dev_queue_xmit+0xb/0xd
      [  973.728986]        [<ffffffff81449978>] neigh_direct_output+0xc/0xe
      [  973.728986]        [<ffffffff81487811>] ip_finish_output2+0x5db/0x609
      [  973.728986]        [<ffffffff81489590>] ip_finish_output+0x152/0x15e
      [  973.728986]        [<ffffffff8148a0d4>] ip_output+0x8c/0x96
      [  973.728986]        [<ffffffff81489652>] ip_local_out+0x41/0x4a
      [  973.728986]        [<ffffffff81489e7d>] ip_queue_xmit+0x5a5/0x609
      [  973.728986]        [<ffffffffa0202fe4>] l2tp_xmit_skb+0x582/0x5d7 [l2tp_core]
      [  973.728986]        [<ffffffffa01b2466>] pppol2tp_xmit+0x1f2/0x25e [l2tp_ppp]
      [  973.728986]        [<ffffffffa0184f59>] ppp_channel_push+0xb5/0x14a [ppp_generic]
      [  973.728986]        [<ffffffffa01853ed>] ppp_write+0x104/0x11c [ppp_generic]
      [  973.728986]        [<ffffffff811b2ec6>] __vfs_write+0x56/0x120
      [  973.728986]        [<ffffffff811b3f4c>] vfs_write+0xbd/0x11b
      [  973.728986]        [<ffffffff811b4cb2>] SyS_write+0x5e/0x96
      [  973.728986]        [<ffffffff81575ba5>] entry_SYSCALL_64_fastpath+0x18/0xa8
      [  973.728986]
      [  973.728986] other info that might help us debug this:
      [  973.728986]
      [  973.728986] Chain exists of:
        &qdisc_xmit_lock_key --> &(&pch->downl)->rlock --> l2tp_sock
      
      [  973.728986]  Possible unsafe locking scenario:
      [  973.728986]
      [  973.728986]        CPU0                    CPU1
      [  973.728986]        ----                    ----
      [  973.728986]   lock(l2tp_sock);
      [  973.728986]                                lock(&(&pch->downl)->rlock);
      [  973.728986]                                lock(l2tp_sock);
      [  973.728986]   lock(&qdisc_xmit_lock_key);
      [  973.728986]
      [  973.728986]  *** DEADLOCK ***
      [  973.728986]
      [  973.728986] 6 locks held by accel-pppd/1806:
      [  973.728986]  #0:  (&(&pch->downl)->rlock){+.-...}, at: [<ffffffffa0184efa>] ppp_channel_push+0x56/0x14a [ppp_generic]
      [  973.728986]  #1:  (l2tp_sock){+.-...}, at: [<ffffffffa0202c4a>] l2tp_xmit_skb+0x1e8/0x5d7 [l2tp_core]
      [  973.728986]  #2:  (rcu_read_lock){......}, at: [<ffffffff81486981>] rcu_lock_acquire+0x0/0x20
      [  973.728986]  #3:  (rcu_read_lock_bh){......}, at: [<ffffffff81486981>] rcu_lock_acquire+0x0/0x20
      [  973.728986]  #4:  (rcu_read_lock_bh){......}, at: [<ffffffff814340e3>] rcu_lock_acquire+0x0/0x20
      [  973.728986]  #5:  (dev->qdisc_running_key ?: &qdisc_running_key#2){+.....}, at: [<ffffffff8144011e>] __dev_queue_xmit+0x564/0x912
      [  973.728986]
      [  973.728986] stack backtrace:
      [  973.728986] CPU: 2 PID: 1806 Comm: accel-pppd Tainted: G           O    4.8.0-rc2 #1
      [  973.728986] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014
      [  973.728986]  ffff7fffffffffff ffff88003436f850 ffffffff812a20f4 ffffffff82156e30
      [  973.728986]  ffffffff82156920 ffff88003436f890 ffffffff8115c759 ffff88003344ae00
      [  973.728986]  ffff88003344b5c0 0000000000000002 0000000000000006 ffff88003344b5e8
      [  973.728986] Call Trace:
      [  973.728986]  [<ffffffff812a20f4>] dump_stack+0x67/0x90
      [  973.728986]  [<ffffffff8115c759>] print_circular_bug+0x22e/0x23c
      [  973.728986]  [<ffffffff810b28d6>] __lock_acquire+0x1118/0x1483
      [  973.728986]  [<ffffffff810b3130>] lock_acquire+0x150/0x217
      [  973.728986]  [<ffffffff810b3130>] ? lock_acquire+0x150/0x217
      [  973.728986]  [<ffffffff8146f6fe>] ? sch_direct_xmit+0x8d/0x221
      [  973.728986]  [<ffffffff815752f4>] _raw_spin_lock+0x2d/0x3c
      [  973.728986]  [<ffffffff8146f6fe>] ? sch_direct_xmit+0x8d/0x221
      [  973.728986]  [<ffffffff8146f6fe>] sch_direct_xmit+0x8d/0x221
      [  973.728986]  [<ffffffff814401e4>] __dev_queue_xmit+0x62a/0x912
      [  973.728986]  [<ffffffff814404d7>] dev_queue_xmit+0xb/0xd
      [  973.728986]  [<ffffffff81449978>] neigh_direct_output+0xc/0xe
      [  973.728986]  [<ffffffff81487811>] ip_finish_output2+0x5db/0x609
      [  973.728986]  [<ffffffff81486853>] ? dst_mtu+0x29/0x2e
      [  973.728986]  [<ffffffff81489590>] ip_finish_output+0x152/0x15e
      [  973.728986]  [<ffffffff8148a0bc>] ? ip_output+0x74/0x96
      [  973.728986]  [<ffffffff8148a0d4>] ip_output+0x8c/0x96
      [  973.728986]  [<ffffffff81489652>] ip_local_out+0x41/0x4a
      [  973.728986]  [<ffffffff81489e7d>] ip_queue_xmit+0x5a5/0x609
      [  973.728986]  [<ffffffff814c559e>] ? udp_set_csum+0x207/0x21e
      [  973.728986]  [<ffffffffa0202fe4>] l2tp_xmit_skb+0x582/0x5d7 [l2tp_core]
      [  973.728986]  [<ffffffffa01b2466>] pppol2tp_xmit+0x1f2/0x25e [l2tp_ppp]
      [  973.728986]  [<ffffffffa0184f59>] ppp_channel_push+0xb5/0x14a [ppp_generic]
      [  973.728986]  [<ffffffffa01853ed>] ppp_write+0x104/0x11c [ppp_generic]
      [  973.728986]  [<ffffffff811b2ec6>] __vfs_write+0x56/0x120
      [  973.728986]  [<ffffffff8124c11d>] ? fsnotify_perm+0x27/0x95
      [  973.728986]  [<ffffffff8124d41d>] ? security_file_permission+0x4d/0x54
      [  973.728986]  [<ffffffff811b3f4c>] vfs_write+0xbd/0x11b
      [  973.728986]  [<ffffffff811b4cb2>] SyS_write+0x5e/0x96
      [  973.728986]  [<ffffffff81575ba5>] entry_SYSCALL_64_fastpath+0x18/0xa8
      [  973.728986]  [<ffffffff810ae0fa>] ? trace_hardirqs_off_caller+0x121/0x12f
      Signed-off-by: default avatarGuillaume Nault <g.nault@alphalink.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      07712770