1. 15 Feb, 2024 8 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus-6.8a-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · cc9c4f0b
      Linus Torvalds authored
      Pull xen fixes from Juergen Gross:
       "Fixes and simple cleanups:
      
         - use a proper flexible array instead of a one-element array in order
           to avoid array-bounds sanitizer errors
      
         - add NULL pointer checks after allocating memory
      
         - use memdup_array_user() instead of open-coding it
      
         - fix a rare race condition in Xen event channel allocation code
      
         - make struct bus_type instances const
      
         - make kerneldoc inline comments match reality"
      
      * tag 'for-linus-6.8a-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen/events: close evtchn after mapping cleanup
        xen/gntalloc: Replace UAPI 1-element array
        xen: balloon: make balloon_subsys const
        xen: pcpu: make xen_pcpu_subsys const
        xen/privcmd: Use memdup_array_user() in alloc_ioreq()
        x86/xen: Add some null pointer checking to smp.c
        xen/xenbus: document will_handle argument for xenbus_watch_path()
      cc9c4f0b
    • Linus Torvalds's avatar
      update workarounds for gcc "asm goto" issue · 68fb3ca0
      Linus Torvalds authored
      In commit 4356e9f8 ("work around gcc bugs with 'asm goto' with
      outputs") I did the gcc workaround unconditionally, because the cause of
      the bad code generation wasn't entirely clear.
      
      In the meantime, Jakub Jelinek debugged the issue, and has come up with
      a fix in gcc [2], which also got backported to the still maintained
      branches of gcc-11, gcc-12 and gcc-13.
      
      Note that while the fix technically wasn't in the original gcc-14
      branch, Jakub says:
      
       "while it is true that no GCC 14 snapshots until today (or whenever the
        fix will be committed) have the fix, for GCC trunk it is up to the
        distros to use the latest snapshot if they use it at all and would
        allow better testing of the kernel code without the workaround, so
        that if there are other issues they won't be discovered years later.
        Most userland code doesn't actually use asm goto with outputs..."
      
      so we will consider gcc-14 to be fixed - if somebody is using gcc
      snapshots of the gcc-14 before the fix, they should upgrade.
      
      Note that while the bug goes back to gcc-11, in practice other gcc
      changes seem to have effectively hidden it since gcc-12.1 as per a
      bisect by Jakub.  So even a gcc-14 snapshot without the fix likely
      doesn't show actual problems.
      
      Also, make the default 'asm_goto_output()' macro mark the asm as
      volatile by hand, because of an unrelated gcc issue [1] where it doesn't
      match the documented behavior ("asm goto is always volatile").
      
      Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103979 [1]
      Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113921 [2]
      Link: https://lore.kernel.org/all/20240208220604.140859-1-seanjc@google.com/Requested-by: default avatarJakub Jelinek <jakub@redhat.com>
      Cc: Uros Bizjak <ubizjak@gmail.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Andrew Pinski <quic_apinski@quicinc.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      68fb3ca0
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-6.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 339e2fca
      Linus Torvalds authored
      Pull devicetree fixes from Rob Herring:
      
       - Improve devlink dependency parsing for DT graphs
      
       - Fix devlink handling of io-channels dependencies
      
       - Fix PCI addressing in marvell,prestera example
      
       - A few schema fixes for property constraints
      
       - Improve performance of DT unprobed devices kselftest
      
       - Fix regression in DT_SCHEMA_FILES handling
      
       - Fix compile error in unittest for !OF_DYNAMIC
      
      * tag 'devicetree-fixes-for-6.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        dt-bindings: ufs: samsung,exynos-ufs: Add size constraints on "samsung,sysreg"
        of: property: Add in-ports/out-ports support to of_graph_get_port_parent()
        of: property: Improve finding the supplier of a remote-endpoint property
        of: property: Improve finding the consumer of a remote-endpoint property
        net: marvell,prestera: Fix example PCI bus addressing
        of: unittest: Fix compile in the non-dynamic case
        of: property: fix typo in io-channels
        dt-bindings: tpm: Drop type from "resets"
        dt-bindings: display: nxp,tda998x: Fix 'audio-ports' constraints
        dt-bindings: xilinx: replace Piyush Mehta maintainership
        kselftest: dt: Stop relying on dirname to improve performance
        dt-bindings: don't anchor DT_SCHEMA_FILES to bindings directory
      339e2fca
    • Linus Torvalds's avatar
      Merge tag 'spi-fix-v6.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · a00cf198
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "A smallish collection of fixes for SPI, all driver specific, plus one
        device ID addition for a new Intel part.
      
        The ppc4xx isn't routinely covered by most of the automated testing so
        there were some errors that were missed in some of the recent API
        conversions, otherwise there's nothing super remarkable here"
      
      * tag 'spi-fix-v6.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        spi-mxs: Fix chipselect glitch
        spi: intel-pci: Add support for Lunar Lake-M SPI serial flash
        spi: omap2-mcspi: Revert FIFO support without DMA
        spi: ppc4xx: Drop write-only variable
        spi: ppc4xx: Fix fallout from rename in struct spi_bitbang
        spi: ppc4xx: Fix fallout from include cleanup
        spi: spi-ppc4xx: include missing platform_device.h
        spi: imx: fix the burst length at DMA mode and CPU mode
      a00cf198
    • Linus Torvalds's avatar
      Merge tag 'regmap-fix-v6.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap · 2c460834
      Linus Torvalds authored
      Pull regmap test fixes from Mark Brown:
       "Guenter runs a lot of KUnit tests so noticed that there were a couple
        of the regmap tests, including the newly added noinc test, which could
        show spurious failures due to the use of randomly generated test
        values. These changes handle the randomly generated data properly"
      
      * tag 'regmap-fix-v6.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
        regmap: kunit: Ensure that changed bytes are actually different
        regmap: kunit: fix raw noinc write test wrapping
      2c460834
    • Linus Torvalds's avatar
      Merge tag 'hid-for-linus-2024021501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · 9207fe75
      Linus Torvalds authored
      Pull HID fixes from Jiri Kosina:
      
       - fix for 'MSC_SERIAL = 0' corner case handling in wacom driver (Jason
         Gerecke)
      
       - ACPI S3 suspend/resume fix for intel-ish-hid (Even Xu)
      
       - race condition fix preventing Wacom driver from losing events shortly
         after initialization (Jason Gerecke)
      
       - fix preventing certain Logitech HID++ devices from spamming kernel
         log (Oleksandr Natalenko)
      
      * tag 'hid-for-linus-2024021501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        HID: wacom: generic: Avoid reporting a serial of '0' to userspace
        HID: Intel-ish-hid: Ishtp: Fix sensor reads after ACPI S3 suspend
        HID: multitouch: Add required quirk for Synaptics 0xcddc device
        HID: wacom: Do not register input devices until after hid_hw_start
        HID: logitech-hidpp: Do not flood kernel log
      9207fe75
    • Linus Torvalds's avatar
      Merge tag 'mips-fixes_6.8_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux · 8d3dea21
      Linus Torvalds authored
      Pull MIPS fixes from Thomas Bogendoerfer:
      
       - Fix for broken ipv6 checksums
      
       - Fix handling of exceptions in delay slots
      
      * tag 'mips-fixes_6.8_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
        mm/memory: Use exception ip to search exception tables
        MIPS: Clear Cause.BD in instruction_pointer_set
        ptrace: Introduce exception_ip arch hook
        MIPS: Add 'memory' clobber to csum_ipv6_magic() inline assembler
      8d3dea21
    • Linus Torvalds's avatar
      Merge tag 'landlock-6.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux · 6004b044
      Linus Torvalds authored
      Pull landlock test fixes from Mickaël Salaün:
       "Fix build issues for tests, and improve test compatibility"
      
      * tag 'landlock-6.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux:
        selftests/landlock: Fix capability for net_test
        selftests/landlock: Fix fs_test build with old libc
        selftests/landlock: Fix net_test build with old libc
      6004b044
  2. 14 Feb, 2024 2 commits
    • Linus Torvalds's avatar
      Merge tag 'for-6.8-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 1f3a3e2a
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "A few regular fixes and one fix for space reservation regression since
        6.7 that users have been reporting:
      
         - fix over-reservation of metadata chunks due to not keeping proper
           balance between global block reserve and delayed refs reserve; in
           practice this leaves behind empty metadata block groups, the
           workaround is to reclaim them by using the '-musage=1' balance
           filter
      
         - other space reservation fixes:
            - do not delete unused block group if it may be used soon
            - do not reserve space for checksums for NOCOW files
      
         - fix extent map assertion failure when writing out free space inode
      
         - reject encoded write if inode has nodatasum flag set
      
         - fix chunk map leak when loading block group zone info"
      
      * tag 'for-6.8-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: don't refill whole delayed refs block reserve when starting transaction
        btrfs: zoned: fix chunk map leak when loading block group zone info
        btrfs: reject encoded write if inode has nodatasum flag set
        btrfs: don't reserve space for checksums when writing to nocow files
        btrfs: add new unused block groups to the list of unused block groups
        btrfs: do not delete unused block group if it may be used soon
        btrfs: add and use helper to check if block group is used
        btrfs: don't drop extent_map for free space inode on write error
      1f3a3e2a
    • Linus Torvalds's avatar
      Merge tag 'linux_kselftest-kunit-fixes-6.8-rc5' of... · 91f842ff
      Linus Torvalds authored
      Merge tag 'linux_kselftest-kunit-fixes-6.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull KUnit fix from Shuah Khan:
       "One important fix to unregister kunit_bus when KUnit module is
        unloaded.
      
        Not doing so causes an error when KUnit module tries to re-register
        the bus when it gets reloaded"
      
      * tag 'linux_kselftest-kunit-fixes-6.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        kunit: device: Unregister the kunit_bus on shutdown
      91f842ff
  3. 13 Feb, 2024 15 commits
    • Filipe Manana's avatar
      btrfs: don't refill whole delayed refs block reserve when starting transaction · 2f6397e4
      Filipe Manana authored
      Since commit 28270e25 ("btrfs: always reserve space for delayed refs
      when starting transaction") we started not only to reserve metadata space
      for the delayed refs a caller of btrfs_start_transaction() might generate
      but also to try to fully refill the delayed refs block reserve, because
      there are several case where we generate delayed refs and haven't reserved
      space for them, relying on the global block reserve. Relying too much on
      the global block reserve is not always safe, and can result in hitting
      -ENOSPC during transaction commits or worst, in rare cases, being unable
      to mount a filesystem that needs to do orphan cleanup or anything that
      requires modifying the filesystem during mount, and has no more
      unallocated space and the metadata space is nearly full. This was
      explained in detail in that commit's change log.
      
      However the gap between the reserved amount and the size of the delayed
      refs block reserve can be huge, so attempting to reserve space for such
      a gap can result in allocating many metadata block groups that end up
      not being used. After a recent patch, with the subject:
      
        "btrfs: add new unused block groups to the list of unused block groups"
      
      We started to add new block groups that are unused to the list of unused
      block groups, to avoid having them around for a very long time in case
      they are never used, because a block group is only added to the list of
      unused block groups when we deallocate the last extent or when mounting
      the filesystem and the block group has 0 bytes used. This is not a problem
      introduced by the commit mentioned earlier, it always existed as our
      metadata space reservations are, most of the time, pessimistic and end up
      not using all the space they reserved, so we can occasionally end up with
      one or two unused metadata block groups for a long period. However after
      that commit mentioned earlier, we are just more pessimistic in the
      metadata space reservations when starting a transaction and therefore the
      issue is more likely to happen.
      
      This however is not always enough because we might create unused metadata
      block groups when reserving metadata space at a high rate if there's
      always a gap in the delayed refs block reserve and the cleaner kthread
      isn't triggered often enough or is busy with other work (running delayed
      iputs, cleaning deleted roots, etc), not to mention the block group's
      allocated space is only usable for a new block group after the transaction
      used to remove it is committed.
      
      A user reported that he's getting a lot of allocated metadata block groups
      but the usage percentage of metadata space was very low compared to the
      total allocated space, specially after running a series of block group
      relocations.
      
      So for now stop trying to refill the gap in the delayed refs block reserve
      and reserve space only for the delayed refs we are expected to generate
      when starting a transaction.
      
      CC: stable@vger.kernel.org # 6.7+
      Reported-by: default avatarIvan Shapovalov <intelfx@intelfx.name>
      Link: https://lore.kernel.org/linux-btrfs/9cdbf0ca9cdda1b4c84e15e548af7d7f9f926382.camel@intelfx.name/
      Link: https://lore.kernel.org/linux-btrfs/CAL3q7H6802ayLHUJFztzZAVzBLJAGdFx=6FHNNy87+obZXXZpQ@mail.gmail.com/Tested-by: default avatarIvan Shapovalov <intelfx@intelfx.name>
      Reported-by: default avatarHeddxh <g311571057@gmail.com>
      Link: https://lore.kernel.org/linux-btrfs/CAE93xANEby6RezOD=zcofENYZOT-wpYygJyauyUAZkLv6XVFOA@mail.gmail.com/Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      2f6397e4
    • Filipe Manana's avatar
      btrfs: zoned: fix chunk map leak when loading block group zone info · 88e81a67
      Filipe Manana authored
      At btrfs_load_block_group_zone_info() we never drop a reference on the
      chunk map we have looked up, therefore leaking a reference on it. So
      add the missing btrfs_free_chunk_map() at the end of the function.
      
      Fixes: 7dc66abb ("btrfs: use a dedicated data structure for chunk maps")
      Reported-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Tested-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      88e81a67
    • Filipe Manana's avatar
      btrfs: reject encoded write if inode has nodatasum flag set · 1bd96c92
      Filipe Manana authored
      Currently we allow an encoded write against inodes that have the NODATASUM
      flag set, either because they are NOCOW files or they were created while
      the filesystem was mounted with "-o nodatasum". This results in having
      compressed extents without corresponding checksums, which is a filesystem
      inconsistency reported by 'btrfs check'.
      
      For example, running btrfs/281 with MOUNT_OPTIONS="-o nodatacow" triggers
      this and 'btrfs check' errors out with:
      
         [1/7] checking root items
         [2/7] checking extents
         [3/7] checking free space tree
         [4/7] checking fs roots
         root 256 inode 257 errors 1040, bad file extent, some csum missing
         root 256 inode 258 errors 1040, bad file extent, some csum missing
         ERROR: errors found in fs roots
         (...)
      
      So reject encoded writes if the target inode has NODATASUM set.
      
      CC: stable@vger.kernel.org # 6.1+
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      1bd96c92
    • Filipe Manana's avatar
      btrfs: don't reserve space for checksums when writing to nocow files · feefe1f4
      Filipe Manana authored
      Currently when doing a write to a file we always reserve metadata space
      for inserting data checksums. However we don't need to do it if we have
      a nodatacow file (-o nodatacow mount option or chattr +C) or if checksums
      are disabled (-o nodatasum mount option), as in that case we are only
      adding unnecessary pressure to metadata reservations.
      
      For example on x86_64, with the default node size of 16K, a 4K buffered
      write into a nodatacow file is reserving 655360 bytes of metadata space,
      as it's accounting for checksums. After this change, which stops reserving
      space for checksums if we have a nodatacow file or checksums are disabled,
      we only need to reserve 393216 bytes of metadata.
      
      CC: stable@vger.kernel.org # 6.1+
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      feefe1f4
    • Linus Torvalds's avatar
      Merge tag 'trace-tools-v6.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 7e90b5c2
      Linus Torvalds authored
      Pull tracing tooling fixes from Steven Rostedt:
       "RTLA:
      
         - rtla tools are exiting with a positive value when usage() is
           called. Make them return 0 if the usage was called via -h/--help
      
         - the -P priority sets the sched priority for rtla workload. When the
           SCHED_OTHER scheduler is selected, it sets the rt_priority instead
           of the nice parameter. Setting the nice value is the correct thing,
           so fix it
      
         - rtla is failing to compile with clang due to unsupported options
           from gcc. Adjusting the compiler/linker options makes clang work
           properly
      
         - Remove the sched_getattr() unused function on utils.c
      
         - Fixes for variable initialization and size, reported by clang
      
        Verification:
      
         - rv is failing to compile with clang due to unsupported options from
           gcc. Adjusting the compiler/linker options makes clang work
           properly
      
         - Fix an uninitialized variable on in_kernel.c reported by clang"
      
      * tag 'trace-tools-v6.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        tools/rtla: Exit with EXIT_SUCCESS when help is invoked
        tools/rtla: Replace setting prio with nice for SCHED_OTHER
        tools/rv: Fix curr_reactor uninitialized variable
        tools/rv: Fix Makefile compiler options for clang
        tools/rtla: Remove unused sched_getattr() function
        tools/rtla: Fix clang warning about mount_point var size
        tools/rtla: Fix uninitialized bucket/data->bucket_size warning
        tools/rtla: Fix Makefile compiler options for clang
      7e90b5c2
    • Rob Herring's avatar
      dt-bindings: ufs: samsung,exynos-ufs: Add size constraints on "samsung,sysreg" · 4e06ec07
      Rob Herring authored
      The 'phandle-array' type is a bit ambiguous. It can be either just an
      array of phandles or an array of phandles plus args. "samsung,sysreg" is
      the latter and needs to be constrained to a single entry with a phandle and
      offset.
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Link: https://lore.kernel.org/r/20240124190733.1554314-1-robh@kernel.orgSigned-off-by: default avatarRob Herring <robh@kernel.org>
      4e06ec07
    • Ralf Schlatterbeck's avatar
      spi-mxs: Fix chipselect glitch · 269e31ae
      Ralf Schlatterbeck authored
      There was a change in the mxs-dma engine that uses a new custom flag.
      The change was not applied to the mxs spi driver.
      This results in chipselect being deasserted too early.
      This fixes the chipselect problem by using the new flag in the mxs-spi
      driver.
      
      Fixes: ceeeb99c ("dmaengine: mxs: rename custom flag")
      Signed-off-by: default avatarRalf Schlatterbeck <rsc@runtux.com>
      Link: https://msgid.link/r/20240202115330.wxkbfmvd76sy3a6a@runtux.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      269e31ae
    • Tatsunosuke Tobita's avatar
      HID: wacom: generic: Avoid reporting a serial of '0' to userspace · ab41a31d
      Tatsunosuke Tobita authored
      The xf86-input-wacom driver does not treat '0' as a valid serial
      number and will drop any input report which contains an
      MSC_SERIAL = 0 event. The kernel driver already takes care to
      avoid sending any MSC_SERIAL event if the value of serial[0] == 0
      (which is the case for devices that don't actually report a
      serial number), but this is not quite sufficient.
      Only the lower 32 bits of the serial get reported to userspace,
      so if this portion of the serial is zero then there can still
      be problems.
      
      This commit allows the driver to report either the lower 32 bits
      if they are non-zero or the upper 32 bits otherwise.
      Signed-off-by: default avatarJason Gerecke <jason.gerecke@wacom.com>
      Signed-off-by: default avatarTatsunosuke Tobita <tatsunosuke.tobita@wacom.com>
      Fixes: f85c9dc6 ("HID: wacom: generic: Support tool ID and additional tool types")
      CC: stable@vger.kernel.org # v4.10
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.com>
      ab41a31d
    • Even Xu's avatar
      HID: Intel-ish-hid: Ishtp: Fix sensor reads after ACPI S3 suspend · bdab6c94
      Even Xu authored
      After legacy suspend/resume via ACPI S3, sensor read operation fails
      with timeout. Also, it will cause delay in resume operation as there
      will be retries on failure.
      
      This is caused by commit f645a90e ("HID: intel-ish-hid:
      ishtp-hid-client: use helper functions for connection"), which used
      helper functions to simplify connect, reset and disconnect process.
      Also avoid freeing and allocating client buffers again during reconnect
      process.
      
      But there is a case, when ISH firmware resets after ACPI S3 suspend,
      ishtp bus driver frees client buffers. Since there is no realloc again
      during reconnect, there are no client buffers available to send connection
      requests to the firmware. Without successful connection to the firmware,
      subsequent sensor reads will timeout.
      
      To address this issue, ishtp bus driver does not free client buffers on
      warm reset after S3 resume. Simply add the buffers from the read list
      to free list of buffers.
      
      Fixes: f645a90e ("HID: intel-ish-hid: ishtp-hid-client: use helper functions for connection")
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218442Signed-off-by: default avatarEven Xu <even.xu@intel.com>
      Acked-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.com>
      bdab6c94
    • Manuel Fombuena's avatar
      HID: multitouch: Add required quirk for Synaptics 0xcddc device · 1741a826
      Manuel Fombuena authored
      Add support for the pointing stick (Accupoint) and 2 mouse buttons.
      
      Present on some Toshiba/dynabook Portege X30 and X40 laptops.
      
      It should close https://bugzilla.kernel.org/show_bug.cgi?id=205817Signed-off-by: default avatarManuel Fombuena <fombuena@outlook.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.com>
      1741a826
    • Maximilian Heyne's avatar
      xen/events: close evtchn after mapping cleanup · fa765c4b
      Maximilian Heyne authored
      shutdown_pirq and startup_pirq are not taking the
      irq_mapping_update_lock because they can't due to lock inversion. Both
      are called with the irq_desc->lock being taking. The lock order,
      however, is first irq_mapping_update_lock and then irq_desc->lock.
      
      This opens multiple races:
      - shutdown_pirq can be interrupted by a function that allocates an event
        channel:
      
        CPU0                        CPU1
        shutdown_pirq {
          xen_evtchn_close(e)
                                    __startup_pirq {
                                      EVTCHNOP_bind_pirq
                                        -> returns just freed evtchn e
                                      set_evtchn_to_irq(e, irq)
                                    }
          xen_irq_info_cleanup() {
            set_evtchn_to_irq(e, -1)
          }
        }
      
        Assume here event channel e refers here to the same event channel
        number.
        After this race the evtchn_to_irq mapping for e is invalid (-1).
      
      - __startup_pirq races with __unbind_from_irq in a similar way. Because
        __startup_pirq doesn't take irq_mapping_update_lock it can grab the
        evtchn that __unbind_from_irq is currently freeing and cleaning up. In
        this case even though the event channel is allocated, its mapping can
        be unset in evtchn_to_irq.
      
      The fix is to first cleanup the mappings and then close the event
      channel. In this way, when an event channel gets allocated it's
      potential previous evtchn_to_irq mappings are guaranteed to be unset already.
      This is also the reverse order of the allocation where first the event
      channel is allocated and then the mappings are setup.
      
      On a 5.10 kernel prior to commit 3fcdaf3d ("xen/events: modify internal
      [un]bind interfaces"), we hit a BUG like the following during probing of NVMe
      devices. The issue is that during nvme_setup_io_queues, pci_free_irq
      is called for every device which results in a call to shutdown_pirq.
      With many nvme devices it's therefore likely to hit this race during
      boot because there will be multiple calls to shutdown_pirq and
      startup_pirq are running potentially in parallel.
      
        ------------[ cut here ]------------
        blkfront: xvda: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled; bounce buffer: enabled
        kernel BUG at drivers/xen/events/events_base.c:499!
        invalid opcode: 0000 [#1] SMP PTI
        CPU: 44 PID: 375 Comm: kworker/u257:23 Not tainted 5.10.201-191.748.amzn2.x86_64 #1
        Hardware name: Xen HVM domU, BIOS 4.11.amazon 08/24/2006
        Workqueue: nvme-reset-wq nvme_reset_work
        RIP: 0010:bind_evtchn_to_cpu+0xdf/0xf0
        Code: 5d 41 5e c3 cc cc cc cc 44 89 f7 e8 2b 55 ad ff 49 89 c5 48 85 c0 0f 84 64 ff ff ff 4c 8b 68 30 41 83 fe ff 0f 85 60 ff ff ff <0f> 0b 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 0f 1f 44 00 00
        RSP: 0000:ffffc9000d533b08 EFLAGS: 00010046
        RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
        RDX: 0000000000000028 RSI: 00000000ffffffff RDI: 00000000ffffffff
        RBP: ffff888107419680 R08: 0000000000000000 R09: ffffffff82d72b00
        R10: 0000000000000000 R11: 0000000000000000 R12: 00000000000001ed
        R13: 0000000000000000 R14: 00000000ffffffff R15: 0000000000000002
        FS:  0000000000000000(0000) GS:ffff88bc8b500000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000000000000000 CR3: 0000000002610001 CR4: 00000000001706e0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
         ? show_trace_log_lvl+0x1c1/0x2d9
         ? show_trace_log_lvl+0x1c1/0x2d9
         ? set_affinity_irq+0xdc/0x1c0
         ? __die_body.cold+0x8/0xd
         ? die+0x2b/0x50
         ? do_trap+0x90/0x110
         ? bind_evtchn_to_cpu+0xdf/0xf0
         ? do_error_trap+0x65/0x80
         ? bind_evtchn_to_cpu+0xdf/0xf0
         ? exc_invalid_op+0x4e/0x70
         ? bind_evtchn_to_cpu+0xdf/0xf0
         ? asm_exc_invalid_op+0x12/0x20
         ? bind_evtchn_to_cpu+0xdf/0xf0
         ? bind_evtchn_to_cpu+0xc5/0xf0
         set_affinity_irq+0xdc/0x1c0
         irq_do_set_affinity+0x1d7/0x1f0
         irq_setup_affinity+0xd6/0x1a0
         irq_startup+0x8a/0xf0
         __setup_irq+0x639/0x6d0
         ? nvme_suspend+0x150/0x150
         request_threaded_irq+0x10c/0x180
         ? nvme_suspend+0x150/0x150
         pci_request_irq+0xa8/0xf0
         ? __blk_mq_free_request+0x74/0xa0
         queue_request_irq+0x6f/0x80
         nvme_create_queue+0x1af/0x200
         nvme_create_io_queues+0xbd/0xf0
         nvme_setup_io_queues+0x246/0x320
         ? nvme_irq_check+0x30/0x30
         nvme_reset_work+0x1c8/0x400
         process_one_work+0x1b0/0x350
         worker_thread+0x49/0x310
         ? process_one_work+0x350/0x350
         kthread+0x11b/0x140
         ? __kthread_bind_mask+0x60/0x60
         ret_from_fork+0x22/0x30
        Modules linked in:
        ---[ end trace a11715de1eee1873 ]---
      
      Fixes: d46a78b0 ("xen: implement pirq type event channels")
      Cc: stable@vger.kernel.org
      Co-debugged-by: default avatarAndrew Panyakin <apanyaki@amazon.com>
      Signed-off-by: default avatarMaximilian Heyne <mheyne@amazon.de>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Link: https://lore.kernel.org/r/20240124163130.31324-1-mheyne@amazon.deSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      fa765c4b
    • Kees Cook's avatar
      xen/gntalloc: Replace UAPI 1-element array · bf580223
      Kees Cook authored
      Without changing the structure size (since it is UAPI), add a proper
      flexible array member, and reference it in the kernel so that it will
      not be trip the array-bounds sanitizer[1].
      
      Link: https://github.com/KSPP/linux/issues/113 [1]
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Stefano Stabellini <sstabellini@kernel.org>
      Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Cc: xen-devel@lists.xenproject.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Link: https://lore.kernel.org/r/20240206170320.work.437-kees@kernel.orgSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      bf580223
    • Ricardo B. Marliere's avatar
      xen: balloon: make balloon_subsys const · b0f2f82c
      Ricardo B. Marliere authored
      Now that the driver core can properly handle constant struct bus_type,
      move the balloon_subsys variable to be a constant structure as well,
      placing it into read-only memory which can not be modified at runtime.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Suggested-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarRicardo B. Marliere <ricardo@marliere.net>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Link: https://lore.kernel.org/r/20240203-bus_cleanup-xen-v1-2-c2f5fe89ed95@marliere.netSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      b0f2f82c
    • Ricardo B. Marliere's avatar
      xen: pcpu: make xen_pcpu_subsys const · 2528dcbe
      Ricardo B. Marliere authored
      Now that the driver core can properly handle constant struct bus_type,
      move the xen_pcpu_subsys variable to be a constant structure as well,
      placing it into read-only memory which can not be modified at runtime.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Suggested-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarRicardo B. Marliere <ricardo@marliere.net>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Link: https://lore.kernel.org/r/20240203-bus_cleanup-xen-v1-1-c2f5fe89ed95@marliere.netSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      2528dcbe
    • Markus Elfring's avatar
      xen/privcmd: Use memdup_array_user() in alloc_ioreq() · b2c52b8c
      Markus Elfring authored
      * The function “memdup_array_user” was added with the
        commit 313ebe47 ("string.h: add
        array-wrappers for (v)memdup_user()").
        Thus use it accordingly.
      
        This issue was detected by using the Coccinelle software.
      
      * Delete a label which became unnecessary with this refactoring.
      Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Link: https://lore.kernel.org/r/41e333f7-1f3a-41b6-a121-a3c0ae54e36f@web.deSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      b2c52b8c
  4. 12 Feb, 2024 15 commits