30 Sep, 2022

1 commit

  • This is the 5.15.71 stable release

    * tag 'v5.15.71': (144 commits)
    Linux 5.15.71
    ext4: use locality group preallocation for small closed files
    ext4: avoid unnecessary spreading of allocations among groups
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    drivers/net/phy/aquantia_main.c
    drivers/tty/serial/fsl_lpuart.c

    Jason Liu
     

28 Sep, 2022

5 commits

  • [ Upstream commit 83e4b196838d90799a8879e5054a3beecf9ed256 ]

    RHEL/Fedora RPM build checks are stricter, and complain when executable
    files don't have a shebang line, e.g.

    *** WARNING: ./kselftests/net/forwarding/sch_red.sh is executable but has no shebang, removing executable bit

    Fix it by adding shebang line.

    Fixes: 6cf0291f9517 ("selftests: forwarding: Add a RED test for SW datapath")
    Signed-off-by: Hangbin Liu
    Reviewed-by: Petr Machata
    Link: https://lore.kernel.org/r/20220922024453.437757-1-liuhangbin@gmail.com
    Signed-off-by: Jakub Kicinski
    Signed-off-by: Sasha Levin

    Hangbin Liu
     
  • [ Upstream commit 999e4eaa4b3691acf85d094836260ec4b66c74fd ]

    It needs to enter the namespace before reading a file.

    Fixes: 4183a8d70a288627 ("perf tools: Allow synthesizing the build id for kernel/modules/tasks in PERF_RECORD_MMAP2")
    Signed-off-by: Namhyung Kim
    Cc: Adrian Hunter
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20220920222822.2171056-1-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Namhyung Kim
     
  • [ Upstream commit 5b427df27b94aec1312cace48a746782a0925c53 ]

    /proc/kallsyms and /proc/modules are compared before and after the copy
    in order to ensure no changes during the copy.

    However /proc/modules also might change due to reference counts changing
    even though that does not make any difference.

    Any modules loaded or unloaded should be visible in changes to kallsyms,
    so it is not necessary to check /proc/modules also anyway.

    Remove the comparison checking that /proc/modules is unchanged.

    Fixes: fc1b691d7651d949 ("perf buildid-cache: Add ability to add kcore to the cache")
    Reported-by: Daniel Dao
    Signed-off-by: Adrian Hunter
    Tested-by: Daniel Dao
    Acked-by: Namhyung Kim
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Link: https://lore.kernel.org/r/20220914122429.8770-1-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Adrian Hunter
     
  • [ Upstream commit babd04386b1df8c364cdaa39ac0e54349502e1e5 ]

    The missing header makes it hard for programs like elfutils to open
    these files.

    Fixes: 2d86612aacb7805f ("perf symbol: Correct address for bss symbols")
    Reviewed-by: Leo Yan
    Signed-off-by: Lieven Hey
    Tested-by: Leo Yan
    Cc: Leo Yan
    Link: https://lore.kernel.org/r/20220915092910.711036-1-lieven.hey@kdab.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Lieven Hey
     
  • [ Upstream commit 0d77326c3369e255715ed2440a78894ccc98dd69 ]

    It seems the recent libbpf got more strict about the section name.
    I'm seeing a failure like this:

    $ sudo ./perf stat -a --bpf-counters --for-each-cgroup ^. sleep 1
    libbpf: prog 'on_cgrp_switch': missing BPF prog type, check ELF section name 'perf_events'
    libbpf: prog 'on_cgrp_switch': failed to load: -22
    libbpf: failed to load object 'bperf_cgroup_bpf'
    libbpf: failed to load BPF skeleton 'bperf_cgroup_bpf': -22
    Failed to load cgroup skeleton

    The section name should be 'perf_event' (without the trailing 's').
    Although it's related to the libbpf change, it'd be better fix the
    section name in the first place.

    Fixes: 944138f048f7d759 ("perf stat: Enable BPF counter with --for-each-cgroup")
    Signed-off-by: Namhyung Kim
    Cc: Adrian Hunter
    Cc: bpf@vger.kernel.org
    Cc: Ian Rogers
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Song Liu
    Link: https://lore.kernel.org/r/20220916184132.1161506-2-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Namhyung Kim
     

27 Sep, 2022

1 commit

  • This is the 5.15.70 stable release

    * tag 'v5.15.70': (2444 commits)
    Linux 5.15.70
    ALSA: hda/sigmatel: Fix unused variable warning for beep power change
    cgroup: Add missing cpus_read_lock() to cgroup_attach_task_all()
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    arch/arm/boot/dts/imx6ul.dtsi
    arch/arm/mm/mmu.c
    arch/arm64/boot/dts/freescale/imx8mp-evk.dts
    drivers/gpu/drm/imx/dcss/dcss-kms.c
    drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
    drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h
    drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
    drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
    drivers/soc/fsl/Kconfig
    drivers/soc/imx/gpcv2.c
    drivers/usb/dwc3/host.c
    net/dsa/slave.c
    sound/soc/fsl/imx-card.c

    Jason Liu
     

23 Sep, 2022

1 commit

  • commit 95363747a6f39e88a3052fcf6ce6237769495ce0 upstream.

    tools/include/uapi/asm/errno.h currently attempts to include
    non-existent arch-specific errno.h header for xtensa.
    Remove this case so that is used instead,
    and add the missing arch-specific header for parisc.

    References: https://buildd.debian.org/status/fetch.php?pkg=linux&arch=ia64&ver=5.8.3-1%7Eexp1&stamp=1598340829&raw=1
    Signed-off-by: Ben Hutchings
    Signed-off-by: Salvatore Bonaccorso
    Cc: # 5.10+
    Signed-off-by: Helge Deller
    Signed-off-by: Greg Kroah-Hartman

    Ben Hutchings
     

15 Sep, 2022

2 commits

  • commit 9d5f0c36438eeae7566ca383b2b673179e3cc613 upstream.

    Its more intention revealing, and if we're interested in the odd cases
    where this may end up truncating we can do debug checks at one
    centralized place.

    Motivation, of all the container builds, fedora rawhide started
    complaining of:

    util/machine.c: In function ‘machine__create_modules’:
    util/machine.c:1419:50: error: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-truncation=]
    1419 | snprintf(path, sizeof(path), "%s/%s", dir_name, dent->d_name);
    | ^~
    In file included from /usr/include/stdio.h:894,
    from util/branch.h:9,
    from util/callchain.h:8,
    from util/machine.c:7:
    In function ‘snprintf’,
    inlined from ‘maps__set_modules_path_dir’ at util/machine.c:1419:3,
    inlined from ‘machine__set_modules_path’ at util/machine.c:1473:9,
    inlined from ‘machine__create_modules’ at util/machine.c:1519:7:
    /usr/include/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 2 and 4352 bytes into a destination of size 4096

    There are other places where we should use path__join(), but lets get rid of
    this one first.

    Cc: Adrian Hunter
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Acked-by: Ian Rogers
    Link: Link: https://lore.kernel.org/r/YebZKjwgfdOz0lAs@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Jisheng Zhang
    Signed-off-by: Greg Kroah-Hartman

    Arnaldo Carvalho de Melo
     
  • [ Upstream commit 82b2425fad2dd47204b3da589b679220f8aacc0e ]

    Commit b91e5492f9d7ca89 ("perf record: Add a dummy event on hybrid
    systems to collect metadata records") adds a dummy event on hybrid
    systems to fix the symbol "unknown" issue when the workload is created
    in a P-core but runs on an E-core. The added dummy event will cause
    "perf script -F iregs" to fail. Dummy events do not have "iregs"
    attribute set, so when we do evsel__check_attr, the "iregs" attribute
    check will fail, so the issue happened.

    The following commit [1] has fixed a similar issue by skipping the attr
    check for the dummy event because it does not have any samples anyway. It
    works okay for the normal mode, but the issue still happened when running
    the test in the pipe mode. In the pipe mode, it calls process_attr() which
    still checks the attr for the dummy event. This commit fixed the issue by
    skipping the attr check for the dummy event in the API evsel__check_attr,
    Otherwise, we have to patch everywhere when evsel__check_attr() is called.

    Before:

    #./perf record -o - --intr-regs=di,r8,dx,cx -e br_inst_retired.near_call:p -c 1000 --per-thread true 2>/dev/null|./perf script -F iregs |head -5
    Samples for 'dummy:HG' event do not have IREGS attribute set. Cannot print 'iregs' field.
    0x120 [0x90]: failed to process type: 64
    #

    After:

    # ./perf record -o - --intr-regs=di,r8,dx,cx -e br_inst_retired.near_call:p -c 1000 --per-thread true 2>/dev/null|./perf script -F iregs |head -5
    ABI:2 CX:0x55b8efa87000 DX:0x55b8efa7e000 DI:0xffffba5e625efbb0 R8:0xffff90e51f8ae100
    ABI:2 CX:0x7f1dae1e4000 DX:0xd0 DI:0xffff90e18c675ac0 R8:0x71
    ABI:2 CX:0xcc0 DX:0x1 DI:0xffff90e199880240 R8:0x0
    ABI:2 CX:0xffff90e180dd7500 DX:0xffff90e180dd7500 DI:0xffff90e180043500 R8:0x1
    ABI:2 CX:0x50 DX:0xffff90e18c583bd0 DI:0xffff90e1998803c0 R8:0x58
    #

    [1]https://lore.kernel.org/lkml/20220831124041.219925-1-jolsa@kernel.org/

    Fixes: b91e5492f9d7ca89 ("perf record: Add a dummy event on hybrid systems to collect metadata records")
    Suggested-by: Namhyung Kim
    Signed-off-by: Xing Zhengjun
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Ian Rogers
    Cc: Ingo Molnar
    Cc: Kan Liang
    Cc: Peter Zijlstra
    Link: https://lore.kernel.org/r/20220908070030.3455164-1-zhengjun.xing@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Zhengjun Xing
     

05 Sep, 2022

1 commit


31 Aug, 2022

2 commits

  • commit bf515f024e4c0ca46a1b08c4f31860c01781d8a5 upstream.

    If a weak group is broken then the reset_group flag remains set for
    the next run. Having reset_group set means the counter isn't created
    and ultimately a segfault.

    A simple reproduction of this is:

    # perf stat -r2 -e '{cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles}:W

    which will be added as a test in the next patch.

    Fixes: 4804e0111662d7d8 ("perf stat: Use affinity for opening events")
    Reviewed-by: Andi Kleen
    Signed-off-by: Ian Rogers
    Tested-by: Arnaldo Carvalho de Melo
    Tested-by: Xing Zhengjun
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Kan Liang
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: https://lore.kernel.org/r/20220822213352.75721-1-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Ian Rogers
     
  • commit bc9e7fe313d5e56d4d5f34bcc04d1165f94f86fb upstream.

    The previous change to Python autodetection had a small mistake where
    the auto value was used to determine the Python binary, rather than the
    user supplied value. The Python binary is only used for one part of the
    build process, rather than the final linking, so it was producing
    correct builds in most scenarios, especially when the auto detected
    value matched what the user wanted, or the system only had a valid set
    of Pythons.

    Change it so that the Python binary path is derived from either the
    PYTHON_CONFIG value or PYTHON value, depending on what is specified by
    the user. This was the original intention.

    This error was spotted in a build failure an odd cross compilation
    environment after commit 4c41cb46a732fe82 ("perf python: Prefer
    python3") was merged.

    Fixes: 630af16eee495f58 ("perf tools: Use Python devtools for version autodetection rather than runtime")
    Signed-off-by: James Clark
    Acked-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Ingo Molnar
    Cc: James Clark
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: https://lore.kernel.org/r/20220728093946.1337642-1-james.clark@arm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    James Clark
     

25 Aug, 2022

7 commits

  • [ Upstream commit f5eab65ff2b76449286d18efc7fee3e0b72f7d9b ]

    A new feature is added where kprobes (and other probes) do not need to
    explicitly state the event name when creating a probe. The event name will
    come from what is being attached.

    That is:

    # echo 'p:foo/ vfs_read' > kprobe_events

    Will no longer error, but instead create an event:

    # cat kprobe_events
    p:foo/p_vfs_read_0 vfs_read

    This should not be tested as an error case anymore. Remove it from the
    selftest as now this feature "breaks" the selftest as it no longer fails
    as expected.

    Link: https://lore.kernel.org/all/1656296348-16111-1-git-send-email-quic_linyyuan@quicinc.com/
    Link: https://lkml.kernel.org/r/20220712161707.6dc08a14@gandalf.local.home

    Signed-off-by: Steven Rostedt (Google)
    Signed-off-by: Sasha Levin

    Steven Rostedt (Google)
     
  • commit 1da1d60774014137d776d0400fdf2f1779d8d4d5 upstream.

    If cpu_core PMU event fails to parse, try also cpu_atom PMU event when
    parsing cycles event.

    Fixes: 43eb05d066795bdf ("perf tests: Support 'Track with sched_switch' test for hybrid")
    Signed-off-by: Adrian Hunter
    Cc: Ian Rogers
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: https://lore.kernel.org/r/20220809080702.6921-3-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Adrian Hunter
     
  • commit 2e828582b81f5bc76a4fe8e7812df259ab208302 upstream.

    parse_events() is often called with parse_events_error set to NULL.
    Make parse_events_error__handle() not segfault in that case.

    A subsequent patch changes to avoid passing NULL in the first place.

    Fixes: 43eb05d066795bdf ("perf tests: Support 'Track with sched_switch' test for hybrid")
    Signed-off-by: Adrian Hunter
    Cc: Ian Rogers
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: https://lore.kernel.org/r/20220809080702.6921-2-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Adrian Hunter
     
  • commit 4bf6dcaa93bcd083a13c278a91418fe10e6d23a0 upstream.

    If a memory allocation fail, we should branch to the error handling path
    in order to free some resources allocated a few lines above.

    Fixes: 15354d54698648e2 ("perf probe: Generate event name with line number")
    Signed-off-by: Christophe JAILLET
    Acked-by: Masami Hiramatsu
    Cc: Alexander Shishkin
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: kernel-janitors@vger.kernel.org
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: https://lore.kernel.org/r/b71bcb01fa0c7b9778647235c3ab490f699ba278.1659797452.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Christophe JAILLET
     
  • commit 5b245985a6de5ac18b5088c37068816d413fb8ed upstream.

    Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an
    error when it encounters the deprecated function MD5_Init() and the others.

    The error would be interpreted as missing libcrypto, while in reality it is
    not.

    Fixes: 6e8ccb4f624a73c5 ("tools/bpf: properly account for libbfd variations")
    Signed-off-by: Roberto Sassu
    Cc: Alexei Starovoitov
    Cc: Andrii Nakryiko
    Cc: bpf@vger.kernel.org
    Cc: Daniel Borkmann
    Cc: Ingo Molnar
    Cc: John Fastabend
    Cc: KP Singh
    Cc: llvm@lists.linux.dev
    Cc: Martin KaFai Lau
    Cc: Nathan Chancellor
    Cc: Nick Desaulniers
    Cc: Nick Terrell
    Cc: Peter Zijlstra
    Cc: Quentin Monnet
    Cc: Song Liu
    Cc: Stanislav Fomichev
    Link: https://lore.kernel.org/r/20220719170555.2576993-4-roberto.sassu@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Roberto Sassu
     
  • commit 4f5ceb8851f0081af54313abbf56de1615911faf upstream.

    When the number of partial slabs in each cache is the same (e.g., the
    value are 0), the results of the `slabinfo -X -N5` and `slabinfo -P -N5`
    are different.

    / # slabinfo -X -N5
    ...
    Slabs sorted by number of partial slabs
    ---------------------------------------
    Name Objects Objsize Space Slabs/Part/Cpu O/S O %Fr %Ef Flg
    inode_cache 15180 392 6217728 758/0/1 20 1 0 95 a
    kernfs_node_cache 22494 88 2002944 488/0/1 46 0 0 98
    shmem_inode_cache 663 464 319488 38/0/1 17 1 0 96
    biovec-max 50 3072 163840 4/0/1 10 3 0 93 A
    dentry 19050 136 2600960 633/0/2 30 0 0 99 a

    / # slabinfo -P -N5
    Name Objects Objsize Space Slabs/Part/Cpu O/S O %Fr %Ef Flg
    bdev_cache 32 984 32.7K 1/0/1 16 2 0 96 Aa
    ext4_inode_cache 42 752 32.7K 1/0/1 21 2 0 96 a
    dentry 19050 136 2.6M 633/0/2 30 0 0 99 a
    TCPv6 17 1840 32.7K 0/0/1 17 3 0 95 A
    RAWv6 18 856 16.3K 0/0/1 18 2 0 94 A

    This problem is caused by the sort_slabs(). So let's use alphabetic order
    when two values are equal in the sort_slabs().

    By the way, the content of the `slabinfo -h` is not aligned because the

    `-P|--partial Sort by number of partial slabs`

    uses tabs instead of spaces. So let's use spaces instead of tabs to fix
    it.

    Link: https://lkml.kernel.org/r/20220528063117.935158-1-songyuanzheng@huawei.com
    Fixes: 1106b205a3fe ("tools/vm/slabinfo: add partial slab listing to -X")
    Signed-off-by: Yuanzheng Song
    Cc: "Tobin C. Harding"
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Yuanzheng Song
     
  • commit 8bcfb4ae4d970b9a9724ddfbac26c387934e0e94 upstream.

    The custom multipath hash tests use mausezahn in order to test how
    changes in various packet fields affect the packet distribution across
    the available nexthops.

    The tool uses the libnet library for various low-level packet
    construction and injection. The library started using the
    "SO_BINDTODEVICE" socket option for IPv6 sockets in version 1.1.6 and
    for IPv4 sockets in version 1.2.

    When the option is not set, packets are not routed according to the
    table associated with the VRF master device and tests fail.

    Fix this by prefixing the command with "ip vrf exec", which will cause
    the route lookup to occur in the VRF routing table. This makes the tests
    pass regardless of the libnet library version.

    Fixes: 511e8db54036 ("selftests: forwarding: Add test for custom multipath hash")
    Fixes: 185b0c190bb6 ("selftests: forwarding: Add test for custom multipath hash with IPv4 GRE")
    Fixes: b7715acba4d3 ("selftests: forwarding: Add test for custom multipath hash with IPv6 GRE")
    Reported-by: Ivan Vecera
    Tested-by: Ivan Vecera
    Signed-off-by: Ido Schimmel
    Reviewed-by: Amit Cohen
    Link: https://lore.kernel.org/r/20220809113320.751413-1-idosch@nvidia.com
    Signed-off-by: Jakub Kicinski
    Signed-off-by: Greg Kroah-Hartman

    Ido Schimmel
     

17 Aug, 2022

14 commits

  • [ Upstream commit 6c58cf40e3a1d2f47c09d3489857e9476316788a ]

    A build with -D_FORTIFY_SOURCE=2 enabled will produce the following warnings:

    sysfs.c:63:30: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 0 and 255 [-Wformat-truncation=]
    snprintf(filepath, 256, "%s/%s", path, filename);
    ^~
    Bump up the buffer to PATH_MAX which is the limit and account for all of
    the possible NUL and separators that could lead to exceeding the
    allocated buffer sizes.

    Fixes: 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal subsystem")
    Signed-off-by: Florian Fainelli
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Sasha Levin

    Florian Fainelli
     
  • [ Upstream commit 91cea6be90e436c55cde8770a15e4dac9d3032d0 ]

    When genelf was introduced it tested for HAVE_LIBCRYPTO not
    HAVE_LIBCRYPTO_SUPPORT, which is the define the feature test for openssl
    defines, fix it.

    This also adds disables the deprecation warning, someone has to fix this
    to build with openssl 3.0 before the warning becomes a hard error.

    Fixes: 9b07e27f88b9cd78 ("perf inject: Add jitdump mmap injection support")
    Reported-by: 谭梓煊
    Cc: Alexei Starovoitov
    Cc: Andrii Nakryiko
    Cc: Daniel Borkmann
    Cc: Jiri Olsa
    Cc: John Fastabend
    Cc: KP Singh
    Cc: Martin KaFai Lau
    Cc: Nick Terrell
    Cc: Song Liu
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/YulpPqXSOG0Q4J1o@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Arnaldo Carvalho de Melo
     
  • [ Upstream commit 6d518ac7be6223811ab947897273b1bbef846180 ]

    The perf jvmti agent doesn't create program headers, in this case
    fallback on section headers as happened previously.

    Committer notes:

    To test this, from a public post by Ian:

    1) download a Java workload dacapo-9.12-MR1-bach.jar from
    https://sourceforge.net/projects/dacapobench/

    2) build perf such as "make -C tools/perf O=/tmp/perf NO_LIBBFD=1" it
    should detect Java and create /tmp/perf/libperf-jvmti.so

    3) run perf with the jvmti agent:

    perf record -k 1 java -agentpath:/tmp/perf/libperf-jvmti.so -jar dacapo-9.12-MR1-bach.jar -n 10 fop

    4) run perf inject:

    perf inject -i perf.data -o perf-injected.data -j

    5) run perf report

    perf report -i perf-injected.data | grep org.apache.fop

    With this patch reverted I see lots of symbols like:

    0.00% java jitted-388040-4656.so [.] org.apache.fop.fo.FObj.bind(org.apache.fop.fo.PropertyList)

    With the patch (2d86612aacb7805f ("perf symbol: Correct address for bss
    symbols")) I see lots of:

    dso__load_sym_internal: failed to find program header for symbol:
    Lorg/apache/fop/fo/FObj;bind(Lorg/apache/fop/fo/PropertyList;)V
    st_value: 0x40

    Fixes: 2d86612aacb7805f ("perf symbol: Correct address for bss symbols")
    Reviewed-by: Leo Yan
    Signed-off-by: Ian Rogers
    Tested-by: Leo Yan
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Leo Yan
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20220731164923.691193-1-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Ian Rogers
     
  • [ Upstream commit 68566a7cf56bf3148797c218ed45a9de078ef47c ]

    Synthesized MMAP events have zero ino_generation, so do not compare
    them to DSOs with a real ino_generation otherwise we end up with a DSO
    without a build id.

    Fixes: 0e3149f86b99ddab ("perf dso: Move dso_id from 'struct map' to 'struct dso'")
    Signed-off-by: Adrian Hunter
    Cc: Andi Kleen
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: kvm@vger.kernel.org
    Cc: Namhyung Kim
    Link: https://lore.kernel.org/r/20220711093218.10967-2-adrian.hunter@intel.com
    [ Added clarification to the comment from Ian + more detailed explanation from Adrian ]
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Adrian Hunter
     
  • [ Upstream commit 281106f938d3daaea6f8b6723a8217a2a1ef6936 ]

    kvm_hypercall has to place the hypercall number in rax.

    Trace events show that kvm_pv_test doesn't work properly:
    kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0
    kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0
    kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0

    With this change, it starts working as expected:
    kvm_pv_test-54285: kvm_hypercall: nr 0x5 a0 0x0 a1 0x0 a2 0x0 a3 0x0
    kvm_pv_test-54285: kvm_hypercall: nr 0xa a0 0x0 a1 0x0 a2 0x0 a3 0x0
    kvm_pv_test-54285: kvm_hypercall: nr 0xb a0 0x0 a1 0x0 a2 0x0 a3 0x0

    Signed-off-by: Andrei Vagin
    Message-Id:
    Fixes: ac4a4d6de22e ("selftests: kvm: test enforcement of paravirtual cpuid features")
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Sasha Levin

    Andrei Vagin
     
  • [ Upstream commit b80892ca022e9eb484771a66eb68e12364695a2a ]

    No driver is left using the external pgmap refcount, so remove the
    code to support it.

    Signed-off-by: Christoph Hellwig
    Acked-by: Bjorn Helgaas
    Link: https://lore.kernel.org/r/20211028151017.50234-1-hch@lst.de
    Signed-off-by: Dan Williams
    Signed-off-by: Sasha Levin

    Christoph Hellwig
     
  • [ Upstream commit b77ffb30cfc5f58e957571d8541c6a7e3da19221 ]

    The snprintf() function returns the number of bytes it *would* have
    copied if there were enough space. So it can return > the
    sizeof(gen->attach_target).

    Fixes: 67234743736a ("libbpf: Generate loader program out of BPF ELF file.")
    Signed-off-by: Dan Carpenter
    Acked-by: Martin KaFai Lau
    Link: https://lore.kernel.org/r/YtZ+oAySqIhFl6/J@kili
    Signed-off-by: Alexei Starovoitov
    Signed-off-by: Sasha Levin

    Dan Carpenter
     
  • [ Upstream commit c5d22f4cfe8dfb93f1db0a1e7e2e7ebc41395d98 ]

    The snprintf() function returns the number of bytes which *would*
    have been copied if there were space. In other words, it can be
    > sizeof(pin_path).

    Fixes: c0fa1b6c3efc ("bpf: btf: Add BTF tests")
    Signed-off-by: Dan Carpenter
    Acked-by: Martin KaFai Lau
    Link: https://lore.kernel.org/r/YtZ+aD/tZMkgOUw+@kili
    Signed-off-by: Alexei Starovoitov
    Signed-off-by: Sasha Levin

    Dan Carpenter
     
  • [ Upstream commit 4d8f52ac5fa9eede7b7aa2f2d67c841d9eeb655f ]

    The return value from system() is a waitpid-style integer. Do not return
    it directly because with the implicit masking in exit() it will always
    return 0. Access it with appropriate macros to really pass on errors.

    Fixes: 7290ce1423c3 ("selftests/timers: Add clocksource-switch test from timetest suite")
    Signed-off-by: Wolfram Sang
    Acked-by: John Stultz
    Signed-off-by: Shuah Khan
    Signed-off-by: Sasha Levin

    Wolfram Sang
     
  • [ Upstream commit 9a162977d20436be5678a8e21a8e58eb4616d86a ]

    Toolchains with an include file 'sys/timex.h' based on 3.18 will have a
    'clock_adjtime' definition added, so it can't be static in the code:

    valid-adjtimex.c:43:12: error: static declaration of ‘clock_adjtime’ follows non-static declaration

    Fixes: e03a58c320e1 ("kselftests: timers: Add adjtimex SETOFFSET validity tests")
    Signed-off-by: Wolfram Sang
    Acked-by: John Stultz
    Signed-off-by: Shuah Khan
    Signed-off-by: Sasha Levin

    Wolfram Sang
     
  • [ Upstream commit bf3f00378524adae16628cbadbd11ba7211863bb ]

    BPF map name is limited to BPF_OBJ_NAME_LEN.
    A map name is defined as being longer than BPF_OBJ_NAME_LEN,
    it will be truncated to BPF_OBJ_NAME_LEN when a userspace program
    calls libbpf to create the map. A pinned map also generates a path
    in the /sys. If the previous program wanted to reuse the map,
    it can not get bpf_map by name, because the name of the map is only
    partially the same as the name which get from pinned path.

    The syscall information below show that map name "process_pinned_map"
    is truncated to "process_pinned_".

    bpf(BPF_OBJ_GET, {pathname="/sys/fs/bpf/process_pinned_map",
    bpf_fd=0, file_flags=0}, 144) = -1 ENOENT (No such file or directory)

    bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_HASH, key_size=4,
    value_size=4,max_entries=1024, map_flags=0, inner_map_fd=0,
    map_name="process_pinned_",map_ifindex=0, btf_fd=3, btf_key_type_id=6,
    btf_value_type_id=10,btf_vmlinux_value_type_id=0}, 72) = 4

    This patch check that if the name of pinned map are the same as the
    actual name for the first (BPF_OBJ_NAME_LEN - 1),
    bpf map still uses the name which is included in bpf object.

    Fixes: 26736eb9a483 ("tools: libbpf: allow map reuse")
    Signed-off-by: Anquan Wu
    Signed-off-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/OSZP286MB1725CEA1C95C5CB8E7CCC53FB8869@OSZP286MB1725.JPNP286.PROD.OUTLOOK.COM
    Signed-off-by: Sasha Levin

    Anquan Wu
     
  • [ Upstream commit 39e940d4abfabb08b6937a315546b24d10be67e3 ]

    Currently, xsk_socket__delete frees BPF resources regardless of ctx
    refcount. Xdpxceiver has a test to verify whether underlying BPF
    resources would not be wiped out after closing XSK socket that was
    bound to interface with other active sockets. From library's xsk part
    perspective it also means that the internal xsk context is shared and
    its refcount is bumped accordingly.

    After a switch to loading XDP prog based on previously opened XSK
    socket, mentioned xdpxceiver test fails with:

    not ok 16 [xdpxceiver.c:swap_xsk_resources:1334]: ERROR: 9/"Bad file descriptor

    which means that in swap_xsk_resources(), xsk_socket__delete() released
    xskmap which in turn caused a failure of xsk_socket__update_xskmap().

    To fix this, when deleting socket, decrement ctx refcount before
    releasing BPF resources and do so only when refcount dropped to 0 which
    means there are no more active sockets for this ctx so BPF resources can
    be freed safely.

    Fixes: 2f6324a3937f ("libbpf: Support shared umems between queues and devices")
    Signed-off-by: Maciej Fijalkowski
    Signed-off-by: Daniel Borkmann
    Acked-by: Magnus Karlsson
    Link: https://lore.kernel.org/bpf/20220629143458.934337-5-maciej.fijalkowski@intel.com
    Signed-off-by: Sasha Levin

    Maciej Fijalkowski
     
  • [ Upstream commit 0cf51bfe999524377fbb71becb583b4ca6d07cfc ]

    Include sys/time.h and pthread.h in tmon.h, so that types
    "pthread_mutex_t" and "struct timeval tv" are known when tmon.h
    references them.

    Without these headers, compiling tmon against musl-libc will fail with
    these errors:

    In file included from sysfs.c:31:0:
    tmon.h:47:8: error: unknown type name 'pthread_mutex_t'
    extern pthread_mutex_t input_lock;
    ^~~~~~~~~~~~~~~
    make[3]: *** [: sysfs.o] Error 1
    make[3]: *** Waiting for unfinished jobs....
    In file included from tui.c:31:0:
    tmon.h:54:17: error: field 'tv' has incomplete type
    struct timeval tv;
    ^~
    make[3]: *** [: tui.o] Error 1
    make[2]: *** [Makefile:83: tmon] Error 2

    Signed-off-by: Markus Mayer
    Acked-by: Florian Fainelli
    Reviewed-by: Sumeet Pawnikar
    Acked-by: Alejandro González
    Tested-by: Alejandro González
    Fixes: 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal subsystem")
    Link: https://lore.kernel.org/r/20220718031040.44714-1-f.fainelli@gmail.com
    Signed-off-by: Daniel Lezcano
    Signed-off-by: Sasha Levin

    Markus Mayer
     
  • [ Upstream commit 3ce4b78f73e8e00fb86bad67ee7f6fe12019707e ]

    clang has -Wconstant-conversion by default, and the constant 0xAAAAAAAAA
    (9 As) being converted to an int, which is generally 32 bits, results
    in the compile warning:

    clang -Wl,-no-as-needed -Wall -isystem ../../../../usr/include/ -lpthread seccomp_bpf.c -lcap -o seccomp_bpf
    seccomp_bpf.c:812:67: warning: implicit conversion from 'long' to 'int' changes value from 45812984490 to -1431655766 [-Wconstant-conversion]
    int kill = kill_how == KILL_PROCESS ? SECCOMP_RET_KILL_PROCESS : 0xAAAAAAAAA;
    ~~~~ ^~~~~~~~~~~
    1 warning generated.

    -1431655766 is the expected truncation, 0xAAAAAAAA (8 As), so use
    this directly in the code to avoid the warning.

    Fixes: 3932fcecd962 ("selftests/seccomp: Add test for unknown SECCOMP_RET kill behavior")
    Signed-off-by: YiFei Zhu
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20220526223407.1686936-1-zhuyifei@google.com
    Signed-off-by: Sasha Levin

    YiFei Zhu
     

11 Aug, 2022

6 commits

  • commit 2b1299322016731d56807aa49254a5ea3080b6b3 upstream.

    tl;dr: The Enhanced IBRS mitigation for Spectre v2 does not work as
    documented for RET instructions after VM exits. Mitigate it with a new
    one-entry RSB stuffing mechanism and a new LFENCE.

    == Background ==

    Indirect Branch Restricted Speculation (IBRS) was designed to help
    mitigate Branch Target Injection and Speculative Store Bypass, i.e.
    Spectre, attacks. IBRS prevents software run in less privileged modes
    from affecting branch prediction in more privileged modes. IBRS requires
    the MSR to be written on every privilege level change.

    To overcome some of the performance issues of IBRS, Enhanced IBRS was
    introduced. eIBRS is an "always on" IBRS, in other words, just turn
    it on once instead of writing the MSR on every privilege level change.
    When eIBRS is enabled, more privileged modes should be protected from
    less privileged modes, including protecting VMMs from guests.

    == Problem ==

    Here's a simplification of how guests are run on Linux' KVM:

    void run_kvm_guest(void)
    {
    // Prepare to run guest
    VMRESUME();
    // Clean up after guest runs
    }

    The execution flow for that would look something like this to the
    processor:

    1. Host-side: call run_kvm_guest()
    2. Host-side: VMRESUME
    3. Guest runs, does "CALL guest_function"
    4. VM exit, host runs again
    5. Host might make some "cleanup" function calls
    6. Host-side: RET from run_kvm_guest()

    Now, when back on the host, there are a couple of possible scenarios of
    post-guest activity the host needs to do before executing host code:

    * on pre-eIBRS hardware (legacy IBRS, or nothing at all), the RSB is not
    touched and Linux has to do a 32-entry stuffing.

    * on eIBRS hardware, VM exit with IBRS enabled, or restoring the host
    IBRS=1 shortly after VM exit, has a documented side effect of flushing
    the RSB except in this PBRSB situation where the software needs to stuff
    the last RSB entry "by hand".

    IOW, with eIBRS supported, host RET instructions should no longer be
    influenced by guest behavior after the host retires a single CALL
    instruction.

    However, if the RET instructions are "unbalanced" with CALLs after a VM
    exit as is the RET in #6, it might speculatively use the address for the
    instruction after the CALL in #3 as an RSB prediction. This is a problem
    since the (untrusted) guest controls this address.

    Balanced CALL/RET instruction pairs such as in step #5 are not affected.

    == Solution ==

    The PBRSB issue affects a wide variety of Intel processors which
    support eIBRS. But not all of them need mitigation. Today,
    X86_FEATURE_RSB_VMEXIT triggers an RSB filling sequence that mitigates
    PBRSB. Systems setting RSB_VMEXIT need no further mitigation - i.e.,
    eIBRS systems which enable legacy IBRS explicitly.

    However, such systems (X86_FEATURE_IBRS_ENHANCED) do not set RSB_VMEXIT
    and most of them need a new mitigation.

    Therefore, introduce a new feature flag X86_FEATURE_RSB_VMEXIT_LITE
    which triggers a lighter-weight PBRSB mitigation versus RSB_VMEXIT.

    The lighter-weight mitigation performs a CALL instruction which is
    immediately followed by a speculative execution barrier (INT3). This
    steers speculative execution to the barrier -- just like a retpoline
    -- which ensures that speculation can never reach an unbalanced RET.
    Then, ensure this CALL is retired before continuing execution with an
    LFENCE.

    In other words, the window of exposure is opened at VM exit where RET
    behavior is troublesome. While the window is open, force RSB predictions
    sampling for RET targets to a dead end at the INT3. Close the window
    with the LFENCE.

    There is a subset of eIBRS systems which are not vulnerable to PBRSB.
    Add these systems to the cpu_vuln_whitelist[] as NO_EIBRS_PBRSB.
    Future systems that aren't vulnerable will set ARCH_CAP_PBRSB_NO.

    [ bp: Massage, incorporate review comments from Andy Cooper. ]

    Signed-off-by: Daniel Sneddon
    Co-developed-by: Pawan Gupta
    Signed-off-by: Pawan Gupta
    Signed-off-by: Borislav Petkov
    Signed-off-by: Greg Kroah-Hartman

    Daniel Sneddon
     
  • [ Upstream commit 9e2f6498efbbc880d7caa7935839e682b64fe5a6 ]

    The selftests, when built with newer versions of clang, is found
    to have over optimized guests' ucall() function, and eliminating
    the stores for uc.cmd (perhaps due to no immediate readers). This
    resulted in the userspace side always reading a value of '0', and
    causing multiple test failures.

    As a result, prevent the compiler from optimizing the stores in
    ucall() with WRITE_ONCE().

    Suggested-by: Ricardo Koller
    Suggested-by: Reiji Watanabe
    Signed-off-by: Raghavendra Rao Ananta
    Message-Id:
    Reviewed-by: Andrew Jones
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Sasha Levin

    Raghavendra Rao Ananta
     
  • [ Upstream commit 933b5f9f98da29af646b51b36a0753692908ef64 ]

    Instead of printing an error message, kvm_stat script fails when we
    restrict statistics to a guest by its name and there are multiple guests
    with such name:

    # kvm_stat -g my_vm
    Traceback (most recent call last):
    File "/usr/bin/kvm_stat", line 1819, in
    main()
    File "/usr/bin/kvm_stat", line 1779, in main
    options = get_options()
    File "/usr/bin/kvm_stat", line 1718, in get_options
    options = argparser.parse_args()
    File "/usr/lib64/python3.10/argparse.py", line 1825, in parse_args
    args, argv = self.parse_known_args(args, namespace)
    File "/usr/lib64/python3.10/argparse.py", line 1858, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
    File "/usr/lib64/python3.10/argparse.py", line 2067, in _parse_known_args
    start_index = consume_optional(start_index)
    File "/usr/lib64/python3.10/argparse.py", line 2007, in consume_optional
    take_action(action, args, option_string)
    File "/usr/lib64/python3.10/argparse.py", line 1935, in take_action
    action(self, namespace, argument_values, option_string)
    File "/usr/bin/kvm_stat", line 1649, in __call__
    ' to specify the desired pid'.format(" ".join(pids)))
    TypeError: sequence item 0: expected str instance, int found

    To avoid this, it's needed to convert pids int values to strings before
    pass them to join().

    Signed-off-by: Dmitry Klochkov
    Message-Id:
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Sasha Levin

    Dmitry Klochkov
     
  • [ Upstream commit eae260be3a0111a28fe95923e117a55dddec0384 ]

    hyperv_clock doesn't always give a stable test result, especially with
    AMD CPUs. The test compares Hyper-V MSR clocksource (acquired either
    with rdmsr() from within the guest or KVM_GET_MSRS from the host)
    against rdtsc(). To increase the accuracy, increase the measured delay
    (done with nop loop) by two orders of magnitude and take the mean rdtsc()
    value before and after rdmsr()/KVM_GET_MSRS.

    Reported-by: Maxim Levitsky
    Signed-off-by: Vitaly Kuznetsov
    Reviewed-by: Maxim Levitsky
    Tested-by: Maxim Levitsky
    Message-Id:
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Sasha Levin

    Vitaly Kuznetsov
     
  • commit 0c7e0d699ef1430d7f4cf12b4b1d097af58b5515 upstream.

    Commit 64dd68497be76 relocated and renamed the alloc_calls and
    free_calls files from /sys/kernel/slab/NAME/*_calls over to
    /sys/kernel/debug/slab/NAME/*_calls but didn't update the slabinfo tool
    with the new location.

    This change will now have slabinfo look at the new location (and filenames)
    with a fallback to the prior files.

    Fixes: 64dd68497be76 ("mm: slub: move sysfs slab alloc/free interfaces to debugfs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Stéphane Graber
    Tested-by: Stéphane Graber
    Signed-off-by: Vlastimil Babka
    Signed-off-by: Greg Kroah-Hartman

    Stéphane Graber
     
  • commit 2d2202ba858c112b03f84d546e260c61425831a1 upstream.

    cgroup_skb/egress programs which sock_fields test installs process packets
    flying in both directions, from the client to the server, and in reverse
    direction.

    Recently added dst_port check relies on the fact that destination
    port (remote peer port) of the socket which sends the packet is known ahead
    of time. This holds true only for the client socket, which connects to the
    known server port.

    Filter out any traffic that is not egressing from the client socket in the
    BPF program that tests reading the dst_port.

    Fixes: 8f50f16ff39d ("selftests/bpf: Extend verifier and bpf_sock tests for dst_port loads")
    Signed-off-by: Jakub Sitnicki
    Signed-off-by: Daniel Borkmann
    Acked-by: Martin KaFai Lau
    Link: https://lore.kernel.org/bpf/20220317113920.1068535-3-jakub@cloudflare.com
    Signed-off-by: Ovidiu Panait
    Signed-off-by: Greg Kroah-Hartman

    Jakub Sitnicki