11 Mar, 2019

1 commit

  • Pull networking fixes from David Miller:
    "First batch of fixes in the new merge window:

    1) Double dst_cache free in act_tunnel_key, from Wenxu.

    2) Avoid NULL deref in IN_DEV_MFORWARD() by failing early in the
    ip_route_input_rcu() path, from Paolo Abeni.

    3) Fix appletalk compile regression, from Arnd Bergmann.

    4) If SLAB objects reach the TCP sendpage method we are in serious
    trouble, so put a debugging check there. From Vasily Averin.

    5) Memory leak in hsr layer, from Mao Wenan.

    6) Only test GSO type on GSO packets, from Willem de Bruijn.

    7) Fix crash in xsk_diag_put_umem(), from Eric Dumazet.

    8) Fix VNIC mailbox length in nfp, from Dirk van der Merwe.

    9) Fix race in ipv4 route exception handling, from Xin Long.

    10) Missing DMA memory barrier in hns3 driver, from Jian Shen.

    11) Use after free in __tcf_chain_put(), from Vlad Buslov.

    12) Handle inet_csk_reqsk_queue_add() failures, from Guillaume Nault.

    13) Return value correction when ip_mc_may_pull() fails, from Eric
    Dumazet.

    14) Use after free in x25_device_event(), also from Eric"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (72 commits)
    gro_cells: make sure device is up in gro_cells_receive()
    vxlan: test dev->flags & IFF_UP before calling gro_cells_receive()
    net/x25: fix use-after-free in x25_device_event()
    isdn: mISDNinfineon: fix potential NULL pointer dereference
    net: hns3: fix to stop multiple HNS reset due to the AER changes
    ip: fix ip_mc_may_pull() return value
    net: keep refcount warning in reqsk_free()
    net: stmmac: Avoid one more sometimes uninitialized Clang warning
    net: dsa: mv88e6xxx: Set correct interface mode for CPU/DSA ports
    rxrpc: Fix client call queueing, waiting for channel
    tcp: handle inet_csk_reqsk_queue_add() failures
    net: ethernet: sun: Zero initialize class in default case in niu_add_ethtool_tcam_entry
    8139too : Add support for U.S. Robotics USR997901A 10/100 Cardbus NIC
    fou, fou6: avoid uninit-value in gue_err() and gue6_err()
    net: sched: fix potential use-after-free in __tcf_chain_put()
    vhost: silence an unused-variable warning
    vsock/virtio: fix kernel panic from virtio_transport_reset_no_sock
    connector: fix unsafe usage of ->real_parent
    vxlan: do not need BH again in vxlan_cleanup()
    net: hns3: add dma_rmb() for rx description
    ...

    Linus Torvalds
     

10 Mar, 2019

2 commits

  • Pull media updates from Mauro Carvalho Chehab:

    - remove sensor drivers that got converted from soc_camera

    - remaining soc_camera drivers got moved to staging

    - some documentation cleanups and improvements

    - the imx staging driver now supports imx7

    - the ov9640, mt9m001 and mt9m111 got converted from soc_camera

    - the vim2m driver now does what a m2m convert driver expects to do

    - epoll() fixes on media subsystems

    - several drivers fixes, typos, cleanups and improvements

    * tag 'media/v5.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (346 commits)
    media: dvb/earth-pt1: fix wrong initialization for demod blocks
    media: vim2m: Address some coding style issues
    media: vim2m: don't use BUG()
    media: vim2m: speedup passthrough copy
    media: vim2m: add an horizontal scaler
    media: vim2m: don't accept YUYV anymore as output format
    media: vim2m: add vertical linear scaler
    media: vim2m: better handle cap/out buffers with different sizes
    media: vim2m: use different framesizes for bayer formats
    media: vim2m: add support for VIDIOC_ENUM_FRAMESIZES
    media: vim2m: ensure that width is multiple of two
    media: vim2m: improve debug messages
    media: vim2m: add bayer capture formats
    media: a few more typos at staging, pci, platform, radio and usb
    media: Documentation: fix several typos
    media: staging: fix several typos
    media: include: fix several typos
    media: common: fix several typos
    media: v4l2-core: fix several typos
    media: usb: fix several typos
    ...

    Linus Torvalds
     
  • Pull documentation updates from Jonathan Corbet:
    "A fairly routine cycle for docs - lots of typo fixes, some new
    documents, and more translations. There's also some LICENSES
    adjustments from Thomas"

    * tag 'docs-5.1' of git://git.lwn.net/linux: (74 commits)
    docs: Bring some order to filesystem documentation
    Documentation/locking/lockdep: Drop last two chars of sample states
    doc: rcu: Suspicious RCU usage is a warning
    docs: driver-api: iio: fix errors in documentation
    Documentation/process/howto: Update for 4.x -> 5.x versioning
    docs: Explicitly state that the 'Fixes:' tag shouldn't split lines
    doc: security: Add kern-doc for lsm_hooks.h
    doc: sctp: Merge and clean up rst files
    Docs: Correct /proc/stat path
    scripts/spdxcheck.py: fix C++ comment style detection
    doc: fix typos in license-rules.rst
    Documentation: fix admin-guide/README.rst minimum gcc version requirement
    doc: process: complete removal of info about -git patches
    doc: translations: sync translations 'remove info about -git patches'
    perf-security: wrap paragraphs on 72 columns
    perf-security: elaborate on perf_events/Perf privileged users
    perf-security: document collected perf_events/Perf data categories
    perf-security: document perf_events/Perf resource control
    sysfs.txt: add note on available attribute macros
    docs: kernel-doc: typo "if ... if" -> "if ... is"
    ...

    Linus Torvalds
     

09 Mar, 2019

1 commit

  • Pull livepatching updates from Jiri Kosina:

    - support for something we call 'atomic replace', and allows for much
    better handling of cumulative patches (which is something very useful
    for distros), from Jason Baron with help of Petr Mladek and Joe
    Lawrence

    - improvement of handling of tasks blocking finalization, from Miroslav
    Benes

    - update of MAINTAINERS file to reflect move towards group
    maintainership

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching: (22 commits)
    livepatch/selftests: use "$@" to preserve argument list
    livepatch: Module coming and going callbacks can proceed with all listed patches
    livepatch: Proper error handling in the shadow variables selftest
    livepatch: return -ENOMEM on ptr_id() allocation failure
    livepatch: Introduce klp_for_each_patch macro
    livepatch: core: Return EOPNOTSUPP instead of ENOSYS
    selftests/livepatch: add DYNAMIC_DEBUG config dependency
    livepatch: samples: non static warnings fix
    livepatch: update MAINTAINERS
    livepatch: Remove signal sysfs attribute
    livepatch: Send a fake signal periodically
    selftests/livepatch: introduce tests
    livepatch: Remove ordering (stacking) of the livepatches
    livepatch: Atomic replace and cumulative patches documentation
    livepatch: Remove Nop structures when unused
    livepatch: Add atomic replace
    livepatch: Use lists to manage patches, objects and functions
    livepatch: Simplify API by removing registration step
    livepatch: Don't block the removal of patches loaded after a forced transition
    livepatch: Consolidate klp_free functions
    ...

    Linus Torvalds
     

08 Mar, 2019

1 commit


07 Mar, 2019

1 commit


06 Mar, 2019

1 commit

  • Pull networking updates from David Miller:
    "Here we go, another merge window full of networking and #ebpf changes:

    1) Snoop DHCPACKS in batman-adv to learn MAC/IP pairs in the DHCP
    range without dealing with floods of ARP traffic, from Linus
    Lüssing.

    2) Throttle buffered multicast packet transmission in mt76, from
    Felix Fietkau.

    3) Support adaptive interrupt moderation in ice, from Brett Creeley.

    4) A lot of struct_size conversions, from Gustavo A. R. Silva.

    5) Add peek/push/pop commands to bpftool, as well as bash completion,
    from Stanislav Fomichev.

    6) Optimize sk_msg_clone(), from Vakul Garg.

    7) Add SO_BINDTOIFINDEX, from David Herrmann.

    8) Be more conservative with local resends due to local congestion,
    from Yuchung Cheng.

    9) Allow vetoing of unsupported VXLAN FDBs, from Petr Machata.

    10) Add health buffer support to devlink, from Eran Ben Elisha.

    11) Add TXQ scheduling API to mac80211, from Toke Høiland-Jørgensen.

    12) Add statistics to basic packet scheduler filter, from Cong Wang.

    13) Add GRE tunnel support for mlxsw Spectrum-2, from Nir Dotan.

    14) Lots of new IP tunneling forwarding tests, also from Nir Dotan.

    15) Add 3ad stats to bonding, from Nikolay Aleksandrov.

    16) Lots of probing improvements for bpftool, from Quentin Monnet.

    17) Various nfp drive #ebpf JIT improvements from Jakub Kicinski.

    18) Allow #ebpf programs to access gso_segs from skb shared info, from
    Eric Dumazet.

    19) Add sock_diag support for AF_XDP sockets, from Björn Töpel.

    20) Support 22260 iwlwifi devices, from Luca Coelho.

    21) Use rbtree for ipv6 defragmentation, from Peter Oskolkov.

    22) Add JMP32 instruction class support to #ebpf, from Jiong Wang.

    23) Add spinlock support to #ebpf, from Alexei Starovoitov.

    24) Support 256-bit keys and TLS 1.3 in ktls, from Dave Watson.

    25) Add device infomation API to devlink, from Jakub Kicinski.

    26) Add new timestamping socket options which are y2038 safe, from
    Deepa Dinamani.

    27) Add RX checksum offloading for various sh_eth chips, from Sergei
    Shtylyov.

    28) Flow offload infrastructure, from Pablo Neira Ayuso.

    29) Numerous cleanups, improvements, and bug fixes to the PHY layer
    and many drivers from Heiner Kallweit.

    30) Lots of changes to try and make packet scheduler classifiers run
    lockless as much as possible, from Vlad Buslov.

    31) Support BCM957504 chip in bnxt_en driver, from Erik Burrows.

    32) Add concurrency tests to tc-tests infrastructure, from Vlad
    Buslov.

    33) Add hwmon support to aquantia, from Heiner Kallweit.

    34) Allow 64-bit values for SO_MAX_PACING_RATE, from Eric Dumazet.

    And I would be remiss if I didn't thank the various major networking
    subsystem maintainers for integrating much of this work before I even
    saw it. Alexei Starovoitov, Daniel Borkmann, Pablo Neira Ayuso,
    Johannes Berg, Kalle Valo, and many others. Thank you!"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (2207 commits)
    net/sched: avoid unused-label warning
    net: ignore sysctl_devconf_inherit_init_net without SYSCTL
    phy: mdio-mux: fix Kconfig dependencies
    net: phy: use phy_modify_mmd_changed in genphy_c45_an_config_aneg
    net: dsa: mv88e6xxx: add call to mv88e6xxx_ports_cmode_init to probe for new DSA framework
    selftest/net: Remove duplicate header
    sky2: Disable MSI on Dell Inspiron 1545 and Gateway P-79
    net/mlx5e: Update tx reporter status in case channels were successfully opened
    devlink: Add support for direct reporter health state update
    devlink: Update reporter state to error even if recover aborted
    sctp: call iov_iter_revert() after sending ABORT
    team: Free BPF filter when unregistering netdev
    ip6mr: Do not call __IP6_INC_STATS() from preemptible context
    isdn: mISDN: Fix potential NULL pointer dereference of kzalloc
    net: dsa: mv88e6xxx: support in-band signalling on SGMII ports with external PHYs
    cxgb4/chtls: Prefix adapter flags with CXGB4
    net-sysfs: Switch to bitmap_zalloc()
    mellanox: Switch to bitmap_zalloc()
    bpf: add test cases for non-pointer sanitiation logic
    mlxsw: i2c: Extend initialization by querying resources data
    ...

    Linus Torvalds
     

05 Mar, 2019

2 commits

  • Document change towards group maintainership of livepatching code
    samples/ warning fix from Nicholas Mc Guire

    Jiri Kosina
     
  • Pull VFIO updates from Alex Williamson:

    - Switch mdev to generic UUID API (Andy Shevchenko)

    - Fixup platform reset include paths (Masahiro Yamada)

    - Fix usage of MINORMASK (Chengguang Xu)

    - Remove noise from duplicate spapr table unsets (Alexey Kardashevskiy)

    - Restore device state after PM reset (Alex Williamson)

    - Ensure memory translation enabled for PCI ROM access (Eric Auger)

    * tag 'vfio-v5.1-rc1' of git://github.com/awilliam/linux-vfio:
    vfio_pci: Enable memory accesses before calling pci_map_rom
    vfio/pci: Restore device state on PM transition
    vfio/spapr_tce: Skip unsetting already unset table
    samples/vfio-mdev/mtty: expand minor range when registering chrdev region
    samples/vfio-mdev/mdpy: expand minor range when registering chrdev region
    samples/vfio-mdev/mbochs: expand minor range when registering chrdev region
    vfio: expand minor range when registering chrdev region
    vfio: platform: reset: fix up include directives to remove ccflags-y
    vfio-mdev: Switch to use new generic UUID API

    Linus Torvalds
     

03 Mar, 2019

3 commits

  • Script for testing HBM (Host Bandwidth Manager) framework.
    It creates a cgroup to use for testing and load a BPF program to limit
    egress bandwidht. It then uses iperf3 or netperf to create
    loads. The output is the goodput in Mbps (unless -D is used).

    It can work on a single host using loopback or among two hosts (with netperf).
    When using loopback, it is recommended to also introduce a delay of at least
    1ms (-d=1), otherwise the assigned bandwidth is likely to be underutilized.

    USAGE: $name [out] [-b=|--bpf=] [-c=|--cc=] [-D]
    [-d=|--delay=] [--debug] [-E]
    [-f=|--flows=] [-h] [-i=|--id=] [-l]
    [-N] [-p=|--port=] [-P] [-q=]
    [-R] [-s=|--server=|--time=] [-w] [cubic|dctcp]
    Where:
    out Egress (default egress)
    -b or --bpf BPF program filename to load and attach.
    Default is nrm_out_kern.o for egress,
    -c or -cc TCP congestion control (cubic or dctcp)
    -d or --delay Add a delay in ms using netem
    -D In addition to the goodput in Mbps, it also outputs
    other detailed information. This information is
    test dependent (i.e. iperf3 or netperf).
    --debug Print BPF trace buffer
    -E Enable ECN (not required for dctcp)
    -f or --flows Number of concurrent flows (default=1)
    -i or --id cgroup id (an integer, default is 1)
    -l Do not limit flows using loopback
    -N Use netperf instead of iperf3
    -h Help
    -p or --port iperf3 port (default is 5201)
    -P Use an iperf3 instance for each flow
    -q Use the specified qdisc.
    -r or --rate Rate in Mbps (default 1s 1Gbps)
    -R Use TCP_RR for netperf. 1st flow has req
    size of 10KB, rest of 1MB. Reply in all
    cases is 1 byte.
    More detailed output for each flow can be found
    in the files netperf.., where is the
    cgroup id as specified with the -i flag, and
    is the flow id starting at 1 and increasing by 1 for
    flow (as specified by -f).
    -s or --server hostname of netperf server. Used to create netperf
    test traffic between to hosts (default is within host)
    netserver must be running on the host.
    --stats Get HBM stats (marked, dropped, etc.)
    -t or --time duration of iperf3 in seconds (default=5)
    -w Work conserving flag. cgroup can increase its
    bandwidth beyond the rate limit specified
    while there is available bandwidth. Current
    implementation assumes there is only one NIC
    (eth0), but can be extended to support multiple
    NICs. This is just a proof of concept.
    cubic or dctcp specify TCP CC to use

    Examples:
    ./do_hbm_test.sh -l -d=1 -D --stats
    Runs a 5 second test, using a single iperf3 flow and with the default
    rate limit of 1Gbps and a delay of 1ms (using netem) using the default
    TCP congestion control on the loopback device (hence we use "-l" to
    enforce bandwidth limit on loopback device). Since no direction is
    specified, it defaults to egress. Since no TCP CC algorithm is
    specified it uses the system default (Cubic for this test).
    With no -D flag, only the value of the AGGREGATE OUTPUT would show.
    id refers to the cgroup id and is useful when running multi cgroup
    tests (supported by a future patch).
    This patchset does not support calling TCP's congesion window
    reduction, even when packets are dropped by the BPF program, resulting
    in a large number of packets dropped. It is recommended that the current
    HBM implemenation only be used with ECN enabled flows. A future patch
    will add support for reducing TCP's cwnd and will increase the
    performance of non-ECN enabled flows.
    Output:
    Details for HBM in cgroup 1
    id:1
    rate_mbps:493
    duration:4.8 secs
    packets:11355
    bytes_MB:590
    pkts_dropped:4497
    bytes_dropped_MB:292
    pkts_marked_percent: 39.60
    bytes_marked_percent: 49.49
    pkts_dropped_percent: 39.60
    bytes_dropped_percent: 49.49
    PING AVG DELAY:2.075
    AGGREGATE_GOODPUT:505

    ./do_nrm_test.sh -l -d=1 -D --stats dctcp
    Same as above but using dctcp. Note that fewer bytes are dropped
    (0.01% vs. 49%).
    Output:
    Details for HBM in cgroup 1
    id:1
    rate_mbps:945
    duration:4.9 secs
    packets:16859
    bytes_MB:578
    pkts_dropped:1
    bytes_dropped_MB:0
    pkts_marked_percent: 28.74
    bytes_marked_percent: 45.15
    pkts_dropped_percent: 0.01
    bytes_dropped_percent: 0.01
    PING AVG DELAY:2.083
    AGGREGATE_GOODPUT:965

    ./do_nrm_test.sh -d=1 -D --stats
    As first example, but without limiting loopback device (i.e. no
    "-l" flag). Since there is no bandwidth limiting, no details for
    HBM are printed out.
    Output:
    Details for HBM in cgroup 1
    PING AVG DELAY:2.019
    AGGREGATE_GOODPUT:42655

    ./do_hbm.sh -l -d=1 -D --stats -f=2
    Uses iper3 and does 2 flows
    ./do_hbm.sh -l -d=1 -D --stats -f=4 -P
    Uses iperf3 and does 4 flows, each flow as a separate process.
    ./do_hbm.sh -l -d=1 -D --stats -f=4 -N
    Uses netperf, 4 flows
    ./do_hbm.sh -f=1 -r=2000 -t=5 -N -D --stats dctcp -s=
    Uses netperf between two hosts. The remote host name is specified
    with -s= and you need to start the program netserver manually on
    the remote host. It will use 1 flow, a rate limit of 2Gbps and dctcp.
    ./do_hbm.sh -f=1 -r=2000 -t=5 -N -D --stats -w dctcp \
    -s=
    As previous, but allows use of extra bandwidth. For this test the
    rate is 8Gbps vs. 1Gbps of the previous test.

    Signed-off-by: Lawrence Brakmo
    Signed-off-by: Alexei Starovoitov

    brakmo
     
  • The program nrm creates a cgroup and attaches a BPF program to the
    cgroup for testing HBM (Host Bandwidth Manager) for egress traffic.
    One still needs to create network traffic. This can be done through
    netesto, netperf or iperf3.
    A follow-up patch contains a script to create traffic.

    USAGE: hbm [-d] [-l] [-n ] [-r ] [-s] [-t ]
    [-w] [-h] [prog]
    Where:
    -d Print BPF trace debug buffer
    -l Also limit flows doing loopback
    -n To create cgroup "/hbm#" and attach prog. Default is /nrm1
    This is convenient when testing HBM in more than 1 cgroup
    -r Rate limit in Mbps
    -s Get HBM stats (marked, dropped, etc.)
    -t Exit after specified seconds (deault is 0)
    -w Work conserving flag. cgroup can increase its bandwidth
    beyond the rate limit specified while there is available
    bandwidth. Current implementation assumes there is only
    NIC (eth0), but can be extended to support multiple NICs.
    Currrently only supported for egress. Note, this is just
    a proof of concept.
    -h Print this info
    prog BPF program file name. Name defaults to hbm_out_kern.o

    More information about HBM can be found in the paper "BPF Host Resource
    Management" presented at the 2018 Linux Plumbers Conference, Networking Track
    (http://vger.kernel.org/lpc_net2018_talks/LPC%20BPF%20Network%20Resource%20Paper.pdf)

    Signed-off-by: Lawrence Brakmo
    Signed-off-by: Alexei Starovoitov

    brakmo
     
  • A cgroup skb BPF program to limit cgroup output bandwidth.
    It uses a modified virtual token bucket queue to limit average
    egress bandwidth. The implementation uses credits instead of tokens.
    Negative credits imply that queueing would have happened (this is
    a virtual queue, so no queueing is done by it. However, queueing may
    occur at the actual qdisc (which is not used for rate limiting).

    This implementation uses 3 thresholds, one to start marking packets and
    the other two to drop packets:
    CREDIT
    - +
    | | | 0
    | Large pkt |
    | drop thresh |
    Small pkt drop Mark threshold
    thresh

    The effect of marking depends on the type of packet:
    a) If the packet is ECN enabled, then the packet is ECN ce marked.
    The current mark threshold is tuned for DCTCP.
    c) Else, it is dropped if it is a large packet.

    If the credit is below the drop threshold, the packet is dropped.
    Note that dropping a packet through the BPF program does not trigger CWR
    (Congestion Window Reduction) in TCP packets. A future patch will add
    support for triggering CWR.

    This BPF program actually uses 2 drop thresholds, one threshold
    for larger packets (>= 120 bytes) and another for smaller packets. This
    protects smaller packets such as SYNs, ACKs, etc.

    The default bandwidth limit is set at 1Gbps but this can be changed by
    a user program through a shared BPF map. In addition, by default this BPF
    program does not limit connections using loopback. This behavior can be
    overwritten by the user program. There is also an option to calculate
    some statistics, such as percent of packets marked or dropped, which
    the user program can access.

    A latter patch provides such a program (hbm.c)

    Signed-off-by: Lawrence Brakmo
    Signed-off-by: Alexei Starovoitov

    brakmo
     

02 Mar, 2019

1 commit

  • Compiling xdpsock_user.c with 4.8.5, I hit the following
    compilation warning:
    HOSTCC samples/bpf/xdpsock_user.o
    /data/users/yhs/work/net-next/samples/bpf/xdpsock_user.c: In function ‘main’:
    /data/users/yhs/work/net-next/samples/bpf/xdpsock_user.c:449:6: warning: ‘idx_cq’ may be used unini
    tialized in this function [-Wmaybe-uninitialized]
    u32 idx_cq, idx_fq;
    ^
    /data/users/yhs/work/net-next/samples/bpf/xdpsock_user.c:606:7: warning: ‘idx_rx’ may be used unini
    tialized in this function [-Wmaybe-uninitialized]
    u32 idx_rx, idx_tx = 0;
    ^
    /data/users/yhs/work/net-next/samples/bpf/xdpsock_user.c:506:6: warning: ‘idx_rx’ may be used unini
    tialized in this function [-Wmaybe-uninitialized]
    u32 idx_rx, idx_fq = 0;

    As an example, the code pattern looks like:
    u32 idx_cq;
    ...
    ret = xsk_ring_prod__reserve(&xsk->umem->fq, rcvd, &idx_fq);
    if (ret) {
    ...
    }
    ... idx_fq ...
    The compiler warns since it does not know whether &idx_fq is assigned
    or not inside the library function xsk_ring_prod__reserve().

    Let us assign an initial value 0 to such auto variables to silence
    compiler warning.

    Fixes: 248c7f9c0e21 ("samples/bpf: convert xdpsock to use libbpf for AF_XDP access")
    Signed-off-by: Yonghong Song
    Acked-by: Jonathan Lemon
    Acked-by: Song Liu
    Signed-off-by: Daniel Borkmann

    Yonghong Song
     

01 Mar, 2019

3 commits

  • Some samples don't really need the magic of bpf_load,
    switch them to libbpf.

    v2: - specify program types.

    Signed-off-by: Jakub Kicinski
    Reviewed-by: Quentin Monnet
    Acked-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann

    Jakub Kicinski
     
  • bpftool can do all the things load_sock_ops used to do, and more.
    Point users to bpftool instead of maintaining this sample utility.

    Signed-off-by: Jakub Kicinski
    Reviewed-by: Quentin Monnet
    Acked-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann

    Jakub Kicinski
     
  • ping localhost may default of IPv6 on modern systems, but
    samples are trying to only parse IPv4. Force IPv4.

    samples/bpf/tracex1_user.c doesn't interpret the packet so
    we don't care which IP version will be used there.

    Signed-off-by: Jakub Kicinski
    Reviewed-by: Quentin Monnet
    Acked-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann

    Jakub Kicinski
     

28 Feb, 2019

1 commit

  • Currently, running sample "task_fd_query" and "tracex3" occurs the
    following error. On kernel v5.0-rc* this sample will be unavailable
    due to the removal of function 'blk_start_request' at commit "a1ce35f".
    (function removed, as "Single Queue IO scheduler" no longer exists)

    $ sudo ./task_fd_query
    failed to create kprobe 'blk_start_request' error 'No such file or
    directory'

    This commit will change the function 'blk_start_request' to
    'blk_mq_start_request' to fix the broken sample.

    Signed-off-by: Daniel T. Lee
    Signed-off-by: Daniel Borkmann

    Daniel T. Lee
     

26 Feb, 2019

1 commit

  • This commit converts the xdpsock sample application to use the AF_XDP
    functions present in libbpf. This cuts down the size of it by nearly
    300 lines of code.

    The default ring sizes plus the batch size has been increased and the
    size of the umem area has decreased. This so that the sample application
    will provide higher throughput. Note also that the shared umem code
    has been removed from the sample as this is not supported by libbpf
    at this point in time.

    Tested-by: Björn Töpel
    Signed-off-by: Magnus Karlsson
    Signed-off-by: Daniel Borkmann

    Magnus Karlsson
     

22 Feb, 2019

1 commit

  • The xdp_redirect and xdp_redirect_map sample programs both load a dummy
    program onto the egress interfaces. However, the unload code checks these
    programs against the wrong id number, and thus refuses to unload them. Fix
    the comparison to avoid this.

    Fixes: 3b7a8ec2dec3 ("samples/bpf: Check the prog id before exiting")
    Signed-off-by: Toke Høiland-Jørgensen
    Acked-by: Maciej Fijalkowski
    Acked-by: Martin KaFai Lau
    Signed-off-by: Daniel Borkmann

    Toke Høiland-Jørgensen
     

18 Feb, 2019

1 commit

  • Linux 5.0-rc7

    * tag 'v5.0-rc7': (1667 commits)
    Linux 5.0-rc7
    Input: elan_i2c - add ACPI ID for touchpad in Lenovo V330-15ISK
    Input: st-keyscan - fix potential zalloc NULL dereference
    Input: apanel - switch to using brightness_set_blocking()
    powerpc/64s: Fix possible corruption on big endian due to pgd/pud_present()
    efi/arm: Revert "Defer persistent reservations until after paging_init()"
    arm64, mm, efi: Account for GICv3 LPI tables in static memblock reserve table
    sunrpc: fix 4 more call sites that were using stack memory with a scatterlist
    include/linux/module.h: copy __init/__exit attrs to init/cleanup_module
    Compiler Attributes: add support for __copy (gcc >= 9)
    lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure
    auxdisplay: ht16k33: fix potential user-after-free on module unload
    x86/platform/UV: Use efi_runtime_lock to serialise BIOS calls
    i2c: bcm2835: Clear current buffer pointers and counts after a transfer
    i2c: cadence: Fix the hold bit setting
    drm: Use array_size() when creating lease
    dm thin: fix bug where bio that overwrites thin block ignores FUA
    Revert "exec: load_script: don't blindly truncate shebang string"
    Revert "gfs2: read journal in large chunks to locate the head"
    net: ethernet: freescale: set FEC ethtool regs version
    ...

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

13 Feb, 2019

3 commits


09 Feb, 2019

1 commit


06 Feb, 2019

1 commit

  • There are new types and helpers that are supposed to be used in new code.

    As a preparation to get rid of legacy types and API functions do
    the conversion here.

    Cc: Kirti Wankhede
    Cc: Alex Williamson
    Signed-off-by: Andy Shevchenko
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Alex Williamson

    Andy Shevchenko
     

02 Feb, 2019

5 commits

  • Check the program id within the signal handler on polling xdp samples
    that were previously converted to libbpf usage. Avoid the situation of
    unloading the program that was not attached by sample that is exiting.
    Handle also the case where bpf_get_link_xdp_id didn't exit with an error
    but the xdp program was not found on an interface.

    Reported-by: Michal Papaj
    Reported-by: Jakub Spizewski
    Signed-off-by: Maciej Fijalkowski
    Reviewed-by: Jakub Kicinski
    Signed-off-by: Daniel Borkmann

    Maciej Fijalkowski
     
  • Make xdp samples consistent with iproute2 behavior and set the
    XDP_FLAGS_UPDATE_IF_NOEXIST by default when setting the xdp program on
    interface. Provide an option for user to force the program loading,
    which as a result will not include the mentioned flag in
    bpf_set_link_xdp_fd call.

    Signed-off-by: Maciej Fijalkowski
    Reviewed-by: Jakub Kicinski
    Acked-by: John Fastabend
    Signed-off-by: Daniel Borkmann

    Maciej Fijalkowski
     
  • There is a common problem with xdp samples that happens when user wants
    to run a particular sample and some bpf program is already loaded. The
    default 64kb RLIMIT_MEMLOCK resource limit will cause a following error
    (assuming that xdp sample that is failing was converted to libbpf
    usage):

    libbpf: Error in bpf_object__probe_name():Operation not permitted(1).
    Couldn't load basic 'r0 = 0' BPF program.
    libbpf: failed to load object './xdp_sample_pkts_kern.o'

    Fix it in xdp_sample_pkts and xdp_router_ipv4 by setting RLIMIT_MEMLOCK
    to RLIM_INFINITY.

    Signed-off-by: Maciej Fijalkowski
    Reviewed-by: Jakub Kicinski
    Acked-by: Jesper Dangaard Brouer
    Acked-by: John Fastabend
    Signed-off-by: Daniel Borkmann

    Maciej Fijalkowski
     
  • Some of XDP samples that are attaching the bpf program to the interface
    via libbpf's bpf_set_link_xdp_fd are still using the bpf_load.c for
    loading and manipulating the ebpf program and maps. Convert them to do
    this through libbpf usage and remove bpf_load from the picture.

    While at it remove what looks like debug leftover in
    xdp_redirect_map_user.c

    In xdp_redirect_cpu, change the way that the program to be loaded onto
    interface is chosen - user now needs to pass the program's section name
    instead of the relative number. In case of typo print out the section
    names to choose from.

    Signed-off-by: Maciej Fijalkowski
    Reviewed-by: Jakub Kicinski
    Acked-by: Jesper Dangaard Brouer
    Signed-off-by: Daniel Borkmann

    Maciej Fijalkowski
     
  • The sample xdp_redirect_cpu is not using helper bpf_trace_printk.
    Thus it makes no sense that the --debug option us reading
    from /sys/kernel/debug/tracing/trace_pipe via read_trace_pipe.
    Simply remove it.

    Signed-off-by: Jesper Dangaard Brouer
    Acked-by: John Fastabend
    Signed-off-by: Daniel Borkmann

    Jesper Dangaard Brouer
     

30 Jan, 2019

1 commit


29 Jan, 2019

1 commit

  • Daniel Borkmann says:

    ====================
    pull-request: bpf-next 2019-01-29

    The following pull-request contains BPF updates for your *net-next* tree.

    The main changes are:

    1) Teach verifier dead code removal, this also allows for optimizing /
    removing conditional branches around dead code and to shrink the
    resulting image. Code store constrained architectures like nfp would
    have hard time doing this at JIT level, from Jakub.

    2) Add JMP32 instructions to BPF ISA in order to allow for optimizing
    code generation for 32-bit sub-registers. Evaluation shows that this
    can result in code reduction of ~5-20% compared to 64 bit-only code
    generation. Also add implementation for most JITs, from Jiong.

    3) Add support for __int128 types in BTF which is also needed for
    vmlinux's BTF conversion to work, from Yonghong.

    4) Add a new command to bpftool in order to dump a list of BPF-related
    parameters from the system or for a specific network device e.g. in
    terms of available prog/map types or helper functions, from Quentin.

    5) Add AF_XDP sock_diag interface for querying sockets from user
    space which provides information about the RX/TX/fill/completion
    rings, umem, memory usage etc, from Björn.

    6) Add skb context access for skb_shared_info->gso_segs field, from Eric.

    7) Add support for testing flow dissector BPF programs by extending
    existing BPF_PROG_TEST_RUN infrastructure, from Stanislav.

    8) Split BPF kselftest's test_verifier into various subgroups of tests
    in order better deal with merge conflicts in this area, from Jakub.

    9) Add support for queue/stack manipulations in bpftool, from Stanislav.

    10) Document BTF, from Yonghong.

    11) Dump supported ELF section names in libbpf on program load
    failure, from Taeung.

    12) Silence a false positive compiler warning in verifier's BTF
    handling, from Peter.

    13) Fix help string in bpftool's feature probing, from Prashant.

    14) Remove duplicate includes in BPF kselftests, from Yue.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

27 Jan, 2019

1 commit


26 Jan, 2019

1 commit


25 Jan, 2019

1 commit

  • Sparse reported warnings about non-static symbols. For the variables
    a simple static attribute is fine - for the functions referenced by
    livepatch via klp_func the symbol-names must be unmodified in the
    symbol table and the patchable code has to be emitted. The resolution
    is to attach __used attribute to the shared statically declared functions.

    Link: https://lore.kernel.org/lkml/1544965657-26804-1-git-send-email-hofrat@osadl.org/
    Suggested-by: Joe Lawrence
    Signed-off-by: Nicholas Mc Guire
    Acked-by: Miroslav Benes
    Signed-off-by: Jiri Kosina

    Nicholas Mc Guire
     

16 Jan, 2019

2 commits

  • x86 compilation has required asm goto support since 4.17.
    Since clang does not support asm goto, at 4.17,
    Commit b1ae32dbab50 ("x86/cpufeature: Guard asm_volatile_goto usage
    for BPF compilation") worked around the issue by permitting an
    alternative implementation without asm goto for clang.

    At 5.0, more asm goto usages appeared.
    [yhs@148 x86]$ egrep -r asm_volatile_goto
    include/asm/cpufeature.h: asm_volatile_goto("1: jmp 6f\n"
    include/asm/jump_label.h: asm_volatile_goto("1:"
    include/asm/jump_label.h: asm_volatile_goto("1:"
    include/asm/rmwcc.h: asm_volatile_goto (fullop "; j" #cc " %l[cc_label]" \
    include/asm/uaccess.h: asm_volatile_goto("\n" \
    include/asm/uaccess.h: asm_volatile_goto("\n" \
    [yhs@148 x86]$

    Compiling samples/bpf directories, most bpf programs failed
    compilation with error messages like:
    In file included from /home/yhs/work/bpf-next/samples/bpf/xdp_sample_pkts_kern.c:2:
    In file included from /home/yhs/work/bpf-next/include/linux/ptrace.h:6:
    In file included from /home/yhs/work/bpf-next/include/linux/sched.h:15:
    In file included from /home/yhs/work/bpf-next/include/linux/sem.h:5:
    In file included from /home/yhs/work/bpf-next/include/uapi/linux/sem.h:5:
    In file included from /home/yhs/work/bpf-next/include/linux/ipc.h:9:
    In file included from /home/yhs/work/bpf-next/include/linux/refcount.h:72:
    /home/yhs/work/bpf-next/arch/x86/include/asm/refcount.h:70:9: error: 'asm goto' constructs are not supported yet
    return GEN_BINARY_SUFFIXED_RMWcc(LOCK_PREFIX "subl",
    ^
    /home/yhs/work/bpf-next/arch/x86/include/asm/rmwcc.h:67:2: note: expanded from macro 'GEN_BINARY_SUFFIXED_RMWcc'
    __GEN_RMWcc(op " %[val], %[var]\n\t" suffix, var, cc, \
    ^
    /home/yhs/work/bpf-next/arch/x86/include/asm/rmwcc.h:21:2: note: expanded from macro '__GEN_RMWcc'
    asm_volatile_goto (fullop "; j" #cc " %l[cc_label]" \
    ^
    /home/yhs/work/bpf-next/include/linux/compiler_types.h:188:37: note: expanded from macro 'asm_volatile_goto'
    #define asm_volatile_goto(x...) asm goto(x)

    Most implementation does not even provide an alternative
    implementation. And it is also not practical to make changes
    for each call site.

    This patch workarounded the asm goto issue by redefining the macro like below:
    #define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto")

    If asm_volatile_goto is not used by bpf programs, which is typically the case, nothing bad
    will happen. If asm_volatile_goto is used by bpf programs, which is incorrect, the compiler
    will issue an error since "invalid use of asm_volatile_goto" is not valid assembly codes.

    With this patch, all bpf programs under samples/bpf can pass compilation.

    Note that bpf programs under tools/testing/selftests/bpf/ compiled fine as
    they do not access kernel internal headers.

    Fixes: e769742d3584 ("Revert "x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs"")
    Fixes: 18fe58229d80 ("x86, asm: change the GEN_*_RMWcc() macros to not quote the condition")
    Acked-by: Alexei Starovoitov
    Signed-off-by: Yonghong Song
    Signed-off-by: Daniel Borkmann

    Yonghong Song
     
  • Pull networking fixes from David Miller:

    1) Fix regression in multi-SKB responses to RTM_GETADDR, from Arthur
    Gautier.

    2) Fix ipv6 frag parsing in openvswitch, from Yi-Hung Wei.

    3) Unbounded recursion in ipv4 and ipv6 GUE tunnels, from Stefano
    Brivio.

    4) Use after free in hns driver, from Yonglong Liu.

    5) icmp6_send() needs to handle the case of NULL skb, from Eric
    Dumazet.

    6) Missing rcu read lock in __inet6_bind() when operating on mapped
    addresses, from David Ahern.

    7) Memory leak in tipc-nl_compat_publ_dump(), from Gustavo A. R. Silva.

    8) Fix PHY vs r8169 module loading ordering issues, from Heiner
    Kallweit.

    9) Fix bridge vlan memory leak, from Ido Schimmel.

    10) Dev refcount leak in AF_PACKET, from Jason Gunthorpe.

    11) Infoleak in ipv6_local_error(), flow label isn't completely
    initialized. From Eric Dumazet.

    12) Handle mv88e6390 errata, from Andrew Lunn.

    13) Making vhost/vsock CID hashing consistent, from Zha Bin.

    14) Fix lack of UMH cleanup when it unexpectedly exits, from Taehee Yoo.

    15) Bridge forwarding must clear skb->tstamp, from Paolo Abeni.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (87 commits)
    bnxt_en: Fix context memory allocation.
    bnxt_en: Fix ring checking logic on 57500 chips.
    mISDN: hfcsusb: Use struct_size() in kzalloc()
    net: clear skb->tstamp in bridge forwarding path
    net: bpfilter: disallow to remove bpfilter module while being used
    net: bpfilter: restart bpfilter_umh when error occurred
    net: bpfilter: use cleanup callback to release umh_info
    umh: add exit routine for UMH process
    isdn: i4l: isdn_tty: Fix some concurrency double-free bugs
    vhost/vsock: fix vhost vsock cid hashing inconsistent
    net: stmmac: Prevent RX starvation in stmmac_napi_poll()
    net: stmmac: Fix the logic of checking if RX Watchdog must be enabled
    net: stmmac: Check if CBS is supported before configuring
    net: stmmac: dwxgmac2: Only clear interrupts that are active
    net: stmmac: Fix PCI module removal leak
    tools/bpf: fix bpftool map dump with bitfields
    tools/bpf: test btf bitfield with >=256 struct member offset
    bpf: fix bpffs bitfield pretty print
    net: ethernet: mediatek: fix warning in phy_start_aneg
    tcp: change txhash on SYN-data timeout
    ...

    Linus Torvalds
     

15 Jan, 2019

1 commit

  • This adds a simple sample program mounting binderfs and adding, then
    removing a binder device. Hopefully, it will be helpful to users who want
    to know how binderfs is supposed to be used.

    Signed-off-by: Christian Brauner
    Signed-off-by: Jonathan Corbet

    Christian Brauner
     

12 Jan, 2019

1 commit

  • The possibility to re-enable a registered patch was useful for immediate
    patches where the livepatch module had to stay until the system reboot.
    The improved consistency model allows to achieve the same result by
    unloading and loading the livepatch module again.

    Also we are going to add a feature called atomic replace. It will allow
    to create a patch that would replace all already registered patches.
    The aim is to handle dependent patches more securely. It will obsolete
    the stack of patches that helped to handle the dependencies so far.
    Then it might be unclear when a cumulative patch re-enabling is safe.

    It would be complicated to support the many modes. Instead we could
    actually make the API and code easier to understand.

    Therefore, remove the two step public API. All the checks and init calls
    are moved from klp_register_patch() to klp_enabled_patch(). Also the patch
    is automatically freed, including the sysfs interface when the transition
    to the disabled state is completed.

    As a result, there is never a disabled patch on the top of the stack.
    Therefore we do not need to check the stack in __klp_enable_patch().
    And we could simplify the check in __klp_disable_patch().

    Also the API and logic is much easier. It is enough to call
    klp_enable_patch() in module_init() call. The patch can be disabled
    by writing '0' into /sys/kernel/livepatch//enabled. Then the module
    can be removed once the transition finishes and sysfs interface is freed.

    The only problem is how to free the structures and kobjects safely.
    The operation is triggered from the sysfs interface. We could not put
    the related kobject from there because it would cause lock inversion
    between klp_mutex and kernfs locks, see kn->count lockdep map.

    Therefore, offload the free task to a workqueue. It is perfectly fine:

    + The patch can no longer be used in the livepatch operations.

    + The module could not be removed until the free operation finishes
    and module_put() is called.

    + The operation is asynchronous already when the first
    klp_try_complete_transition() fails and another call
    is queued with a delay.

    Suggested-by: Josh Poimboeuf
    Signed-off-by: Petr Mladek
    Acked-by: Miroslav Benes
    Acked-by: Josh Poimboeuf
    Signed-off-by: Jiri Kosina

    Petr Mladek
     

10 Jan, 2019

1 commit

  • Use optind as index for argv instead of a hardcoded value.
    When the program has options this leads to improper parameter handling.

    Fixes: dc378a1ab5b6 ("samples: bpf: get ifindex from ifname")
    Signed-off-by: Ioana Ciornei
    Acked-by: Matteo Croce
    Signed-off-by: Daniel Borkmann

    Ioana Ciornei