1. 02 4月, 2021 4 次提交
  2. 30 3月, 2021 1 次提交
  3. 29 3月, 2021 2 次提交
  4. 27 3月, 2021 3 次提交
  5. 26 3月, 2021 1 次提交
    • Y
      bpf: Fix NULL pointer dereference in bpf_get_local_storage() helper · b910eaaa
      Yonghong Song 提交于
      Jiri Olsa reported a bug ([1]) in kernel where cgroup local
      storage pointer may be NULL in bpf_get_local_storage() helper.
      There are two issues uncovered by this bug:
        (1). kprobe or tracepoint prog incorrectly sets cgroup local storage
             before prog run,
        (2). due to change from preempt_disable to migrate_disable,
             preemption is possible and percpu storage might be overwritten
             by other tasks.
      
      This issue (1) is fixed in [2]. This patch tried to address issue (2).
      The following shows how things can go wrong:
        task 1:   bpf_cgroup_storage_set() for percpu local storage
               preemption happens
        task 2:   bpf_cgroup_storage_set() for percpu local storage
               preemption happens
        task 1:   run bpf program
      
      task 1 will effectively use the percpu local storage setting by task 2
      which will be either NULL or incorrect ones.
      
      Instead of just one common local storage per cpu, this patch fixed
      the issue by permitting 8 local storages per cpu and each local
      storage is identified by a task_struct pointer. This way, we
      allow at most 8 nested preemption between bpf_cgroup_storage_set()
      and bpf_cgroup_storage_unset(). The percpu local storage slot
      is released (calling bpf_cgroup_storage_unset()) by the same task
      after bpf program finished running.
      bpf_test_run() is also fixed to use the new bpf_cgroup_storage_set()
      interface.
      
      The patch is tested on top of [2] with reproducer in [1].
      Without this patch, kernel will emit error in 2-3 minutes.
      With this patch, after one hour, still no error.
      
       [1] https://lore.kernel.org/bpf/CAKH8qBuXCfUz=w8L+Fj74OaUpbosO29niYwTki7e3Ag044_aww@mail.gmail.com/T
       [2] https://lore.kernel.org/bpf/20210309185028.3763817-1-yhs@fb.comSigned-off-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NRoman Gushchin <guro@fb.com>
      Link: https://lore.kernel.org/bpf/20210323055146.3334476-1-yhs@fb.com
      b910eaaa
  6. 25 3月, 2021 25 次提交
  7. 24 3月, 2021 4 次提交
    • D
      net: make unregister netdev warning timeout configurable · 5aa3afe1
      Dmitry Vyukov 提交于
      netdev_wait_allrefs() issues a warning if refcount does not drop to 0
      after 10 seconds. While 10 second wait generally should not happen
      under normal workload in normal environment, it seems to fire falsely
      very often during fuzzing and/or in qemu emulation (~10x slower).
      At least it's not possible to understand if it's really a false
      positive or not. Automated testing generally bumps all timeouts
      to very high values to avoid flake failures.
      Add net.core.netdev_unregister_timeout_secs sysctl to make
      the timeout configurable for automated testing systems.
      Lowering the timeout may also be useful for e.g. manual bisection.
      The default value matches the current behavior.
      Signed-off-by: NDmitry Vyukov <dvyukov@google.com>
      Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=211877
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5aa3afe1
    • V
      net: dsa: sync up switchdev objects and port attributes when joining the bridge · 010e269f
      Vladimir Oltean 提交于
      If we join an already-created bridge port, such as a bond master
      interface, then we can miss the initial switchdev notifications emitted
      by the bridge for this port, while it wasn't offloaded by anybody.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      010e269f
    • V
      net: dsa: inherit the actual bridge port flags at join time · 5961d6a1
      Vladimir Oltean 提交于
      DSA currently assumes that the bridge port starts off with this
      constellation of bridge port flags:
      
      - learning on
      - unicast flooding on
      - multicast flooding on
      - broadcast flooding on
      
      just by virtue of code copy-pasta from the bridge layer (new_nbp).
      This was a simple enough strategy thus far, because the 'bridge join'
      moment always coincided with the 'bridge port creation' moment.
      
      But with sandwiched interfaces, such as:
      
       br0
        |
      bond0
        |
       swp0
      
      it may happen that the user has had time to change the bridge port flags
      of bond0 before enslaving swp0 to it. In that case, swp0 will falsely
      assume that the bridge port flags are those determined by new_nbp, when
      in fact this can happen:
      
      ip link add br0 type bridge
      ip link add bond0 type bond
      ip link set bond0 master br0
      ip link set bond0 type bridge_slave learning off
      ip link set swp0 master br0
      
      Now swp0 has learning enabled, bond0 has learning disabled. Not nice.
      
      Fix this by "dumpster diving" through the actual bridge port flags with
      br_port_flag_is_set, at bridge join time.
      
      We use this opportunity to split dsa_port_change_brport_flags into two
      distinct functions called dsa_port_inherit_brport_flags and
      dsa_port_clear_brport_flags, now that the implementation for the two
      cases is no longer similar. This patch also creates two functions called
      dsa_port_switchdev_sync and dsa_port_switchdev_unsync which collect what
      we have so far, even if that's asymmetrical. More is going to be added
      in the next patch.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5961d6a1
    • V
      net: dsa: pass extack to dsa_port_{bridge,lag}_join · 2afc526a
      Vladimir Oltean 提交于
      This is a pretty noisy change that was broken out of the larger change
      for replaying switchdev attributes and objects at bridge join time,
      which is when these extack objects are actually used.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: NTobias Waldekranz <tobias@waldekranz.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2afc526a