1. 19 Jan, 2023 6 commits
  2. 18 Jan, 2023 15 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus-2023011801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · 7287904c
      Linus Torvalds authored
      Pull HID fixes from Jiri Kosina:
      
       - fixes for potential empty list handling in HID core (Pietro Borrello)
      
       - fix for NULL pointer dereference in betop driver that could be
         triggered by malicious device (Pietro Borrello)
      
       - fixes for handling calibration data preventing division by zero in
         Playstation driver (Roderick Colenbrander)
      
       - fix for memory leak on error path in amd-sfh driver (Basavaraj
         Natikar)
      
       - other few assorted small fixes and device ID-specific handling
      
      * tag 'for-linus-2023011801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        HID: betop: check shape of output reports
        HID: playstation: sanity check DualSense calibration data.
        HID: playstation: sanity check DualShock4 calibration data.
        HID: uclogic: Add support for XP-PEN Deco 01 V2
        HID: revert CHERRY_MOUSE_000C quirk
        HID: check empty report_list in bigben_probe()
        HID: check empty report_list in hid_validate_values()
        HID: amd_sfh: Fix warning unwind goto
        HID: intel_ish-hid: Add check for ishtp_dma_tx_map
      7287904c
    • Linus Torvalds's avatar
      Merge tag 'affs-for-6.2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 7026172b
      Linus Torvalds authored
      Pull affs fix from David Sterba:
       "One minor fix for a KCSAN report"
      
      * tag 'affs-for-6.2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        affs: initialize fsdata in affs_truncate()
      7026172b
    • Linus Torvalds's avatar
      Merge tag 'erofs-for-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs · 5fbad44d
      Linus Torvalds authored
      Pull erofs fixes from Gao Xiang:
       "Two patches fixes issues reported by syzbot, one fixes a missing
        `domain_id` mount option in documentation and a minor cleanup:
      
         - Fix wrong iomap->length calculation post EOF, which could cause a
           WARN_ON in iomap_iter_done() (Siddh)
      
         - Fix improper kvcalloc() use with __GFP_NOFAIL (me)
      
         - Add missing `domain_id` mount option in documentation (Jingbo)
      
         - Clean up fscache option parsing (Jingbo)"
      
      * tag 'erofs-for-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
        erofs: clean up parsing of fscache related options
        erofs: add documentation for 'domain_id' mount option
        erofs: fix kvcalloc() misuse with __GFP_NOFAIL
        erofs/zmap.c: Fix incorrect offset calculation
      5fbad44d
    • Linus Torvalds's avatar
      Merge tag 'loongarch-fixes-6.2-1' of... · 84bd7e08
      Linus Torvalds authored
      Merge tag 'loongarch-fixes-6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
      
      Pull LoongArch fixes from Huacai Chen:
       "Fix a missing elf_hwcap, fix some stack unwinder bugs and two trivial
        cleanups"
      
      * tag 'loongarch-fixes-6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
        LoongArch: Add generic ex-handler unwind in prologue unwinder
        LoongArch: Strip guess unwinder out from prologue unwinder
        LoongArch: Use correct sp value to get graph addr in stack unwinders
        LoongArch: Get frame info in unwind_start() when regs is not available
        LoongArch: Adjust PC value when unwind next frame in unwinder
        LoongArch: Simplify larch_insn_gen_xxx implementation
        LoongArch: Use common function sign_extend64()
        LoongArch: Add HWCAP_LOONGARCH_CPUCFG to elf_hwcap
      84bd7e08
    • Pietro Borrello's avatar
      HID: betop: check shape of output reports · 3782c0d6
      Pietro Borrello authored
      betopff_init() only checks the total sum of the report counts for each
      report field to be at least 4, but hid_betopff_play() expects 4 report
      fields.
      A device advertising an output report with one field and 4 report counts
      would pass the check but crash the kernel with a NULL pointer dereference
      in hid_betopff_play().
      
      Fixes: 52cd7785 ("HID: betop: add drivers/hid/hid-betopff.c")
      Signed-off-by: default avatarPietro Borrello <borrello@diag.uniroma1.it>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      3782c0d6
    • Athira Rajeev's avatar
      perf test build-id: Fix test check for PE file · 3d9c07c4
      Athira Rajeev authored
      Perf test "build id cache operations" fails for PE executable.  Logs
      below from powerpc system.  Same is observed on x86 as well.
      
        <<>>
        Adding 5a0fd882b53084224ba47b624c55a469 ./tests/shell/../pe-file.exe: Ok
        build id: 5a0fd882b53084224ba47b624c55a469
        link: /tmp/perf.debug.w0V/.build-id/5a/0fd882b53084224ba47b624c55a469
        file: /tmp/perf.debug.w0V/.build-id/5a/../../root/<user>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf
        failed: file /tmp/perf.debug.w0V/.build-id/5a/../../root/<user>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf does not exist
        test child finished with -1
        ---- end ----
        build id cache operations: FAILED!
        <<>>
      
      The test tries to do:
      
        <<>>
        mkdir /tmp/perf.debug.TeY1
        perf --buildid-dir /tmp/perf.debug.TeY1 buildid-cache -v -a ./tests/shell/../pe-file.exe
        <<>>
      
      The option "--buildid-dir" sets the build id cache directory as
      /tmp/perf.debug.TeY1. The option given to buildid-cahe, ie "-a
      ./tests/shell/../pe-file.exe", is to add the pe-file.exe to the cache.
      
      The testcase, sets buildid-dir and adds the file: pe-file.exe to build
      id cache. To check if the command is run successfully, "check" function
      looks for presence of the file in buildid cache directory. But the check
      here expects the added file to be executable. Snippet below:
      
        <<>>
        if [ ! -x $file ]; then
        	echo "failed: file ${file} does not exist"
        	exit 1
        fi
        <<>>
      
      The buildid test is done for sha1 binary, md5 binary and also for PE
      file. The first two binaries are created at runtime by compiling with
      "--build-id" option and hence the check for sha1/md5 test should use [ !
      -x ]. But in case of PE file, the permission for this input file is
      rw-r--r-- Hence the file added to build id cache has same permissoin
      
      Original file:
      
        ls tests/pe-file.exe | xargs stat --printf "%n %A \n"
        tests/pe-file.exe -rw-r--r--
      
      buildid cache file:
      
        ls /tmp/perf.debug.w0V/.build-id/5a/../../root/<user>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf | xargs stat --printf "%n %A \n"
        /tmp/perf.debug.w0V/.build-id/5a/../../root/<user>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf -rw-r--r--
      
      Fix the test to match with the permission of original file in case of FE
      file. ie if the "tests/pe-file.exe" file is not having exec permission,
      just check for existence of the buildid file using [ ! -e <file> ]
      Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Disha Goel <disgoel@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20230116050131.17221-2-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3d9c07c4
    • Athira Rajeev's avatar
      perf buildid-cache: Fix the file mode with copyfile() while adding file to build-id cache · 4b21b3e7
      Athira Rajeev authored
      The test "build id cache operations" fails on powerpc as below:
      
      	Adding 5a0fd882b53084224ba47b624c55a469 ./tests/shell/../pe-file.exe: Ok
      	build id: 5a0fd882b53084224ba47b624c55a469
      	link: /tmp/perf.debug.ZTu/.build-id/5a/0fd882b53084224ba47b624c55a469
      	file: /tmp/perf.debug.ZTu/.build-id/5a/../../root/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf
      	failed: file /tmp/perf.debug.ZTu/.build-id/5a/../../root/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf does not exist
      	test child finished with -1
      	---- end ----
      	build id cache operations: FAILED!
      
      The failing test is when trying to add pe-file.exe to build id cache.
      
      'perf buildid-cache' can be used to add/remove/manage files from the
      build-id cache. "-a" option is used to add a file to the build-id cache.
      
      Simple command to do so for a PE exe file:
      
        # ls -ltr tests/pe-file.exe
        -rw-r--r--. 1 root root 75595 Jan 10 23:35 tests/pe-file.exe
      
        The file is in home directory.
      
        # mkdir  /tmp/perf.debug.TeY1
        # perf --buildid-dir /tmp/perf.debug.TeY1 buildid-cache -v -a tests/pe-file.exe
      
      The above will create ".build-id" folder in build id directory, which is
      /tmp/perf.debug.TeY1. Also adds file to this folder under build id.
      Example:
      
        # ls -ltr /tmp/perf.debug.TeY1/.build-id/5a/0fd882b53084224ba47b624c55a469/
        total 76
        -rw-r--r--. 1 root root     0 Jan 11 00:38 probes
        -rwxr-xr-x. 1 root root 75595 Jan 11 00:38 elf
      
      We can see in the results that file mode for original file and file in
      build id directory is different. ie, build id file has executable
      permission whereas original file doesn’t have.
      
      The code path and function (build_id_cache__add  to add a file to the
      cache is in "util/build-id.c". In build_id_cache__add() function, it
      first attempts to link the original file to destination cache folder.
      
      If linking the file fails (which can happen if the destination and
      source is on a different mount points), it will copy the file to
      destination.  Here copyfile() routine explicitly uses mode as "755" and
      hence file in the destination will have executable permission.
      
      Code snippet:
      
       if (link(realname, filename) && errno != EEXIST && copyfile(name, filename))
      
      strace logs:
      
      	172285 link("/home/<user_name>/linux/tools/perf/tests/pe-file.exe", "/tmp/perf.debug.TeY1/home/<user_name>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf") = -1 EXDEV (Invalid cross-device link)
      	172285 newfstatat(AT_FDCWD, "tests/pe-file.exe", {st_mode=S_IFREG|0644, st_size=75595, ...}, 0) = 0
      	172285 openat(AT_FDCWD, "/tmp/perf.debug.TeY1/home/<user_name>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/.elf.KbAnsl", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
      	172285 fchmod(3, 0755)                  = 0
      	172285 openat(AT_FDCWD, "tests/pe-file.exe", O_RDONLY) = 4
      	172285 mmap(NULL, 75595, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7fffa5cd0000
      	172285 pwrite64(3, "MZ\220\0\3\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 75595, 0) = 75595
      
      Whereas if the link succeeds, it succeeds in the first attempt itself
      and the file in the build-id dir will have same permission as original
      file.
      
      Example, above uses /tmp. Instead if we use "--buildid-dir /home/build",
      linking will work here since mount points are same. Hence the
      destination file will not have executable permission.
      
      Since the testcase "tests/shell/buildid.sh" always looks for executable
      file, test fails in powerpc environment when test is run from /root.
      
      The patch adds a change in build_id_cache__add() to use copyfile_mode()
      which also passes the file’s original mode as argument. This way the
      destination file mode also will be same as original file.
      Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Disha Goel <disgoel@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20230116050131.17221-1-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4b21b3e7
    • Sohom Datta's avatar
      perf expr: Prevent normalize() from reading into undefined memory in the expression lexer · 85c44913
      Sohom Datta authored
      The current implementation does not account for a trailing backslash
      followed by a null-byte.
      
      If a null-byte is encountered following a backslash, normalize() will
      continue reading (and potentially writing) into garbage memory ignoring
      the EOS null-byte.
      Signed-off-by: default avatarSohom Datta <sohomdatta1+git@gmail.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      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/20221204105836.1012885-1-sohomdatta1+git@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      85c44913
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Syncronize linux/build_bug.h with the kernel sources · c905ecfb
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        07a368b3 ("bug: introduce ASSERT_STRUCT_OFFSET")
      
      This cset only introduces a build time assert macro, that may be useful
      at some point for tooling, for now it silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/linux/build_bug.h' differs from latest version at 'include/linux/build_bug.h'
        diff -u tools/include/linux/build_bug.h include/linux/build_bug.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Maxim Levitsky <mlevitsk@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: http://lore.kernel.org/lkml/Y8f0jqQFYDAOBkHx@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c905ecfb
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Update copy of linux/socket.h with the kernel sources · d352588b
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        b5f0de6d ("net: dev: Convert sa_data to flexible array in struct sockaddr")
      
      That don't result in any changes in the tables generated from that
      header.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/perf/trace/beauty/include/linux/socket.h' differs from latest version at 'include/linux/socket.h'
        diff -u tools/perf/trace/beauty/include/linux/socket.h include/linux/socket.h
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d352588b
    • Arnaldo Carvalho de Melo's avatar
      tools headers arm64: Sync arm64's cputype.h with the kernel sources · 8c51e8f4
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
        decb17ae ("KVM: arm64: vgic: Add Apple M2 cpus to the list of broken SEIS implementations")
        07e39e60 ("arm64: Add Cortex-715 CPU part definition")
        8ec8490a ("arm64: Fix bit-shifting UB in the MIDR_CPU_MODEL() macro")
      
      That addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/arm64/include/asm/cputype.h' differs from latest version at 'arch/arm64/include/asm/cputype.h'
        diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
      
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: D Scott Phillips <scott@os.amperecomputing.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lore.kernel.org/lkml/Y8fvEGCGn+227qW0@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8c51e8f4
    • Arnaldo Carvalho de Melo's avatar
      tools kvm headers arm64: Update KVM header from the kernel sources · 7f2d4cdd
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        9cb1096f ("KVM: arm64: Enable ring-based dirty memory tracking")
      
      That doesn't result in any changes in tooling (built on a Libre Computer
      Firefly ROC-RK3399-PC-V1.1-A running Ubuntu 22.04), only addresses this
      perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm64/include/uapi/asm/kvm.h'
        diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Gavin Shan <gshan@redhat.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/Y8fmIT5PIfGaZuwa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7f2d4cdd
    • Roderick Colenbrander's avatar
      HID: playstation: sanity check DualSense calibration data. · ccf1e162
      Roderick Colenbrander authored
      Make sure calibration values are defined to prevent potential kernel
      crashes. This fixes a hypothetical issue for virtual or clone devices
      inspired by a similar fix for DS4.
      Signed-off-by: default avatarRoderick Colenbrander <roderick.colenbrander@sony.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      ccf1e162
    • Roderick Colenbrander's avatar
      HID: playstation: sanity check DualShock4 calibration data. · 74cb485f
      Roderick Colenbrander authored
      Some DualShock4 devices report invalid calibration data resulting
      in kernel oopses due to division by zero during report handling.
      
      The devices affected generally appear to be clone devices, which don't
      implement all reports properly and don't populate proper calibration
      data. The issue may have been seen on an official device with erased
      calibration reports.
      
      This patch prevents the crashes by essentially disabling calibration
      when invalid values are detected.
      Signed-off-by: default avatarRoderick Colenbrander <roderick.colenbrander@sony.com>
      Tested-by: default avatarAlain Carlucci <alain.carlucci@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      74cb485f
    • José Expósito's avatar
      HID: uclogic: Add support for XP-PEN Deco 01 V2 · febb2c0d
      José Expósito authored
      The XP-PEN Deco 01 V2 is a UGEE v2 device with a frame with 8 buttons.
      Its pen has 2 buttons, supports tilt and pressure.
      
      Add its ID in order to support the device.
      
      Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/839Tested-by: default avatarMark Waddoups <mwaddoups@gmail.com>
      Signed-off-by: default avatarJosé Expósito <jose.exposito89@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      febb2c0d
  3. 17 Jan, 2023 17 commits
  4. 16 Jan, 2023 2 commits