22 Apr, 2016

6 commits

  • Pull networking fixes from David Miller:

    1) Fix memory leak in iwlwifi, from Matti Gottlieb.

    2) Add missing registration of netfilter arp_tables into initial
    namespace, from Florian Westphal.

    3) Fix potential NULL deref in DecNET routing code.

    4) Restrict NETLINK_URELEASE to truly bound sockets only, from Dmitry
    Ivanov.

    5) Fix dst ref counting in VRF, from David Ahern.

    6) Fix TSO segmenting limits in i40e driver, from Alexander Duyck.

    7) Fix heap leak in PACKET_DIAG_MCLIST, from Mathias Krause.

    8) Ravalidate IPV6 datagram socket cached routes properly, particularly
    with UDP, from Martin KaFai Lau.

    9) Fix endian bug in RDS dp_ack_seq handling, from Qing Huang.

    10) Fix stats typing in bcmgenet driver, from Eric Dumazet.

    11) Openvswitch needs to orphan SKBs before ipv6 fragmentation handing,
    from Joe Stringer.

    12) SPI device reference leak in spi_ks8895 PHY driver, from Mark Brown.

    13) atl2 doesn't actually support scatter-gather, so don't advertise the
    feature. From Ben Hucthings.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (72 commits)
    openvswitch: use flow protocol when recalculating ipv6 checksums
    Driver: Vmxnet3: set CHECKSUM_UNNECESSARY for IPv6 packets
    atl2: Disable unimplemented scatter/gather feature
    net/mlx4_en: Split SW RX dropped counter per RX ring
    net/mlx4_core: Don't allow to VF change global pause settings
    net/mlx4_core: Avoid repeated calls to pci enable/disable
    net/mlx4_core: Implement pci_resume callback
    net: phy: spi_ks8895: Don't leak references to SPI devices
    net: ethernet: davinci_emac: Fix platform_data overwrite
    net: ethernet: davinci_emac: Fix Unbalanced pm_runtime_enable
    qede: Fix single MTU sized packet from firmware GRO flow
    qede: Fix setting Skb network header
    qede: Fix various memory allocation error flows for fastpath
    tcp: Merge tx_flags and tskey in tcp_shifted_skb
    tcp: Merge tx_flags and tskey in tcp_collapse_retrans
    drivers: net: cpsw: fix wrong regs access in cpsw_ndo_open
    tcp: Fix SOF_TIMESTAMPING_TX_ACK when handling dup acks
    openvswitch: Orphan skbs before IPv6 defrag
    Revert "Prevent NUll pointer dereference with two PHYs on cpsw"
    VSOCK: Only check error on skb_recv_datagram when skb is NULL
    ...

    Linus Torvalds
     
  • When using masked actions the ipv6_proto field of an action
    to set IPv6 fields may be zero rather than the prevailing protocol
    which will result in skipping checksum recalculation.

    This patch resolves the problem by relying on the protocol
    in the flow key rather than that in the set field action.

    Fixes: 83d2b9ba1abc ("net: openvswitch: Support masked set actions.")
    Cc: Jarno Rajahalme
    Signed-off-by: Simon Horman
    Signed-off-by: David S. Miller

    Simon Horman
     
  • After receiving sacks, tcp_shifted_skb() will collapse
    skbs if possible. tx_flags and tskey also have to be
    merged.

    This patch reuses the tcp_skb_collapse_tstamp() to handle
    them.

    BPF Output Before:
    ~~~~~

    BPF Output After:
    ~~~~~
    -2024 [007] d.s. 88.644374: : ee_data:14599

    Packetdrill Script:
    ~~~~~
    +0 `sysctl -q -w net.ipv4.tcp_min_tso_segs=10`
    +0 `sysctl -q -w net.ipv4.tcp_no_metrics_save=1`
    +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
    +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
    +0 bind(3, ..., ...) = 0
    +0 listen(3, 1) = 0

    0.100 < S 0:0(0) win 32792
    0.100 > S. 0:0(0) ack 1
    0.200 < . 1:1(0) ack 1 win 257
    0.200 accept(3, ..., ...) = 4
    +0 setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0

    0.200 write(4, ..., 1460) = 1460
    +0 setsockopt(4, SOL_SOCKET, 37, [2688], 4) = 0
    0.200 write(4, ..., 13140) = 13140

    0.200 > P. 1:1461(1460) ack 1
    0.200 > . 1461:8761(7300) ack 1
    0.200 > P. 8761:14601(5840) ack 1

    0.300 < . 1:1(0) ack 1 win 257
    0.300 > P. 1:1461(1460) ack 1
    0.400 < . 1:1(0) ack 14601 win 257

    0.400 close(4) = 0
    0.400 > F. 14601:14601(0) ack 1
    0.500 < F. 1:1(0) ack 14602 win 257
    0.500 > . 14602:14602(0) ack 2

    Signed-off-by: Martin KaFai Lau
    Cc: Eric Dumazet
    Cc: Neal Cardwell
    Cc: Soheil Hassas Yeganeh
    Cc: Willem de Bruijn
    Cc: Yuchung Cheng
    Acked-by: Soheil Hassas Yeganeh
    Tested-by: Soheil Hassas Yeganeh
    Signed-off-by: David S. Miller

    Martin KaFai Lau
     
  • If two skbs are merged/collapsed during retransmission, the current
    logic does not merge the tx_flags and tskey. The end result is
    the SCM_TSTAMP_ACK timestamp could be missing for a packet.

    The patch:
    1. Merge the tx_flags
    2. Overwrite the prev_skb's tskey with the next_skb's tskey

    BPF Output Before:
    ~~~~~~

    BPF Output After:
    ~~~~~~
    packetdrill-2092 [001] d.s. 453.998486: : ee_data:1459

    Packetdrill Script:
    ~~~~~~
    +0 `sysctl -q -w net.ipv4.tcp_min_tso_segs=10`
    +0 `sysctl -q -w net.ipv4.tcp_no_metrics_save=1`
    +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
    +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
    +0 bind(3, ..., ...) = 0
    +0 listen(3, 1) = 0

    0.100 < S 0:0(0) win 32792
    0.100 > S. 0:0(0) ack 1
    0.200 < . 1:1(0) ack 1 win 257
    0.200 accept(3, ..., ...) = 4
    +0 setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0

    0.200 write(4, ..., 730) = 730
    +0 setsockopt(4, SOL_SOCKET, 37, [2688], 4) = 0
    0.200 write(4, ..., 730) = 730
    +0 setsockopt(4, SOL_SOCKET, 37, [2176], 4) = 0
    0.200 write(4, ..., 11680) = 11680
    +0 setsockopt(4, SOL_SOCKET, 37, [2688], 4) = 0

    0.200 > P. 1:731(730) ack 1
    0.200 > P. 731:1461(730) ack 1
    0.200 > . 1461:8761(7300) ack 1
    0.200 > P. 8761:13141(4380) ack 1

    0.300 < . 1:1(0) ack 1 win 257
    0.300 < . 1:1(0) ack 1 win 257
    0.300 < . 1:1(0) ack 1 win 257
    0.300 > P. 1:1461(1460) ack 1
    0.400 < . 1:1(0) ack 13141 win 257

    0.400 close(4) = 0
    0.400 > F. 13141:13141(0) ack 1
    0.500 < F. 1:1(0) ack 13142 win 257
    0.500 > . 13142:13142(0) ack 2

    Signed-off-by: Martin KaFai Lau
    Cc: Eric Dumazet
    Cc: Neal Cardwell
    Cc: Soheil Hassas Yeganeh
    Cc: Willem de Bruijn
    Cc: Yuchung Cheng
    Acked-by: Soheil Hassas Yeganeh
    Tested-by: Soheil Hassas Yeganeh
    Signed-off-by: David S. Miller

    Martin KaFai Lau
     
  • Assuming SOF_TIMESTAMPING_TX_ACK is on. When dup acks are received,
    it could incorrectly think that a skb has already
    been acked and queue a SCM_TSTAMP_ACK cmsg to the
    sk->sk_error_queue.

    In tcp_ack_tstamp(), it checks
    'between(shinfo->tskey, prior_snd_una, tcp_sk(sk)->snd_una - 1)'.
    If prior_snd_una == tcp_sk(sk)->snd_una like the following packetdrill
    script, between() returns true but the tskey is actually not acked.
    e.g. try between(3, 2, 1).

    The fix is to replace between() with one before() and one !before().
    By doing this, the -1 offset on the tcp_sk(sk)->snd_una can also be
    removed.

    A packetdrill script is used to reproduce the dup ack scenario.
    Due to the lacking cmsg support in packetdrill (may be I
    cannot find it), a BPF prog is used to kprobe to
    sock_queue_err_skb() and print out the value of
    serr->ee.ee_data.

    Both the packetdrill and the bcc BPF script is attached at the end of
    this commit message.

    BPF Output Before Fix:
    ~~~~~~
    -2056 [001] d.s. 433.927987: : ee_data:1459 #incorrect
    packetdrill-2056 [001] d.s. 433.929563: : ee_data:1459 #incorrect
    packetdrill-2056 [001] d.s. 433.930765: : ee_data:1459 #incorrect
    packetdrill-2056 [001] d.s. 434.028177: : ee_data:1459
    packetdrill-2056 [001] d.s. 434.029686: : ee_data:14599

    BPF Output After Fix:
    ~~~~~~
    -2049 [000] d.s. 113.517039: : ee_data:1459
    -2049 [000] d.s. 113.517253: : ee_data:14599

    BCC BPF Script:
    ~~~~~~
    #!/usr/bin/env python

    from __future__ import print_function
    from bcc import BPF

    bpf_text = """
    #include
    #include
    #include
    #include

    #ifdef memset
    #undef memset
    #endif

    int trace_err_skb(struct pt_regs *ctx)
    {
    struct sk_buff *skb = (struct sk_buff *)ctx->si;
    struct sock *sk = (struct sock *)ctx->di;
    struct sock_exterr_skb *serr;
    u32 ee_data = 0;

    if (!sk || !skb)
    return 0;

    serr = SKB_EXT_ERR(skb);
    bpf_probe_read(&ee_data, sizeof(ee_data), &serr->ee.ee_data);
    bpf_trace_printk("ee_data:%u\\n", ee_data);

    return 0;
    };
    """

    b = BPF(text=bpf_text)
    b.attach_kprobe(event="sock_queue_err_skb", fn_name="trace_err_skb")
    print("Attached to kprobe")
    b.trace_print()

    Packetdrill Script:
    ~~~~~~
    +0 `sysctl -q -w net.ipv4.tcp_min_tso_segs=10`
    +0 `sysctl -q -w net.ipv4.tcp_no_metrics_save=1`
    +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
    +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
    +0 bind(3, ..., ...) = 0
    +0 listen(3, 1) = 0

    0.100 < S 0:0(0) win 32792
    0.100 > S. 0:0(0) ack 1
    0.200 < . 1:1(0) ack 1 win 257
    0.200 accept(3, ..., ...) = 4
    +0 setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0

    +0 setsockopt(4, SOL_SOCKET, 37, [2688], 4) = 0
    0.200 write(4, ..., 1460) = 1460
    0.200 write(4, ..., 13140) = 13140

    0.200 > P. 1:1461(1460) ack 1
    0.200 > . 1461:8761(7300) ack 1
    0.200 > P. 8761:14601(5840) ack 1

    0.300 < . 1:1(0) ack 1 win 257
    0.300 < . 1:1(0) ack 1 win 257
    0.300 < . 1:1(0) ack 1 win 257
    0.300 > P. 1:1461(1460) ack 1
    0.400 < . 1:1(0) ack 14601 win 257

    0.400 close(4) = 0
    0.400 > F. 14601:14601(0) ack 1
    0.500 < F. 1:1(0) ack 14602 win 257
    0.500 > . 14602:14602(0) ack 2

    Signed-off-by: Martin KaFai Lau
    Cc: Eric Dumazet
    Cc: Neal Cardwell
    Cc: Soheil Hassas Yeganeh
    Cc: Willem de Bruijn
    Cc: Yuchung Cheng
    Acked-by: Soheil Hassas Yeganeh
    Tested-by: Soheil Hassas Yeganeh
    Signed-off-by: David S. Miller

    Martin KaFai Lau
     
  • This is the IPv6 counterpart to commit 8282f27449bf ("inet: frag: Always
    orphan skbs inside ip_defrag()").

    Prior to commit 029f7f3b8701 ("netfilter: ipv6: nf_defrag: avoid/free
    clone operations"), ipv6 fragments sent to nf_ct_frag6_gather() would be
    cloned (implicitly orphaning) prior to queueing for reassembly. As such,
    when the IPv6 message is eventually reassembled, the skb->sk for all
    fragments would be NULL. After that commit was introduced, rather than
    cloning, the original skbs were queued directly without orphaning. The
    end result is that all frags except for the first and last may have a
    socket attached.

    This commit explicitly orphans such skbs during nf_ct_frag6_gather() to
    prevent BUG_ON(skb->sk) during a later call to ip6_fragment().

    kernel BUG at net/ipv6/ip6_output.c:631!
    [...]
    Call Trace:

    [] ? __lock_acquire+0x927/0x20a0
    [] ? do_output.isra.28+0x1b0/0x1b0 [openvswitch]
    [] ? __lock_is_held+0x52/0x70
    [] ovs_fragment+0x1f7/0x280 [openvswitch]
    [] ? mark_held_locks+0x75/0xa0
    [] ? _raw_spin_unlock_irqrestore+0x36/0x50
    [] ? dst_discard_out+0x20/0x20
    [] ? dst_ifdown+0x80/0x80
    [] do_output.isra.28+0xf3/0x1b0 [openvswitch]
    [] do_execute_actions+0x709/0x12c0 [openvswitch]
    [] ? ovs_flow_stats_update+0x74/0x1e0 [openvswitch]
    [] ? ovs_flow_stats_update+0xa1/0x1e0 [openvswitch]
    [] ? _raw_spin_unlock+0x27/0x40
    [] ovs_execute_actions+0x45/0x120 [openvswitch]
    [] ovs_dp_process_packet+0x85/0x150 [openvswitch]
    [] ? _raw_spin_unlock+0x27/0x40
    [] ovs_execute_actions+0xc4/0x120 [openvswitch]
    [] ovs_dp_process_packet+0x85/0x150 [openvswitch]
    [] ? key_extract+0x442/0xc10 [openvswitch]
    [] ovs_vport_receive+0x5d/0xb0 [openvswitch]
    [] ? __lock_acquire+0x927/0x20a0
    [] ? __lock_acquire+0x927/0x20a0
    [] ? __lock_acquire+0x927/0x20a0
    [] ? _raw_spin_unlock_irqrestore+0x36/0x50
    [] internal_dev_xmit+0x6d/0x150 [openvswitch]
    [] ? internal_dev_xmit+0x5/0x150 [openvswitch]
    [] dev_hard_start_xmit+0x2df/0x660
    [] ? validate_xmit_skb.isra.105.part.106+0x1a/0x2b0
    [] __dev_queue_xmit+0x8f5/0x950
    [] ? __dev_queue_xmit+0x50/0x950
    [] ? mark_held_locks+0x75/0xa0
    [] dev_queue_xmit+0x10/0x20
    [] neigh_resolve_output+0x178/0x220
    [] ? ip6_finish_output2+0x219/0x7b0
    [] ip6_finish_output2+0x219/0x7b0
    [] ? ip6_finish_output2+0x65/0x7b0
    [] ? ip_idents_reserve+0x6b/0x80
    [] ? ip6_fragment+0x93f/0xc50
    [] ip6_fragment+0xba1/0xc50
    [] ? ip6_flush_pending_frames+0x40/0x40
    [] ip6_finish_output+0xcb/0x1d0
    [] ip6_output+0x5f/0x1a0
    [] ? ip6_fragment+0xc50/0xc50
    [] ip6_local_out+0x3d/0x80
    [] ip6_send_skb+0x2f/0xc0
    [] ip6_push_pending_frames+0x4d/0x50
    [] icmpv6_push_pending_frames+0xac/0xe0
    [] icmpv6_echo_reply+0x42e/0x500
    [] icmpv6_rcv+0x4cf/0x580
    [] ip6_input_finish+0x1a7/0x690
    [] ? ip6_input_finish+0x5/0x690
    [] ip6_input+0x30/0xa0
    [] ? ip6_rcv_finish+0x1a0/0x1a0
    [] ip6_rcv_finish+0x4e/0x1a0
    [] ipv6_rcv+0x45f/0x7c0
    [] ? ipv6_rcv+0x36/0x7c0
    [] ? ip6_make_skb+0x1c0/0x1c0
    [] __netif_receive_skb_core+0x229/0xb80
    [] ? mark_held_locks+0x75/0xa0
    [] ? process_backlog+0x6f/0x230
    [] __netif_receive_skb+0x16/0x70
    [] process_backlog+0x78/0x230
    [] ? process_backlog+0xdd/0x230
    [] net_rx_action+0x203/0x480
    [] ? mark_held_locks+0x75/0xa0
    [] __do_softirq+0xde/0x49f
    [] ? ip6_finish_output2+0x228/0x7b0
    [] do_softirq_own_stack+0x1c/0x30

    [] do_softirq.part.18+0x3b/0x40
    [] __local_bh_enable_ip+0xb6/0xc0
    [] ip6_finish_output2+0x251/0x7b0
    [] ? ip6_fragment+0xba1/0xc50
    [] ? ip_idents_reserve+0x6b/0x80
    [] ? ip6_fragment+0x93f/0xc50
    [] ip6_fragment+0xba1/0xc50
    [] ? ip6_flush_pending_frames+0x40/0x40
    [] ip6_finish_output+0xcb/0x1d0
    [] ip6_output+0x5f/0x1a0
    [] ? ip6_fragment+0xc50/0xc50
    [] ip6_local_out+0x3d/0x80
    [] ip6_send_skb+0x2f/0xc0
    [] ip6_push_pending_frames+0x4d/0x50
    [] rawv6_sendmsg+0xa28/0xe30
    [] ? inet_sendmsg+0xc7/0x1d0
    [] inet_sendmsg+0x106/0x1d0
    [] ? inet_sendmsg+0x5/0x1d0
    [] sock_sendmsg+0x38/0x50
    [] SYSC_sendto+0xf6/0x170
    [] ? trace_hardirqs_on_thunk+0x1b/0x1d
    [] SyS_sendto+0xe/0x10
    [] entry_SYSCALL_64_fastpath+0x18/0xa8
    Code: 06 48 83 3f 00 75 26 48 8b 87 d8 00 00 00 2b 87 d0 00 00 00 48 39 d0 72 14 8b 87 e4 00 00 00 83 f8 01 75 09 48 83 7f 18 00 74 9a 0b 41 8b 86 cc 00 00 00 49 8#
    RIP [] ip6_fragment+0x73a/0xc50
    RSP

    Fixes: 029f7f3b8701 ("netfilter: ipv6: nf_defrag: avoid/free clone
    operations")
    Reported-by: Daniele Di Proietto
    Signed-off-by: Joe Stringer
    Signed-off-by: David S. Miller

    Joe Stringer
     

20 Apr, 2016

1 commit


17 Apr, 2016

2 commits

  • Two different threads with different rds sockets may be in
    rds_recv_rcvbuf_delta() via receive path. If their ports
    both map to the same word in the congestion map, then
    using non-atomic ops to update it could cause the map to
    be incorrect. Lets use atomics to avoid such an issue.

    Full credit to Wengang for
    finding the issue, analysing it and also pointing out
    to offending code with spin lock based fix.

    Reviewed-by: Leon Romanovsky
    Signed-off-by: Wengang Wang
    Signed-off-by: Santosh Shilimkar
    Signed-off-by: David S. Miller

    santosh.shilimkar@oracle.com
     
  • dp->dp_ack_seq is used in big endian format. We need to do the
    big endianness conversion when we assign a value in host format
    to it.

    Signed-off-by: Qing Huang
    Signed-off-by: Santosh Shilimkar
    Signed-off-by: David S. Miller

    Qing Huang
     

16 Apr, 2016

1 commit

  • When __vlan_insert_tag() fails from skb_vlan_push() path due to the
    skb_cow_head(), we need to undo the __skb_push() in the error path
    as well that was done earlier to move skb->data pointer to mac header.

    Moreover, I noticed that when in the non-error path the __skb_pull()
    is done and the original offset to mac header was non-zero, we fixup
    from a wrong skb->data offset in the checksum complete processing.

    So the skb_postpush_rcsum() really needs to be done before __skb_pull()
    where skb->data still points to the mac header start and thus operates
    under the same conditions as in __vlan_insert_tag().

    Fixes: 93515d53b133 ("net: move vlan pop/push functions into common code")
    Signed-off-by: Daniel Borkmann
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

15 Apr, 2016

7 commits

  • Pull crypto fixes from Herbert Xu:
    "This fixes an NFS regression caused by the skcipher/hash conversion in
    sunrpc. It also fixes a build problem in certain configurations with
    bcm63xx"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    hwrng: bcm63xx - fix device tree compilation
    sunrpc: Fix skcipher/shash conversion

    Linus Torvalds
     
  • With the SO_REUSEPORT socket option, it is possible to create sockets
    in the AF_INET and AF_INET6 domains which are bound to the same IPv4 address.
    This is only possible with SO_REUSEPORT and when not using IPV6_V6ONLY on
    the AF_INET6 sockets.

    Prior to the commits referenced below, an incoming IPv4 packet would
    always be routed to a socket of type AF_INET when this mixed-mode was used.
    After those changes, the same packet would be routed to the most recently
    bound socket (if this happened to be an AF_INET6 socket, it would
    have an IPv4 mapped IPv6 address).

    The change in behavior occurred because the recent SO_REUSEPORT optimizations
    short-circuit the socket scoring logic as soon as they find a match. They
    did not take into account the scoring logic that favors AF_INET sockets
    over AF_INET6 sockets in the event of a tie.

    To fix this problem, this patch changes the insertion order of AF_INET
    and AF_INET6 addresses in the TCP and UDP socket lists when the sockets
    have SO_REUSEPORT set. AF_INET sockets will be inserted at the head of the
    list and AF_INET6 sockets with SO_REUSEPORT set will always be inserted at
    the tail of the list. This will force AF_INET sockets to always be
    considered first.

    Fixes: e32ea7e74727 ("soreuseport: fast reuseport UDP socket selection")
    Fixes: 125e80b88687 ("soreuseport: fast reuseport TCP socket selection")

    Reported-by: Maciej Żenczykowski
    Signed-off-by: Craig Gallek
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Craig Gallek
     
  • This patch adds a release_cb for UDPv6. It does a route lookup
    and updates sk->sk_dst_cache if it is needed. It picks up the
    left-over job from ip6_sk_update_pmtu() if the sk was owned
    by user during the pmtu update.

    It takes a rcu_read_lock to protect the __sk_dst_get() operations
    because another thread may do ip6_dst_store() without taking the
    sk lock (e.g. sendmsg).

    Fixes: 45e4fd26683c ("ipv6: Only create RTF_CACHE routes after encountering pmtu exception")
    Signed-off-by: Martin KaFai Lau
    Reported-by: Wei Wang
    Cc: Cong Wang
    Cc: Eric Dumazet
    Cc: Wei Wang
    Signed-off-by: David S. Miller

    Martin KaFai Lau
     
  • There is a case in connected UDP socket such that
    getsockopt(IPV6_MTU) will return a stale MTU value. The reproducible
    sequence could be the following:
    1. Create a connected UDP socket
    2. Send some datagrams out
    3. Receive a ICMPV6_PKT_TOOBIG
    4. No new outgoing datagrams to trigger the sk_dst_check()
    logic to update the sk->sk_dst_cache.
    5. getsockopt(IPV6_MTU) returns the mtu from the invalid
    sk->sk_dst_cache instead of the newly created RTF_CACHE clone.

    This patch updates the sk->sk_dst_cache for a connected datagram sk
    during pmtu-update code path.

    Note that the sk->sk_v6_daddr is used to do the route lookup
    instead of skb->data (i.e. iph). It is because a UDP socket can become
    connected after sending out some datagrams in un-connected state. or
    It can be connected multiple times to different destinations. Hence,
    iph may not be related to where sk is currently connected to.

    It is done under '!sock_owned_by_user(sk)' condition because
    the user may make another ip6_datagram_connect() (i.e changing
    the sk->sk_v6_daddr) while dst lookup is happening in the pmtu-update
    code path.

    For the sock_owned_by_user(sk) == true case, the next patch will
    introduce a release_cb() which will update the sk->sk_dst_cache.

    Test:

    Server (Connected UDP Socket):
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Route Details:
    [root@arch-fb-vm1 ~]# ip -6 r show | egrep '2fac'
    2fac::/64 dev eth0 proto kernel metric 256 pref medium
    2fac:face::/64 via 2fac::face dev eth0 metric 1024 pref medium

    A simple python code to create a connected UDP socket:

    import socket
    import errno

    HOST = '2fac::1'
    PORT = 8080

    s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
    s.bind((HOST, PORT))
    s.connect(('2fac:face::face', 53))
    print("connected")
    while True:
    try:
    data = s.recv(1024)
    except socket.error as se:
    if se.errno == errno.EMSGSIZE:
    pmtu = s.getsockopt(41, 24)
    print("PMTU:%d" % pmtu)
    break
    s.close()

    Python program output after getting a ICMPV6_PKT_TOOBIG:
    [root@arch-fb-vm1 ~]# python2 ~/devshare/kernel/tasks/fib6/udp-connect-53-8080.py
    connected
    PMTU:1300

    Cache routes after recieving TOOBIG:
    [root@arch-fb-vm1 ~]# ip -6 r show table cache
    2fac:face::face via 2fac::face dev eth0 metric 0
    cache expires 463sec mtu 1300 pref medium

    Client (Send the ICMPV6_PKT_TOOBIG):
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    scapy is used to generate the TOOBIG message. Here is the scapy script I have
    used:

    >>> p=Ether(src='da:75:4d:36:ac:32', dst='52:54:00:12:34:66', type=0x86dd)/IPv6(src='2fac::face', dst='2fac::1')/ICMPv6PacketTooBig(mtu=1300)/IPv6(src='2fac::
    1',dst='2fac:face::face', nh='UDP')/UDP(sport=8080,dport=53)
    >>> sendp(p, iface='qemubr0')

    Fixes: 45e4fd26683c ("ipv6: Only create RTF_CACHE routes after encountering pmtu exception")
    Signed-off-by: Martin KaFai Lau
    Reported-by: Wei Wang
    Cc: Cong Wang
    Cc: Eric Dumazet
    Cc: Wei Wang
    Signed-off-by: David S. Miller

    Martin KaFai Lau
     
  • This patch moves the route lookup and update codes for connected
    datagram sk to a newly created function ip6_datagram_dst_update()

    It will be reused during the pmtu update in the later patch.

    Signed-off-by: Martin KaFai Lau
    Cc: Cong Wang
    Cc: Eric Dumazet
    Cc: Wei Wang
    Signed-off-by: David S. Miller

    Martin KaFai Lau
     
  • Move flowi6 init codes for connected datagram sk to a newly created
    function ip6_datagram_flow_key_init().

    Notes:
    1. fl6_flowlabel is used instead of fl6.flowlabel in __ip6_datagram_connect
    2. ipv6_addr_is_multicast(&fl6->daddr) is used instead of
    (addr_type & IPV6_ADDR_MULTICAST) in ip6_datagram_flow_key_init()

    This new function will be reused during pmtu update in the later patch.

    Signed-off-by: Martin KaFai Lau
    Cc: Cong Wang
    Cc: Eric Dumazet
    Cc: Wei Wang
    Signed-off-by: David S. Miller

    Martin KaFai Lau
     
  • …kernel/git/jberg/mac80211

    Johannes Berg says:

    ====================
    This has just the single fix from Dmitry Ivanov, adding the missing
    netlink notifier family check to avoid the socket close DoS problem.
    ====================

    Signed-off-by: David S. Miller <davem@davemloft.net>

    David S. Miller
     

14 Apr, 2016

5 commits

  • A failure in validate_xmit_skb_list() triggered an unconditional call
    to dev_requeue_skb with skb=NULL. This slowly grows the queue
    discipline's qlen count until all traffic through the queue stops.

    We take the optimistic approach and continue running the queue after a
    failure since it is unknown if later packets also will fail in the
    validate path.

    Fixes: 55a93b3ea780 ("qdisc: validate skb without holding lock")
    Signed-off-by: Lars Persson
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Lars Persson
     
  • Because we miss to wipe the remainder of i->addr[] in packet_mc_add(),
    pdiag_put_mclist() leaks uninitialized heap bytes via the
    PACKET_DIAG_MCLIST netlink attribute.

    Fix this by explicitly memset(0)ing the remaining bytes in i->addr[].

    Fixes: eea68e2f1a00 ("packet: Report socket mclist info via diag module")
    Signed-off-by: Mathias Krause
    Cc: Eric W. Biederman
    Cc: Pavel Emelyanov
    Acked-by: Pavel Emelyanov
    Signed-off-by: David S. Miller

    Mathias Krause
     
  • For local routes that require a particular output interface we do not want
    to cache the result. Caching the result causes incorrect behaviour when
    there are multiple source addresses on the interface. The end result
    being that if the intended recipient is waiting on that interface for the
    packet he won't receive it because it will be delivered on the loopback
    interface and the IP_PKTINFO ipi_ifindex will be set to the loopback
    interface as well.

    This can be tested by running a program such as "dhcp_release" which
    attempts to inject a packet on a particular interface so that it is
    received by another program on the same board. The receiving process
    should see an IP_PKTINFO ipi_ifndex value of the source interface
    (e.g., eth1) instead of the loopback interface (e.g., lo). The packet
    will still appear on the loopback interface in tcpdump but the important
    aspect is that the CMSG info is correct.

    Sample dhcp_release command line:

    dhcp_release eth1 192.168.204.222 02:11:33:22:44:66

    Signed-off-by: Allain Legacy
    Signed off-by: Chris Friesen
    Reviewed-by: Julian Anastasov
    Signed-off-by: David S. Miller

    Chris Friesen
     
  • f1705ec197e7 added the option to retain user configured addresses on an
    admin down. A comment to one of the later revisions suggested using the
    IFA_F_PERMANENT flag rather than adding a user_managed boolean to the
    ifaddr struct. A side effect of this change is that link local and
    loopback addresses are also retained which is not part of the objective
    of f1705ec197e7. Add check to drop those addresses.

    Fixes: f1705ec197e7 ("net: ipv6: Make address flushing on ifdown optional")
    Signed-off-by: David Ahern
    Signed-off-by: David S. Miller

    David Ahern
     
  • Pablo Neira Ayuso says:

    ====================
    Netfilter fixes for net

    The following patchset contains Netfilter fixes for your net tree. More
    specifically, they are:

    1) Fix missing filter table per-netns registration in arptables, from
    Florian Westphal.

    2) Resolve out of bound access when parsing TCP options in
    nf_conntrack_tcp, patch from Jozsef Kadlecsik.

    3) Prefer NFPROTO_BRIDGE extensions over NFPROTO_UNSPEC in ebtables,
    this resolves conflict between xt_limit and ebt_limit, from Phil Sutter.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

13 Apr, 2016

1 commit

  • If a requested extension exists as module and is not loaded,
    ebt_check_match() might accidentally use an NFPROTO_UNSPEC one with same
    name and fail.

    Reproduced with limit match: Given xt_limit and ebt_limit both built as
    module, the following would fail:

    modprobe xt_limit
    ebtables -I INPUT --limit 1/s -j ACCEPT

    The fix is to make ebt_check_match() distrust a found NFPROTO_UNSPEC
    extension and retry after requesting an appropriate module.

    Cc: Florian Westphal
    Signed-off-by: Phil Sutter
    Acked-by: Florian Westphal
    Signed-off-by: Pablo Neira Ayuso

    Phil Sutter
     

12 Apr, 2016

5 commits

  • A non-privileged user can create a netlink socket with the same port_id as
    used by an existing open nl80211 netlink socket (e.g. as used by a hostapd
    process) with a different protocol number.

    Closing this socket will then lead to the notification going to nl80211's
    socket release notification handler, and possibly cause an action such as
    removing a virtual interface.

    Fix this issue by checking that the netlink protocol is NETLINK_GENERIC.
    Since generic netlink has no notifier chain of its own, we can't fix the
    problem more generically.

    Fixes: 026331c4d9b5 ("cfg80211/mac80211: allow registering for and sending action frames")
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Ivanov
    [rewrite commit message]
    Signed-off-by: Johannes Berg

    Dmitry Ivanov
     
  • ifupdown2 found a kernel bug with IPv6 routes and movement from the main
    table to the VRF table. Sequence of events:

    Create the interface and add addresses:
    ip link add dev eth4.105 link eth4 type vlan id 105
    ip addr add dev eth4.105 8.105.105.10/24
    ip -6 addr add dev eth4.105 2008:105:105::10/64

    At this point IPv6 has inserted a prefix route in the main table even
    though the interface is 'down'. From there the VRF device is created:
    ip link add dev vrf105 type vrf table 105
    ip addr add dev vrf105 9.9.105.10/32
    ip -6 addr add dev vrf105 2000:9:105::10/128
    ip link set vrf105 up

    Then the interface is enslaved, while still in the 'down' state:
    ip link set dev eth4.105 master vrf105

    Since the device is down the VRF driver cycling the device does not
    send the NETDEV_UP and NETDEV_DOWN but rather the NETDEV_CHANGE event
    which does not flush the routes inserted prior.

    When the link is brought up
    ip link set dev eth4.105 up

    the prefix route is added in the VRF table, but does not remove
    the route from the main table.

    Fix by handling the NETDEV_CHANGEUPPER event similar what was implemented
    for IPv4 in 7f49e7a38b77 ("net: Flush local routes when device changes vrf
    association")

    Fixes: 35402e3136634 ("net: Add IPv6 support to VRF device")

    Signed-off-by: David Ahern
    Signed-off-by: David S. Miller

    David Ahern
     
  • Vivek reported a kernel exception deleting a VRF with an active
    connection through it. The root cause is that the socket has a cached
    reference to a dst that is destroyed. Converting the dst_destroy to
    dst_release and letting proper reference counting kick in does not
    work as the dst has a reference to the device which needs to be released
    as well.

    I talked to Hannes about this at netdev and he pointed out the ipv4 and
    ipv6 dst handling has dst_ifdown for just this scenario. Rather than
    continuing with the reinvented dst wheel in VRF just remove it and
    leverage the ipv4 and ipv6 versions.

    Fixes: 193125dbd8eb2 ("net: Introduce VRF device driver")
    Fixes: 35402e3136634 ("net: Add IPv6 support to VRF device")

    Signed-off-by: David Ahern
    Signed-off-by: David S. Miller

    David Ahern
     
  • If a peer node becomes unavailable, in addition to removing the
    nametable entries from this node we also need to purge all deferred
    updates associated with this node.

    Signed-off-by: Erik Hugne
    Signed-off-by: Jon Maloy
    Signed-off-by: David S. Miller

    Erik Hugne
     
  • Nametable updates received from the network that cannot be applied
    immediately are placed on a defer queue. This queue is global to the
    TIPC module, which might cause problems when using TIPC in containers.
    To prevent nametable updates from escaping into the wrong namespace,
    we make the queue pernet instead.

    Signed-off-by: Erik Hugne
    Signed-off-by: Jon Maloy
    Signed-off-by: David S. Miller

    Erik Hugne
     

11 Apr, 2016

3 commits

  • All existing users of NETLINK_URELEASE use it to clean up resources that
    were previously allocated to a socket via some command. As a result, no
    users require getting this notification for unbound sockets.

    Sending it for unbound sockets, however, is a problem because any user
    (including unprivileged users) can create a socket that uses the same ID
    as an existing socket. Binding this new socket will fail, but if the
    NETLINK_URELEASE notification is generated for such sockets, the users
    thereof will be tricked into thinking the socket that they allocated the
    resources for is closed.

    In the nl80211 case, this will cause destruction of virtual interfaces
    that still belong to an existing hostapd process; this is the case that
    Dmitry noticed. In the NFC case, it will cause a poll abort. In the case
    of netlink log/queue it will cause them to stop reporting events, as if
    NFULNL_CFG_CMD_UNBIND/NFQNL_CFG_CMD_UNBIND had been called.

    Fix this problem by checking that the socket is bound before generating
    the NETLINK_URELEASE notification.

    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Ivanov
    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Dmitry Ivanov
     
  • In particular, make sure we check for decnet private presence
    for loopback devices.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Currently on high rate SCTP streams the heartbeat timer refresh can
    consume quite a lot of resources as timer updates are costly and it
    contains a random factor, which a) is also costly and b) invalidates
    mod_timer() optimization for not editing a timer to the same value.
    It may even cause the timer to be slightly advanced, for no good reason.

    As suggested by David Laight this patch now removes this timer update
    from hot path by leaving the timer on and re-evaluating upon its
    expiration if the heartbeat is still needed or not, similarly to what is
    done for TCP. If it's not needed anymore the timer is re-scheduled to
    the new timeout, considering the time already elapsed.

    For this, we now record the last tx timestamp per transport, updated in
    the same spots as hb timer was restarted on tx. Also split up
    sctp_transport_reset_timers into sctp_transport_reset_t3_rtx and
    sctp_transport_reset_hb_timer, so we can re-arm T3 without re-arming the
    heartbeat one.

    On loopback with MTU of 65535 and data chunks with 1636, so that we
    have a considerable amount of chunks without stressing system calls,
    netperf -t SCTP_STREAM -l 30, perf looked like this before:

    Samples: 103K of event 'cpu-clock', Event count (approx.): 25833000000
    Overhead Command Shared Object Symbol
    + 6,15% netperf [kernel.vmlinux] [k] copy_user_enhanced_fast_string
    - 5,43% netperf [kernel.vmlinux] [k] _raw_write_unlock_irqrestore
    - _raw_write_unlock_irqrestore
    - 96,54% _raw_spin_unlock_irqrestore
    - 36,14% mod_timer
    + 97,24% sctp_transport_reset_timers
    + 2,76% sctp_do_sm
    + 33,65% __wake_up_sync_key
    + 28,77% sctp_ulpq_tail_event
    + 1,40% del_timer
    - 1,84% mod_timer
    + 99,03% sctp_transport_reset_timers
    + 0,97% sctp_do_sm
    + 1,50% sctp_ulpq_tail_event

    And after this patch, now with netperf -l 60:

    Samples: 230K of event 'cpu-clock', Event count (approx.): 57707250000
    Overhead Command Shared Object Symbol
    + 5,65% netperf [kernel.vmlinux] [k] memcpy_erms
    + 5,59% netperf [kernel.vmlinux] [k] copy_user_enhanced_fast_string
    - 5,05% netperf [kernel.vmlinux] [k] _raw_spin_unlock_irqrestore
    - _raw_spin_unlock_irqrestore
    + 49,89% __wake_up_sync_key
    + 45,68% sctp_ulpq_tail_event
    - 2,85% mod_timer
    + 76,51% sctp_transport_reset_t3_rtx
    + 23,49% sctp_do_sm
    + 1,55% del_timer
    + 2,50% netperf [sctp] [k] sctp_datamsg_from_user
    + 2,26% netperf [sctp] [k] sctp_sendmsg

    Throughput-wise, from 6800mbps without the patch to 7050mbps with it,
    ~3.7%.

    Signed-off-by: Marcelo Ricardo Leitner
    Signed-off-by: David S. Miller

    Marcelo Ricardo Leitner
     

10 Apr, 2016

1 commit

  • Pull networking fixes from David Miller:

    1) Stale SKB data pointer access across pskb_may_pull() calls in L2TP,
    from Haishuang Yan.

    2) Fix multicast frame handling in mac80211 AP code, from Felix
    Fietkau.

    3) mac80211 station hashtable insert errors not handled properly, fix
    from Johannes Berg.

    4) Fix TX descriptor count limit handling in e1000, from Alexander
    Duyck.

    5) Revert a buggy netdev refcount fix in netpoll, from Bjorn Helgaas.

    6) Must assign rtnl_link_ops of the device before registering it, fix
    in ip6_tunnel from Thadeu Lima de Souza Cascardo.

    7) Memory leak fix in tc action net exit, from WANG Cong.

    8) Add missing AF_KCM entries to name tables, from Dexuan Cui.

    9) Fix regression in GRE handling of csums wrt. FOU, from Alexander
    Duyck.

    10) Fix memory allocation alignment and congestion map corruption in
    RDS, from Shamir Rabinovitch.

    11) Fix default qdisc regression in tuntap driver, from Jason Wang.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (44 commits)
    bridge, netem: mark mailing lists as moderated
    tuntap: restore default qdisc
    mpls: find_outdev: check for err ptr in addition to NULL check
    ipv6: Count in extension headers in skb->network_header
    RDS: fix congestion map corruption for PAGE_SIZE > 4k
    RDS: memory allocated must be align to 8
    GRE: Disable segmentation offloads w/ CSUM and we are encapsulated via FOU
    net: add the AF_KCM entries to family name tables
    MAINTAINERS: intel-wired-lan list is moderated
    lib/test_bpf: Add additional BPF_ADD tests
    lib/test_bpf: Add test to check for result of 32-bit add that overflows
    lib/test_bpf: Add tests for unsigned BPF_JGT
    lib/test_bpf: Fix JMP_JSET tests
    VSOCK: Detach QP check should filter out non matching QPs.
    stmmac: fix adjust link call in case of a switch is attached
    af_packet: tone down the Tx-ring unsupported spew.
    net_sched: fix a memory leak in tc action
    samples/bpf: Enable powerpc support
    samples/bpf: Use llc in PATH, rather than a hardcoded value
    samples/bpf: Fix build breakage with map_perf_test_user.c
    ...

    Linus Torvalds
     

09 Apr, 2016

2 commits

  • …kernel/git/jberg/mac80211

    Johannes Berg says:

    ====================
    For the current RC series, we have the following fixes:
    * TDLS fixes from Arik and Ilan
    * rhashtable fixes from Ben and myself
    * documentation fixes from Luis
    * U-APSD fixes from Emmanuel
    * a TXQ fix from Felix
    * and a compiler warning suppression from Jeff
    ====================

    Signed-off-by: David S. Miller <davem@davemloft.net>

    David S. Miller
     
  • find_outdev calls inet{,6}_fib_lookup_dev() or dev_get_by_index() to
    find the output device. In case of an error, inet{,6}_fib_lookup_dev()
    returns error pointer and dev_get_by_index() returns NULL. But the function
    only checks for NULL and thus can end up calling dev_put on an ERR_PTR.
    This patch adds an additional check for err ptr after the NULL check.

    Before: Trying to add an mpls route with no oif from user, no available
    path to 10.1.1.8 and no default route:
    $ip -f mpls route add 100 as 200 via inet 10.1.1.8
    [ 822.337195] BUG: unable to handle kernel NULL pointer dereference at
    00000000000003a3
    [ 822.340033] IP: [] mpls_nh_assign_dev+0x10b/0x182
    [ 822.340033] PGD 1db38067 PUD 1de9e067 PMD 0
    [ 822.340033] Oops: 0000 [#1] SMP
    [ 822.340033] Modules linked in:
    [ 822.340033] CPU: 0 PID: 11148 Comm: ip Not tainted 4.5.0-rc7+ #54
    [ 822.340033] 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
    [ 822.340033] task: ffff88001db82580 ti: ffff88001dad4000 task.ti:
    ffff88001dad4000
    [ 822.340033] RIP: 0010:[] []
    mpls_nh_assign_dev+0x10b/0x182
    [ 822.340033] RSP: 0018:ffff88001dad7a88 EFLAGS: 00010282
    [ 822.340033] RAX: ffffffffffffff9b RBX: ffffffffffffff9b RCX:
    0000000000000002
    [ 822.340033] RDX: 00000000ffffff9b RSI: 0000000000000008 RDI:
    0000000000000000
    [ 822.340033] RBP: ffff88001ddc9ea0 R08: ffff88001e9f1768 R09:
    0000000000000000
    [ 822.340033] R10: ffff88001d9c1100 R11: ffff88001e3c89f0 R12:
    ffffffff8187e0c0
    [ 822.340033] R13: ffffffff8187e0c0 R14: ffff88001ddc9e80 R15:
    0000000000000004
    [ 822.340033] FS: 00007ff9ed798700(0000) GS:ffff88001fc00000(0000)
    knlGS:0000000000000000
    [ 822.340033] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 822.340033] CR2: 00000000000003a3 CR3: 000000001de89000 CR4:
    00000000000006f0
    [ 822.340033] Stack:
    [ 822.340033] 0000000000000000 0000000100000000 0000000000000000
    0000000000000000
    [ 822.340033] 0000000000000000 0801010a00000000 0000000000000000
    0000000000000000
    [ 822.340033] 0000000000000004 ffffffff8148749b ffffffff8187e0c0
    000000000000001c
    [ 822.340033] Call Trace:
    [ 822.340033] [] ? mpls_rt_alloc+0x2b/0x3e
    [ 822.340033] [] ? mpls_rtm_newroute+0x358/0x3e2
    [ 822.340033] [] ? get_page+0x5/0xa
    [ 822.340033] [] ? rtnetlink_rcv_msg+0x17e/0x191
    [ 822.340033] [] ? __kmalloc_track_caller+0x8c/0x9e
    [ 822.340033] [] ?
    rht_key_hashfn.isra.20.constprop.57+0x14/0x1f
    [ 822.340033] [] ? __rtnl_unlock+0xc/0xc
    [ 822.340033] [] ? netlink_rcv_skb+0x36/0x82
    [ 822.340033] [] ? rtnetlink_rcv+0x1f/0x28
    [ 822.340033] [] ? netlink_unicast+0x106/0x189
    [ 822.340033] [] ? netlink_sendmsg+0x27f/0x2c8
    [ 822.340033] [] ? sock_sendmsg_nosec+0x10/0x1b
    [ 822.340033] [] ? ___sys_sendmsg+0x182/0x1e3
    [ 822.340033] [] ?
    __alloc_pages_nodemask+0x11c/0x1e4
    [ 822.340033] [] ? PageAnon+0x5/0xd
    [ 822.340033] [] ? __page_set_anon_rmap+0x45/0x52
    [ 822.340033] [] ? get_page+0x5/0xa
    [ 822.340033] [] ? __lru_cache_add+0x1a/0x3a
    [ 822.340033] [] ? current_kernel_time64+0x9/0x30
    [ 822.340033] [] ? __sys_sendmsg+0x3c/0x5a
    [ 822.340033] [] ?
    entry_SYSCALL_64_fastpath+0x12/0x6a
    [ 822.340033] Code: 83 08 04 00 00 65 ff 00 48 8b 3c 24 e8 40 7c f2 ff
    eb 13 48 c7 c3 9f ff ff ff eb 0f 89 ce e8 f1 ae f1 ff 48 89 c3 48 85 db
    74 15 8b 83 08 04 00 00 65 ff 08 48 81 fb 00 f0 ff ff 76 0d eb 07
    [ 822.340033] RIP [] mpls_nh_assign_dev+0x10b/0x182
    [ 822.340033] RSP
    [ 822.340033] CR2: 00000000000003a3
    [ 822.435363] ---[ end trace 98cc65e6f6b8bf11 ]---

    After patch:
    $ip -f mpls route add 100 as 200 via inet 10.1.1.8
    RTNETLINK answers: Network is unreachable

    Signed-off-by: Roopa Prabhu
    Reported-by: David Miller
    Signed-off-by: David S. Miller

    Roopa Prabhu
     

08 Apr, 2016

5 commits

  • When sending a UDPv6 message longer than MTU, account for the length
    of fragmentable IPv6 extension headers in skb->network_header offset.
    Same as we do in alloc_new_skb path in __ip6_append_data().

    This ensures that later on __ip6_make_skb() will make space in
    headroom for fragmentable extension headers:

    /* move skb->data to ip header from ext header */
    if (skb->data < skb_network_header(skb))
    __skb_pull(skb, skb_network_offset(skb));

    Prevents a splat due to skb_under_panic:

    skbuff: skb_under_panic: text:ffffffff8143397b len:2126 put:14 \
    head:ffff880005bacf50 data:ffff880005bacf4a tail:0x48 end:0xc0 dev:lo
    ------------[ cut here ]------------
    kernel BUG at net/core/skbuff.c:104!
    invalid opcode: 0000 [#1] KASAN
    CPU: 0 PID: 160 Comm: reproducer Not tainted 4.6.0-rc2 #65
    [...]
    Call Trace:
    [] skb_push+0x79/0x80
    [] eth_header+0x2b/0x100
    [] neigh_resolve_output+0x210/0x310
    [] ip6_finish_output2+0x4a7/0x7c0
    [] ip6_output+0x16a/0x280
    [] ip6_local_out+0xb1/0xf0
    [] ip6_send_skb+0x45/0xd0
    [] udp_v6_send_skb+0x246/0x5d0
    [] udpv6_sendmsg+0xa6e/0x1090
    [...]

    Reported-by: Ji Jianwen
    Signed-off-by: Jakub Sitnicki
    Acked-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Jakub Sitnicki
     
  • When PAGE_SIZE > 4k single page can contain 2 RDS fragments. If
    'rds_ib_cong_recv' ignore the RDS fragment offset in to the page it
    then read the data fragment as far congestion map update and lead to
    corruption of the RDS connection far congestion map.

    Signed-off-by: Shamir Rabinovitch
    Signed-off-by: David S. Miller

    shamir rabinovitch
     
  • Fix issue in 'rds_ib_cong_recv' when accessing unaligned memory
    allocated by 'rds_page_remainder_alloc' using uint64_t pointer.

    Signed-off-by: Shamir Rabinovitch
    Signed-off-by: David S. Miller

    shamir rabinovitch
     
  • This patch fixes an issue I found in which we were dropping frames if we
    had enabled checksums on GRE headers that were encapsulated by either FOU
    or GUE. Without this patch I was barely able to get 1 Gb/s of throughput.
    With this patch applied I am now at least getting around 6 Gb/s.

    The issue is due to the fact that with FOU or GUE applied we do not provide
    a transport offset pointing to the GRE header, nor do we offload it in
    software as the GRE header is completely skipped by GSO and treated like a
    VXLAN or GENEVE type header. As such we need to prevent the stack from
    generating it and also prevent GRE from generating it via any interface we
    create.

    Fixes: c3483384ee511 ("gro: Allow tunnel stacking in the case of FOU/GUE")
    Signed-off-by: Alexander Duyck
    Signed-off-by: David S. Miller

    Alexander Duyck
     
  • Baozeng Ding reported a KASAN stack out of bounds issue - it uncovered that
    the TCP option parsing routines in netfilter TCP connection tracking could
    read one byte out of the buffer of the TCP options. Therefore in the patch
    we check that the available data length is large enough to parse both TCP
    option code and size.

    Reported-by: Baozeng Ding
    Tested-by: Baozeng Ding
    Signed-off-by: Jozsef Kadlecsik
    Signed-off-by: Pablo Neira Ayuso

    Jozsef Kadlecsik
     

07 Apr, 2016

1 commit