1. 05 Dec, 2022 4 commits
  2. 24 Nov, 2022 24 commits
  3. 23 Nov, 2022 12 commits
    • Linus Torvalds's avatar
      Merge tag 'pci-v6.1-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · c3eb11fb
      Linus Torvalds authored
      Pull pci fixes from Bjorn Helgaas:
      
       - Update MAINTAINERS to add Manivannan Sadhasivam as Qcom PCIe RC
         maintainer (replacing Stanimir Varbanov) and include DT PCI bindings
         in the "PCI native host bridge and endpoint drivers" entry.
      
      * tag 'pci-v6.1-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        MAINTAINERS: Include PCI bindings in host bridge entry
        MAINTAINERS: Add Manivannan Sadhasivam as Qcom PCIe RC maintainer
      c3eb11fb
    • Linus Torvalds's avatar
      Merge tag 'spi-fix-v6.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · 4312098b
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "A few fixes, all device specific.
      
        The most important ones are for the i.MX driver which had a couple of
        nasty data corruption inducing errors appear after the change to
        support PIO mode in the last merge window (one introduced by the
        change and one latent one which the PIO changes exposed).
      
        Thanks to Frieder, Fabio, Marc and Marek for jumping on that and
        resolving the issues quickly once they were found"
      
      * tag 'spi-fix-v6.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        spi: spi-imx: spi_imx_transfer_one(): check for DMA transfer first
        spi: tegra210-quad: Fix duplicate resource error
        spi: dw-dma: decrease reference count in dw_spi_dma_init_mfld()
        spi: spi-imx: Fix spi_bus_clk if requested clock is higher than input clock
        spi: mediatek: Fix DEVAPC Violation at KO Remove
      4312098b
    • Linus Torvalds's avatar
      Merge tag '9p-for-6.1-rc7' of https://github.com/martinetd/linux · fd64898d
      Linus Torvalds authored
      Pull 9p fixes from Dominique Martinet:
      
       - 9p now uses a variable size for its recv buffer, but every place
         hadn't been updated properly to use it and some buffer overflows have
         been found and needed fixing.
      
         There's still one place where msize is incorrectly used in a safety
         check (p9_check_errors), but all paths leading to it should already
         be avoiding overflows and that patch took a bit more time to get
         right for zero-copy requests so I'll send it for 6.2
      
       - yet another race condition in p9_conn_cancel introduced by a fix for
         a syzbot report in the same place. Maybe at some point we'll get it
         right without burning it all down...
      
      * tag '9p-for-6.1-rc7' of https://github.com/martinetd/linux:
        9p/xen: check logical size for buffer size
        9p/fd: Use P9_HDRSZ for header size
        9p/fd: Fix write overflow in p9_read_work
        9p/fd: fix issue of list_del corruption in p9_fd_cancel()
      fd64898d
    • David Howells's avatar
      fscache: fix OOB Read in __fscache_acquire_volume · 9f0933ac
      David Howells authored
      The type of a->key[0] is char in fscache_volume_same().  If the length
      of cache volume key is greater than 127, the value of a->key[0] is less
      than 0.  In this case, klen becomes much larger than 255 after type
      conversion, because the type of klen is size_t.  As a result, memcmp()
      is read out of bounds.
      
      This causes a slab-out-of-bounds Read in __fscache_acquire_volume(), as
      reported by Syzbot.
      
      Fix this by changing the type of the stored key to "u8 *" rather than
      "char *" (it isn't a simple string anyway).  Also put in a check that
      the volume name doesn't exceed NAME_MAX.
      
        BUG: KASAN: slab-out-of-bounds in memcmp+0x16f/0x1c0 lib/string.c:757
        Read of size 8 at addr ffff888016f3aa90 by task syz-executor344/3613
        Call Trace:
         memcmp+0x16f/0x1c0 lib/string.c:757
         memcmp include/linux/fortify-string.h:420 [inline]
         fscache_volume_same fs/fscache/volume.c:133 [inline]
         fscache_hash_volume fs/fscache/volume.c:171 [inline]
         __fscache_acquire_volume+0x76c/0x1080 fs/fscache/volume.c:328
         fscache_acquire_volume include/linux/fscache.h:204 [inline]
         v9fs_cache_session_get_cookie+0x143/0x240 fs/9p/cache.c:34
         v9fs_session_init+0x1166/0x1810 fs/9p/v9fs.c:473
         v9fs_mount+0xba/0xc90 fs/9p/vfs_super.c:126
         legacy_get_tree+0x105/0x220 fs/fs_context.c:610
         vfs_get_tree+0x89/0x2f0 fs/super.c:1530
         do_new_mount fs/namespace.c:3040 [inline]
         path_mount+0x1326/0x1e20 fs/namespace.c:3370
         do_mount fs/namespace.c:3383 [inline]
         __do_sys_mount fs/namespace.c:3591 [inline]
         __se_sys_mount fs/namespace.c:3568 [inline]
         __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568
      
      Fixes: 62ab6335 ("fscache: Implement volume registration")
      Reported-by: syzbot+a76f6a6e524cf2080aa3@syzkaller.appspotmail.com
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarZhang Peng <zhangpeng362@huawei.com>
      Reviewed-by: default avatarJingbo Xu <jefflexu@linux.alibaba.com>
      cc: Dominique Martinet <asmadeus@codewreck.org>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: v9fs-developer@lists.sourceforge.net
      cc: linux-cachefs@redhat.com
      Link: https://lore.kernel.org/r/Y3OH+Dmi0QIOK18n@codewreck.org/ # Zhang Peng's v1 fix
      Link: https://lore.kernel.org/r/20221115140447.2971680-1-zhangpeng362@huawei.com/ # Zhang Peng's v2 fix
      Link: https://lore.kernel.org/r/166869954095.3793579.8500020902371015443.stgit@warthog.procyon.org.uk/ # v1
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9f0933ac
    • Namhyung Kim's avatar
      perf lock contention: Do not use BPF task local storage · c66a36af
      Namhyung Kim authored
      It caused some troubles when a lock inside kmalloc is contended
      because task local storage would allocate memory using kmalloc.
      It'd create a recusion and even crash in my system.
      
      There could be a couple of workarounds but I think the simplest
      one is to use a pre-allocated hash map.  We could fix the task
      local storage to use the safe BPF allocator, but it takes time
      so let's change this until it happens actually.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Blake Jones <blakejones@google.com>
      Cc: Chris Li <chriscli@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <song@kernel.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20221118190109.1512674-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c66a36af
    • John Garry's avatar
    • Michael Petlan's avatar
      perf test: Fix record test on KVM guests · 2e9f5bda
      Michael Petlan authored
      Using precise flag with br_inst_retired.near_call causes the test fail
      on KVM guests, even when the guests have PMU forwarding enabled and the
      event itself is supported.
      
      Remove the precise flag in order to make the test work on KVM guests.
      Signed-off-by: default avatarMichael Petlan <mpetlan@redhat.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Link: https://lore.kernel.org/r/20221122083121.6012-1-mpetlan@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2e9f5bda
    • Namhyung Kim's avatar
      perf inject: Set PERF_RECORD_MISC_BUILD_ID_SIZE · 19030564
      Namhyung Kim authored
      With perf inject -b, it synthesizes build-id event for DSOs.  But it
      missed to set the size and resulted in having trailing zeros.
      
      As perf record sets the size in write_build_id(), let's set the size
      here as well.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20221119002750.1568027-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      19030564
    • Naveen N. Rao's avatar
      perf test: Skip watchpoint tests if no watchpoints available · 7d54a4ac
      Naveen N. Rao authored
      On IBM Power9, perf watchpoint tests fail since no hardware breakpoints
      are available. Detect this by checking the error returned by
      perf_event_open() and skip the tests in that case.
      Reported-by: default avatarDisha Goel <disgoel@linux.vnet.ibm.com>
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: Kajol Jain<kjain@linux.ibm.com>
      Tested-by: Kajol Jain<kjain@linux.ibm.com>
      Link: https://lore.kernel.org/r/20221121102747.208289-1-naveen.n.rao@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-perf-users@vger.kernel.org
      7d54a4ac
    • Leo Yan's avatar
      perf trace: Remove unused bpf map 'syscalls' · 8daf87f5
      Leo Yan authored
      augmented_raw_syscalls.c defines the bpf map 'syscalls' which is
      initialized by perf tool in user space to indicate which system calls
      are enabled for tracing, on the other flip eBPF program relies on the
      map to filter out the trace events which are not enabled.
      
      The map also includes a field 'string_args_len[6]' which presents the
      string length if the corresponding argument is a string type.
      
      Now the map 'syscalls' is not used, bpf program doesn't use it as filter
      anymore, this is replaced by using the function bpf_tail_call() and
      PROG_ARRAY syscalls map.  And we don't need to explicitly set the string
      length anymore, bpf_probe_read_str() is smart to copy the string and
      return string length.
      
      Therefore, it's safe to remove the bpf map 'syscalls'.
      
      To consolidate the code, this patch removes the definition of map
      'syscalls' from augmented_raw_syscalls.c and drops code for using
      the map in the perf trace.
      
      Note, since function trace__set_ev_qualifier_bpf_filter() is removed,
      calling trace__init_syscall_bpf_progs() from it is also removed.  We
      don't need to worry it because trace__init_syscall_bpf_progs() is
      still invoked from trace__init_syscalls_bpf_prog_array_maps() for
      initialization the system call's bpf program callback.
      
      After:
      
        # perf trace -e examples/bpf/augmented_raw_syscalls.c,open* --max-events 10 perf stat --quiet sleep 0.001
        openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
        openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
        openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libelf.so.1", O_RDONLY|O_CLOEXEC) = 3
        openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libdw.so.1", O_RDONLY|O_CLOEXEC) = 3
        openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libunwind.so.8", O_RDONLY|O_CLOEXEC) = 3
        openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libunwind-aarch64.so.8", O_RDONLY|O_CLOEXEC) = 3
        openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libcrypto.so.3", O_RDONLY|O_CLOEXEC) = 3
        openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libslang.so.2", O_RDONLY|O_CLOEXEC) = 3
        openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libperl.so.5.34", O_RDONLY|O_CLOEXEC) = 3
        openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
      
        # perf trace -e examples/bpf/augmented_raw_syscalls.c --max-events 10 perf stat --quiet sleep 0.001
        ... [continued]: execve())             = 0
        brk(NULL)                               = 0xaaaab1d28000
        faccessat(-100, "/etc/ld.so.preload", 4) = -1 ENOENT (No such file or directory)
        openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
        close(3</usr/lib/aarch64-linux-gnu/libcrypto.so.3>) = 0
        openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
        read(3</usr/lib/aarch64-linux-gnu/libcrypto.so.3>, 0xfffff33f70d0, 832) = 832
        munmap(0xffffb5519000, 28672)           = 0
        munmap(0xffffb55b7000, 32880)           = 0
        mprotect(0xffffb55a6000, 61440, PROT_NONE) = 0
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20221121075237.127706-6-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8daf87f5
    • Leo Yan's avatar
      perf augmented_raw_syscalls: Remove unused variable 'syscall' · 9bc427a0
      Leo Yan authored
      The local variable 'syscall' is not used anymore, remove it.
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20221121075237.127706-5-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9bc427a0
    • Leo Yan's avatar
      perf trace: Handle failure when trace point folder is missed · 03e9a5d8
      Leo Yan authored
      On Arm64 a case is perf tools fails to find the corresponding trace
      point folder for system calls listed in the table 'syscalltbl_arm64',
      e.g. the generated system call table contains "lookup_dcookie" but we
      cannot find out the matched trace point folder for it.
      
      We need to figure out if there have any issue for the generated system
      call table, on the other hand, we need to handle the case when trace
      point folder is missed under sysfs, this patch sets the flag
      syscall::nonexistent as true and returns the error from
      trace__read_syscall_info().
      
      Another problem is for trace__syscall_info(), it returns two different
      values if a system call doesn't exist: at the first time calling
      trace__syscall_info() it returns NULL when the system call doesn't exist,
      later if call trace__syscall_info() again for the same missed system
      call, it returns pointer of syscall.  trace__syscall_info() checks the
      condition 'syscalls.table[id].name == NULL', but the name will be
      assigned in the first invoking even the system call is not found.
      
      So checking system call's name in trace__syscall_info() is not the right
      thing to do, this patch simply checks flag syscall::nonexistent to make
      decision if a system call exists or not, finally trace__syscall_info()
      returns the consistent result (NULL) if a system call doesn't existed.
      
      Fixes: b8b1033f ("perf trace: Mark syscall ids that are not allocated to avoid unnecessary error messages")
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: bpf@vger.kernel.org
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20221121075237.127706-4-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      03e9a5d8