31 Jan, 2019

2 commits

  • [ Upstream commit 6c57f0458022298e4da1729c67bd33ce41c14e7a ]

    In certain cases, pskb_trim_rcsum() may change skb pointers.
    Reinitialize header pointers afterwards to avoid potential
    use-after-frees. Add a note in the documentation of
    pskb_trim_rcsum(). Found by KASAN.

    Signed-off-by: Ross Lagerwall
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Ross Lagerwall
     
  • [ Upstream commit 28c1382fa28f2e2d9d0d6f25ae879b5af2ecbd03 ]

    The skb header should be set to ethernet header before using
    is_skb_forwardable. Because the ethernet header length has been
    considered in is_skb_forwardable(including dev->hard_header_len
    length).

    To reproduce the issue:
    1, add 2 ports on linux bridge br using following commands:
    $ brctl addbr br
    $ brctl addif br eth0
    $ brctl addif br eth1
    2, the MTU of eth0 and eth1 is 1500
    3, send a packet(Data 1480, UDP 8, IP 20, Ethernet 14, VLAN 4)
    from eth0 to eth1

    So the expect result is packet larger than 1500 cannot pass through
    eth0 and eth1. But currently, the packet passes through success, it
    means eth1's MTU limit doesn't take effect.

    Fixes: f6367b4660dd ("bridge: use is_skb_forwardable in forward path")
    Cc: bridge@lists.linux-foundation.org
    Cc: Nkolay Aleksandrov
    Cc: Roopa Prabhu
    Cc: Stephen Hemminger
    Signed-off-by: Yunjian Wang
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Yunjian Wang
     

23 Jan, 2019

2 commits

  • commit e2c8d550a973bb34fc28bc8d0ec996f84562fb8a upstream.

    The [ip,ip6,arp]_tables use x_tables_info internally and the underlying
    memory is already accounted to kmemcg. Do the same for ebtables. The
    syzbot, by using setsockopt(EBT_SO_SET_ENTRIES), was able to OOM the
    whole system from a restricted memcg, a potential DoS.

    By accounting the ebt_table_info, the memory used for ebt_table_info can
    be contained within the memcg of the allocating process. However the
    lifetime of ebt_table_info is independent of the allocating process and
    is tied to the network namespace. So, the oom-killer will not be able to
    relieve the memory pressure due to ebt_table_info memory. The memory for
    ebt_table_info is allocated through vmalloc. Currently vmalloc does not
    handle the oom-killed allocating process correctly and one large
    allocation can bypass memcg limit enforcement. So, with this patch,
    at least the small allocations will be contained. For large allocations,
    we need to fix vmalloc.

    Reported-by: syzbot+7713f3aa67be76b1552c@syzkaller.appspotmail.com
    Signed-off-by: Shakeel Butt
    Reviewed-by: Kirill Tkhai
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Shakeel Butt
     
  • [ Upstream commit 4c84edc11b76590859b1e45dd676074c59602dc4 ]

    When handling DNAT'ed packets on a bridge device, the neighbour cache entry
    from lookup was used without checking its state. It means that a cache entry
    in the NUD_STALE state will be used directly instead of entering the NUD_DELAY
    state to confirm the reachability of the neighbor.

    This problem becomes worse after commit 2724680bceee ("neigh: Keep neighbour
    cache entries if number of them is small enough."), since all neighbour cache
    entries in the NUD_STALE state will be kept in the neighbour table as long as
    the number of cache entries does not exceed the value specified in gc_thresh1.

    This commit validates the state of a neighbour cache entry before using
    the entry.

    Signed-off-by: JianJhen Chen
    Reviewed-by: JinLin Chen
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    JianJhen Chen
     

04 Nov, 2018

3 commits

  • commit 0fe5119e267f3e3d8ac206895f5922195ec55a8a upstream.

    Recently a check was added which prevents marking of routers with zero
    source address, but for IPv6 that cannot happen as the relevant RFCs
    actually forbid such packets:
    RFC 2710 (MLDv1):
    "To be valid, the Query message MUST
    come from a link-local IPv6 Source Address, be at least 24 octets
    long, and have a correct MLD checksum."

    Same goes for RFC 3810.

    And also it can be seen as a requirement in ipv6_mc_check_mld_query()
    which is used by the bridge to validate the message before processing
    it. Thus any queries with :: source address won't be processed anyway.
    So just remove the check for zero IPv6 source address from the query
    processing function.

    Fixes: 5a2de63fd1a5 ("bridge: do not add port to router list when receives query with source 0.0.0.0")
    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller
    Cc: Hangbin Liu
    Signed-off-by: Greg Kroah-Hartman

    Nikolay Aleksandrov
     
  • commit 5a2de63fd1a59c30c02526d427bc014b98adf508 upstream.

    Based on RFC 4541, 2.1.1. IGMP Forwarding Rules

    The switch supporting IGMP snooping must maintain a list of
    multicast routers and the ports on which they are attached. This
    list can be constructed in any combination of the following ways:

    a) This list should be built by the snooping switch sending
    Multicast Router Solicitation messages as described in IGMP
    Multicast Router Discovery [MRDISC]. It may also snoop
    Multicast Router Advertisement messages sent by and to other
    nodes.

    b) The arrival port for IGMP Queries (sent by multicast routers)
    where the source address is not 0.0.0.0.

    We should not add the port to router list when receives query with source
    0.0.0.0.

    Reported-by: Ying Xu
    Signed-off-by: Hangbin Liu
    Acked-by: Nikolay Aleksandrov
    Acked-by: Roopa Prabhu
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Hangbin Liu
     
  • [ Upstream commit a173f066c7cfc031acb8f541708041e009fc9812 ]

    For starters, the bridge netfilter code registers operations that
    are invoked any time nh_hook is called. Specifically, ip_sabotage_in
    watches for nested calls for NF_INET_PRE_ROUTING when a bridge is in
    the stack.

    Packet wise, the bridge netfilter hook runs first. br_nf_pre_routing
    allocates nf_bridge, sets in_prerouting to 1 and calls NF_HOOK for
    NF_INET_PRE_ROUTING. It's finish function, br_nf_pre_routing_finish,
    then resets in_prerouting flag to 0 and the packet continues up the
    stack. The packet eventually makes it to the VRF driver and it invokes
    nf_hook for NF_INET_PRE_ROUTING in case any rules have been added against
    the vrf device.

    Because of the registered operations the call to nf_hook causes
    ip_sabotage_in to be invoked. That function sees the nf_bridge on the
    skb and that in_prerouting is not set. Thinking it is an invalid nested
    call it steals (drops) the packet.

    Update ip_sabotage_in to recognize that the bridge or one of its upper
    devices (e.g., vlan) can be enslaved to a VRF (L3 master device) and
    allow the packet to go through the nf_hook a second time.

    Fixes: 73e20b761acf ("net: vrf: Add support for PREROUTING rules on vrf device")
    Reported-by: D'Souza, Nelson
    Signed-off-by: David Ahern
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Sasha Levin

    David Ahern
     

22 Jul, 2018

1 commit

  • commit 11ff7288beb2b7da889a014aff0a7b80bf8efcf3 upstream.

    the ebtables evaluation loop expects targets to return
    positive values (jumps), or negative values (absolute verdicts).

    This is completely different from what xtables does.
    In xtables, targets are expected to return the standard netfilter
    verdicts, i.e. NF_DROP, NF_ACCEPT, etc.

    ebtables will consider these as jumps.

    Therefore reject any target found due to unspec fallback.
    v2: also reject watchers. ebtables ignores their return value, so
    a target that assumes skb ownership (and returns NF_STOLEN) causes
    use-after-free.

    The only watchers in the 'ebtables' front-end are log and nflog;
    both have AF_BRIDGE specific wrappers on kernel side.

    Reported-by: syzbot+2b43f681169a2a0d306a@syzkaller.appspotmail.com
    Signed-off-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Florian Westphal
     

17 Jul, 2018

1 commit

  • commit c568503ef02030f169c9e19204def610a3510918 upstream.

    syzbot reports following splat:

    BUG: KMSAN: uninit-value in ebt_stp_mt_check+0x24b/0x450
    net/bridge/netfilter/ebt_stp.c:162
    ebt_stp_mt_check+0x24b/0x450 net/bridge/netfilter/ebt_stp.c:162
    xt_check_match+0x1438/0x1650 net/netfilter/x_tables.c:506
    ebt_check_match net/bridge/netfilter/ebtables.c:372 [inline]
    ebt_check_entry net/bridge/netfilter/ebtables.c:702 [inline]

    The uninitialised access is
    xt_mtchk_param->nft_compat

    ... which should be set to 0.
    Fix it by zeroing the struct beforehand, same for tgchk.

    ip(6)tables targetinfo uses c99-style initialiser, so no change
    needed there.

    Reported-by: syzbot+da4494182233c23a5fcf@syzkaller.appspotmail.com
    Fixes: 55917a21d0cc0 ("netfilter: x_tables: add context to know if extension runs from nft_compat")
    Signed-off-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Florian Westphal
     

08 Jul, 2018

1 commit

  • [ Upstream commit 94c752f99954797da583a84c4907ff19e92550a4 ]

    strlcpy() can't be safely used on a user-space provided string,
    as it can try to read beyond the buffer's end, if the latter is
    not NULL terminated.

    Leveraging the above, syzbot has been able to trigger the following
    splat:

    BUG: KASAN: stack-out-of-bounds in strlcpy include/linux/string.h:300
    [inline]
    BUG: KASAN: stack-out-of-bounds in compat_mtw_from_user
    net/bridge/netfilter/ebtables.c:1957 [inline]
    BUG: KASAN: stack-out-of-bounds in ebt_size_mwt
    net/bridge/netfilter/ebtables.c:2059 [inline]
    BUG: KASAN: stack-out-of-bounds in size_entry_mwt
    net/bridge/netfilter/ebtables.c:2155 [inline]
    BUG: KASAN: stack-out-of-bounds in compat_copy_entries+0x96c/0x14a0
    net/bridge/netfilter/ebtables.c:2194
    Write of size 33 at addr ffff8801b0abf888 by task syz-executor0/4504

    CPU: 0 PID: 4504 Comm: syz-executor0 Not tainted 4.17.0-rc2+ #40
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
    Google 01/01/2011
    Call Trace:
    __dump_stack lib/dump_stack.c:77 [inline]
    dump_stack+0x1b9/0x294 lib/dump_stack.c:113
    print_address_description+0x6c/0x20b mm/kasan/report.c:256
    kasan_report_error mm/kasan/report.c:354 [inline]
    kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
    check_memory_region_inline mm/kasan/kasan.c:260 [inline]
    check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
    memcpy+0x37/0x50 mm/kasan/kasan.c:303
    strlcpy include/linux/string.h:300 [inline]
    compat_mtw_from_user net/bridge/netfilter/ebtables.c:1957 [inline]
    ebt_size_mwt net/bridge/netfilter/ebtables.c:2059 [inline]
    size_entry_mwt net/bridge/netfilter/ebtables.c:2155 [inline]
    compat_copy_entries+0x96c/0x14a0 net/bridge/netfilter/ebtables.c:2194
    compat_do_replace+0x483/0x900 net/bridge/netfilter/ebtables.c:2285
    compat_do_ebt_set_ctl+0x2ac/0x324 net/bridge/netfilter/ebtables.c:2367
    compat_nf_sockopt net/netfilter/nf_sockopt.c:144 [inline]
    compat_nf_setsockopt+0x9b/0x140 net/netfilter/nf_sockopt.c:156
    compat_ip_setsockopt+0xff/0x140 net/ipv4/ip_sockglue.c:1279
    inet_csk_compat_setsockopt+0x97/0x120 net/ipv4/inet_connection_sock.c:1041
    compat_tcp_setsockopt+0x49/0x80 net/ipv4/tcp.c:2901
    compat_sock_common_setsockopt+0xb4/0x150 net/core/sock.c:3050
    __compat_sys_setsockopt+0x1ab/0x7c0 net/compat.c:403
    __do_compat_sys_setsockopt net/compat.c:416 [inline]
    __se_compat_sys_setsockopt net/compat.c:413 [inline]
    __ia32_compat_sys_setsockopt+0xbd/0x150 net/compat.c:413
    do_syscall_32_irqs_on arch/x86/entry/common.c:323 [inline]
    do_fast_syscall_32+0x345/0xf9b arch/x86/entry/common.c:394
    entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139
    RIP: 0023:0xf7fb3cb9
    RSP: 002b:00000000fff0c26c EFLAGS: 00000282 ORIG_RAX: 000000000000016e
    RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000000000
    RDX: 0000000000000080 RSI: 0000000020000300 RDI: 00000000000005f4
    RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
    R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

    The buggy address belongs to the page:
    page:ffffea0006c2afc0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
    flags: 0x2fffc0000000000()
    raw: 02fffc0000000000 0000000000000000 0000000000000000 00000000ffffffff
    raw: 0000000000000000 ffffea0006c20101 0000000000000000 0000000000000000
    page dumped because: kasan: bad access detected

    Fix the issue replacing the unsafe function with strscpy() and
    taking care of possible errors.

    Fixes: 81e675c227ec ("netfilter: ebtables: add CONFIG_COMPAT support")
    Reported-and-tested-by: syzbot+4e42a04e0bc33cb6c087@syzkaller.appspotmail.com
    Signed-off-by: Paolo Abeni
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Paolo Abeni
     

30 May, 2018

2 commits

  • [ Upstream commit 932909d9b28d27e807ff8eecb68c7748f6701628 ]

    The last rule in the blob has next_entry offset that is same as total size.
    This made "ebtables32 -A OUTPUT -d de:ad:be:ef:01:02" fail on 64 bit kernel.

    Fixes: b71812168571fa ("netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets")
    Signed-off-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Florian Westphal
     
  • [ Upstream commit fc6a5d0601c5ac1d02f283a46f60b87b2033e5ca ]

    All of these conditions are not fatal and should have
    been WARN_ONs from the get-go.

    Convert them to WARN_ONs and bail out.

    Signed-off-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Florian Westphal
     

19 May, 2018

1 commit

  • [ Upstream commit e8238fc2bd7b4c3c7554fa2df067e796610212fc ]

    When we set a bond slave's master to bridge via ioctl, we only check
    the IFF_BRIDGE_PORT flag. Although we will find the slave's real master
    at netdev_master_upper_dev_link() later, it already does some settings
    and allocates some resources. It would be better to return as early
    as possible.

    v1 -> v2:
    use netdev_master_upper_dev_get() instead of netdev_has_any_upper_dev()
    to check if we have a master, because not all upper devs are masters,
    e.g. vlan device.

    Reported-by: syzbot+de73361ee4971b6e6f75@syzkaller.appspotmail.com
    Signed-off-by: Hangbin Liu
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Hangbin Liu
     

16 May, 2018

1 commit

  • commit 3f1e53abff84cf40b1adb3455d480dd295bf42e8 upstream.

    Dmitry reports 32bit ebtables on 64bit kernel got broken by
    a recent change that returns -EINVAL when ruleset has no entries.

    ebtables however only counts user-defined chains, so for the
    initial table nentries will be 0.

    Don't try to allocate the compat array in this case, as no user
    defined rules exist no rule will need 64bit translation.

    Reported-by: Dmitry Vyukov
    Fixes: 7d7d7e02111e9 ("netfilter: compat: reject huge allocation requests")
    Signed-off-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Florian Westphal
     

26 Apr, 2018

1 commit


08 Apr, 2018

1 commit

  • commit c8d70a700a5b486bfa8e5a7d33d805389f6e59f9 upstream.

    ebt_among is special, it has a dynamic match size and is exempt
    from the central size checks.

    commit c4585a2823edf ("bridge: ebt_among: add missing match size checks")
    added validation for pool size, but missed fact that the macros
    ebt_among_wh_src/dst can already return out-of-bound result because
    they do not check value of wh_src/dst_ofs (an offset) vs. the size
    of the match that userspace gave to us.

    v2:
    check that offset has correct alignment.
    Paolo Abeni points out that we should also check that src/dst
    wormhash arrays do not overlap, and src + length lines up with
    start of dst (or vice versa).
    v3: compact wormhash_sizes_valid() part

    NB: Fixes tag is intentionally wrong, this bug exists from day
    one when match was added for 2.6 kernel. Tag is there so stable
    maintainers will notice this one too.

    Tested with same rules from the earlier patch.

    Fixes: c4585a2823edf ("bridge: ebt_among: add missing match size checks")
    Reported-by:
    Signed-off-by: Florian Westphal
    Reviewed-by: Eric Dumazet
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Florian Westphal
     

15 Mar, 2018

2 commits

  • commit c4585a2823edf4d1326da44d1524ecbfda26bb37 upstream.

    ebt_among is special, it has a dynamic match size and is exempt
    from the central size checks.

    Therefore it must check that the size of the match structure
    provided from userspace is sane by making sure em->match_size
    is at least the minimum size of the expected structure.

    The module has such a check, but its only done after accessing
    a structure that might be out of bounds.

    tested with: ebtables -A INPUT ... \
    --among-dst fe:fe:fe:fe:fe:fe
    --among-dst fe:fe:fe:fe:fe:fe --among-src fe:fe:fe:fe:ff:f,fe:fe:fe:fe:fe:fb,fe:fe:fe:fe:fc:fd,fe:fe:fe:fe:fe:fd,fe:fe:fe:fe:fe:fe
    --among-src fe:fe:fe:fe:ff:f,fe:fe:fe:fe:fe:fa,fe:fe:fe:fe:fe:fd,fe:fe:fe:fe:fe:fe,fe:fe:fe:fe:fe:fe

    Reported-by:
    Signed-off-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Florian Westphal
     
  • commit b71812168571fa55e44cdd0254471331b9c4c4c6 upstream.

    We need to make sure the offsets are not out of range of the
    total size.
    Also check that they are in ascending order.

    The WARN_ON triggered by syzkaller (it sets panic_on_warn) is
    changed to also bail out, no point in continuing parsing.

    Briefly tested with simple ruleset of
    -A INPUT --limit 1/s' --log
    plus jump to custom chains using 32bit ebtables binary.

    Reported-by:
    Signed-off-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Florian Westphal
     

09 Mar, 2018

2 commits

  • [ Upstream commit 0e5a82efda872c2469c210957d7d4161ef8f4391 ]

    When a VLAN is added on a port, a reference is taken on the
    corresponding master VLAN entry. If it does not already exist, then it
    is created and a reference taken.

    However, in the second case a reference is not really taken when
    CONFIG_REFCOUNT_FULL is enabled as refcount_inc() is replaced by
    refcount_inc_not_zero().

    Fix this by using refcount_set() on a newly created master VLAN entry.

    Fixes: 251277598596 ("net, bridge: convert net_bridge_vlan.refcnt from atomic_t to refcount_t")
    Signed-off-by: Ido Schimmel
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Ido Schimmel
     
  • [ Upstream commit 1b12580af1d0677c3c3a19e35bfe5d59b03f737f ]

    Now br_sysfs_if file flush doesn't have attr show. To read it will
    cause kernel panic after users chmod u+r this file.

    Xiong found this issue when running the commands:

    ip link add br0 type bridge
    ip link add type veth
    ip link set veth0 master br0
    chmod u+r /sys/devices/virtual/net/veth0/brport/flush
    timeout 3 cat /sys/devices/virtual/net/veth0/brport/flush

    kernel crashed with NULL a pointer dereference call trace.

    This patch is to fix it by return -EINVAL when brport_attr->show
    is null, just the same as the check for brport_attr->store in
    brport_store().

    Fixes: 9cf637473c85 ("bridge: add sysfs hook to flush forwarding table")
    Reported-by: Xiong Zhou
    Signed-off-by: Xin Long
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Xin Long
     

03 Jan, 2018

1 commit

  • [ Upstream commit 84aeb437ab98a2bce3d4b2111c79723aedfceb33 ]

    The early call to br_stp_change_bridge_id in bridge's newlink can cause
    a memory leak if an error occurs during the newlink because the fdb
    entries are not cleaned up if a different lladdr was specified, also
    another minor issue is that it generates fdb notifications with
    ifindex = 0. Another unrelated memory leak is the bridge sysfs entries
    which get added on NETDEV_REGISTER event, but are not cleaned up in the
    newlink error path. To remove this special case the call to
    br_stp_change_bridge_id is done after netdev register and we cleanup the
    bridge on changelink error via br_dev_delete to plug all leaks.

    This patch makes netlink bridge destruction on newlink error the same as
    dellink and ioctl del which is necessary since at that point we have a
    fully initialized bridge device.

    To reproduce the issue:
    $ ip l add br0 address 00:11:22:33:44:55 type bridge group_fwd_mask 1
    RTNETLINK answers: Invalid argument

    $ rmmod bridge
    [ 1822.142525] =============================================================================
    [ 1822.143640] BUG bridge_fdb_cache (Tainted: G O ): Objects remaining in bridge_fdb_cache on __kmem_cache_shutdown()
    [ 1822.144821] -----------------------------------------------------------------------------

    [ 1822.145990] Disabling lock debugging due to kernel taint
    [ 1822.146732] INFO: Slab 0x0000000092a844b2 objects=32 used=2 fp=0x00000000fef011b0 flags=0x1ffff8000000100
    [ 1822.147700] CPU: 2 PID: 13584 Comm: rmmod Tainted: G B O 4.15.0-rc2+ #87
    [ 1822.148578] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
    [ 1822.150008] Call Trace:
    [ 1822.150510] dump_stack+0x78/0xa9
    [ 1822.151156] slab_err+0xb1/0xd3
    [ 1822.151834] ? __kmalloc+0x1bb/0x1ce
    [ 1822.152546] __kmem_cache_shutdown+0x151/0x28b
    [ 1822.153395] shutdown_cache+0x13/0x144
    [ 1822.154126] kmem_cache_destroy+0x1c0/0x1fb
    [ 1822.154669] SyS_delete_module+0x194/0x244
    [ 1822.155199] ? trace_hardirqs_on_thunk+0x1a/0x1c
    [ 1822.155773] entry_SYSCALL_64_fastpath+0x23/0x9a
    [ 1822.156343] RIP: 0033:0x7f929bd38b17
    [ 1822.156859] RSP: 002b:00007ffd160e9a98 EFLAGS: 00000202 ORIG_RAX: 00000000000000b0
    [ 1822.157728] RAX: ffffffffffffffda RBX: 00005578316ba090 RCX: 00007f929bd38b17
    [ 1822.158422] RDX: 00007f929bd9ec60 RSI: 0000000000000800 RDI: 00005578316ba0f0
    [ 1822.159114] RBP: 0000000000000003 R08: 00007f929bff5f20 R09: 00007ffd160e8a11
    [ 1822.159808] R10: 00007ffd160e9860 R11: 0000000000000202 R12: 00007ffd160e8a80
    [ 1822.160513] R13: 0000000000000000 R14: 0000000000000000 R15: 00005578316ba090
    [ 1822.161278] INFO: Object 0x000000007645de29 @offset=0
    [ 1822.161666] INFO: Object 0x00000000d5df2ab5 @offset=128

    Fixes: 30313a3d5794 ("bridge: Handle IFLA_ADDRESS correctly when creating bridge device")
    Fixes: 5b8d5429daa0 ("bridge: netlink: register netdevice before executing changelink")
    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Nikolay Aleksandrov
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

22 Oct, 2017

1 commit

  • When vlan tunnels were introduced, vlan range errors got silently
    dropped and instead 0 was returned always. Restore the previous
    behaviour and return errors to user-space.

    Fixes: efa5356b0d97 ("bridge: per vlan dst_metadata netlink support")
    Signed-off-by: Nikolay Aleksandrov
    Acked-by: Roopa Prabhu
    Signed-off-by: David S. Miller

    Nikolay Aleksandrov
     

29 Sep, 2017

1 commit


06 Sep, 2017

1 commit


04 Sep, 2017

2 commits

  • This patch removes CONFIG_NETFILTER_DEBUG and _ASSERT() macros as they
    are no longer required. Replace _ASSERT() macros with WARN_ON().

    Signed-off-by: Varsha Rao
    Signed-off-by: Pablo Neira Ayuso

    Varsha Rao
     
  • Pablo Neira Ayuso says:

    ====================
    Netfilter updates for net-next

    The following patchset contains Netfilter updates for your net-next
    tree. Basically, updates to the conntrack core, enhancements for
    nf_tables, conversion of netfilter hooks from linked list to array to
    improve memory locality and asorted improvements for the Netfilter
    codebase. More specifically, they are:

    1) Add expection to hashes after timer initialization to prevent
    access from another CPU that walks on the hashes and calls
    del_timer(), from Florian Westphal.

    2) Don't update nf_tables chain counters from hot path, this is only
    used by the x_tables compatibility layer.

    3) Get rid of nested rcu_read_lock() calls from netfilter hook path.
    Hooks are always guaranteed to run from rcu read side, so remove
    nested rcu_read_lock() where possible. Patch from Taehee Yoo.

    4) nf_tables new ruleset generation notifications include PID and name
    of the process that has updated the ruleset, from Phil Sutter.

    5) Use skb_header_pointer() from nft_fib, so we can reuse this code from
    the nf_family netdev family. Patch from Pablo M. Bermudo.

    6) Add support for nft_fib in nf_tables netdev family, also from Pablo.

    7) Use deferrable workqueue for conntrack garbage collection, to reduce
    power consumption, from Patch from Subash Abhinov Kasiviswanathan.

    8) Add nf_ct_expect_iterate_net() helper and use it. From Florian
    Westphal.

    9) Call nf_ct_unconfirmed_destroy only from cttimeout, from Florian.

    10) Drop references on conntrack removal path when skbuffs has escaped via
    nfqueue, from Florian.

    11) Don't queue packets to nfqueue with dying conntrack, from Florian.

    12) Constify nf_hook_ops structure, from Florian.

    13) Remove neededlessly branch in nf_tables trace code, from Phil Sutter.

    14) Add nla_strdup(), from Phil Sutter.

    15) Rise nf_tables objects name size up to 255 chars, people want to use
    DNS names, so increase this according to what RFC 1035 specifies.
    Patch series from Phil Sutter.

    16) Kill nf_conntrack_default_on, it's broken. Default on conntrack hook
    registration on demand, suggested by Eric Dumazet, patch from Florian.

    17) Remove unused variables in compat_copy_entry_from_user both in
    ip_tables and arp_tables code. Patch from Taehee Yoo.

    18) Constify struct nf_conntrack_l4proto, from Julia Lawall.

    19) Constify nf_loginfo structure, also from Julia.

    20) Use a single rb root in connlimit, from Taehee Yoo.

    21) Remove unused netfilter_queue_init() prototype, from Taehee Yoo.

    22) Use audit_log() instead of open-coding it, from Geliang Tang.

    23) Allow to mangle tcp options via nft_exthdr, from Florian.

    24) Allow to fetch TCP MSS from nft_rt, from Florian. This includes
    a fix for a miscalculation of the minimal length.

    25) Simplify branch logic in h323 helper, from Nick Desaulniers.

    26) Calculate netlink attribute size for conntrack tuple at compile
    time, from Florian.

    27) Remove protocol name field from nf_conntrack_{l3,l4}proto structure.
    From Florian.

    28) Remove holes in nf_conntrack_l4proto structure, so it becomes
    smaller. From Florian.

    29) Get rid of print_tuple() indirection for /proc conntrack listing.
    Place all the code in net/netfilter/nf_conntrack_standalone.c.
    Patch from Florian.

    30) Do not built in print_conntrack() if CONFIG_NF_CONNTRACK_PROCFS is
    off. From Florian.

    31) Constify most nf_conntrack_{l3,l4}proto helper functions, from
    Florian.

    32) Fix broken indentation in ebtables extensions, from Colin Ian King.

    33) Fix several harmless sparse warning, from Florian.

    34) Convert netfilter hook infrastructure to use array for better memory
    locality, joint work done by Florian and Aaron Conole. Moreover, add
    some instrumentation to debug this.

    35) Batch nf_unregister_net_hooks() calls, to call synchronize_net once
    per batch, from Florian.

    36) Get rid of noisy logging in ICMPv6 conntrack helper, from Florian.

    37) Get rid of obsolete NFDEBUG() instrumentation, from Varsha Rao.

    38) Remove unused code in the generic protocol tracker, from Davide
    Caratti.

    I think I will have material for a second Netfilter batch in my queue if
    time allow to make it fit in this merge window.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

02 Sep, 2017

2 commits

  • Three cases of simple overlapping changes.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Commit 6bc506b4fb06 ("bridge: switchdev: Add forward mark support for
    stacked devices") added the 'offload_fwd_mark' bit to the skb in order
    to allow drivers to indicate to the bridge driver that they already
    forwarded the packet in L2.

    In case the bit is set, before transmitting the packet from each port,
    the port's mark is compared with the mark stored in the skb's control
    block. If both marks are equal, we know the packet arrived from a switch
    device that already forwarded the packet and it's not re-transmitted.

    However, if the packet is transmitted from the bridge device itself
    (e.g., br0), we should clear the 'offload_fwd_mark' bit as the mark
    stored in the skb's control block isn't valid.

    This scenario can happen in rare cases where a packet was trapped during
    L3 forwarding and forwarded by the kernel to a bridge device.

    Fixes: 6bc506b4fb06 ("bridge: switchdev: Add forward mark support for stacked devices")
    Signed-off-by: Ido Schimmel
    Reported-by: Yotam Gigi
    Tested-by: Yotam Gigi
    Reviewed-by: Jiri Pirko
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Ido Schimmel
     

01 Sep, 2017

1 commit

  • This extends bridge fdb table tracepoints to also cover
    learned fdb entries in the br_fdb_update path. Note that
    unlike other tracepoints I have moved this to when the fdb
    is modified because this is in the datapath and can generate
    a lot of noise in the trace output. br_fdb_update is also called
    from added_by_user context in the NTF_USE case which is already
    traced ..hence the !added_by_user check.

    Signed-off-by: Roopa Prabhu
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Roopa Prabhu
     

30 Aug, 2017

1 commit


29 Aug, 2017

2 commits

  • current switchdev drivers dont seem to support offloading fdb
    entries pointing to the bridge device which have fdb->dst
    not set to any port. This patch adds a NULL fdb->dst check in
    the switchdev notifier code.

    This patch fixes the below NULL ptr dereference:
    $bridge fdb add 00:02:00:00:00:33 dev br0 self

    [ 69.953374] BUG: unable to handle kernel NULL pointer dereference at
    0000000000000008
    [ 69.954044] IP: br_switchdev_fdb_notify+0x29/0x80
    [ 69.954044] PGD 66527067
    [ 69.954044] P4D 66527067
    [ 69.954044] PUD 7899c067
    [ 69.954044] PMD 0
    [ 69.954044]
    [ 69.954044] Oops: 0000 [#1] SMP
    [ 69.954044] Modules linked in:
    [ 69.954044] CPU: 1 PID: 3074 Comm: bridge Not tainted 4.13.0-rc6+ #1
    [ 69.954044] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
    BIOS rel-1.7.5.1-0-g8936dbb-20141113_115728-nilsson.home.kraxel.org
    04/01/2014
    [ 69.954044] task: ffff88007b827140 task.stack: ffffc90001564000
    [ 69.954044] RIP: 0010:br_switchdev_fdb_notify+0x29/0x80
    [ 69.954044] RSP: 0018:ffffc90001567918 EFLAGS: 00010246
    [ 69.954044] RAX: 0000000000000000 RBX: ffff8800795e0880 RCX:
    00000000000000c0
    [ 69.954044] RDX: ffffc90001567920 RSI: 000000000000001c RDI:
    ffff8800795d0600
    [ 69.954044] RBP: ffffc90001567938 R08: ffff8800795d0600 R09:
    0000000000000000
    [ 69.954044] R10: ffffc90001567a88 R11: ffff88007b849400 R12:
    ffff8800795e0880
    [ 69.954044] R13: ffff8800795d0600 R14: ffffffff81ef8880 R15:
    000000000000001c
    [ 69.954044] FS: 00007f93d3085700(0000) GS:ffff88007fd00000(0000)
    knlGS:0000000000000000
    [ 69.954044] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 69.954044] CR2: 0000000000000008 CR3: 0000000066551000 CR4:
    00000000000006e0
    [ 69.954044] Call Trace:
    [ 69.954044] fdb_notify+0x3f/0xf0
    [ 69.954044] __br_fdb_add.isra.12+0x1a7/0x370
    [ 69.954044] br_fdb_add+0x178/0x280
    [ 69.954044] rtnl_fdb_add+0x10a/0x200
    [ 69.954044] rtnetlink_rcv_msg+0x1b4/0x240
    [ 69.954044] ? skb_free_head+0x21/0x40
    [ 69.954044] ? rtnl_calcit.isra.18+0xf0/0xf0
    [ 69.954044] netlink_rcv_skb+0xed/0x120
    [ 69.954044] rtnetlink_rcv+0x15/0x20
    [ 69.954044] netlink_unicast+0x180/0x200
    [ 69.954044] netlink_sendmsg+0x291/0x370
    [ 69.954044] ___sys_sendmsg+0x180/0x2e0
    [ 69.954044] ? filemap_map_pages+0x2db/0x370
    [ 69.954044] ? do_wp_page+0x11d/0x420
    [ 69.954044] ? __handle_mm_fault+0x794/0xd80
    [ 69.954044] ? vma_link+0xcb/0xd0
    [ 69.954044] __sys_sendmsg+0x4c/0x90
    [ 69.954044] SyS_sendmsg+0x12/0x20
    [ 69.954044] do_syscall_64+0x63/0xe0
    [ 69.954044] entry_SYSCALL64_slow_path+0x25/0x25
    [ 69.954044] RIP: 0033:0x7f93d2bad690
    [ 69.954044] RSP: 002b:00007ffc7217a638 EFLAGS: 00000246 ORIG_RAX:
    000000000000002e
    [ 69.954044] RAX: ffffffffffffffda RBX: 00007ffc72182eac RCX:
    00007f93d2bad690
    [ 69.954044] RDX: 0000000000000000 RSI: 00007ffc7217a670 RDI:
    0000000000000003
    [ 69.954044] RBP: 0000000059a1f7f8 R08: 0000000000000006 R09:
    000000000000000a
    [ 69.954044] R10: 00007ffc7217a400 R11: 0000000000000246 R12:
    00007ffc7217a670
    [ 69.954044] R13: 00007ffc72182a98 R14: 00000000006114c0 R15:
    00007ffc72182aa0
    [ 69.954044] Code: 1f 00 66 66 66 66 90 55 48 89 e5 48 83 ec 20 f6 47
    20 04 74 0a 83 fe 1c 74 09 83 fe 1d 74 2c c9 66 90 c3 48 8b 47 10 48 8d
    55 e8 8b 70 08 0f b7 47 1e 48 83 c7 18 48 89 7d f0 bf 03 00 00 00
    [ 69.954044] RIP: br_switchdev_fdb_notify+0x29/0x80 RSP:
    ffffc90001567918
    [ 69.954044] CR2: 0000000000000008
    [ 69.954044] ---[ end trace 03e9eec4a82c238b ]---

    Fixes: 6b26b51b1d13 ("net: bridge: Add support for notifying devices about FDB add/del")
    Signed-off-by: Roopa Prabhu
    Signed-off-by: David S. Miller

    Roopa Prabhu
     
  • Make this const as it is only passed to a const argument of the function
    ebt_register_table.

    Signed-off-by: Bhumika Goyal
    Signed-off-by: David S. Miller

    Bhumika Goyal
     

28 Aug, 2017

1 commit

  • This converts the storage and layout of netfilter hook entries from a
    linked list to an array. After this commit, hook entries will be
    stored adjacent in memory. The next pointer is no longer required.

    The ops pointers are stored at the end of the array as they are only
    used in the register/unregister path and in the legacy br_netfilter code.

    nf_unregister_net_hooks() is slower than needed as it just calls
    nf_unregister_net_hook in a loop (i.e. at least n synchronize_net()
    calls), this will be addressed in followup patch.

    Test setup:
    - ixgbe 10gbit
    - netperf UDP_STREAM, 64 byte packets
    - 5 hooks: (raw + mangle prerouting, mangle+filter input, inet filter):
    empty mangle and raw prerouting, mangle and filter input hooks:
    353.9
    this patch:
    364.2

    Signed-off-by: Aaron Conole
    Signed-off-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso

    Aaron Conole
     

25 Aug, 2017

1 commit


19 Aug, 2017

1 commit


10 Aug, 2017

1 commit

  • This change allows us to later indicate to rtnetlink core that certain
    doit functions should be called without acquiring rtnl_mutex.

    This change should have no effect, we simply replace the last (now
    unused) calcit argument with the new flag.

    Signed-off-by: Florian Westphal
    Reviewed-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Florian Westphal
     

08 Aug, 2017

1 commit


01 Aug, 2017

1 commit


14 Jul, 2017

1 commit

  • With 802.1ad support the vlan_ingress code started checking for vlan
    protocol mismatch which causes the current tag to be inserted and the
    bridge vlan protocol & pvid to be set. The vlan tag insertion changes
    the skb mac_header and thus the lookup mac dest pointer which was loaded
    prior to calling br_allowed_ingress in br_handle_frame_finish is VLAN_HLEN
    bytes off now, pointing to the last two bytes of the destination mac and
    the first four of the source mac causing lookups to always fail and
    broadcasting all such packets to all ports. Same thing happens for locally
    originated packets when passing via br_dev_xmit. So load the dest pointer
    after the vlan checks and possible skb change.

    Fixes: 8580e2117c06 ("bridge: Prepare for 802.1ad vlan filtering support")
    Reported-by: Anitha Narasimha Murthy
    Signed-off-by: Nikolay Aleksandrov
    Acked-by: Toshiaki Makita
    Signed-off-by: David S. Miller

    Nikolay Aleksandrov