06 Jan, 2021

1 commit

  • commit 7ddcdea5b54492f54700f427f58690cf1e187e5e upstream.

    To pick up the changes in:

    a85cbe6159ffc973 ("uapi: move constants from to ")

    That causes no changes in tooling, just addresses this perf build
    warning:

    Warning: Kernel ABI header at 'tools/include/uapi/linux/const.h' differs from latest version at 'include/uapi/linux/const.h'
    diff -u tools/include/uapi/linux/const.h include/uapi/linux/const.h

    Cc: Adrian Hunter
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Petr Vorel
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Arnaldo Carvalho de Melo
     

30 Dec, 2020

12 commits

  • [ Upstream commit 5149303fdfe5c67ddb51c911e23262f781cd75eb ]

    The argv_split() function must be paired with argv_free(), else we must
    keep a reference to the argv array received or do the freeing ourselves,
    in synthesize_sdt_probe_command() we were simply leaking that argv[]
    array.

    Fixes: 3b1f8311f6963cd1 ("perf probe: Add sdt probes arguments into the uprobe cmd string")
    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Alexandre Truong
    Cc: Alexis Berlemont
    Cc: He Zhe
    Cc: Ian Rogers
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: John Garry
    Cc: Mark Rutland
    Cc: Masami Hiramatsu
    Cc: Mathieu Poirier
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Sumanth Korikkar
    Cc: Thomas Richter
    Cc: Will Deacon
    Link: https://lore.kernel.org/r/20201224135139.GF477817@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Arnaldo Carvalho de Melo
     
  • [ Upstream commit 2eb5dd418034ecea2f7031e3d33f2991a878b148 ]

    When using 'perf record's option '-I' or '--user-regs=' along with
    argument '?' to list available register names, memory of variable 'os'
    allocated by strdup() needs to be released before __parse_regs()
    returns, otherwise memory leak will occur.

    Fixes: bcc84ec65ad1 ("perf record: Add ability to name registers to record")
    Signed-off-by: Zheng Zengkai
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Li Bin
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Link: https://lore.kernel.org/r/20200703093344.189450-1-zhengzengkai@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Zheng Zengkai
     
  • [ Upstream commit 09d59c2f3465fb01e65a0c96698697b026ea8e79 ]

    We're missing -lcap in test-all.bin target, so in case it's the only
    library missing (if more are missing test-all.bin fails anyway), we will
    falsely claim that we detected it and fail build, like:

    $ make
    ...
    Auto-detecting system features:
    ... dwarf: [ on ]
    ... dwarf_getlocations: [ on ]
    ... glibc: [ on ]
    ... libbfd: [ on ]
    ... libbfd-buildid: [ on ]
    ... libcap: [ on ]
    ... libelf: [ on ]
    ... libnuma: [ on ]
    ... numa_num_possible_cpus: [ on ]
    ... libperl: [ on ]
    ... libpython: [ on ]
    ... libcrypto: [ on ]
    ... libunwind: [ on ]
    ... libdw-dwarf-unwind: [ on ]
    ... zlib: [ on ]
    ... lzma: [ on ]
    ... get_cpuid: [ on ]
    ... bpf: [ on ]
    ... libaio: [ on ]
    ... libzstd: [ on ]
    ... disassembler-four-args: [ on ]

    ...

    CC builtin-ftrace.o

    In file included from builtin-ftrace.c:29:
    util/cap.h:11:10: fatal error: sys/capability.h: No such file or directory
    11 | #include
    | ^~~~~~~~~~~~~~~~~~
    compilation terminated.

    Fixes: 74d5f3d06f707eb5 ("tools build: Add capability-related feature detection")
    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Ian Rogers
    Cc: Igor Lubashev
    Cc: Mark Rutland
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20201203230836.3751981-1-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Jiri Olsa
     
  • [ Upstream commit b2ce5dbc15819ea4bef47dbd368239cb1e965158 ]

    Commit e1c92a7fbbc5 ("perf tests: Add another metric parsing test") add
    another test for metric parsing. The test goes through all metrics
    compiled for arch within pmu events and try to parse them.

    Right now this test is failing in powerpc machine.

    Result in power9 platform:

    [command]# ./perf test 10
    10: PMU events :
    10.1: PMU event table sanity : Ok
    10.2: PMU event map aliases : Ok
    10.3: Parsing of PMU event table metrics : Skip (some metrics failed)
    10.4: Parsing of PMU event table metrics with fake PMUs : FAILED!

    Issue is we are passing different runtime parameter value in
    "expr__find_other" and "expr__parse" function which is called from
    function `metric_parse_fake`. And because of this parsing of hv-24x7
    metrics is failing.

    [command]# ./perf test 10 -vv
    .....
    hv_24x7/pm_mcs01_128b_rd_disp_port01,chip=1/ not found
    expr__parse failed
    test child finished with -1
    ---- end ----
    PMU events subtest 4: FAILED!

    This patch fix this issue and change runtime parameter value to '0' in
    expr__parse function.

    Result in power9 platform after this patch:

    [command]# ./perf test 10
    10: PMU events :
    10.1: PMU event table sanity : Ok
    10.2: PMU event map aliases : Ok
    10.3: Parsing of PMU event table metrics : Skip (some metrics failed)
    10.4: Parsing of PMU event table metrics with fake PMUs : Ok

    Fixes: e1c92a7fbbc5 ("perf tests: Add another metric parsing test")
    Signed-off-by: Kajol Jain
    Acked-by: Ian Rogers
    Acked-by: Jiri Olsa
    Cc: Madhavan Srinivasan
    Cc: Ravi Bangoria
    Link: http://lore.kernel.org/lkml/20201119152411.46041-1-kjain@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Kajol Jain
     
  • [ Upstream commit eceae70bdeaeb6b8ceb662983cf663ff352fbc96 ]

    strncat()'s third argument is how many bytes will be added *in addition* to
    already existing bytes in destination. Plus extra zero byte will be added
    after that. So existing use in test_sockmap has many opportunities to overflow
    the string and cause memory corruptions. And in this case, GCC complains for
    a good reason.

    Fixes: 16962b2404ac ("bpf: sockmap, add selftests")
    Fixes: 73563aa3d977 ("selftests/bpf: test_sockmap, print additional test options")
    Fixes: 1ade9abadfca ("bpf: test_sockmap, add options for msg_pop_data() helper")
    Fixes: 463bac5f1ca7 ("bpf, selftests: Add test for ktls with skb bpf ingress policy")
    Fixes: e9dd904708c4 ("bpf: add tls support for testing in test_sockmap")
    Fixes: 753fb2ee0934 ("bpf: sockmap, add msg_peek tests to test_sockmap")
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Alexei Starovoitov
    Link: https://lore.kernel.org/bpf/20201203235440.2302137-2-andrii@kernel.org
    Signed-off-by: Sasha Levin

    Andrii Nakryiko
     
  • [ Upstream commit 9cf309c56f7910a81fbe053b6f11c3b1f0987b12 ]

    When we added sanitising of map names before loading programs to libbpf, we
    still allowed periods in the name. While the kernel will accept these for
    the map names themselves, they are not allowed in file names when pinning
    maps. This means that bpf_object__pin_maps() will fail if called on an
    object that contains internal maps (such as sections .rodata).

    Fix this by replacing periods with underscores when constructing map pin
    paths. This only affects the paths generated by libbpf when
    bpf_object__pin_maps() is called with a path argument. Any pin paths set
    by bpf_map__set_pin_path() are unaffected, and it will still be up to the
    caller to avoid invalid characters in those.

    Fixes: 113e6b7e15e2 ("libbpf: Sanitise internal map names so they are not rejected by the kernel")
    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/20201203093306.107676-1-toke@redhat.com
    Signed-off-by: Sasha Levin

    Toke Høiland-Jørgensen
     
  • [ Upstream commit 2c07343abd8932200a45ff7b10950e71081e9e77 ]

    seccomp_bpf.c uses unshare(CLONE_NEWPID), which requires CONFIG_PID_NS
    to be set.

    Cc: Kees Cook
    Cc: Shuah Khan
    Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace")
    Signed-off-by: Mickaël Salaün
    Acked-by: Tycho Andersen
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20201202162643.249276-1-mic@digikod.net
    Signed-off-by: Sasha Levin

    Mickaël Salaün
     
  • [ Upstream commit 6016df8fe874e1cf36f6357d71438b384198ce06 ]

    The selftests/bpf Makefile includes system include directories from
    the host, when building BPF programs. On RISC-V glibc requires that
    __riscv_xlen is defined. This is not the case for "clang -target bpf",
    which messes up __WORDSIZE (errno.h -> ... -> wordsize.h) and breaks
    the build.

    By explicitly defining __risc_xlen correctly for riscv, we can
    workaround this.

    Fixes: 167381f3eac0 ("selftests/bpf: Makefile fix "missing" headers on build with -idirafter")
    Signed-off-by: Björn Töpel
    Signed-off-by: Andrii Nakryiko
    Acked-by: Luke Nelson
    Link: https://lore.kernel.org/bpf/20201118071640.83773-2-bjorn.topel@gmail.com
    Signed-off-by: Sasha Levin

    Björn Töpel
     
  • [ Upstream commit 58cfa49c2ba7f815adccc27a775e7cf8a8f7f539 ]

    In comment 173ca26e9b51 ("samples/bpf: add comprehensive ipip, ipip6,
    ip6ip6 test") we added ip6ip6 test for bpf tunnel testing. But in commit
    933a741e3b82 ("selftests/bpf: bpf tunnel test.") when we moved it to
    the current folder, we didn't add it.

    This patch add the ip6ip6 test back to bpf tunnel test. Update the ipip6's
    topology for both IPv4 and IPv6 testing. Since iperf test is removed as
    currect framework simplified it in purpose, I also removed unused tcp
    checkings in test_tunnel_kern.c.

    Fixes: 933a741e3b82 ("selftests/bpf: bpf tunnel test.")
    Signed-off-by: Hangbin Liu
    Signed-off-by: Alexei Starovoitov
    Link: https://lore.kernel.org/bpf/20201110015013.1570716-2-liuhangbin@gmail.com
    Signed-off-by: Sasha Levin

    Hangbin Liu
     
  • [ Upstream commit 93f20eff0cca972d74cb554a2e8b47730228be16 ]

    Should be -d instead of -n for dry-run.

    Fixes: 5da1918446a1 ("selftests/run_kselftest.sh: Make each test individually selectable")
    Signed-off-by: Hangbin Liu
    Signed-off-by: Shuah Khan
    Signed-off-by: Sasha Levin

    Hangbin Liu
     
  • [ Upstream commit f0e5ba0bc481df77cf0afac2b33e420b33eeb463 ]

    The {inode,sk}_storage_result checking if the correct value was retrieved
    was being clobbered unconditionally by the return value of the
    bpf_{inode,sk}_storage_delete call.

    Also, consistently use the newly added BPF_LOCAL_STORAGE_GET_F_CREATE
    flag.

    Fixes: cd324d7abb3d ("bpf: Add selftests for local_storage")
    Signed-off-by: KP Singh
    Signed-off-by: Alexei Starovoitov
    Acked-by: Song Liu
    Link: https://lore.kernel.org/bpf/20201106103747.2780972-7-kpsingh@chromium.org
    Signed-off-by: Sasha Levin

    KP Singh
     
  • [ Upstream commit 9b0a7836359443227c9af101f7aea8412e739458 ]

    I found that the UNHALTED_CORE_CYCLES event is only available in the
    Intel machines and it makes other vendors/archs fail on the test. As
    libpfm4 can parse the generic events like cycles, let's use them.

    Fixes: 40b74c30ffb9 ("perf test: Add expand cgroup event test")
    Signed-off-by: Namhyung Kim
    Acked-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20201027072855.655449-1-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Namhyung Kim
     

21 Dec, 2020

2 commits

  • commit 170f4869e66275f498ae4736106fb54c0fdcd036 upstream.

    The logic for truncating the log file for emailing based on the
    MAIL_MAX_SIZE option is confusing and incorrect. Simplify it and have the
    tail of the log file truncated to the max size specified in the config.

    Cc: stable@vger.kernel.org
    Fixes: 855d8abd2e8ff ("ktest.pl: Change the logic to control the size of the log file emailed")
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt (VMware)
     
  • commit 8cd6bc0359deebd8500e6de95899a8a78d3ec4ba upstream.

    If the size of the error log is too big to send via email, and the sending
    fails, it wont email any result. This can be confusing for the user who is
    waiting for an email on the completion of the tests.

    If it fails to send email, then try again without the log file stating that
    it failed to send an email. Obviously this will not be of use if the sending
    of email failed for some other reasons, but it will at least give the user
    some information when it fails for the most common reason.

    Cc: stable@vger.kernel.org
    Fixes: c2d84ddb338c8 ("ktest.pl: Add MAIL_COMMAND option to define how to send email")
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt (VMware)
     

13 Dec, 2020

1 commit

  • Pull kvm fixes from Paolo Bonzini:
    "Bugfixes for ARM, x86 and tools"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
    tools/kvm_stat: Exempt time-based counters
    KVM: mmu: Fix SPTE encoding of MMIO generation upper half
    kvm: x86/mmu: Use cpuid to determine max gfn
    kvm: svm: de-allocate svm_cpu_data for all cpus in svm_cpu_uninit()
    selftests: kvm/set_memory_region_test: Fix race in move region test
    KVM: arm64: Add usage of stage 2 fault lookup level in user_mem_abort()
    KVM: arm64: Fix handling of merging tables into a block entry
    KVM: arm64: Fix memory leak on stage2 update of a valid PTE

    Linus Torvalds
     

12 Dec, 2020

2 commits

  • The new counters halt_poll_success_ns and halt_poll_fail_ns do not count
    events. Instead they provide a time, and mess up our statistics. Therefore,
    we should exclude them.
    Removal is currently implemented with an exempt list. If more counters like
    these appear, we can think about a more general rule like excluding all
    fields name "*_ns", in case that's a standing convention.

    Signed-off-by: Stefan Raspl
    Tested-and-reported-by: Christian Borntraeger
    Message-Id:
    Signed-off-by: Paolo Bonzini

    Stefan Raspl
     
  • Remove bpf_ prefix, which causes these helpers to be reported in verifier
    dump as bpf_bpf_this_cpu_ptr() and bpf_bpf_per_cpu_ptr(), respectively. Lets
    fix it as long as it is still possible before UAPI freezes on these helpers.

    Fixes: eaa6bcb71ef6 ("bpf: Introduce bpf_per_cpu_ptr()")
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Alexei Starovoitov
    Signed-off-by: Daniel Borkmann
    Signed-off-by: Linus Torvalds

    Andrii Nakryiko
     

11 Dec, 2020

7 commits

  • Pull ktest fix from Steven Rostedt:
    "Fix issues with grub2bls in ktest.pl

    ktest.pl did not know about grub2bls that was introduced in Fedora 30,
    and now it does"

    * tag 'ktest-v5.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest:
    ktest.pl: Fix incorrect reboot for grub2bls

    Linus Torvalds
     
  • Pull networking fixes from David Miller:

    1) IPsec compat fixes, from Dmitry Safonov.

    2) Fix memory leak in xfrm_user_policy(). Fix from Yu Kuai.

    3) Fix polling in xsk sockets by using sk_poll_wait() instead of
    datagram_poll() which keys off of sk_wmem_alloc and such which xsk
    sockets do not update. From Xuan Zhuo.

    4) Missing init of rekey_data in cfgh80211, from Sara Sharon.

    5) Fix destroy of timer before init, from Davide Caratti.

    6) Missing CRYPTO_CRC32 selects in ethernet driver Kconfigs, from Arnd
    Bergmann.

    7) Missing error return in rtm_to_fib_config() switch case, from Zhang
    Changzhong.

    8) Fix some src/dest address handling in vrf and add a testcase. From
    Stephen Suryaputra.

    9) Fix multicast handling in Seville switches driven by mscc-ocelot
    driver. From Vladimir Oltean.

    10) Fix proto value passed to skb delivery demux in udp, from Xin Long.

    11) HW pkt counters not reported correctly in enetc driver, from Claudiu
    Manoil.

    12) Fix deadlock in bridge, from Joseph Huang.

    13) Missing of_node_pur() in dpaa2 driver, fromn Christophe JAILLET.

    14) Fix pid fetching in bpftool when there are a lot of results, from
    Andrii Nakryiko.

    15) Fix long timeouts in nft_dynset, from Pablo Neira Ayuso.

    16) Various stymmac fixes, from Fugang Duan.

    17) Fix null deref in tipc, from Cengiz Can.

    18) When mss is biog, coose more resonable rcvq_space in tcp, fromn Eric
    Dumazet.

    19) Revert a geneve change that likely isnt necessary, from Jakub
    Kicinski.

    20) Avoid premature rx buffer reuse in various Intel driversm from Björn
    Töpel.

    21) retain EcT bits during TIS reflection in tcp, from Wei Wang.

    22) Fix Tso deferral wrt. cwnd limiting in tcp, from Neal Cardwell.

    23) MPLS_OPT_LSE_LABEL attribute is 342 ot 8 bits, from Guillaume Nault

    24) Fix propagation of 32-bit signed bounds in bpf verifier and add test
    cases, from Alexei Starovoitov.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (81 commits)
    selftests: fix poll error in udpgro.sh
    selftests/bpf: Fix "dubious pointer arithmetic" test
    selftests/bpf: Fix array access with signed variable test
    selftests/bpf: Add test for signed 32-bit bound check bug
    bpf: Fix propagation of 32-bit signed bounds from 64-bit bounds.
    MAINTAINERS: Add entry for Marvell Prestera Ethernet Switch driver
    net: sched: Fix dump of MPLS_OPT_LSE_LABEL attribute in cls_flower
    net/mlx4_en: Handle TX error CQE
    net/mlx4_en: Avoid scheduling restart task if it is already running
    tcp: fix cwnd-limited bug for TSO deferral where we send nothing
    net: flow_offload: Fix memory leak for indirect flow block
    tcp: Retain ECT bits for tos reflection
    ethtool: fix stack overflow in ethnl_parse_bitset()
    e1000e: fix S0ix flow to allow S0i3.2 subset entry
    ice: avoid premature Rx buffer reuse
    ixgbe: avoid premature Rx buffer reuse
    i40e: avoid premature Rx buffer reuse
    igb: avoid transmit queue timeout in xdp path
    igb: use xdp_do_flush
    igb: skb add metasize for xdp
    ...

    Linus Torvalds
     
  • Alexei Starovoitov says:

    ====================
    pull-request: bpf 2020-12-10

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

    We've added 21 non-merge commits during the last 12 day(s) which contain
    a total of 21 files changed, 163 insertions(+), 88 deletions(-).

    The main changes are:

    1) Fix propagation of 32-bit signed bounds from 64-bit bounds, from Alexei.

    2) Fix ring_buffer__poll() return value, from Andrii.

    3) Fix race in lwt_bpf, from Cong.

    4) Fix test_offload, from Toke.

    5) Various xsk fixes.

    Please consider pulling these changes from:

    git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git

    Thanks a lot!

    Also thanks to reporters, reviewers and testers of commits in this pull-request:

    Cong Wang, Hulk Robot, Jakub Kicinski, Jean-Philippe Brucker, John
    Fastabend, Magnus Karlsson, Maxim Mikityanskiy, Yonghong Song
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • The test program udpgso_bench_rx always invokes the poll()
    syscall with a timeout of 10ms. If a larger timeout is specified
    via the command line, udpgso_bench_rx is supposed to do multiple
    poll() calls till the timeout is expired or an event is received.

    Currently the poll() loop errors out after the first invocation with
    no events, and may causes self-tests failure alike:

    failed
    GRO with custom segment size ./udpgso_bench_rx: poll: 0x0 expected 0x1

    This change addresses the issue allowing the poll() loop to consume
    all the configured timeout.

    Fixes: ada641ff6ed3 ("selftests: fixes for UDP GRO")
    Signed-off-by: Paolo Abeni
    Signed-off-by: David S. Miller

    Paolo Abeni
     
  • The verifier trace changed following a bugfix. After checking the 64-bit
    sign, only the upper bit mask is known, not bit 31. Update the test
    accordingly.

    Signed-off-by: Jean-Philippe Brucker
    Acked-by: John Fastabend
    Signed-off-by: Alexei Starovoitov

    Jean-Philippe Brucker
     
  • The test fails because of a recent fix to the verifier, even though this
    program is valid. In details what happens is:

    7: (61) r1 = *(u32 *)(r0 +0)

    Load a 32-bit value, with signed bounds [S32_MIN, S32_MAX]. The bounds
    of the 64-bit value are [0, U32_MAX]...

    8: (65) if r1 s> 0xffffffff goto pc+1

    ... therefore this is always true (the operand is sign-extended).

    10: (b4) w2 = 11
    11: (6d) if r2 s> r1 goto pc+1

    When true, the 64-bit bounds become [0, 10]. The 32-bit bounds are still
    [S32_MIN, 10].

    13: (64) w1 <
    Acked-by: John Fastabend
    Signed-off-by: Alexei Starovoitov

    Jean-Philippe Brucker
     
  • After a 32-bit load followed by a branch, the verifier would reduce the
    maximum bound of the register to 0x7fffffff, allowing a user to bypass
    bound checks. Ensure such a program is rejected.

    In the second test, the 64-bit compare should not sufficient to
    determine whether the signed 32-bit lower bound is 0, so the verifier
    should reject the second branch.

    Signed-off-by: Jean-Philippe Brucker
    Acked-by: John Fastabend
    Signed-off-by: Alexei Starovoitov

    Jean-Philippe Brucker
     

09 Dec, 2020

5 commits

  • A few of the tests in test_offload.py expects to see a certain number of
    maps created, and checks this by counting the number of maps returned by
    bpftool. There is already a filter that will remove any maps already there
    at the beginning of the test, but bpftool now creates a map for the PID
    iterator rodata on each invocation, which makes the map count wrong. Fix
    this by also filtering the pid_iter.rodata map by name when counting.

    Fixes: d53dee3fe013 ("tools/bpftool: Show info for processes holding BPF map/prog/link/btf FDs")
    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Daniel Borkmann
    Acked-by: Jakub Kicinski
    Link: https://lore.kernel.org/bpf/160752226387.110217.9887866138149423444.stgit@toke.dk

    Toke Høiland-Jørgensen
     
  • When setting the ethtool feature flag fails (as expected for the test), the
    kernel now tracks that the feature was requested to be 'off' and refuses to
    subsequently disable it again. So reset it back to 'on' so a subsequent
    disable (that's not supposed to fail) can succeed.

    Fixes: 417ec26477a5 ("selftests/bpf: add offload test based on netdevsim")
    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Daniel Borkmann
    Acked-by: Jakub Kicinski
    Link: https://lore.kernel.org/bpf/160752226280.110217.10696241563705667871.stgit@toke.dk

    Toke Høiland-Jørgensen
     
  • Commit 7f0a838254bd ("bpf, xdp: Maintain info on attached XDP BPF programs
    in net_device") changed the case of some of the extack messages being
    returned when attaching of XDP programs failed. This broke test_offload.py,
    so let's fix the test to reflect this.

    Fixes: 7f0a838254bd ("bpf, xdp: Maintain info on attached XDP BPF programs in net_device")
    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Daniel Borkmann
    Acked-by: Jakub Kicinski
    Link: https://lore.kernel.org/bpf/160752226175.110217.11214100824416344952.stgit@toke.dk

    Toke Høiland-Jørgensen
     
  • Since commit 6f8a57ccf851 ("bpf: Make verifier log more relevant by
    default"), the verifier discards log messages for successfully-verified
    programs. This broke test_offload.py which is looking for a verification
    message from the driver callback. Change test_offload.py to use the toggle
    in netdevsim to make the verification fail before looking for the
    verification message.

    Fixes: 6f8a57ccf851 ("bpf: Make verifier log more relevant by default")
    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Daniel Borkmann
    Acked-by: Jakub Kicinski
    Link: https://lore.kernel.org/bpf/160752226069.110217.12370824996153348073.stgit@toke.dk

    Toke Høiland-Jørgensen
     
  • Since we just removed the xdp_attachment_flags_ok() callback, also remove
    the check for it in test_offload.py, and replace it with a test for the new
    ambiguity-avoid check when multiple programs are loaded.

    Fixes: 7f0a838254bd ("bpf, xdp: Maintain info on attached XDP BPF programs in net_device")
    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Daniel Borkmann
    Acked-by: Jakub Kicinski
    Link: https://lore.kernel.org/bpf/160752225858.110217.13036901876869496246.stgit@toke.dk

    Toke Høiland-Jørgensen
     

08 Dec, 2020

1 commit

  • In case of having so many PID results that they don't fit into a singe page
    (4096) bytes, bpftool will erroneously conclude that it got corrupted data due
    to 4096 not being a multiple of struct pid_iter_entry, so the last entry will
    be partially truncated. Fix this by sizing the buffer to fit exactly N entries
    with no truncation in the middle of record.

    Fixes: d53dee3fe013 ("tools/bpftool: Show info for processes holding BPF map/prog/link/btf FDs")
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Daniel Borkmann
    Acked-by: Yonghong Song
    Link: https://lore.kernel.org/bpf/20201204232002.3589803-1-andrii@kernel.org

    Andrii Nakryiko
     

07 Dec, 2020

3 commits

  • Pull x86 fixes from Thomas Gleixner:
    "A set of fixes for x86:

    - Make the AMD L3 QoS code and data priorization enable/disable
    mechanism work correctly.

    The control bit was only set/cleared on one of the CPUs in a L3
    domain, but it has to be modified on all CPUs in the domain. The
    initial documentation was not clear about this, but the updated one
    from Oct 2020 spells it out.

    - Fix an off by one in the UV platform detection code which causes
    the UV hubs to be identified wrongly.

    The chip revisions start at 1 not at 0.

    - Fix a long standing bug in the evaluation of prefixes in the
    uprobes code which fails to handle repeated prefixes properly.

    The aggregate size of the prefixes can be larger than the bytes
    array but the code blindly iterated over the aggregate size beyond
    the array boundary. Add a macro to handle this case properly and
    use it at the affected places"

    * tag 'x86-urgent-2020-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/sev-es: Use new for_each_insn_prefix() macro to loop over prefixes bytes
    x86/insn-eval: Use new for_each_insn_prefix() macro to loop over prefixes bytes
    x86/uprobes: Do not use prefixes.nbytes when looping over prefixes.bytes
    x86/platform/uv: Fix UV4 hub revision adjustment
    x86/resctrl: Fix AMD L3 QOS CDP enable/disable

    Linus Torvalds
     
  • The error handling in hugetlb_allocate_area() was incorrect for the
    hugetlb_shared test case.

    Previously the behavior was:

    - mmap a hugetlb area
    - If this fails, set the pointer to NULL, and carry on
    - mmap an alias of the same hugetlb fd
    - If this fails, munmap the original area

    If the original mmap failed, it's likely the second one did too. If
    both failed, we'd blindly try to munmap a NULL pointer, causing a
    SIGSEGV. Instead, "goto fail" so we return before trying to mmap the
    alias.

    This issue can be hit "in real life" by forgetting to set
    /proc/sys/vm/nr_hugepages (leaving it at 0), and then trying to run the
    hugetlb_shared test.

    Another small improvement is, when the original mmap fails, don't just
    print "it failed": perror(), so we can see *why*. :)

    Signed-off-by: Axel Rasmussen
    Signed-off-by: Andrew Morton
    Cc: Shuah Khan
    Cc: Peter Xu
    Cc: Joe Perches
    Cc: Mike Rapoport
    Cc: Andrea Arcangeli
    Cc: David Alan Gilbert
    Link: https://lkml.kernel.org/r/20201204203443.2714693-1-axelrasmussen@google.com
    Signed-off-by: Linus Torvalds

    Axel Rasmussen
     
  • Only x86 and PowerPC implement the pkey-xxx.h, and an error was reported
    when compiling protection_keys.c.

    Add a Arch judgment to compile "protection_keys" in the Makefile.

    If other arch implement this, add the arch name to the Makefile.
    eg:
    ifneq (,$(findstring $(ARCH),powerpc mips ... ))

    Following build errors:

    pkey-helpers.h:93:2: error: #error Architecture not supported
    #error Architecture not supported
    pkey-helpers.h:96:20: error: `PKEY_DISABLE_ACCESS' undeclared
    #define PKEY_MASK (PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE)
    ^
    protection_keys.c:218:45: error: `PKEY_DISABLE_WRITE' undeclared
    pkey_assert(flags & (PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE));
    ^

    Signed-off-by: Xingxing Su
    Signed-off-by: Andrew Morton
    Cc: Shuah Khan
    Cc: Sandipan Das
    Cc: John Hubbard
    Cc: Dave Hansen
    Cc: "Kirill A. Shutemov"
    Cc: Brian Geffon
    Cc: Mina Almasry
    Link: https://lkml.kernel.org/r/1606826876-30656-1-git-send-email-suxingxing@loongson.cn
    Signed-off-by: Linus Torvalds

    Xingxing Su
     

06 Dec, 2020

2 commits

  • Since insn.prefixes.nbytes can be bigger than the size of
    insn.prefixes.bytes[] when a prefix is repeated, the proper check must
    be

    insn.prefixes.bytes[i] != 0 and i < 4

    instead of using insn.prefixes.nbytes.

    Introduce a for_each_insn_prefix() macro for this purpose. Debugged by
    Kees Cook .

    [ bp: Massage commit message, sync with the respective header in tools/
    and drop "we". ]

    Fixes: 2b1444983508 ("uprobes, mm, x86: Add the ability to install and remove uprobes breakpoints")
    Reported-by: syzbot+9b64b619f10f19d19a7c@syzkaller.appspotmail.com
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Borislav Petkov
    Reviewed-by: Srikar Dronamraju
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/160697103739.3146288.7437620795200799020.stgit@devnote2

    Masami Hiramatsu
     
  • Depending on the order of the routes to fe80::/64 are installed on the
    VRF table, the NS for the source link-local address of the originator
    might be sent to the wrong interface.

    This patch ensures that packets with link-local addr source is doing a
    lookup with the orig_iif when the destination addr indicates that it
    is strict.

    Add the reproducer as a use case in self test script fcnal-test.sh.

    Fixes: b4869aa2f881 ("net: vrf: ipv6 support for local traffic to local addresses")
    Signed-off-by: Stephen Suryaputra
    Reviewed-by: David Ahern
    Link: https://lore.kernel.org/r/20201204030604.18828-1-ssuryaextr@gmail.com
    Signed-off-by: Jakub Kicinski

    Stephen Suryaputra
     

04 Dec, 2020

2 commits

  • Pull networking fixes from Jakub Kicinski:
    "Networking fixes for 5.10-rc7, including fixes from bpf, netfilter,
    wireless drivers, wireless mesh and can.

    Current release - regressions:

    - mt76: usb: fix crash on device removal

    Current release - always broken:

    - xsk: Fix umem cleanup from wrong context in socket destruct

    Previous release - regressions:

    - net: ip6_gre: set dev->hard_header_len when using header_ops

    - ipv4: Fix TOS mask in inet_rtm_getroute()

    - net, xsk: Avoid taking multiple skbuff references

    Previous release - always broken:

    - net/x25: prevent a couple of overflows

    - netfilter: ipset: prevent uninit-value in hash_ip6_add

    - geneve: pull IP header before ECN decapsulation

    - mpls: ensure LSE is pullable in TC and openvswitch paths

    - vxlan: respect needed_headroom of lower device

    - batman-adv: Consider fragmentation for needed packet headroom

    - can: drivers: don't count arbitration loss as an error

    - netfilter: bridge: reset skb->pkt_type after POST_ROUTING traversal

    - inet_ecn: Fix endianness of checksum update when setting ECT(1)

    - ibmvnic: fix various corner cases around reset handling

    - net/mlx5: fix rejecting unsupported Connect-X6DX SW steering

    - net/mlx5: Enforce HW TX csum offload with kTLS"

    * tag 'net-5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (62 commits)
    net/mlx5: DR, Proper handling of unsupported Connect-X6DX SW steering
    net/mlx5e: kTLS, Enforce HW TX csum offload with kTLS
    net: mlx5e: fix fs_tcp.c build when IPV6 is not enabled
    net/mlx5: Fix wrong address reclaim when command interface is down
    net/sched: act_mpls: ensure LSE is pullable before reading it
    net: openvswitch: ensure LSE is pullable before reading it
    net: skbuff: ensure LSE is pullable before decrementing the MPLS ttl
    net: mvpp2: Fix error return code in mvpp2_open()
    chelsio/chtls: fix a double free in chtls_setkey()
    rtw88: debug: Fix uninitialized memory in debugfs code
    vxlan: fix error return code in __vxlan_dev_create()
    net: pasemi: fix error return code in pasemi_mac_open()
    cxgb3: fix error return code in t3_sge_alloc_qset()
    net/x25: prevent a couple of overflows
    dpaa_eth: copy timestamp fields to new skb in A-050385 workaround
    net: ip6_gre: set dev->hard_header_len when using header_ops
    mt76: usb: fix crash on device removal
    iwlwifi: pcie: add some missing entries for AX210
    iwlwifi: pcie: invert values of NO_160 device config entries
    iwlwifi: pcie: add one missing entry for AX210
    ...

    Linus Torvalds
     
  • The current memory region move test correctly handles the situation that
    the second (realigning) memslot move operation would temporarily trigger
    MMIO until it completes, however it does not handle the case in which the
    first (misaligning) move operation does this, too.
    This results in false test assertions in case it does so.

    Fix this by handling temporary MMIO from the first memslot move operation
    in the test guest code, too.

    Fixes: 8a0639fe9201 ("KVM: sefltests: Add explicit synchronization to move mem region test")
    Signed-off-by: Maciej S. Szmigiero
    Message-Id:
    Signed-off-by: Paolo Bonzini

    Maciej S. Szmigiero
     

03 Dec, 2020

1 commit

  • …nel/git/rostedt/linux-trace

    Pull bootconfig fixes from Steven Rostedt:
    "Have bootconfig size and checksum be little endian

    In case the bootconfig is created on one kind of endian machine, and
    then read on the other kind of endian kernel, the size and checksum
    will be incorrect. Instead, have both the size and checksum always be
    little endian and have the tool and the kernel convert it from little
    endian to or from the host endian"

    * tag 'trace-v5.10-rc6-bootconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
    docs: bootconfig: Add the endianness of fields
    tools/bootconfig: Store size and checksum in footer as le32
    bootconfig: Load size and checksum in the footer as le32

    Linus Torvalds
     

02 Dec, 2020

1 commit

  • Avoid occasional test failures due to the last sample being delayed to
    another ring_buffer__poll() call. Instead, drain samples completely with
    ring_buffer__consume(). This is supposed to fix a rare and non-deterministic
    test failure in libbpf CI.

    Fixes: cb1c9ddd5525 ("selftests/bpf: Add BPF ringbuf selftests")
    Signed-off-by: Andrii Nakryiko
    Signed-off-by: Alexei Starovoitov
    Link: https://lore.kernel.org/bpf/20201130223336.904192-2-andrii@kernel.org

    Andrii Nakryiko