Skip to content
  1. Aug 14, 2022
  2. Aug 11, 2022
    • Nick Desaulniers's avatar
      x86: link vdso and boot with -z noexecstack --no-warn-rwx-segments · ffcf9c57
      Nick Desaulniers authored
      Users of GNU ld (BFD) from binutils 2.39+ will observe multiple
      instances of a new warning when linking kernels in the form:
      
        ld: warning: arch/x86/boot/pmjump.o: missing .note.GNU-stack section implies executable stack
        ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
        ld: warning: arch/x86/boot/compressed/vmlinux has a LOAD segment with RWX permissions
      
      Generally, we would like to avoid the stack being executable.  Because
      there could be a need for the stack to be executable, assembler sources
      have to opt-in to this security feature via explicit creation of the
      .note.GNU-stack feature (which compilers create by default) or command
      line flag --noexecstack.  Or we can simply tell the linker the
      production of such sections is irrelevant and to link the stack as
      --noexecstack.
      
      LLVM's LLD linker defaults to -z noexecstack, so this flag isn't
      strictly necessary when linking with LLD, only BFD, but it doesn't hurt
      to be explicit here for all linkers IMO.  --no-warn-rwx-segments is
      currently BFD specific and only available in the current latest release,
      so it's wrapped in an ld-option check.
      
      While the kernel makes extensive usage of ELF sections, it doesn't use
      permissions from ELF segments.
      
      Link: https://lore.kernel.org/linux-block/3af4127a-f453-4cf7-f133-a181cce06f73@kernel.dk/
      Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
      Link: https://github.com/llvm/llvm-project/issues/57009
      
      
      Reported-and-tested-by: default avatarJens Axboe <axboe@kernel.dk>
      Suggested-by: default avatarFangrui Song <maskray@google.com>
      Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ffcf9c57
    • Nick Desaulniers's avatar
      Makefile: link with -z noexecstack --no-warn-rwx-segments · 0d362be5
      Nick Desaulniers authored
      Users of GNU ld (BFD) from binutils 2.39+ will observe multiple
      instances of a new warning when linking kernels in the form:
      
        ld: warning: vmlinux: missing .note.GNU-stack section implies executable stack
        ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
        ld: warning: vmlinux has a LOAD segment with RWX permissions
      
      Generally, we would like to avoid the stack being executable.  Because
      there could be a need for the stack to be executable, assembler sources
      have to opt-in to this security feature via explicit creation of the
      .note.GNU-stack feature (which compilers create by default) or command
      line flag --noexecstack.  Or we can simply tell the linker the
      production of such sections is irrelevant and to link the stack as
      --noexecstack.
      
      LLVM's LLD linker defaults to -z noexecstack, so this flag isn't
      strictly necessary when linking with LLD, only BFD, but it doesn't hurt
      to be explicit here for all linkers IMO.  --no-warn-rwx-segments is
      currently BFD specific and only available in the current latest release,
      so it's wrapped in an ld-option check.
      
      While the kernel makes extensive usage of ELF sections, it doesn't use
      permissions from ELF segments.
      
      Link: https://lore.kernel.org/linux-block/3af4127a-f453-4cf7-f133-a181cce06f73@kernel.dk/
      Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
      Link: https://github.com/llvm/llvm-project/issues/57009
      
      
      Reported-and-tested-by: default avatarJens Axboe <axboe@kernel.dk>
      Suggested-by: default avatarFangrui Song <maskray@google.com>
      Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0d362be5
    • Linus Torvalds's avatar
      crypto: blake2b: effectively disable frame size warning · 1d3551ce
      Linus Torvalds authored
      It turns out that gcc-12.1 has some nasty problems with register
      allocation on a 32-bit x86 build for the 64-bit values used in the
      generic blake2b implementation, where the pattern of 64-bit rotates and
      xor operations ends up making gcc generate horrible code.
      
      As a result it ends up with a ridiculously large stack frame for all the
      spills it generates, resulting in the following build problem:
      
          crypto/blake2b_generic.c: In function ‘blake2b_compress_one_generic’:
          crypto/blake2b_generic.c:109:1: error: the frame size of 2640 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
      
      on the same test-case, clang ends up generating a stack frame that is
      just 296 bytes (and older gcc versions generate a slightly bigger one at
      428 bytes - still nowhere near that almost 3kB monster stack frame of
      gcc-12.1).
      
      The issue is fixed both in mainline and the GCC 12 release branch [1],
      but current release compilers end up failing the i386 allmodconfig build
      due to this issue.
      
      Disable the warning for now by simply raising the frame size for this
      one file, just to keep this issue from having people turn off WERROR.
      
      Link: https://lore.kernel.org/all/CAHk-=wjxqgeG2op+=W9sqgsWqCYnavC+SRfVyopu9-31S6xw+Q@mail.gmail.com/
      Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105930
      
       [1]
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1d3551ce
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-5.20-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · aeb6e6ac
      Linus Torvalds authored
      Pull NFS client updates from Trond Myklebust:
       "Highlights include:
      
        Stable fixes:
         - pNFS/flexfiles: Fix infinite looping when the RDMA connection
           errors out
      
        Bugfixes:
         - NFS: fix port value parsing
         - SUNRPC: Reinitialise the backchannel request buffers before reuse
         - SUNRPC: fix expiry of auth creds
         - NFSv4: Fix races in the legacy idmapper upcall
         - NFS: O_DIRECT fixes from Jeff Layton
         - NFSv4.1: Fix OP_SEQUENCE error handling
         - SUNRPC: Fix an RPC/RDMA performance regression
         - NFS: Fix case insensitive renames
         - NFSv4/pnfs: Fix a use-after-free bug in open
         - NFSv4.1: RECLAIM_COMPLETE must handle EACCES
      
        Features:
         - NFSv4.1: session trunking enhancements
         - NFSv4.2: READ_PLUS performance optimisations
         - NFS: relax the rules for rsize/wsize mount options
         - NFS: don't unhash dentry during unlink/rename
         - SUNRPC: Fail faster on bad verifier
         - NFS/SUNRPC: Various tracing improvements"
      
      * tag 'nfs-for-5.20-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (46 commits)
        NFS: Improve readpage/writepage tracing
        NFS: Improve O_DIRECT tracing
        NFS: Improve write error tracing
        NFS: don't unhash dentry during unlink/rename
        NFSv4/pnfs: Fix a use-after-free bug in open
        NFS: nfs_async_write_reschedule_io must not recurse into the writeback code
        SUNRPC: Don't reuse bvec on retransmission of the request
        SUNRPC: Reinitialise the backchannel request buffers before reuse
        NFSv4.1: RECLAIM_COMPLETE must handle EACCES
        NFSv4.1 probe offline transports for trunking on session creation
        SUNRPC create a function that probes only offline transports
        SUNRPC export xprt_iter_rewind function
        SUNRPC restructure rpc_clnt_setup_test_and_add_xprt
        NFSv4.1 remove xprt from xprt_switch if session trunking test fails
        SUNRPC create an rpc function that allows xprt removal from rpc_clnt
        SUNRPC enable back offline transports in trunking discovery
        SUNRPC create an iterator to list only OFFLINE xprts
        NFSv4.1 offline trunkable transports on DESTROY_SESSION
        SUNRPC add function to offline remove trunkable transports
        SUNRPC expose functions for offline remote xprt functionality
        ...
      aeb6e6ac
    • Linus Torvalds's avatar
      Merge tag 'hwmon-fixes-for-v6.0-rc1' of... · f4144564
      Linus Torvalds authored
      Merge tag 'hwmon-fixes-for-v6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull hwmon fixes from Guenter Roeck:
       "Fix two regressions in nct6775 and lm90 drivers"
      
      * tag 'hwmon-fixes-for-v6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (nct6775) Fix platform driver suspend regression
        hwmon: (lm90) Fix error return value from detect function
      f4144564
    • Linus Torvalds's avatar
      Merge tag 'rpmsg-v5.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux · b196f3d1
      Linus Torvalds authored
      Pull rpmsg fixes from Bjorn Andersson:
       "This fixes schema validation warnings in the Devicetree bindings for
        SMD and SMD RPM"
      
      * tag 'rpmsg-v5.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux:
        dt-bindings: soc: qcom: smd-rpm: extend example
        dt-bindings: soc: qcom: smd: reference SMD edge schema
      b196f3d1
    • Linus Torvalds's avatar
      Merge tag 'mm-stable-2022-08-09' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm · b1701d5e
      Linus Torvalds authored
      Pull remaining MM updates from Andrew Morton:
       "Three patch series - two that perform cleanups and one feature:
      
         - hugetlb_vmemmap cleanups from Muchun Song
      
         - hardware poisoning support for 1GB hugepages, from Naoya Horiguchi
      
         - highmem documentation fixups from Fabio De Francesco"
      
      * tag 'mm-stable-2022-08-09' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (23 commits)
        Documentation/mm: add details about kmap_local_page() and preemption
        highmem: delete a sentence from kmap_local_page() kdocs
        Documentation/mm: rrefer kmap_local_page() and avoid kmap()
        Documentation/mm: avoid invalid use of addresses from kmap_local_page()
        Documentation/mm: don't kmap*() pages which can't come from HIGHMEM
        highmem: specify that kmap_local_page() is callable from interrupts
        highmem: remove unneeded spaces in kmap_local_page() kdocs
        mm, hwpoison: enable memory error handling on 1GB hugepage
        mm, hwpoison: skip raw hwpoison page in freeing 1GB hugepage
        mm, hwpoison: make __page_handle_poison returns int
        mm, hwpoison: set PG_hwpoison for busy hugetlb pages
        mm, hwpoison: make unpoison aware of raw error info in hwpoisoned hugepage
        mm, hwpoison, hugetlb: support saving mechanism of raw error pages
        mm/hugetlb: make pud_huge() and follow_huge_pud() aware of non-present pud entry
        mm/hugetlb: check gigantic_page_runtime_supported() in return_unused_surplus_pages()
        mm: hugetlb_vmemmap: use PTRS_PER_PTE instead of PMD_SIZE / PAGE_SIZE
        mm: hugetlb_vmemmap: move code comments to vmemmap_dedup.rst
        mm: hugetlb_vmemmap: improve hugetlb_vmemmap code readability
        mm: hugetlb_vmemmap: replace early_param() with core_param()
        mm: hugetlb_vmemmap: move vmemmap code related to HugeTLB to hugetlb_vmemmap.c
        ...
      b1701d5e
    • Linus Torvalds's avatar
      Merge tag 'cxl-for-6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl · c2356983
      Linus Torvalds authored
      Pull cxl updates from Dan Williams:
       "Compute Express Link (CXL) updates for 6.0:
      
         - Introduce a 'struct cxl_region' object with support for
           provisioning and assembling persistent memory regions.
      
         - Introduce alloc_free_mem_region() to accompany the existing
           request_free_mem_region() as a method to allocate physical memory
           capacity out of an existing resource.
      
         - Export insert_resource_expand_to_fit() for the CXL subsystem to
           late-publish CXL platform windows in iomem_resource.
      
         - Add a polled mode PCI DOE (Data Object Exchange) driver service and
           use it in cxl_pci to retrieve the CDAT (Coherent Device Attribute
           Table)"
      
      * tag 'cxl-for-6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: (74 commits)
        cxl/hdm: Fix skip allocations vs multiple pmem allocations
        cxl/region: Disallow region granularity != window granularity
        cxl/region: Fix x1 interleave to greater than x1 interleave routing
        cxl/region: Move HPA setup to cxl_region_attach()
        cxl/region: Fix decoder interleave programming
        Documentation: cxl: remove dangling kernel-doc reference
        cxl/region: describe targets and nr_targets members of cxl_region_params
        cxl/regions: add padding for cxl_rr_ep_add nested lists
        cxl/region: Fix IS_ERR() vs NULL check
        cxl/region: Fix region reference target accounting
        cxl/region: Fix region commit uninitialized variable warning
        cxl/region: Fix port setup uninitialized variable warnings
        cxl/region: Stop initializing interleave granularity
        cxl/hdm: Fix DPA reservation vs cxl_endpoint_decoder lifetime
        cxl/acpi: Minimize granularity for x1 interleaves
        cxl/region: Delete 'region' attribute from root decoders
        cxl/acpi: Autoload driver for 'cxl_acpi' test devices
        cxl/region: decrement ->nr_targets on error in cxl_region_attach()
        cxl/region: prevent underflow in ways_to_cxl()
        cxl/region: uninitialized variable in alloc_hpa()
        ...
      c2356983
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · 5e2e7383
      Linus Torvalds authored
      Pull pin control updates from Linus Walleij:
       "Outside the pinctrl driver and DT bindings we hit some Arm DT files,
        patched by the maintainers.
      
        Other than that it is business as usual.
      
        Core changes:
      
         - Add PINCTRL_PINGROUP() helper macro (and use it in the AMD driver).
      
        New drivers:
      
         - Intel Meteor Lake support.
      
         - Reneasas RZ/V2M and r8a779g0 (R-Car V4H).
      
         - AXP209 variants AXP221, AXP223 and AXP809.
      
         - Qualcomm MSM8909, PM8226, PMP8074 and SM6375.
      
         - Allwinner D1.
      
        Improvements:
      
         - Proper pin multiplexing in the AMD driver.
      
         - Mediatek MT8192 can use generic drive strength and pin bias, then
           fixes on top plus some I2C pin group fixes.
      
         - Have the Allwinner Sunplus SP7021 use the generic DT schema and
           make interrupts optional.
      
         - Handle Qualcomm SC7280 ADSP.
      
         - Handle Qualcomm MSM8916 CAMSS GP clock muxing.
      
         - High impedance bias on ZynqMP.
      
         - Serialize StarFive access to MMIO.
      
         - Immutable gpiochip for BCM2835, Ingenic, Qualcomm SPMI GPIO"
      
      * tag 'pinctrl-v6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (117 commits)
        dt-bindings: pinctrl: qcom,pmic-gpio: add PM8226 constraints
        pinctrl: qcom: Make PINCTRL_SM8450 depend on PINCTRL_MSM
        pinctrl: qcom: sm8250: Fix PDC map
        pinctrl: amd: Fix an unused variable
        dt-bindings: pinctrl: mt8186: Add and use drive-strength-microamp
        dt-bindings: pinctrl: mt8186: Add gpio-line-names property
        ARM: dts: imxrt1170-pinfunc: Add pinctrl binding header
        pinctrl: amd: Use unicode for debugfs output
        pinctrl: amd: Fix newline declaration in debugfs output
        pinctrl: at91: Fix typo 'the the' in comment
        dt-bindings: pinctrl: st,stm32: Correct 'resets' property name
        pinctrl: mvebu: Missing a blank line after declarations.
        pinctrl: qcom: Add SM6375 TLMM driver
        dt-bindings: pinctrl: Add DT schema for SM6375 TLMM
        dt-bindings: pinctrl: mt8195: Use drive-strength-microamp in examples
        Revert "pinctrl: qcom: spmi-gpio: make the irqchip immutable"
        pinctrl: imx93: Add MODULE_DEVICE_TABLE()
        pinctrl: sunxi: Add driver for Allwinner D1
        pinctrl: sunxi: Make some layout parameters dynamic
        pinctrl: sunxi: Refactor register/offset calculation
        ...
      5e2e7383
    • Linus Torvalds's avatar
      Merge tag 'apparmor-pr-2022-08-08' of... · 00aa9d0b
      Linus Torvalds authored
      Merge tag 'apparmor-pr-2022-08-08' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor
      
      Pull AppArmor updates from John Johansen:
       "This is mostly cleanups and bug fixes with the one bigger change being
        Mathew Wilcox's patch to use XArrays instead of the IDR from the
        thread around the locking weirdness.
      
        Features:
         - Convert secid mapping to XArrays instead of IDR
         - Add a kernel label to use on kernel objects
         - Extend policydb permission set by making use of the xbits
         - Make export of raw binary profile to userspace optional
         - Enable tuning of policy paranoid load for embedded systems
         - Don't create raw_sha1 symlink if sha1 hashing is disabled
         - Allow labels to carry debug flags
      
        Cleanups:
         - Update MAINTAINERS file
         - Use struct_size() helper in kmalloc()
         - Move ptrace mediation to more logical task.{h,c}
         - Resolve uninitialized symbol warnings
         - Remove redundant ret variable
         - Mark alloc_unconfined() as static
         - Update help description of policy hash for introspection
         - Remove some casts which are no-longer required
      
        Bug Fixes:
         - Fix aa_label_asxprint return check
         - Fix reference count leak in aa_pivotroot()
         - Fix memleak in aa_simple_write_to_buffer()
         - Fix kernel doc comments
         - Fix absroot causing audited secids to begin with =
         - Fix quiet_denied for file rules
         - Fix failed mount permission check error message
         - Disable showing the mode as part of a secid to secctx
         - Fix setting unconfined mode on a loaded profile
         - Fix overlapping attachment computation
         - Fix undefined reference to `zlib_deflate_workspacesize'"
      
      * tag 'apparmor-pr-2022-08-08' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor: (34 commits)
        apparmor: Update MAINTAINERS file with new email address
        apparmor: correct config reference to intended one
        apparmor: move ptrace mediation to more logical task.{h,c}
        apparmor: extend policydb permission set by making use of the xbits
        apparmor: allow label to carry debug flags
        apparmor: fix overlapping attachment computation
        apparmor: fix setting unconfined mode on a loaded profile
        apparmor: Fix some kernel-doc comments
        apparmor: Mark alloc_unconfined() as static
        apparmor: disable showing the mode as part of a secid to secctx
        apparmor: Convert secid mapping to XArrays instead of IDR
        apparmor: add a kernel label to use on kernel objects
        apparmor: test: Remove some casts which are no-longer required
        apparmor: Fix memleak in aa_simple_write_to_buffer()
        apparmor: fix reference count leak in aa_pivotroot()
        apparmor: Fix some kernel-doc comments
        apparmor: Fix undefined reference to `zlib_deflate_workspacesize'
        apparmor: fix aa_label_asxprint return check
        apparmor: Fix some kernel-doc comments
        apparmor: Fix some kernel-doc comments
        ...
      00aa9d0b
    • Linus Torvalds's avatar
      Merge tag 'kbuild-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild · 0af5cb34
      Linus Torvalds authored
      Pull Kbuild updates from Masahiro Yamada:
      
       - Remove the support for -O3 (CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3)
      
       - Fix error of rpm-pkg cross-builds
      
       - Support riscv for checkstack tool
      
       - Re-enable -Wformwat warnings for Clang
      
       - Clean up modpost, Makefiles, and misc scripts
      
      * tag 'kbuild-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (30 commits)
        modpost: remove .symbol_white_list field entirely
        modpost: remove unneeded .symbol_white_list initializers
        modpost: add PATTERNS() helper macro
        modpost: shorten warning messages in report_sec_mismatch()
        Revert "Kbuild, lto, workaround: Don't warn for initcall_reference in modpost"
        modpost: use more reliable way to get fromsec in section_rel(a)()
        modpost: add array range check to sec_name()
        modpost: refactor get_secindex()
        kbuild: set EXIT trap before creating temporary directory
        modpost: remove unused Elf_Sword macro
        Makefile.extrawarn: re-enable -Wformat for clang
        kbuild: add dtbs_prepare target
        kconfig: Qt5: tell the user which packages are required
        modpost: use sym_get_data() to get module device_table data
        modpost: drop executable ELF support
        checkstack: add riscv support for scripts/checkstack.pl
        kconfig: shorten the temporary directory name for cc-option
        scripts: headers_install.sh: Update config leak ignore entries
        kbuild: error out if $(INSTALL_MOD_PATH) contains % or :
        kbuild: error out if $(KBUILD_EXTMOD) contains % or :
        ...
      0af5cb34
  3. Aug 10, 2022
    • Zev Weiss's avatar
      hwmon: (nct6775) Fix platform driver suspend regression · f4e6960f
      Zev Weiss authored
      Commit c3963bc0
      
       ("hwmon: (nct6775) Split core and platform
      driver") introduced a slight change in nct6775_suspend() in order to
      avoid an otherwise-needless symbol export for nct6775_update_device(),
      replacing a call to that function with a simple dev_get_drvdata()
      instead.
      
      As it turns out, there is no guarantee that nct6775_update_device()
      is ever called prior to suspend. If this happens, the resume function
      ends up writing bad data into the various chip registers, which results
      in a crash shortly after resume.
      
      To fix the problem, just add the symbol export and return to using
      nct6775_update_device() as was employed previously.
      
      Reported-by: default avatarZoltán Kővágó <dirty.ice.hu@gmail.com>
      Tested-by: default avatarZoltán Kővágó <dirty.ice.hu@gmail.com>
      Fixes: c3963bc0
      
       ("hwmon: (nct6775) Split core and platform driver")
      Cc: stable@kernel.org
      Signed-off-by: default avatarZev Weiss <zev@bewilderbeest.net>
      Link: https://lore.kernel.org/r/20220810052646.13825-1-zev@bewilderbeest.net
      
      
      [groeck: Updated description]
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      f4e6960f
    • Guenter Roeck's avatar
      hwmon: (lm90) Fix error return value from detect function · 7aeef154
      Guenter Roeck authored
      lm90_detect_nuvoton() is supposed to return NULL if it can not detect
      a chip, or a pointer to the chip name if it does. Under some circumstances
      it returns an error pointer instead. Some versions of gcc interpret an
      ERR_PTR as region of size 0 and generate an error message.
      
        In function ‘__fortify_strlen’,
            inlined from ‘strlcpy’ at ./include/linux/fortify-string.h:159:10,
            inlined from ‘lm90_detect’ at drivers/hwmon/lm90.c:2550:2:
        ./include/linux/fortify-string.h:50:33: error:
            ‘__builtin_strlen’ reading 1 or more bytes from a region of size 0
           50 | #define __underlying_strlen     __builtin_strlen
              |                                 ^
        ./include/linux/fortify-string.h:141:24: note:
            in expansion of macro ‘__underlying_strlen’
          141 |                 return __underlying_strlen(p);
              |                        ^~~~~~~~~~~~~~~~~~~
      
      Returning NULL instead of ERR_PTR() fixes the problem.
      
      Fixes: c7cebce9
      
       ("hwmon: (lm90) Rework detect function")
      Reported-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Kees Cook <keescook@chromium.org>
      Tested-by: default avatarIngo Molnar <mingo@kernel.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      7aeef154
    • Mikulas Patocka's avatar
      add barriers to buffer_uptodate and set_buffer_uptodate · d4252071
      Mikulas Patocka authored
      
      
      Let's have a look at this piece of code in __bread_slow:
      
      	get_bh(bh);
      	bh->b_end_io = end_buffer_read_sync;
      	submit_bh(REQ_OP_READ, 0, bh);
      	wait_on_buffer(bh);
      	if (buffer_uptodate(bh))
      		return bh;
      
      Neither wait_on_buffer nor buffer_uptodate contain any memory barrier.
      Consequently, if someone calls sb_bread and then reads the buffer data,
      the read of buffer data may be executed before wait_on_buffer(bh) on
      architectures with weak memory ordering and it may return invalid data.
      
      Fix this bug by adding a memory barrier to set_buffer_uptodate and an
      acquire barrier to buffer_uptodate (in a similar way as
      folio_test_uptodate and folio_mark_uptodate).
      
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d4252071
    • Linus Torvalds's avatar
      Merge tag 'nfsd-6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux · e394ff83
      Linus Torvalds authored
      Pull nfsd updates from Chuck Lever:
       "Work on 'courteous server', which was introduced in 5.19, continues
        apace. This release introduces a more flexible limit on the number of
        NFSv4 clients that NFSD allows, now that NFSv4 clients can remain in
        courtesy state long after the lease expiration timeout. The client
        limit is adjusted based on the physical memory size of the server.
      
        The NFSD filecache is a cache of files held open by NFSv4 clients or
        recently touched by NFSv2 or NFSv3 clients. This cache had some
        significant scalability constraints that have been relieved in this
        release. Thanks to all who contributed to this work.
      
        A data corruption bug found during the most recent NFS bake-a-thon
        that involves NFSv3 and NFSv4 clients writing the same file has been
        addressed in this release.
      
        This release includes several improvements in CPU scalability for
        NFSv4 operations. In addition, Neil Brown provided patches that
        simplify locking during file lookup, creation, rename, and removal
        that enables subsequent work on making these operations more scalable.
        We expect to see that work materialize in the next release.
      
        There are also numerous single-patch fixes, clean-ups, and the usual
        improvements in observability"
      
      * tag 'nfsd-6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (78 commits)
        lockd: detect and reject lock arguments that overflow
        NFSD: discard fh_locked flag and fh_lock/fh_unlock
        NFSD: use (un)lock_inode instead of fh_(un)lock for file operations
        NFSD: use explicit lock/unlock for directory ops
        NFSD: reduce locking in nfsd_lookup()
        NFSD: only call fh_unlock() once in nfsd_link()
        NFSD: always drop directory lock in nfsd_unlink()
        NFSD: change nfsd_create()/nfsd_symlink() to unlock directory before returning.
        NFSD: add posix ACLs to struct nfsd_attrs
        NFSD: add security label to struct nfsd_attrs
        NFSD: set attributes when creating symlinks
        NFSD: introduce struct nfsd_attrs
        NFSD: verify the opened dentry after setting a delegation
        NFSD: drop fh argument from alloc_init_deleg
        NFSD: Move copy offload callback arguments into a separate structure
        NFSD: Add nfsd4_send_cb_offload()
        NFSD: Remove kmalloc from nfsd4_do_async_copy()
        NFSD: Refactor nfsd4_do_copy()
        NFSD: Refactor nfsd4_cleanup_inter_ssc() (2/2)
        NFSD: Refactor nfsd4_cleanup_inter_ssc() (1/2)
        ...
      e394ff83
    • Krzysztof Kozlowski's avatar
      dt-bindings: soc: qcom: smd-rpm: extend example · 56e07c0c
      Krzysztof Kozlowski authored
      
      
      Replace existing limited example with proper code for Qualcomm Resource
      Power Manager (RPM) over SMD based on MSM8916.  This also fixes the
      example's indentation.
      
      Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Link: https://lore.kernel.org/r/20220723082358.39544-2-krzysztof.kozlowski@linaro.org
      56e07c0c
    • Krzysztof Kozlowski's avatar
      dt-bindings: soc: qcom: smd: reference SMD edge schema · 568f83ff
      Krzysztof Kozlowski authored
      The child node of smd is an SMD edge representing remote subsystem.
      Bring back missing reference from previously sent patch (disappeared
      when applying).
      
      Link: https://lore.kernel.org/r/20220517070113.18023-9-krzysztof.kozlowski@linaro.org
      Fixes: 385fad13
      
       ("dt-bindings: remoteproc: qcom,smd-edge: define re-usable schema for smd-edge")
      Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Link: https://lore.kernel.org/r/20220723082358.39544-1-krzysztof.kozlowski@linaro.org
      568f83ff
    • Trond Myklebust's avatar
      NFS: Improve readpage/writepage tracing · 3fa5cbdc
      Trond Myklebust authored
      
      
      Switch formatting to better match that used by other NFS tracepoints.
      
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      3fa5cbdc
    • Trond Myklebust's avatar
      NFS: Improve O_DIRECT tracing · b313eb91
      Trond Myklebust authored
      
      
      Switch the formatting to match the other NFS tracepoints.
      
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      b313eb91
    • Trond Myklebust's avatar
      NFS: Improve write error tracing · af887e43
      Trond Myklebust authored
      
      
      Don't leak request pointers, but use the "device:inode" labelling that
      is used by all the other trace points. Furthermore, replace use of page
      indexes with an offset, again in order to align behaviour with other
      NFS trace points.
      
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      af887e43
    • Linus Torvalds's avatar
      Merge tag 'fscache-fixes-20220809' of... · 15205c28
      Linus Torvalds authored
      Merge tag 'fscache-fixes-20220809' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
      
      Pull fscache updates from David Howells:
      
       - Fix a cookie access ref leak if a cookie is invalidated a second time
         before the first invalidation is actually processed.
      
       - Add a tracepoint to log cookie lookup failure
      
      * tag 'fscache-fixes-20220809' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
        fscache: add tracepoint when failing cookie
        fscache: don't leak cookie access refs if invalidation is in progress or failed
      15205c28
    • Linus Torvalds's avatar
      Merge tag 'afs-fixes-20220802' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs · 4b22e207
      Linus Torvalds authored
      Pull AFS fixes from David Howells:
       "Fix AFS refcount handling.
      
        The first patch converts afs to use refcount_t for its refcounts and
        the second patch fixes afs_put_call() and afs_put_server() to save the
        values they're going to log in the tracepoint before decrementing the
        refcount"
      
      * tag 'afs-fixes-20220802' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
        afs: Fix access after dec in put functions
        afs: Use refcount_t rather than atomic_t
      4b22e207
    • Linus Torvalds's avatar
      Merge tag 'fs.setgid.v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux · 426b4ca2
      Linus Torvalds authored
      Pull setgid updates from Christian Brauner:
       "This contains the work to move setgid stripping out of individual
        filesystems and into the VFS itself.
      
        Creating files that have both the S_IXGRP and S_ISGID bit raised in
        directories that themselves have the S_ISGID bit set requires
        additional privileges to avoid security issues.
      
        When a filesystem creates a new inode it needs to take care that the
        caller is either in the group of the newly created inode or they have
        CAP_FSETID in their current user namespace and are privileged over the
        parent directory of the new inode. If any of these two conditions is
        true then the S_ISGID bit can be raised for an S_IXGRP file and if not
        it needs to be stripped.
      
        However, there are several key issues with the current implementation:
      
         - S_ISGID stripping logic is entangled with umask stripping.
      
           For example, if the umask removes the S_IXGRP bit from the file
           about to be created then the S_ISGID bit will be kept.
      
           The inode_init_owner() helper is responsible for S_ISGID stripping
           and is called before posix_acl_create(). So we can end up with two
           different orderings:
      
           1. FS without POSIX ACL support
      
              First strip umask then strip S_ISGID in inode_init_owner().
      
              In other words, if a filesystem doesn't support or enable POSIX
              ACLs then umask stripping is done directly in the vfs before
              calling into the filesystem:
      
           2. FS with POSIX ACL support
      
              First strip S_ISGID in inode_init_owner() then strip umask in
              posix_acl_create().
      
              In other words, if the filesystem does support POSIX ACLs then
              unmask stripping may be done in the filesystem itself when
              calling posix_acl_create().
      
           Note that technically filesystems are free to impose their own
           ordering between posix_acl_create() and inode_init_owner() meaning
           that there's additional ordering issues that influence S_ISGID
           inheritance.
      
           (Note that the commit message of commit 1639a49c ("fs: move
           S_ISGID stripping into the vfs_*() helpers") gets the ordering
           between inode_init_owner() and posix_acl_create() the wrong way
           around. I realized this too late.)
      
         - Filesystems that don't rely on inode_init_owner() don't get S_ISGID
           stripping logic.
      
           While that may be intentional (e.g. network filesystems might just
           defer setgid stripping to a server) it is often just a security
           issue.
      
           Note that mandating the use of inode_init_owner() was proposed as
           an alternative solution but that wouldn't fix the ordering issues
           and there are examples such as afs where the use of
           inode_init_owner() isn't possible.
      
           In any case, we should also try the cleaner and generalized
           solution first before resorting to this approach.
      
         - We still have S_ISGID inheritance bugs years after the initial
           round of S_ISGID inheritance fixes:
      
             e014f37d ("xfs: use setattr_copy to set vfs inode attributes")
             01ea173e ("xfs: fix up non-directory creation in SGID directories")
             fd84bfdd ("ceph: fix up non-directory creation in SGID directories")
      
        All of this led us to conclude that the current state is too messy.
        While we won't be able to make it completely clean as
        posix_acl_create() is still a filesystem specific call we can improve
        the S_SIGD stripping situation quite a bit by hoisting it out of
        inode_init_owner() and into the respective vfs creation operations.
      
        The obvious advantage is that we don't need to rely on individual
        filesystems getting S_ISGID stripping right and instead can
        standardize the ordering between S_ISGID and umask stripping directly
        in the VFS.
      
        A few short implementation notes:
      
         - The stripping logic needs to happen in vfs_*() helpers for the sake
           of stacking filesystems such as overlayfs that rely on these
           helpers taking care of S_ISGID stripping.
      
         - Security hooks have never seen the mode as it is ultimately seen by
           the filesystem because of the ordering issue we mentioned. Nothing
           is changed for them. We simply continue to strip the umask before
           passing the mode down to the security hooks.
      
         - The following filesystems use inode_init_owner() and thus relied on
           S_ISGID stripping: spufs, 9p, bfs, btrfs, ext2, ext4, f2fs,
           hfsplus, hugetlbfs, jfs, minix, nilfs2, ntfs3, ocfs2, omfs,
           overlayfs, ramfs, reiserfs, sysv, ubifs, udf, ufs, xfs, zonefs,
           bpf, tmpfs.
      
           We've audited all callchains as best as we could. More details can
           be found in the commit message to 1639a49c ("fs: move S_ISGID
           stripping into the vfs_*() helpers")"
      
      * tag 'fs.setgid.v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
        ceph: rely on vfs for setgid stripping
        fs: move S_ISGID stripping into the vfs_*() helpers
        fs: Add missing umask strip in vfs_tmpfile
        fs: add mode_strip_sgid() helper
      426b4ca2
    • Linus Torvalds's avatar
      Merge tag 'memblock-v5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock · b8dcef87
      Linus Torvalds authored
      Pull memblock updates from Mike Rapoport:
      
       - An optimization in memblock_add_range() to reduce array traversals
      
       - Improvements to the memblock test suite
      
      * tag 'memblock-v5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
        memblock test: Modify the obsolete description in README
        memblock tests: fix compilation errors
        memblock tests: change build options to run-time options
        memblock tests: remove completed TODO items
        memblock tests: set memblock_debug to enable memblock_dbg() messages
        memblock tests: add verbose output to memblock tests
        memblock tests: Makefile: add arguments to control verbosity
        memblock: avoid some repeat when add new range
      b8dcef87
    • Linus Torvalds's avatar
      Merge tag 'm68knommu-for-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu · 15886321
      Linus Torvalds authored
      Pull m68knommu fixes from Greg Ungerer:
      
       - spelling in comment
      
       - compilation when flexcan driver enabled
      
       - sparse warning
      
      * tag 'm68knommu-for-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
        m68k: Fix syntax errors in comments
        m68k: coldfire: make symbol m523x_clk_lookup static
        m68k: coldfire/device.c: protect FLEXCAN blocks
      15886321
    • Linus Torvalds's avatar
      Merge tag 'x86_bugs_pbrsb' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 5318b987
      Linus Torvalds authored
      Pull x86 eIBRS fixes from Borislav Petkov:
       "More from the CPU vulnerability nightmares front:
      
        Intel eIBRS machines do not sufficiently mitigate against RET
        mispredictions when doing a VM Exit therefore an additional RSB,
        one-entry stuffing is needed"
      
      * tag 'x86_bugs_pbrsb' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/speculation: Add LFENCE to RSB fill sequence
        x86/speculation: Add RSB VM Exit protections
      5318b987
  4. Aug 09, 2022