01 Dec, 2018

2 commits

  • Pull perf fixes from Ingo Molnar:
    "Misc fixes:

    - counter freezing related regression fix

    - uprobes race fix

    - Intel PMU unusual event combination fix

    - .. and diverse tooling fixes"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    uprobes: Fix handle_swbp() vs. unregister() + register() race once more
    perf/x86/intel: Disallow precise_ip on BTS events
    perf/x86/intel: Add generic branch tracing check to intel_pmu_has_bts()
    perf/x86/intel: Move branch tracing setup to the Intel-specific source file
    perf/x86/intel: Fix regression by default disabling perfmon v4 interrupt handling
    perf tools beauty ioctl: Support new ISO7816 commands
    tools uapi asm-generic: Synchronize ioctls.h
    tools arch x86: Update tools's copy of cpufeatures.h
    tools headers uapi: Synchronize i915_drm.h
    perf tools: Restore proper cwd on return from mnt namespace
    tools build feature: Check if get_current_dir_name() is available
    perf tools: Fix crash on synthesizing the unit

    Linus Torvalds
     
  • Pull objtool fixes from Ingo Molnar:
    "Two fixes for boundary conditions"

    * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    objtool: Fix segfault in .cold detection with -ffunction-sections
    objtool: Fix double-free in .cold detection error path

    Linus Torvalds
     

29 Nov, 2018

1 commit

  • Pablo Neira Ayuso says:

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

    The following patchset contains Netfilter fixes for net:

    1) Disable BH while holding list spinlock in nf_conncount, from
    Taehee Yoo.

    2) List corruption in nf_conncount, also from Taehee.

    3) Fix race that results in leaving around an empty list node in
    nf_conncount, from Taehee Yoo.

    4) Proper chain handling for inactive chains from the commit path,
    from Florian Westphal. This includes a selftest for this.

    5) Do duplicate rule handles when replacing rules, also from Florian.

    6) Remove net_exit path in xt_RATEEST that results in splat, from Taehee.

    7) Possible use-after-free in nft_compat when releasing extensions.
    From Florian.

    8) Memory leak in xt_hashlimit, from Taehee.

    9) Call ip_vs_dst_notifier after ipv6_dev_notf, from Xin Long.

    10) Fix cttimeout with udplite and gre, from Florian.

    11) Preserve oif for IPv6 link-local generated traffic from mangle
    table, from Alin Nastac.

    12) Missing error handling in masquerade notifiers, from Taehee Yoo.

    13) Use mutex to protect registration/unregistration of masquerade
    extensions in order to prevent a race, from Taehee.

    14) Incorrect condition check in tree_nodes_free(), also from Taehee.

    15) Fix chain counter leak in rule replacement path, from Taehee.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

26 Nov, 2018

1 commit

  • Daniel Borkmann says:

    ====================
    pull-request: bpf 2018-11-25

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

    The main changes are:

    1) Fix an off-by-one bug when adjusting subprog start offsets after
    patching, from Edward.

    2) Fix several bugs such as overflow in size allocation in queue /
    stack map creation, from Alexei.

    3) Fix wrong IPv6 destination port byte order in bpf_sk_lookup_udp
    helper, from Andrey.

    4) Fix several bugs in bpftool such as preventing an infinite loop
    in get_fdinfo, error handling and man page references, from Quentin.

    5) Fix a warning in bpf_trace_printk() that wasn't catching an
    invalid format string, from Martynas.

    6) Fix a bug in BPF cgroup local storage where non-atomic allocation
    was used in atomic context, from Roman.

    7) Fix a NULL pointer dereference bug in bpftool from reallocarray()
    error handling, from Jakub and Wen.

    8) Add a copy of pkt_cls.h and tc_bpf.h uapi headers to the tools
    include infrastructure so that bpftool compiles on older RHEL7-like
    user space which does not ship these headers, from Yonghong.

    9) Fix BPF kselftests for user space where to get ping test working
    with ping6 and ping -6, from Li.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

24 Nov, 2018

1 commit

  • Pull power management fixes from Rafael Wysocki:
    "These fix two issues in the Operating Performance Points (OPP)
    framework, one cpufreq driver issue, one problem related to the tasks
    freezer and a few build-related issues in the cpupower utility.

    Specifics:

    - Fix tasks freezer deadlock in de_thread() that occurs if one of its
    sub-threads has been frozen already (Chanho Min).

    - Avoid registering a platform device by the ti-cpufreq driver on
    platforms that cannot use it (Dave Gerlach).

    - Fix a mistake in the ti-opp-supply operating performance points
    (OPP) driver that caused an incorrect reference voltage to be used
    and make it adjust the minimum voltage dynamically to avoid hangs
    or crashes in some cases (Keerthy).

    - Fix issues related to compiler flags in the cpupower utility and
    correct a linking problem in it by renaming a file with a duplicate
    name (Jiri Olsa, Konstantin Khlebnikov)"

    * tag 'pm-4.20-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    exec: make de_thread() freezable
    cpufreq: ti-cpufreq: Only register platform_device when supported
    opp: ti-opp-supply: Correct the supply in _get_optimal_vdd_voltage call
    opp: ti-opp-supply: Dynamically update u_volt_min
    tools cpupower: Override CFLAGS assignments
    tools cpupower debug: Allow to use outside build flags
    tools/power/cpupower: fix compilation with STATIC=true

    Linus Torvalds
     

22 Nov, 2018

1 commit

  • This patch fixes a possible null pointer dereference in
    do_load, detected by the semantic patch deref_null.cocci,
    with the following warning:

    ./tools/bpf/bpftool/prog.c:1021:23-25: ERROR: map_replace is NULL but dereferenced.

    The following code has potential null pointer references:
    881 map_replace = reallocarray(map_replace, old_map_fds + 1,
    882 sizeof(*map_replace));
    883 if (!map_replace) {
    884 p_err("mem alloc failed");
    885 goto err_free_reuse_maps;
    886 }

    ...
    1019 err_free_reuse_maps:
    1020 for (i = 0; i < old_map_fds; i++)
    1021 close(map_replace[i].fd);
    1022 free(map_replace);

    Fixes: 3ff5a4dc5d89 ("tools: bpftool: allow reuse of maps with bpftool prog load")
    Co-developed-by: Wen Yang
    Signed-off-by: Wen Yang
    Signed-off-by: Jakub Kicinski
    Signed-off-by: Daniel Borkmann

    Jakub Kicinski
     

21 Nov, 2018

4 commits

  • …linux/kernel/git/acme/linux into perf/urgent

    Pull perf/urgent fixes:

    - Update kernel ABI headers, one of them lead to a small change in
    the ioctl 'cmd' beautifier in 'perf trace' to support the new ISO7816
    commands. (Arnaldo Carvalho de Melo)

    - Restore proper cwd on return from mnt namespace (Jiri Olsa)

    - Add feature check for the get_current_dir_name() function used in the
    namespace fix from Jiri, that is not available in systems such as
    Alpine Linux, which uses the musl libc (Arnaldo Carvalho de Melo)

    - Fix crash in 'perf record' when synthesizing the unit for events such
    as 'cpu-clock' (Jiri Olsa)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     
  • Pull cpupower utility updates for 4.20-rc4 from Shuah Khan:

    "This cpupower update for Linux 4.20-rc4 consists of compile fixes to allow
    use of outside build flags and override of CFLAGS from Jiri Olsa, and fix
    to compilation with STATIC=true from Konstantin Khlebnikov."

    * tag 'linux-cpupower-4.20-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux:
    tools cpupower: Override CFLAGS assignments
    tools cpupower debug: Allow to use outside build flags
    tools/power/cpupower: fix compilation with STATIC=true

    Rafael J. Wysocki
     
  • Because find_symbol_by_name() traverses the same lists as
    read_symbols(), changing sym->name in place without copying it affects
    the result of find_symbol_by_name(). In the case where a ".cold"
    function precedes its parent in sec->symbol_list, it can result in a
    function being considered a parent of itself. This leads to function
    length being set to 0 and other consequent side-effects including a
    segfault in add_switch_table(). The effects of this bug are only
    visible when building with -ffunction-sections in KCFLAGS.

    Fix by copying the search string instead of modifying it in place.

    Signed-off-by: Artem Savkov
    Signed-off-by: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Fixes: 13810435b9a7 ("objtool: Support GCC 8's cold subfunctions")
    Link: http://lkml.kernel.org/r/910abd6b5a4945130fd44f787c24e07b9e07c8da.1542736240.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar

    Artem Savkov
     
  • If read_symbols() fails during second list traversal (the one dealing
    with ".cold" subfunctions) it frees the symbol, but never deletes it
    from the list/hash_table resulting in symbol being freed again in
    elf_close(). Fix it by just returning an error, leaving cleanup to
    elf_close().

    Signed-off-by: Artem Savkov
    Signed-off-by: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Fixes: 13810435b9a7 ("objtool: Support GCC 8's cold subfunctions")
    Link: http://lkml.kernel.org/r/beac5a9b7da9e8be90223459dcbe07766ae437dd.1542736240.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar

    Artem Savkov
     

20 Nov, 2018

7 commits

  • Introduced in:

    ad8c0eaa0a41 ("tty/serial_core: add ISO7816 infrastructure")

    Now 'perf trace' will be able to pretty-print the 'cmd' ioctl arg when
    used in capable systems with software emitting those commands.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Greg Kroah-Hartman
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Nicolas Ferre
    Cc: Wang Nan
    Link: https://lkml.kernel.org/n/tip-7bds48dhckfnleie08mit314@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To pick up the changes in:

    ad8c0eaa0a41 ("tty/serial_core: add ISO7816 infrastructure")

    That is a change that imply a change to be made in tools/perf/trace/beauty/ioctl.c to
    make 'perf trace' ioctl syscall argument beautifier to support these new
    commands: TIOCGISO7816 and TIOCSISO7816.

    This is not yet done automatically by a script like is done for some
    other headers, for instance:

    $ tools/perf/trace/beauty/drm_ioctl.sh | head
    #ifndef DRM_COMMAND_BASE
    #define DRM_COMMAND_BASE 0x40
    #endif
    static const char *drm_ioctl_cmds[] = {
    [0x00] = "VERSION",
    [0x01] = "GET_UNIQUE",
    [0x02] = "GET_MAGIC",
    [0x03] = "IRQ_BUSID",
    [0x04] = "GET_MAP",
    [0x05] = "GET_CLIENT",
    $

    So we will need to change tools/perf/trace/beauty/ioctl.c in a follow up
    patch until we switch to a generator script.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Greg Kroah-Hartman
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Nicolas Ferre
    Cc: Wang Nan
    Link: https://lkml.kernel.org/n/tip-zin76fe6iykqsilvo6u47f9o@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To get the changes in the following csets:

    ace6485a0326 ("x86/cpufeatures: Enumerate MOVDIR64B instruction")
    33823f4d63f7 ("x86/cpufeatures: Enumerate MOVDIRI instruction")

    No tools were affected, copy it to silence this perf tool build warning:

    Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
    diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Cc: Fenghua Yu
    Link: https://lkml.kernel.org/n/tip-83kcyqa1qkxkhm1s7q3hbpel@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To pick up the changes in:

    900ccf30f9e1 ("drm/i915: Only force GGTT coherency w/a on required chipsets")

    No changes are required in tools/ nor does anything gets automatically
    generated to be used in the 'perf trace' syscall arg beautifiers.

    This silences this perf build warning:

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

    Cc: Chris Wilson
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: https://lkml.kernel.org/n/tip-t2vor2wegv41gt5n49095kly@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • When reporting on 'record' server we try to retrieve/use the mnt
    namespace of the profiled tasks. We use following API with cookie to
    hold the return namespace, roughly:

    nsinfo__mountns_enter(struct nsinfo *nsi, struct nscookie *nc)
    setns(newns, 0);
    ...
    new ns related open..
    ...
    nsinfo__mountns_exit(struct nscookie *nc)
    setns(nc->oldns)

    Once finished we setns to old namespace, which also sets the current
    working directory (cwd) to "/", trashing the cwd we had.

    This is mostly fine, because we use absolute paths almost everywhere,
    but it screws up 'perf diff':

    # perf diff
    failed to open perf.data: No such file or directory (try 'perf record' first)
    ...

    Adding the current working directory to be part of the cookie and
    restoring it in the nsinfo__mountns_exit call.

    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Krister Johansen
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Fixes: 843ff37bb59e ("perf symbols: Find symbols in different mount namespace")
    Link: http://lkml.kernel.org/r/20181101170001.30019-1-jolsa@kernel.org
    [ No need to check for NULL args for free(), use zfree() for struct members ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • As the namespace support code will use this, which is not available in
    some non _GNU_SOURCE libraries such as Android's bionic used in my
    container build tests (r12b and r15c at the moment).

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: https://lkml.kernel.org/n/tip-x56ypm940pwclwu45d7jfj47@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Pull networking fixes from David Miller:

    1) Fix some potentially uninitialized variables and use-after-free in
    kvaser_usb can drier, from Jimmy Assarsson.

    2) Fix leaks in qed driver, from Denis Bolotin.

    3) Socket leak in l2tp, from Xin Long.

    4) RSS context allocation fix in bnxt_en from Michael Chan.

    5) Fix cxgb4 build errors, from Ganesh Goudar.

    6) Route leaks in ipv6 when removing exceptions, from Xin Long.

    7) Memory leak in IDR allocation handling of act_pedit, from Davide
    Caratti.

    8) Use-after-free of bridge vlan stats, from Nikolay Aleksandrov.

    9) When MTU is locked, do not force DF bit on ipv4 tunnels. From
    Sabrina Dubroca.

    10) When NAPI cached skb is reused, we must set it to the proper initial
    state which includes skb->pkt_type. From Eric Dumazet.

    11) Lockdep and non-linear SKB handling fix in tipc from Jon Maloy.

    12) Set RX queue properly in various tuntap receive paths, from Matthew
    Cover.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (61 commits)
    tuntap: fix multiqueue rx
    ipv6: Fix PMTU updates for UDP/raw sockets in presence of VRF
    tipc: don't assume linear buffer when reading ancillary data
    tipc: fix lockdep warning when reinitilaizing sockets
    net-gro: reset skb->pkt_type in napi_reuse_skb()
    tc-testing: tdc.py: Guard against lack of returncode in executed command
    tc-testing: tdc.py: ignore errors when decoding stdout/stderr
    ip_tunnel: don't force DF when MTU is locked
    MAINTAINERS: Add entry for CAKE qdisc
    net: bridge: fix vlan stats use-after-free on destruction
    socket: do a generic_file_splice_read when proto_ops has no splice_read
    net: phy: mdio-gpio: Fix working over slow can_sleep GPIOs
    Revert "net: phy: mdio-gpio: Fix working over slow can_sleep GPIOs"
    net: phy: mdio-gpio: Fix working over slow can_sleep GPIOs
    net/sched: act_pedit: fix memory leak when IDR allocation fails
    net: lantiq: Fix returned value in case of error in 'xrx200_probe()'
    ipv6: fix a dst leak when removing its exception
    net: mvneta: Don't advertise 2.5G modes
    drivers/net/ethernet/qlogic/qed/qed_rdma.h: fix typo
    net/mlx4: Fix UBSAN warning of signed integer overflow
    ...

    Linus Torvalds
     

19 Nov, 2018

1 commit

  • Pull libnvdimm fixes from Dan Williams:
    "A small batch of fixes for v4.20-rc3.

    The overflow continuation fix addresses something that has been broken
    for several releases. Arguably it could wait even longer, but it's a
    one line fix and this finishes the last of the known address range
    scrub bug reports. The revert addresses a lockdep regression. The unit
    tests are not critical to fix, but no reason to hold this fix back.

    Summary:

    - Address Range Scrub overflow continuation handling has been broken
    since it was initially merged. It was only recently that error
    injection and platform-BIOS support enabled this corner case to be
    exercised.

    - The recent attempt to provide more isolation for the kernel Address
    Range Scrub state machine from userapace initiated sessions
    triggers a lockdep report. Revert and try again at the next merge
    window.

    - Fix a kasan reported buffer overflow in libnvdimm unit test
    infrastrucutre (nfit_test)"

    * tag 'libnvdimm-fixes-4.20-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
    Revert "acpi, nfit: Further restrict userspace ARS start requests"
    acpi, nfit: Fix ARS overflow continuation
    tools/testing/nvdimm: Fix the array size for dimm devices.

    Linus Torvalds
     

18 Nov, 2018

2 commits


17 Nov, 2018

2 commits

  • When patching in a new sequence for the first insn of a subprog, the start
    of that subprog does not change (it's the first insn of the sequence), so
    adjust_subprog_starts should check start < off).
    Also added a test to test_verifier.c (it's essentially the syz reproducer).

    Fixes: cc8b0b92a169 ("bpf: introduce function calls (function boundaries)")
    Reported-by: syzbot+4fc427c7af994b0948be@syzkaller.appspotmail.com
    Signed-off-by: Edward Cree
    Acked-by: Yonghong Song
    Signed-off-by: Alexei Starovoitov

    Edward Cree
     
  • Pull powerpc fixes from Michael Ellerman:
    "Two weeks worth of fixes since rc1.

    - I broke 16-byte alignment of the stack when we moved PPR into
    pt_regs. Despite being required by the ABI this broke almost
    nothing, we eventually hit it in code where GCC does arithmetic on
    the stack pointer assuming the bottom 4 bits are clear. Fix it by
    padding the in-kernel pt_regs by 8 bytes.

    - A couple of commits fixing minor bugs in the recent SLB rewrite.

    - A build fix related to tracepoints in KVM in some configurations.

    - Our old "IO workarounds" code written for Cell couldn't coexist in
    a kernel that runs on Power9 with the Radix MMU, fix that.

    - Remove the NPU DMA ops, these just printed a warning and should
    never have been called.

    - Suppress an overly chatty message triggered by CPU hotplug in some
    configs.

    - Two small selftest fixes.

    Thanks to: Alistair Popple, Gustavo Romero, Nicholas Piggin, Satheesh
    Rajendran, Scott Wood"

    * tag 'powerpc-4.20-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
    selftests/powerpc: Adjust wild_bctr to build with old binutils
    powerpc/64: Fix kernel stack 16-byte alignment
    powerpc/numa: Suppress "VPHN is not supported" messages
    selftests/powerpc: Fix wild_bctr test to work on ppc64
    powerpc/io: Fix the IO workarounds code to work with Radix
    powerpc/mm/64s: Fix preempt warning in slb_allocate_kernel()
    KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE
    powerpc/mm/64s: Only use slbfee on CPUs that support it
    powerpc/mm/64s: Use PPC_SLBFEE macro
    powerpc/mm/64s: Consolidate SLB assertions
    powerpc/powernv/npu: Remove NPU DMA ops

    Linus Torvalds
     

15 Nov, 2018

1 commit


13 Nov, 2018

1 commit

  • Adam reported a record command crash for simple session like:

    $ perf record -e cpu-clock ls

    with following backtrace:

    Program received signal SIGSEGV, Segmentation fault.
    3543 ev = event_update_event__new(size + 1, PERF_EVENT_UPDATE__UNIT, evsel->id[0]);
    (gdb) bt
    #0 perf_event__synthesize_event_update_unit
    #1 0x000000000051e469 in perf_event__synthesize_extra_attr
    #2 0x00000000004445cb in record__synthesize
    #3 0x0000000000444bc5 in __cmd_record
    ...

    We synthesize an update event that needs to touch the evsel id array,
    which is not defined at that time. Fix this by forcing the id allocation
    for events with their unit defined.

    Reflecting possible read_format ID bit in the attr tests.

    Reported-by: Yongxin Liu
    Signed-off-by: Jiri Olsa
    Cc: Adam Lee
    Cc: Alexander Shishkin
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201477
    Fixes: bfd8f72c2778 ("perf record: Synthesize unit/scale/... in event update")
    Link: http://lkml.kernel.org/r/20181112130012.5424-1-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

12 Nov, 2018

2 commits

  • Start flood ping for each cpu while loading/flushing rulesets to make
    sure we do not access already-free'd rules from nf_tables evaluation loop.

    Also add this to TARGETS so 'make run_tests' in selftest dir runs it
    automatically.

    This would have caught the bug fixed in previous change
    ("netfilter: nf_tables: do not skip inactive chains during generation update")
    sooner.

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

    Florian Westphal
     
  • The selftest I recently added to test branching to an out-of-bounds
    NIP doesn't work on 64-bit big endian. It does fail but not in the
    right way. That is it SEGVs trying to load from the opd at BAD_NIP,
    but it never gets as far as branching to BAD_NIP.

    To fix it we need to create an opd which is reachable but which holds
    the bad address.

    Fixes: b7683fc66eba ("selftests/powerpc: Add a test of wild bctr")
    Signed-off-by: Michael Ellerman

    Michael Ellerman
     

09 Nov, 2018

6 commits

  • At commit deee2cae27d1 ("kselftests/bpf: use ping6 as the default ipv6 ping
    binary if it exists"), it fixed similar issues for shell script, but it
    missed a same issue in the C code.

    Fixes: 371e4fcc9d96 ("selftests/bpf: cgroup local storage-based network counters")
    Reported-by: kernel test robot
    Signed-off-by: Li Zhijian
    CC: Philip Li
    Signed-off-by: Daniel Borkmann

    Li Zhijian
     
  • Update references to other bpftool man pages at the bottom of each
    manual page. Also reference the "bpf(2)" and "bpf-helpers(7)" man pages.

    References are sorted by number of man section, then by
    "prog-and-map-go-first", the other pages in alphabetical order.

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

    Quentin Monnet
     
  • Function open_obj_pinned() prints error messages when it fails to open a
    link in the BPF virtual file system. However, in some occasions it is
    not desirable to print an error, for example when we parse all links
    under the bpffs root, and the error is due to some paths actually being
    symbolic links.

    Example output:

    # ls -l /sys/fs/bpf/
    lrwxrwxrwx 1 root root 0 Oct 18 19:00 ip -> /sys/fs/bpf/tc/
    drwx------ 3 root root 0 Oct 18 19:00 tc
    lrwxrwxrwx 1 root root 0 Oct 18 19:00 xdp -> /sys/fs/bpf/tc/

    # bpftool --bpffs prog show
    Error: bpf obj get (/sys/fs/bpf): Permission denied
    Error: bpf obj get (/sys/fs/bpf): Permission denied

    # strace -e bpf bpftool --bpffs prog show
    bpf(BPF_OBJ_GET, {pathname="/sys/fs/bpf/ip", bpf_fd=0}, 72) = -1 EACCES (Permission denied)
    Error: bpf obj get (/sys/fs/bpf): Permission denied
    bpf(BPF_OBJ_GET, {pathname="/sys/fs/bpf/xdp", bpf_fd=0}, 72) = -1 EACCES (Permission denied)
    Error: bpf obj get (/sys/fs/bpf): Permission denied
    ...

    To fix it, pass a bool as a second argument to the function, and prevent
    it from printing an error when the argument is set to true.

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

    Quentin Monnet
     
  • Edit the documentation of the -f|--bpffs option to make it explicit that
    it dumps paths of pinned programs when bpftool is used to list the
    programs only, so that users do not believe they will see the name of
    the newly pinned program with "bpftool prog pin" or "bpftool prog load".

    Also fix the plain output: do not add a blank line after each program
    block, in order to remain consistent with what bpftool does when the
    option is not passed.

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

    Quentin Monnet
     
  • Function getline() returns -1 on failure to read a line, thus creating
    an infinite loop in get_fdinfo() if the key is not found. Fix it by
    calling the function only as long as we get a strictly positive return
    value.

    Found by copying the code for a key which is not always present...

    Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool")
    Signed-off-by: Quentin Monnet
    Reviewed-by: Jakub Kicinski
    Signed-off-by: Daniel Borkmann

    Quentin Monnet
     
  • Commit f6f3bac08ff9 ("tools/bpf: bpftool: add net support")
    added certain networking support to bpftool.
    The implementation relies on a relatively recent uapi header file
    linux/tc_act/tc_bpf.h on the host which contains the marco
    definition of TCA_ACT_BPF_ID.

    Unfortunately, this is not the case for all distributions.
    See the email message below where rhel-7.2 does not have
    an up-to-date linux/tc_act/tc_bpf.h.
    https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1799211.html
    Further investigation found that linux/pkt_cls.h is also needed for macro
    TCA_BPF_TAG.

    This patch fixed the issue by copying linux/tc_act/tc_bpf.h
    and linux/pkt_cls.h from kernel include/uapi directory to
    tools/include/uapi directory so building the bpftool does not depend
    on host system for these files.

    Fixes: f6f3bac08ff9 ("tools/bpf: bpftool: add net support")
    Reported-by: kernel test robot
    Cc: Li Zhijian
    Signed-off-by: Yonghong Song
    Signed-off-by: Daniel Borkmann

    Yonghong Song
     

07 Nov, 2018

1 commit

  • …linux/kernel/git/acme/linux into perf/urgent

    Pull perf/urgent improvements and fixes from Arnaldo Carvalho de Melo:

    Intel PT SQL viewer: (Adrian Hunter)

    - Fall back to /usr/local/lib/libxed.so
    - Add Selected branches report
    - Add help window
    - Fix table find when table re-ordered

    Intel PT debug log (Adrian Hunter)

    - Add more event information
    - Add MTC and CYC timestamps

    perf record: (Andi Kleen)

    - Support weak groups, just like with 'perf stat'

    perf trace: (Arnaldo Carvalho de Melo)

    - Start augmenting raw_syscalls:{sys_enter,sys_exit}: goal is to have a
    generic, arch independent eBPF kernel component that is programmed with
    syscall table details, what to copy, how many bytes, pid, arg filters from the
    userspace via eBPF maps by the 'perf trace' tool that continues to use all its
    argument beautifiers, just taking advantage of the extra pointer contents.

    JVMTI: (Gustavo Romero)

    - Fix undefined symbol scnprintf in libperf-jvmti.so

    perf top: (Jin Yao)

    - Display the LBR stats in callchain entries

    perf stat: (Thomas Richter)

    - Handle different PMU names with common prefix

    arm64: Will (Deacon)

    - Fix arm64 tools build failure wrt smp_load_{acquire,release}.

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

06 Nov, 2018

7 commits

  • So user could specify outside CFLAGS values.

    Cc: Thomas Renninger
    Cc: Shuah Khan
    Signed-off-by: Jiri Olsa
    Acked-by: Thomas Renninger
    Signed-off-by: Shuah Khan (Samsung OSG)

    Jiri Olsa
     
  • Adding CFLAGS and LDFLAGS to be used during the build.

    Cc: Thomas Renninger
    Cc: Shuah Khan
    Signed-off-by: Jiri Olsa
    Acked-by: Thomas Renninger
    Signed-off-by: Shuah Khan (Samsung OSG)

    Jiri Olsa
     
  • Rename duplicate sysfs_read_file into cpupower_read_sysfs and fix linking.

    Signed-off-by: Konstantin Khlebnikov
    Acked-by: Thomas Renninger
    Cc:
    Signed-off-by: Shuah Khan (Samsung OSG)

    Konstantin Khlebnikov
     
  • Andi reported following malfunction:

    # perf record -e '{ref-cycles,cycles}:S' -a sleep 1
    # perf script
    non matching sample_id_all

    That's because we disable sample_id_all bit for non-sampling group
    members. We can't do that, because it needs to be the same over the
    whole event list. This patch keeps it untouched again.

    Reported-by: Andi Kleen
    Tested-by: Andi Kleen
    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180923150420.27327-1-jolsa@kernel.org
    Fixes: e9add8bac6c6 ("perf evsel: Disable write_backward for leader sampling group events")
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • KASAN reports following global out of bounds access while
    nfit_test is being loaded. The out of bound access happens
    the following reference to dimm_fail_cmd_flags[dimm]. 'dimm' is
    over than the index value, NUM_DCR (==5).

    static int override_return_code(int dimm, unsigned int func, int rc)
    {
    if ((1 << func) & dimm_fail_cmd_flags[dimm]) {

    dimm_fail_cmd_flags[] definition:
    static unsigned long dimm_fail_cmd_flags[NUM_DCR];

    'dimm' is the return value of get_dimm(), and get_dimm() returns
    the index of handle[] array. The handle[] has 7 index. Let's use
    ARRAY_SIZE(handle) as the array size.

    KASAN report:

    ==================================================================
    BUG: KASAN: global-out-of-bounds in nfit_test_ctl+0x47bb/0x55b0 [nfit_test]
    Read of size 8 at addr ffffffffc10cbbe8 by task kworker/u41:0/8
    ...
    Call Trace:
    dump_stack+0xea/0x1b0
    ? dump_stack_print_info.cold.0+0x1b/0x1b
    ? kmsg_dump_rewind_nolock+0xd9/0xd9
    print_address_description+0x65/0x22e
    ? nfit_test_ctl+0x47bb/0x55b0 [nfit_test]
    kasan_report.cold.6+0x92/0x1a6
    nfit_test_ctl+0x47bb/0x55b0 [nfit_test]
    ...
    The buggy address belongs to the variable:
    dimm_fail_cmd_flags+0x28/0xffffffffffffa440 [nfit_test]
    ==================================================================

    Fixes: 39611e83a28c ("tools/testing/nvdimm: Make DSM failure code injection...")
    Signed-off-by: Masayoshi Mizuma
    Signed-off-by: Dan Williams

    Masayoshi Mizuma
     
  • Currently jvmti agent can not be used because function scnprintf is not
    present in the agent libperf-jvmti.so. As a result the JVM when using
    such agent to record JITed code profiling information will fail on
    looking up scnprintf:

    java: symbol lookup error: lib/libperf-jvmti.so: undefined symbol: scnprintf

    This commit fixes that by reverting to the use of snprintf, that can be
    looked up, instead of scnprintf, adding a proper check for the returned
    value in order to print a better error message when the jitdump file
    pathname is too long. Checking the returned value also helps to comply
    with some recent gcc versions, like gcc8, which will fail due to
    truncated writing checks related to the -Werror=format-truncation= flag.

    Signed-off-by: Gustavo Romero
    Acked-by: Jiri Olsa
    LPU-Reference: 1541117601-18937-2-git-send-email-gromero@linux.vnet.ibm.com
    Link: https://lkml.kernel.org/n/tip-mvpxxxy7wnzaj74cq75muw3f@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Gustavo Romero
     
  • Guenter reported that using ARCH=x86_64 to build perf has regressed:

    $ make -C tools/perf O=/tmp/build/perf ARCH=x86_64
    make: Entering directory '/home/acme/git/perf/tools/perf'
    BUILD: Doing 'make -j4' parallel build
    HOSTCC /tmp/build/perf/fixdep.o
    HOSTLD /tmp/build/perf/fixdep-in.o
    LINK /tmp/build/perf/fixdep

    Auto-detecting system features:
    ... dwarf: [ on ]

    ... bpf: [ on ]

    GEN /tmp/build/perf/common-cmds.h
    make[2]: *** No rule to make target '/home/acme/git/perf/tools/arch/x86_64/include/uapi/asm//mman.h', needed by '/tmp/build/perf/trace/beauty/generated/mmap_flags_array.c'. Stop.
    make[2]: *** Waiting for unfinished jobs....
    PERF_VERSION = 4.19.gf6c23e3
    make[1]: *** [Makefile.perf:207: sub-make] Error 2
    make: *** [Makefile:70: all] Error 2
    make: Leaving directory '/home/acme/git/perf/tools/perf'
    $

    This is because we must use $(SRCARCH) where we were using $(ARCH), so
    that, just like the top level Makefile, we get this done:

    # Additional ARCH settings for x86
    ifeq ($(ARCH),i386)
    SRCARCH := x86
    endif
    ifeq ($(ARCH),x86_64)
    SRCARCH := x86
    endif

    Which is done in tools/scripts/Makefile.arch, so switch to use
    $(SRCARCH).

    Reported-by: Guenter Roeck
    Cc: Adrian Hunter
    Cc: Clark Williams
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Fixes: fbd7458db757 ("perf beauty: Wire up the mmap flags table generator to the Makefile")
    Link: https://lkml.kernel.org/r/20181105184612.GD7077@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo