1. 24 Apr, 2023 6 commits
    • Linus Torvalds's avatar
      Merge tag 'selinux-pr-20230420' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux · 72eaa096
      Linus Torvalds authored
      Pull selinux updates from Paul Moore:
      
       - Stop passing the 'selinux_state' pointers as function arguments
      
         As discussed during the end of the last development cycle, passing a
         selinux_state pointer through the SELinux code has a noticeable
         impact on performance, and with the current code it is not strictly
         necessary.
      
         This simplifies things by referring directly to the single
         selinux_state global variable which should help improve SELinux
         performance.
      
       - Uninline the unlikely portions of avc_has_perm_noaudit()
      
         This change was also based on a discussion from the last development
         cycle, and is heavily based on an initial proof of concept patch from
         you. The core issue was that avc_has_perm_noaudit() was not able to
         be inlined, as intended, due to its size. We solved this issue by
         extracting the less frequently hit portions of avc_has_perm_noaudit()
         into a separate function, reducing the size of avc_has_perm_noaudit()
         to the point where the compiler began inlining the function. We also
         took the opportunity to clean up some ugly RCU locking in the code
         that became uglier with the change.
      
       - Remove the runtime disable functionality
      
         After several years of work by the userspace and distro folks, we are
         finally in a place where we feel comfortable removing the runtime
         disable functionality which we initially deprecated at the start of
         2020.
      
         There is plenty of information in the kernel's deprecation (now
         removal) notice, but the main motivation was to be able to safely
         mark the LSM hook structures as '__ro_after_init'.
      
         LWN also wrote a good summary of the deprecation this morning which
         offers a more detailed history:
      
              https://lwn.net/SubscriberLink/927463/dcfa0d4ed2872f03
      
       - Remove the checkreqprot functionality
      
         The original checkreqprot deprecation notice stated that the removal
         would happen no sooner than June 2021, which means this falls hard
         into the "better late than never" bucket.
      
         The Kconfig and deprecation notice has more detail on this setting,
         but the basic idea is that we want to ensure that the SELinux policy
         allows for the memory protections actually applied by the kernel, and
         not those requested by the process.
      
         While we haven't found anyone running a supported distro that is
         affected by this deprecation/removal, anyone who is affected would
         only need to update their policy to reflect the reality of their
         applications' mapping protections.
      
       - Minor Makefile improvements
      
         Some minor Makefile improvements to correct some dependency issues
         likely only ever seen by SELinux developers. I expect we will have at
         least one more tweak to the Makefile during the next merge window,
         but it didn't quite make the cutoff this time around.
      
      * tag 'selinux-pr-20230420' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
        selinux: ensure av_permissions.h is built when needed
        selinux: fix Makefile dependencies of flask.h
        selinux: stop returning node from avc_insert()
        selinux: clean up dead code after removing runtime disable
        selinux: update the file list in MAINTAINERS
        selinux: remove the runtime disable functionality
        selinux: remove the 'checkreqprot' functionality
        selinux: stop passing selinux_state pointers and their offspring
        selinux: uninline unlikely parts of avc_has_perm_noaudit()
      72eaa096
    • Linus Torvalds's avatar
      Merge branch 'x86-rep-insns': x86 user copy clarifications · a5624566
      Linus Torvalds authored
      Merge my x86 user copy updates branch.
      
      This cleans up a lot of our x86 memory copy code, particularly for user
      accesses.  I've been pushing for microarchitectural support for good
      memory copying and clearing for a long while, and it's been visible in
      how the kernel has aggressively used 'rep movs' and 'rep stos' whenever
      possible.
      
      And that micro-architectural support has been improving over the years,
      to the point where on modern CPU's the best option for a memory copy
      that would become a function call (as opposed to being something that
      can just be turned into individual 'mov' instructions) is now to inline
      the string instruction sequence instead.
      
      However, that only makes sense when we have the modern markers for this:
      the x86 FSRM and FSRS capabilities ("Fast Short REP MOVS/STOS").
      
      So this cleans up a lot of our historical code, gets rid of the legacy
      marker use ("REP_GOOD" and "ERMS") from the memcpy/memset cases, and
      replaces it with that modern reality.  Note that REP_GOOD and ERMS end
      up still being used by the known large cases (ie page copyin gand
      clearing).
      
      The reason much of this ends up being about user memory accesses is that
      the normal in-kernel cases are done by the compiler (__builtin_memcpy()
      and __builtin_memset()) and getting to the point where we can use our
      instruction rewriting to inline those to be string instructions will
      need some compiler support.
      
      In contrast, the user accessor functions are all entirely controlled by
      the kernel code, so we can change those arbitrarily.
      
      Thanks to Borislav Petkov for feedback on the series, and Jens testing
      some of this on micro-architectures I didn't personally have access to.
      
      * x86-rep-insns:
        x86: rewrite '__copy_user_nocache' function
        x86: remove 'zerorest' argument from __copy_user_nocache()
        x86: set FSRS automatically on AMD CPUs that have FSRM
        x86: improve on the non-rep 'copy_user' function
        x86: improve on the non-rep 'clear_user' function
        x86: inline the 'rep movs' in user copies for the FSRM case
        x86: move stac/clac from user copy routines into callers
        x86: don't use REP_GOOD or ERMS for user memory clearing
        x86: don't use REP_GOOD or ERMS for user memory copies
        x86: don't use REP_GOOD or ERMS for small memory clearing
        x86: don't use REP_GOOD or ERMS for small memory copies
      a5624566
    • Linus Torvalds's avatar
      iov: improve copy_iovec_from_user() code generation · 487c20b0
      Linus Torvalds authored
      Use the same pattern as the compat version of this code does: instead of
      copying the whole array to a kernel buffer and then having a separate
      phase of verifying it, just do it one entry at a time, verifying as you
      go.
      
      On Jens' /dev/zero readv() test this improves performance by ~6%.
      
      [ This was obviously triggered by Jens' ITER_UBUF updates series ]
      Reported-and-tested-by: default avatarJens Axboe <axboe@kernel.dk>
      Link: https://lore.kernel.org/all/de35d11d-bce7-e976-7372-1f2caf417103@kernel.dk/Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      487c20b0
    • Linus Torvalds's avatar
      Merge tag 'iter-ubuf.2-2023-04-21' of git://git.kernel.dk/linux · b9dff219
      Linus Torvalds authored
      Pull ITER_UBUF updates from Jens Axboe:
       "This turns singe vector imports into ITER_UBUF, rather than
        ITER_IOVEC.
      
        The former is more trivial to iterate and advance, and hence a bit
        more efficient. From some very unscientific testing, ~60% of all iovec
        imports are single vector"
      
      * tag 'iter-ubuf.2-2023-04-21' of git://git.kernel.dk/linux:
        iov_iter: Mark copy_compat_iovec_from_user() noinline
        iov_iter: import single vector iovecs as ITER_UBUF
        iov_iter: convert import_single_range() to ITER_UBUF
        iov_iter: overlay struct iovec and ubuf/len
        iov_iter: set nr_segs = 1 for ITER_UBUF
        iov_iter: remove iov_iter_iovec()
        iov_iter: add iter_iov_addr() and iter_iov_len() helpers
        ALSA: pcm: check for user backed iterator, not specific iterator type
        IB/qib: check for user backed iterator, not specific iterator type
        IB/hfi1: check for user backed iterator, not specific iterator type
        iov_iter: add iter_iovec() helper
        block: ensure bio_alloc_map_data() deals with ITER_UBUF correctly
      b9dff219
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm · d88867a2
      Linus Torvalds authored
      Pull ARM development updates from Russell King:
       "Four changes for v6.4:
      
         - simplify the path to the top vmlinux
      
         - three patches to fix vfp with instrumentation enabled (eg lockdep)"
      
      * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
        ARM: 9294/2: vfp: Fix broken softirq handling with instrumentation enabled
        ARM: 9293/1: vfp: Pass successful return address via register R3
        ARM: 9292/1: vfp: Pass thread_info pointer to vfp_support_entry
        ARM: 9291/1: decompressor: simplify the path to the top vmlinux
      d88867a2
    • Ruihan Li's avatar
      scripts: Remove ICC-related dead code · 1a261a6e
      Ruihan Li authored
      Intel compiler support has already been completely removed in commit
      95207db8 ("Remove Intel compiler support").  However, it appears
      that there is still some ICC-related code in scripts/cc-version.sh.
      There is no harm in leaving the code as it is, but removing the dead
      code makes the codebase a bit cleaner.
      
      Hopefully all ICC-related stuff in the build scripts will be removed
      after this commit, given the grep output as below:
      
      	(linux/scripts) $ grep -i -w -R 'icc'
      	cc-version.sh:ICC)
      	cc-version.sh:	min_version=$($min_tool_version icc)
      	dtc/include-prefixes/arm64/qcom/sm6350.dtsi:#include <dt-bindings/interconnect/qcom,icc.h>
      
      Fixes: 95207db8 ("Remove Intel compiler support")
      Signed-off-by: default avatarRuihan Li <lrh2000@pku.edu.cn>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1a261a6e
  2. 23 Apr, 2023 9 commits
  3. 22 Apr, 2023 2 commits
  4. 21 Apr, 2023 13 commits
  5. 20 Apr, 2023 10 commits
    • Dave Airlie's avatar
      Merge tag 'drm-misc-fixes-2023-04-20-2' of... · f126f41c
      Dave Airlie authored
      Merge tag 'drm-misc-fixes-2023-04-20-2' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
      
      Short summary of fixes pull:
      
       * nouveau: fix dma-resv timeout
       * rockchip: fix suspend/resume
       * sched: fix timeout handling
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Thomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230420083114.GA17651@linux-uq9g
      f126f41c
    • Linus Torvalds's avatar
      Merge tag 'pci-v6.3-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci · b7bc77e2
      Linus Torvalds authored
      Pull pci fix from Bjorn Helgaas:
      
       - Previously we ignored PCI devices if the DT "status" property or the
         ACPI _STA method said it was not present.
      
         Per spec, _STA cannot be used for that purpose, and using it that way
         caused regressions, so skip the _STA check (Rob Herring)
      
      * tag 'pci-v6.3-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci:
        PCI: Restrict device disabled status check to DT
      b7bc77e2
    • Boris Burkov's avatar
      btrfs: reinterpret async discard iops_limit=0 as no delay · ef9cddfe
      Boris Burkov authored
      Currently, a limit of 0 results in a hard coded metering over 6 hours.
      Since the default is a set limit, I suspect no one truly depends on this
      rather arbitrary setting. Repurpose it for an arguably more useful
      "unlimited" mode, where the delay is 0.
      
      Note that if block groups are too new, or go fully empty, there is still
      a delay associated with those conditions. Those delays implement
      heuristics for not trimming a region we are relatively likely to fully
      overwrite soon.
      
      CC: stable@vger.kernel.org # 6.2+
      Reviewed-by: default avatarNeal Gompa <neal@gompa.dev>
      Signed-off-by: default avatarBoris Burkov <boris@bur.io>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      ef9cddfe
    • Boris Burkov's avatar
      btrfs: set default discard iops_limit to 1000 · e9f59429
      Boris Burkov authored
      Previously, the default was a relatively conservative 10. This results
      in a 100ms delay, so with ~300 discards in a commit, it takes the full
      30s till the next commit to finish the discards. On a workstation, this
      results in the disk never going idle, wasting power/battery, etc.
      
      Set the default to 1000, which results in using the smallest possible
      delay, currently, which is 1ms. This has shown to not pathologically
      keep the disk busy by the original reporter.
      
      Link: https://lore.kernel.org/linux-btrfs/Y%2F+n1wS%2F4XAH7X1p@nz/
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=2182228
      CC: stable@vger.kernel.org # 6.2+
      Reviewed-by: Neal Gompa <neal@gompa.dev
      Signed-off-by: default avatarBoris Burkov <boris@bur.io>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      e9f59429
    • Toke Høiland-Jørgensen's avatar
      wifi: ath9k: Don't mark channelmap stack variable read-only in ath9k_mci_update_wlan_channels() · 0f2a4af2
      Toke Høiland-Jørgensen authored
      This partially reverts commit e161d4b6.
      
      Turns out the channelmap variable is not actually read-only, it's modified
      through the MCI_GPM_CLR_CHANNEL_BIT() macro further down in the function,
      so making it read-only causes page faults when that code is hit.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=217183
      Link: https://lore.kernel.org/r/20230413214118.153781-1-toke@toke.dk
      Fixes: e161d4b6 ("wifi: ath9k: Make arrays prof_prio and channelmap static const")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@toke.dk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0f2a4af2
    • Linus Torvalds's avatar
      Merge tag 'rust-fixes-6.3' of https://github.com/Rust-for-Linux/linux · 6a66fdd2
      Linus Torvalds authored
      Pull Rust fixes from Miguel Ojeda:
       "Most of these are straightforward.
      
        The last one is more complex, but it only touches Rust + GCC builds
        which are for the moment best-effort.
      
         - Code: Missing 'extern "C"' fix.
      
         - Scripts: 'is_rust_module.sh' and 'generate_rust_analyzer.py' fixes.
      
         - A couple trivial fixes
      
         - Build: Rust + GCC build fix and 'grep' warning fix"
      
      * tag 'rust-fixes-6.3' of https://github.com/Rust-for-Linux/linux:
        rust: allow to use INIT_STACK_ALL_ZERO
        rust: fix regexp in scripts/is_rust_module.sh
        rust: build: Fix grep warning
        scripts: generate_rust_analyzer: Handle sub-modules with no Makefile
        rust: kernel: Mark rust_fmt_argument as extern "C"
        rust: sort uml documentation arch support table
        rust: str: fix requierments->requirements typo
      6a66fdd2
    • Rob Herring's avatar
      PCI: Restrict device disabled status check to DT · 0d21e71a
      Rob Herring authored
      Commit 6fffbc7a ("PCI: Honor firmware's device disabled status")
      checked the firmware device status for both DT and ACPI devices. That
      caused a regression in some ACPI systems. The exact reason isn't clear.
      It's possibly a firmware bug. For now, at least, refactor the check to
      be for DT based systems only.
      
      Note that the original implementation leaked a refcount which is now
      correctly handled.
      
      [bhelgaas: Per ACPI r6.5, sec 6.3.7, for devices on an enumerable bus, _STA
      must return with bit[0] ("device is present") set]
      
      Link: https://lore.kernel.org/all/m2fs9lgndw.fsf@gmail.com/
      Fixes: 6fffbc7a ("PCI: Honor firmware's device disabled status")
      Link: https://lore.kernel.org/r/20230419193513.708818-1-robh@kernel.org
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=217317Reported-by: default avatarDonald Hunter <donald.hunter@gmail.com>
      Reported-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Tested-by: default avatarDonald Hunter <donald.hunter@gmail.com>
      Tested-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: Binbin Zhou <zhoubinbin@loongson.cn>
      Cc: Liu Peibao <liupeibao@loongson.cn>
      Cc: Huacai Chen <chenhuacai@loongson.cn>
      0d21e71a
    • Linus Torvalds's avatar
      Merge tag 'net-6.3-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 23309d60
      Linus Torvalds authored
      Pull networking fixes from Paolo Abeni:
       "Including fixes from netfilter and bpf.
      
        There are a few fixes for new code bugs, including the Mellanox one
        noted in the last networking pull. No known regressions outstanding.
      
        Current release - regressions:
      
         - sched: clear actions pointer in miss cookie init fail
      
         - mptcp: fix accept vs worker race
      
         - bpf: fix bpf_arch_text_poke() with new_addr == NULL on s390
      
         - eth: bnxt_en: fix a possible NULL pointer dereference in unload
           path
      
         - eth: veth: take into account peer device for
           NETDEV_XDP_ACT_NDO_XMIT xdp_features flag
      
        Current release - new code bugs:
      
         - eth: revert "net/mlx5: Enable management PF initialization"
      
        Previous releases - regressions:
      
         - netfilter: fix recent physdev match breakage
      
         - bpf: fix incorrect verifier pruning due to missing register
           precision taints
      
         - eth: virtio_net: fix overflow inside xdp_linearize_page()
      
         - eth: cxgb4: fix use after free bugs caused by circular dependency
           problem
      
         - eth: mlxsw: pci: fix possible crash during initialization
      
        Previous releases - always broken:
      
         - sched: sch_qfq: prevent slab-out-of-bounds in qfq_activate_agg
      
         - netfilter: validate catch-all set elements
      
         - bridge: don't notify FDB entries with "master dynamic"
      
         - eth: bonding: fix memory leak when changing bond type to ethernet
      
         - eth: i40e: fix accessing vsi->active_filters without holding lock
      
        Misc:
      
         - Mat is back as MPTCP co-maintainer"
      
      * tag 'net-6.3-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (33 commits)
        net: bridge: switchdev: don't notify FDB entries with "master dynamic"
        Revert "net/mlx5: Enable management PF initialization"
        MAINTAINERS: Resume MPTCP co-maintainer role
        mailmap: add entries for Mat Martineau
        e1000e: Disable TSO on i219-LM card to increase speed
        bnxt_en: fix free-runnig PHC mode
        net: dsa: microchip: ksz8795: Correctly handle huge frame configuration
        bpf: Fix incorrect verifier pruning due to missing register precision taints
        hamradio: drop ISA_DMA_API dependency
        mlxsw: pci: Fix possible crash during initialization
        mptcp: fix accept vs worker race
        mptcp: stops worker on unaccepted sockets at listener close
        net: rpl: fix rpl header size calculation
        net: vmxnet3: Fix NULL pointer dereference in vmxnet3_rq_rx_complete()
        bonding: Fix memory leak when changing bond type to Ethernet
        veth: take into account peer device for NETDEV_XDP_ACT_NDO_XMIT xdp_features flag
        mlxfw: fix null-ptr-deref in mlxfw_mfa2_tlv_next()
        bnxt_en: Fix a possible NULL pointer dereference in unload path
        bnxt_en: Do not initialize PTP on older P3/P4 chips
        netfilter: nf_tables: tighten netlink attribute requirements for catch-all elements
        ...
      23309d60
    • Ming Lei's avatar
      Revert "block: Merge bio before checking ->cached_rq" · 81ea1222
      Ming Lei authored
      This reverts commit 23f3e327.
      
      blk-mq sched bio merge still needs request to grab queue usage counter,
      so we can't simply call blk_mq_attempt_bio_merge() when queue usage
      counter isn't held.
      
      Fixes: 23f3e327 ("block: Merge bio before checking ->cached_rq")
      Cc: Xiao Ni <xni@redhat.com>
      Reported-by: default avatarYi Zhang <yi.zhang@redhat.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Link: https://lore.kernel.org/r/20230420112018.1108058-1-ming.lei@redhat.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      81ea1222
    • Vladimir Oltean's avatar
      net: bridge: switchdev: don't notify FDB entries with "master dynamic" · 927cdea5
      Vladimir Oltean authored
      There is a structural problem in switchdev, where the flag bits in
      struct switchdev_notifier_fdb_info (added_by_user, is_local etc) only
      represent a simplified / denatured view of what's in struct
      net_bridge_fdb_entry :: flags (BR_FDB_ADDED_BY_USER, BR_FDB_LOCAL etc).
      Each time we want to pass more information about struct
      net_bridge_fdb_entry :: flags to struct switchdev_notifier_fdb_info
      (here, BR_FDB_STATIC), we find that FDB entries were already notified to
      switchdev with no regard to this flag, and thus, switchdev drivers had
      no indication whether the notified entries were static or not.
      
      For example, this command:
      
      ip link add br0 type bridge && ip link set swp0 master br0
      bridge fdb add dev swp0 00:01:02:03:04:05 master dynamic
      
      has never worked as intended with switchdev. It causes a struct
      net_bridge_fdb_entry to be passed to br_switchdev_fdb_notify() which has
      a single flag set: BR_FDB_ADDED_BY_USER.
      
      This is further passed to the switchdev notifier chain, where interested
      drivers have no choice but to assume this is a static (does not age) and
      sticky (does not migrate) FDB entry. So currently, all drivers offload
      it to hardware as such, as can be seen below ("offload" is set).
      
      bridge fdb get 00:01:02:03:04:05 dev swp0 master
      00:01:02:03:04:05 dev swp0 offload master br0
      
      The software FDB entry expires $ageing_time centiseconds after the
      kernel last sees a packet with this MAC SA, and the bridge notifies its
      deletion as well, so it eventually disappears from hardware too.
      
      This is a problem, because it is actually desirable to start offloading
      "master dynamic" FDB entries correctly - they should expire $ageing_time
      centiseconds after the *hardware* port last sees a packet with this
      MAC SA - and this is how the current incorrect behavior was discovered.
      With an offloaded data plane, it can be expected that software only sees
      exception path packets, so an otherwise active dynamic FDB entry would
      be aged out by software sooner than it should.
      
      With the change in place, these FDB entries are no longer offloaded:
      
      bridge fdb get 00:01:02:03:04:05 dev swp0 master
      00:01:02:03:04:05 dev swp0 master br0
      
      and this also constitutes a better way (assuming a backport to stable
      kernels) for user space to determine whether the kernel has the
      capability of doing something sane with these or not.
      
      As opposed to "master dynamic" FDB entries, on the current behavior of
      which no one currently depends on (which can be deduced from the lack of
      kselftests), Ido Schimmel explains that entries with the "extern_learn"
      flag (BR_FDB_ADDED_BY_EXT_LEARN) should still be notified to switchdev,
      since the spectrum driver listens to them (and this is kind of okay,
      because although they are treated identically to "static", they are
      expected to not age, and to roam).
      
      Fixes: 6b26b51b ("net: bridge: Add support for notifying devices about FDB add/del")
      Link: https://lore.kernel.org/netdev/20230327115206.jk5q5l753aoelwus@skbuf/Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Tested-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/20230418155902.898627-1-vladimir.oltean@nxp.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      927cdea5