5.4.129-rc1 review
Subsystems (3)
Sasha Levin
maintainercover 5.4.129-rc1 review
This is the start of the stable review cycle for the 5.4.129 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:29:43 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.4.y&id2=v5.4.128
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
and the diffstat can be found below.
Thanks,
Sasha
-------------
Pseudo-Shortlog of commits:
Alex Shi (1):
mm: add VM_WARN_ON_ONCE_PAGE() macro
Arnd Bergmann (1):
ARM: 9081/1: fix gcc-10 thumb2-kernel regression
Austin Kim (1):
net: ethtool: clear heap allocations for ethtool function
Christian König (2):
drm/nouveau: wait for moving fence after pinning v2 drm/radeon: wait for moving fence after pinning
Du Cheng (1):
cfg80211: call cfg80211_leave_ocb when switching away from OCB
Eric Dumazet (3):
inet: annotate date races around sk->sk_txhash
net/packet: annotate accesses to po->bind
net/packet: annotate accesses to po->ifindex
Eric Snowberg (2):
certs: Add EFI_CERT_X509_GUID support for dbx entries
certs: Move load_system_certificate_list to a common function
Esben Haabendal (2):
net: ll_temac: Add memory-barriers for TX BD access
net: ll_temac: Avoid ndo_start_xmit returning NETDEV_TX_BUSY
Fabien Dessenne (1):
pinctrl: stm32: fix the reported number of GPIO lines per bank
Fuad Tabba (1):
KVM: selftests: Fix kvm_check_cap() assertion
Guillaume Ranquet (3):
dmaengine: mediatek: free the proper desc in desc_free handler
dmaengine: mediatek: do not issue a new desc if one is still current
dmaengine: mediatek: use GFP_NOWAIT instead of GFP_ATOMIC in prep_dma
Haibo Chen (1):
spi: spi-nxp-fspi: move the register operation after the clock enable
Hugh Dickins (16):
mm/thp: fix __split_huge_pmd_locked() on shmem migration entry mm/thp: make is_huge_zero_pmd() safe and quicker mm/thp: try_to_unmap() use TTU_SYNC for safe splitting mm/thp: fix vma_address() if virtual address below file offset mm/thp: unmap_mapping_page() to fix THP truncate_cleanup_page()
mm: page_vma_mapped_walk(): use page for pvmw->page
mm: page_vma_mapped_walk(): settle PageHuge on entry
mm: page_vma_mapped_walk(): use pmde for *pvmw->pmd
mm: page_vma_mapped_walk(): prettify PVMW_MIGRATION block
mm: page_vma_mapped_walk(): crossing page table boundary
mm: page_vma_mapped_walk(): add a level of indentation
mm: page_vma_mapped_walk(): use goto instead of while (1)
mm: page_vma_mapped_walk(): get vma_address_end() earlier mm/thp: fix page_vma_mapped_walk() if THP mapped by ptes mm/thp: another PVMW_SYNC fix in page_vma_mapped_walk() mm, futex: fix shared futex pgoff on shmem huge page
Johan Hovold (1):
i2c: robotfuzz-osif: fix control-request directions
Johannes Berg (3):
mac80211: remove warning in ieee80211_get_sband()
mac80211_hwsim: drop pending frames on stop
mac80211: drop multicast fragments
Jue Wang (1):
mm/thp: fix page_address_in_vma() on file THP tails
Kees Cook (4):
r8152: Avoid memcpy() over-reading of ETH_SS_STATS
sh_eth: Avoid memcpy() over-reading of ETH_SS_STATS
r8169: Avoid memcpy() over-reading of ETH_SS_STATS
net: qed: Fix memcpy() overflow of qed_dcbx_params()
Miaohe Lin (2):
mm/rmap: remove unneeded semicolon in page_not_mapped() mm/rmap: use page_not_mapped in try_to_unmap()
Mikel Rychliski (1):
PCI: Add AMD RS690 quirk to enable 64-bit DMA
Mimi Zohar (1):
module: limit enabling module.sig_enforce
Nathan Chancellor (1):
MIPS: generic: Update node names to avoid unit addresses
Nayna Jain (2):
certs: Add wrapper function to check blacklisted binary hash x86/efi: move common keyring handler functions to new file
Neil Armstrong (1):
mmc: meson-gx: use memcpy_to/fromio for dram-access-quirk
Nicholas Piggin (1):
KVM: do not allow mapping valid but non-reference-counted pages
Nick Desaulniers (1):
arm64: link with -z norelro for LLD or aarch64-elf
Pavel Skripkin (2):
net: caif: fix memory leak in ldisc_open
nilfs2: fix memory leak in nilfs_sysfs_delete_device_group
Peter Zijlstra (1):
recordmcount: Correct st_shndx handling
Petr Mladek (2):
kthread_worker: split code for canceling the delayed work timer
kthread: prevent deadlock when kthread_mod_delayed_work() races with
kthread_cancel_delayed_work_sync()
Praneeth Bajjuri (1):
net: phy: dp83867: perform soft reset and retain established link
Rafael J. Wysocki (1):
Revert "PCI: PM: Do not read power state in pci_enable_device_flags()"
Sami Tolvanen (1):
kbuild: add CONFIG_LD_IS_LLD
Sasha Levin (1):
Linux 5.4.129-rc1
Xu Yu (1):
mm, thp: use head page in __migration_entry_wait()
Yang Shi (1):
mm: thp: replace DEBUG_VM BUG with VM_WARN when unmap fails for split
Yifan Zhang (2):
Revert "drm/amdgpu/gfx9: fix the doorbell missing when in CGPG issue." Revert "drm/amdgpu/gfx10: enlarge CP_MEC_DOORBELL_RANGE_UPPER to cover
full doorbell."
Yu Kuai (1):
dmaengine: zynqmp_dma: Fix PM reference leak in
zynqmp_dma_alloc_chan_resourc()
Zheng Yongjun (2):
net: ipv4: Remove unneed BUG() function
ping: Check return value of function 'ping_queue_rcv_skb'
Zou Wei (1):
dmaengine: rcar-dmac: Fix PM reference leak in rcar_dmac_probe()
Makefile | 4 +- arch/arm/kernel/setup.c | 16 +- arch/arm64/Makefile | 10 +- arch/mips/generic/board-boston.its.S | 10 +- arch/mips/generic/board-ni169445.its.S | 10 +- arch/mips/generic/board-ocelot.its.S | 20 +-- arch/mips/generic/board-xilfpga.its.S | 10 +- arch/mips/generic/vmlinux.its.S | 10 +- arch/x86/pci/fixup.c | 44 +++++ certs/Kconfig | 9 + certs/Makefile | 2 +- certs/blacklist.c | 52 ++++++ certs/blacklist.h | 2 + certs/common.c | 57 +++++++ certs/common.h | 9 + certs/system_keyring.c | 55 +----- drivers/dma/mediatek/mtk-uart-apdma.c | 27 +-- drivers/dma/sh/rcar-dmac.c | 2 +- drivers/dma/xilinx/zynqmp_dma.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 6 +- drivers/gpu/drm/nouveau/nouveau_prime.c | 17 +- drivers/gpu/drm/radeon/radeon_prime.c | 16 +- drivers/i2c/busses/i2c-robotfuzz-osif.c | 4 +- drivers/mmc/host/meson-gx-mmc.c | 50 +++++- drivers/net/caif/caif_serial.c | 1 + drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 4 +- drivers/net/ethernet/realtek/r8169_main.c | 2 +- drivers/net/ethernet/renesas/sh_eth.c | 2 +- drivers/net/ethernet/xilinx/ll_temac_main.c | 19 ++- drivers/net/phy/dp83867.c | 6 +- drivers/net/usb/r8152.c | 2 +- drivers/net/wireless/mac80211_hwsim.c | 5 + drivers/pci/pci.c | 16 +- drivers/pinctrl/stm32/pinctrl-stm32.c | 9 +- drivers/spi/spi-nxp-fspi.c | 11 +- fs/nilfs2/sysfs.c | 1 + include/keys/system_keyring.h | 21 +++ include/linux/huge_mm.h | 8 +- include/linux/hugetlb.h | 16 -- include/linux/mm.h | 3 + include/linux/mmdebug.h | 13 ++ include/linux/pagemap.h | 13 +- include/linux/rmap.h | 3 +- include/net/sock.h | 10 +- init/Kconfig | 3 + kernel/futex.c | 2 +- kernel/kthread.c | 77 ++++++--- kernel/module.c | 14 +- mm/huge_memory.c | 56 +++--- mm/hugetlb.c | 5 +- mm/internal.h | 53 ++++-- mm/memory.c | 41 +++++ mm/migrate.c | 1 + mm/page_vma_mapped.c | 160 +++++++++++------- mm/pgtable-generic.c | 4 +- mm/rmap.c | 50 +++--- mm/truncate.c | 43 +++-- net/core/ethtool.c | 10 +- net/ipv4/devinet.c | 2 +- net/ipv4/ping.c | 12 +- net/ipv6/addrconf.c | 2 +- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/rx.c | 9 +- net/packet/af_packet.c | 32 ++-- net/wireless/util.c | 3 + scripts/recordmcount.h | 15 +- security/integrity/Makefile | 3 +- .../platform_certs/keyring_handler.c | 91 ++++++++++ .../platform_certs/keyring_handler.h | 32 ++++ security/integrity/platform_certs/load_uefi.c | 67 +------- tools/testing/selftests/kvm/lib/kvm_util.c | 2 +- virt/kvm/kvm_main.c | 19 ++- 73 files changed, 959 insertions(+), 466 deletions(-) create mode 100644 certs/common.c create mode 100644 certs/common.h create mode 100644 security/integrity/platform_certs/keyring_handler.c create mode 100644 security/integrity/platform_certs/keyring_handler.h
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 1/71 module: limit enabling module.sig_enforce
From: Mimi Zohar <[email protected]>
[ Upstream commit 0c18f29aae7ce3dadd26d8ee3505d07cc982df75 ]
Irrespective as to whether CONFIG_MODULE_SIG is configured, specifying "module.sig_enforce=1" on the boot command line sets "sig_enforce". Only allow "sig_enforce" to be set when CONFIG_MODULE_SIG is configured.
This patch makes the presence of /sys/module/module/parameters/sig_enforce dependent on CONFIG_MODULE_SIG=y.
--- kernel/module.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
kernel/module.c +9 -5
@@ -268,9 +268,18 @@ static void module_assert_mutex_or_preempt(void)#endif } +#ifdef CONFIG_MODULE_SIG static bool sig_enforce =IS_ENABLED (CONFIG_MODULE_SIG_FORCE );module_param (sig_enforce, bool_enable_only,0644 ); +void set_module_sig_enforced (void ) +{ + sig_enforce = true; +} +#else +#define sig_enforce false +#endif +/* * Export sig_enforce kernel cmdline parameter to allow other subsystems rely * on that instead of directly to CONFIG_MODULE_SIG_FORCE config.
@@ -281,11 +290,6 @@ bool is_module_sig_enforced(void) }EXPORT_SYMBOL (is_module_sig_enforced); -void set_module_sig_enforced (void ) -{ - sig_enforce = true; -} -/* Block module loading/unloading? */ int modules_disabled =0 ;core_param (nomodule, modules_disabled, bint,0 );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 2/71 Revert "drm/amdgpu/gfx9: fix the doorbell missing when in CGPG issue."
In reply to Sasha LevinFrom: Yifan Zhang <[email protected]>
commit ee5468b9f1d3bf48082eed351dace14598e8ca39 upstream.
This reverts commit 4cbbe34807938e6e494e535a68d5ff64edac3f20.
Reason for revert: side effect of enlarging CP_MEC_DOORBELL_RANGE may cause some APUs fail to enter gfxoff in certain user cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -5
@@ -3593,12 +3593,8 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)if (ring->use_doorbell) {WREG32_SOC15 (GC ,0 , mmCP_MEC_DOORBELL_RANGE_LOWER, (adev->doorbell_index.kiq *2 ) <<2 ); -/* If GC has entered CGPG, ringing doorbell > first page doesn't -* wakeup GC. Enlarge CP_MEC_DOORBELL_RANGE_UPPER to workaround -* this issue. -*/ WREG32_SOC15 (GC ,0 , mmCP_MEC_DOORBELL_RANGE_UPPER, - (adev->doorbell.size -4 )); + (adev->doorbell_index.userqueue_end *2 ) <<2 ); } WREG32_SOC15_RLC(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 3/71 Revert "drm/amdgpu/gfx10: enlarge CP_MEC_DOORBELL_RANGE_UPPER to cover full doorbell."
In reply to Sasha LevinFrom: Yifan Zhang <[email protected]>
commit baacf52a473b24e10322b67757ddb92ab8d86717 upstream.
This reverts commit 1c0b0efd148d5b24c4932ddb3fa03c8edd6097b3.
Reason for revert: Side effect of enlarging CP_MEC_DOORBELL_RANGE may cause some APUs fail to enter gfxoff in certain user cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -5
@@ -3416,12 +3416,8 @@ static int gfx_v10_0_kiq_init_register(struct amdgpu_ring *ring)if (ring->use_doorbell) {WREG32_SOC15 (GC ,0 , mmCP_MEC_DOORBELL_RANGE_LOWER, (adev->doorbell_index.kiq *2 ) <<2 ); -/* If GC has entered CGPG, ringing doorbell > first page doesn't -* wakeup GC. Enlarge CP_MEC_DOORBELL_RANGE_UPPER to workaround -* this issue. -*/ WREG32_SOC15 (GC ,0 , mmCP_MEC_DOORBELL_RANGE_UPPER, - (adev->doorbell.size -4 )); + (adev->doorbell_index.userqueue_end *2 ) <<2 ); } WREG32_SOC15(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 4/71 drm/nouveau: wait for moving fence after pinning v2
In reply to Sasha LevinFrom: Christian König <[email protected]>
commit 17b11f71795abdce46f62a808f906857e525cea8 upstream.
We actually need to wait for the moving fence after pinning the BO to make sure that the pin is completed.
v2: grab the lock while waiting
References: https://lore.kernel.org/dri-devel/[email protected]/
--- drivers/gpu/drm/nouveau/nouveau_prime.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_prime.c +16 -1
@@ -112,7 +112,22 @@ int nouveau_gem_prime_pin(struct drm_gem_object *obj)if (ret)return -EINVAL ; -return 0 ; + ret =ttm_bo_reserve (&nvbo->bo, false, false,NULL ); +if (ret) + goto error; + +if (nvbo->bo.moving) + ret =dma_fence_wait (nvbo->bo.moving, true); + +ttm_bo_unreserve (&nvbo->bo); +if (ret) + goto error; + +return ret; + +error: +nouveau_bo_unpin (nvbo); +return ret; }void nouveau_gem_prime_unpin (struct drm_gem_object *obj)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 5/71 drm/radeon: wait for moving fence after pinning
In reply to Sasha LevinFrom: Christian König <[email protected]>
commit 4b41726aae563273bb4b4a9462ba51ce4d372f78 upstream.
We actually need to wait for the moving fence after pinning the BO to make sure that the pin is completed.
References: https://lore.kernel.org/dri-devel/[email protected]/
--- drivers/gpu/drm/radeon/radeon_prime.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_prime.c +13 -3
@@ -94,9 +94,19 @@ int radeon_gem_prime_pin(struct drm_gem_object *obj)/* pin buffer into GTT */ ret =radeon_bo_pin (bo,RADEON_GEM_DOMAIN_GTT ,NULL ); -if (likely (ret ==0 )) - bo->prime_shared_count++; - +if (unlikely (ret)) + goto error; + +if (bo->tbo.moving) { + ret =dma_fence_wait (bo->tbo.moving, false); +if (unlikely (ret)) { +radeon_bo_unpin (bo); + goto error; + } + } + + bo->prime_shared_count++; +error:radeon_bo_unreserve (bo);return ret; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 6/71 ARM: 9081/1: fix gcc-10 thumb2-kernel regression
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
commit dad7b9896a5dbac5da8275d5a6147c65c81fb5f2 upstream.
When building the kernel wtih gcc-10 or higher using the CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y flag, the compiler picks a slightly different set of registers for the inline assembly in cpu_init() that subsequently results in a corrupt kernel stack as well as remaining in FIQ mode. If a banked register is used for the last argument, the wrong version of that register gets loaded into CPSR_c. When building in Arm mode, the arguments are passed as immediate values and the bug cannot happen.
This got introduced when Daniel reworked the FIQ handling and was technically always broken, but happened to work with both clang and gcc before gcc-10 as long as they picked one of the lower registers. This is probably an indication that still very few people build the kernel in Thumb2 mode.
Marek pointed out the problem on IRC, Arnd narrowed it down to this inline assembly and Russell pinpointed the exact bug.
Change the constraints to force the final mode switch to use a non-banked register for the argument to ensure that the correct constant gets loaded. Another alternative would be to always use registers for the constant arguments to avoid the #ifdef that has now become more complex.
--- arch/arm/kernel/setup.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
arch/arm/kernel/setup.c +9 -7
@@ -544,9 +544,11 @@ void notrace cpu_init(void)* In Thumb-2, msr with an immediate value is not allowed. */ #ifdef CONFIG_THUMB2_KERNEL -#define PLC "r" +#define PLC_l "l" +#define PLC_r "r"#else -#define PLC "I" +#define PLC_l "I" +#define PLC_r "I"#endif /*
@@ -568,15 +570,15 @@ void notrace cpu_init(void) "msr cpsr_c, %9" : : "r" (stk), - PLC (PSR_F_BIT | PSR_I_BIT | IRQ_MODE), + PLC_r (PSR_F_BIT | PSR_I_BIT | IRQ_MODE), "I" (offsetof(struct stack, irq[0])), - PLC (PSR_F_BIT | PSR_I_BIT | ABT_MODE), + PLC_r (PSR_F_BIT | PSR_I_BIT | ABT_MODE), "I" (offsetof(struct stack, abt[0])), - PLC (PSR_F_BIT | PSR_I_BIT | UND_MODE), + PLC_r (PSR_F_BIT | PSR_I_BIT | UND_MODE), "I" (offsetof(struct stack, und[0])), - PLC (PSR_F_BIT | PSR_I_BIT | FIQ_MODE), + PLC_r (PSR_F_BIT | PSR_I_BIT | FIQ_MODE), "I" (offsetof(struct stack, fiq[0])), - PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE) + PLC_l (PSR_F_BIT | PSR_I_BIT | SVC_MODE) : "r14");#endif }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 7/71 mmc: meson-gx: use memcpy_to/fromio for dram-access-quirk
In reply to Sasha LevinFrom: Neil Armstrong <[email protected]>
commit 103a5348c22c3fca8b96c735a9e353b8a0801842 upstream.
It has been reported that usage of memcpy() to/from an iomem mapping is invalid, and a recent arm64 memcpy update [1] triggers a memory abort when dram-access-quirk is used on the G12A/G12B platforms.
This adds a local sg_copy_to_buffer which makes usage of io versions of memcpy when dram-access-quirk is enabled.
[1] 285133040e6c ("arm64: Import latest memcpy()/memmove() implementation")
--- drivers/mmc/host/meson-gx-mmc.c | 50 +++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 5 deletions(-)
drivers/mmc/host/meson-gx-mmc.c +45 -5
@@ -166,6 +166,7 @@ struct meson_host {unsigned int bounce_buf_size;void *bounce_buf; +void __iomem *bounce_iomem_buf;dma_addr_t bounce_dma_addr;struct sd_emmc_desc *descs;dma_addr_t descs_dma_addr;
@@ -737,6 +738,47 @@ static void meson_mmc_desc_chain_transfer(struct mmc_host *mmc, u32 cmd_cfg)writel (start, host->regs +SD_EMMC_START ); } +/* local sg copy to buffer version with _to/fromio usage for dram_access_quirk */ +static void meson_mmc_copy_buffer (struct meson_host *host,struct mmc_data *data, +size_t buflen,bool to_buffer) +{ +unsigned int sg_flags =SG_MITER_ATOMIC ; +struct scatterlist *sgl = data->sg; +unsigned int nents = data->sg_len; +struct sg_mapping_iter miter; +unsigned int offset =0 ; + +if (to_buffer) + sg_flags |=SG_MITER_FROM_SG ; +else + sg_flags |=SG_MITER_TO_SG ; + +sg_miter_start (&miter, sgl, nents, sg_flags); + +while ((offset < buflen) &&sg_miter_next (&miter)) { +unsigned int len; + + len =min (miter.length, buflen - offset); + +/* When dram_access_quirk, the bounce buffer is a iomem mapping */ +if (host->dram_access_quirk) { +if (to_buffer) +memcpy_toio (host->bounce_iomem_buf + offset, miter.addr, len); +else +memcpy_fromio (miter.addr, host->bounce_iomem_buf + offset, len); + }else { +if (to_buffer) +memcpy (host->bounce_buf + offset, miter.addr, len); +else +memcpy (miter.addr, host->bounce_buf + offset, len); + } + + offset += len; + } + +sg_miter_stop (&miter); +} +static void meson_mmc_start_cmd (struct mmc_host *mmc,struct mmc_command *cmd) {struct meson_host *host =mmc_priv (mmc);
@@ -780,8 +822,7 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd)if (data->flags &MMC_DATA_WRITE ) { cmd_cfg |=CMD_CFG_DATA_WR ;WARN_ON (xfer_bytes > host->bounce_buf_size); -sg_copy_to_buffer (data->sg, data->sg_len, - host->bounce_buf, xfer_bytes); +meson_mmc_copy_buffer (host, data, xfer_bytes, true);dma_wmb (); }
@@ -950,8 +991,7 @@ static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id)if (meson_mmc_bounce_buf_read (data)) { xfer_bytes = data->blksz * data->blocks;WARN_ON (xfer_bytes > host->bounce_buf_size); -sg_copy_from_buffer (data->sg, data->sg_len, - host->bounce_buf, xfer_bytes); +meson_mmc_copy_buffer (host, data, xfer_bytes, false); } next_cmd =meson_mmc_get_next_command (cmd);
@@ -1179,7 +1219,7 @@ static int meson_mmc_probe(struct platform_device *pdev)* instead of the DDR memory */ host->bounce_buf_size =SD_EMMC_SRAM_DATA_BUF_LEN ; - host->bounce_buf = host->regs +SD_EMMC_SRAM_DATA_BUF_OFF ; + host->bounce_iomem_buf = host->regs +SD_EMMC_SRAM_DATA_BUF_OFF ; host->bounce_dma_addr = res->start +SD_EMMC_SRAM_DATA_BUF_OFF ; }else {/* data bounce buffer */
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 8/71 kbuild: add CONFIG_LD_IS_LLD
In reply to Sasha LevinFrom: Sami Tolvanen <[email protected]>
commit b744b43f79cc758127042e71f9ad7b1afda30f84 upstream.
Similarly to the CC_IS_CLANG config, add LD_IS_LLD to avoid GNU ld specific logic such as ld-version or ld-ifversion and gain the ability to select potential features that depend on the linker at configuration time such as LTO.
--- init/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
init/Kconfig +3 -0
@@ -20,6 +20,9 @@ config GCC_VERSION config CC_IS_CLANG def_bool $(success,$(CC) --version | head -n 1 | grep -q clang) +config LD_IS_LLD + def_bool $(success,$(LD) -v | head -n 1 | grep -q LLD) + config CLANG_VERSION int default $(shell,$(srctree)/scripts/clang-version.sh $(CC))
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 9/71 arm64: link with -z norelro for LLD or aarch64-elf
In reply to Sasha LevinFrom: Nick Desaulniers <[email protected]>
commit 311bea3cb9ee20ef150ca76fc60a592bf6b159f5 upstream.
With GNU binutils 2.35+, linking with BFD produces warnings for vmlinux:
aarch64-linux-gnu-ld: warning: -z norelro ignored
BFD can produce this warning when the target emulation mode does not support RELRO program headers, and -z relro or -z norelro is passed.
Alan Modra clarifies:
The default linker emulation for an aarch64-linux ld.bfd is -maarch64linux, the default for an aarch64-elf linker is -maarch64elf. They are not equivalent. If you choose -maarch64elf you get an emulation that doesn't support -z relro.
The ARCH=arm64 kernel prefers -maarch64elf, but may fall back to -maarch64linux based on the toolchain configuration.
LLD will always create RELRO program header regardless of target emulation.
To avoid the above warning when linking with BFD, pass -z norelro only when linking with LLD or with -maarch64linux.
--- arch/arm64/Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm64/Makefile +7 -3
@@ -10,7 +10,7 @@ # # Copyright (C) 1995-2001 by Russell King -LDFLAGS_vmlinux :=--no-undefined -X -z norelro +LDFLAGS_vmlinux :=--no-undefined -X CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) GZFLAGS :=-9
@@ -82,17 +82,21 @@ CHECKFLAGS += -D__AARCH64EB__ AS += -EB # Prefer the baremetal ELF build target, but not all toolchains include # it so fall back to the standard linux version if needed. -KBUILD_LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb) +KBUILD_LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb -z norelro) UTS_MACHINE := aarch64_be else KBUILD_CPPFLAGS += -mlittle-endian CHECKFLAGS += -D__AARCH64EL__ AS += -EL # Same as above, prefer ELF but fall back to linux target if needed. -KBUILD_LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux) +KBUILD_LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux -z norelro) UTS_MACHINE := aarch64 endif +ifeq ($(CONFIG_LD_IS_LLD), y) +KBUILD_LDFLAGS += -z norelro +endif + CHECKFLAGS += -D__aarch64__ ifeq ($(CONFIG_ARM64_MODULE_PLTS),y)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 10/71 MIPS: generic: Update node names to avoid unit addresses
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
commit e607ff630c6053ecc67502677c0e50053d7892d4 upstream.
With the latest mkimage from U-Boot 2021.04, the generic defconfigs no longer build, failing with:
/usr/bin/mkimage: verify_header failed for FIT Image support with exit code 1
This is expected after the linked U-Boot commits because '@' is forbidden in the node names due to the way that libfdt treats nodes with the same prefix but different unit addresses.
Switch the '@' in the node name to '-'. Drop the unit addresses from the hash and kernel child nodes because there is only one node so they do not need to have a number to differentiate them.
--- arch/mips/generic/board-boston.its.S | 10 +++++----- arch/mips/generic/board-ni169445.its.S | 10 +++++----- arch/mips/generic/board-ocelot.its.S | 20 ++++++++++---------- arch/mips/generic/board-xilfpga.its.S | 10 +++++----- arch/mips/generic/vmlinux.its.S | 10 +++++----- 5 files changed, 30 insertions(+), 30 deletions(-)
arch/mips/generic/board-boston.its.S +5 -5
@@ -1,22 +1,22 @@ / { images { - fdt@boston { + fdt-boston { description = "img,boston Device Tree"; data = /incbin/("boot/dts/img/boston.dtb"); type = "flat_dt"; arch = "mips"; compression = "none"; - hash@0 { + hash { algo = "sha1"; }; }; }; configurations { - conf@boston { + conf-boston { description = "Boston Linux kernel"; - kernel = "kernel@0"; - fdt = "fdt@boston"; + kernel = "kernel"; + fdt = "fdt-boston"; }; }; };
arch/mips/generic/board-ni169445.its.S +5 -5
@@ -1,22 +1,22 @@ / { images { - fdt@ni169445 { + fdt-ni169445 { description = "NI 169445 device tree"; data = /incbin/("boot/dts/ni/169445.dtb"); type = "flat_dt"; arch = "mips"; compression = "none"; - hash@0 { + hash { algo = "sha1"; }; }; }; configurations { - conf@ni169445 { + conf-ni169445 { description = "NI 169445 Linux Kernel"; - kernel = "kernel@0"; - fdt = "fdt@ni169445"; + kernel = "kernel"; + fdt = "fdt-ni169445"; }; }; };
arch/mips/generic/board-ocelot.its.S +10 -10
@@ -1,40 +1,40 @@ /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ / { images { - fdt@ocelot_pcb123 { + fdt-ocelot_pcb123 { description = "MSCC Ocelot PCB123 Device Tree"; data = /incbin/("boot/dts/mscc/ocelot_pcb123.dtb"); type = "flat_dt"; arch = "mips"; compression = "none"; - hash@0 { + hash { algo = "sha1"; }; }; - fdt@ocelot_pcb120 { + fdt-ocelot_pcb120 { description = "MSCC Ocelot PCB120 Device Tree"; data = /incbin/("boot/dts/mscc/ocelot_pcb120.dtb"); type = "flat_dt"; arch = "mips"; compression = "none"; - hash@0 { + hash { algo = "sha1"; }; }; }; configurations { - conf@ocelot_pcb123 { + conf-ocelot_pcb123 { description = "Ocelot Linux kernel"; - kernel = "kernel@0"; - fdt = "fdt@ocelot_pcb123"; + kernel = "kernel"; + fdt = "fdt-ocelot_pcb123"; }; - conf@ocelot_pcb120 { + conf-ocelot_pcb120 { description = "Ocelot Linux kernel"; - kernel = "kernel@0"; - fdt = "fdt@ocelot_pcb120"; + kernel = "kernel"; + fdt = "fdt-ocelot_pcb120"; }; }; };
arch/mips/generic/board-xilfpga.its.S +5 -5
@@ -1,22 +1,22 @@ / { images { - fdt@xilfpga { + fdt-xilfpga { description = "MIPSfpga (xilfpga) Device Tree"; data = /incbin/("boot/dts/xilfpga/nexys4ddr.dtb"); type = "flat_dt"; arch = "mips"; compression = "none"; - hash@0 { + hash { algo = "sha1"; }; }; }; configurations { - conf@xilfpga { + conf-xilfpga { description = "MIPSfpga Linux kernel"; - kernel = "kernel@0"; - fdt = "fdt@xilfpga"; + kernel = "kernel"; + fdt = "fdt-xilfpga"; }; }; };
arch/mips/generic/vmlinux.its.S +5 -5
@@ -6,7 +6,7 @@ #address-cells = <ADDR_CELLS>; images { - kernel@0 { + kernel { description = KERNEL_NAME; data = /incbin/(VMLINUX_BINARY); type = "kernel";
@@ -15,18 +15,18 @@ compression = VMLINUX_COMPRESSION; load = /bits/ ADDR_BITS <VMLINUX_LOAD_ADDRESS>; entry = /bits/ ADDR_BITS <VMLINUX_ENTRY_ADDRESS>; - hash@0 { + hash { algo = "sha1"; }; }; }; configurations { - default = "conf@default"; + default = "conf-default"; - conf@default { + conf-default { description = "Generic Linux kernel"; - kernel = "kernel@0"; + kernel = "kernel"; }; }; };
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 11/71 spi: spi-nxp-fspi: move the register operation after the clock enable
In reply to Sasha LevinFrom: Haibo Chen <[email protected]>
[ Upstream commit f422316c8e9d3c4aff3c56549dfb44a677d02f14 ]
Move the register operation after the clock enable, otherwise system will stuck when this driver probe.
--- drivers/spi/spi-nxp-fspi.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/spi/spi-nxp-fspi.c +5 -6
@@ -975,12 +975,6 @@ static int nxp_fspi_probe(struct platform_device *pdev) goto err_put_ctrl; } -/* Clear potential interrupts */ - reg =fspi_readl (f, f->iobase +FSPI_INTR ); -if (reg) -fspi_writel (f, reg, f->iobase +FSPI_INTR ); - -/* find the resources - controller memory mapped space */ res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"fspi_mmap" ); f->ahb_addr =devm_ioremap_resource (dev, res);
@@ -1012,6 +1006,11 @@ static int nxp_fspi_probe(struct platform_device *pdev) goto err_put_ctrl; } +/* Clear potential interrupts */ + reg =fspi_readl (f, f->iobase +FSPI_INTR ); +if (reg) +fspi_writel (f, reg, f->iobase +FSPI_INTR ); +/* find the irq */ ret =platform_get_irq (pdev,0 );if (ret <0 )
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 12/71 Revert "PCI: PM: Do not read power state in pci_enable_device_flags()"
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 4d6035f9bf4ea12776322746a216e856dfe46698 ]
Revert commit 4514d991d992 ("PCI: PM: Do not read power state in pci_enable_device_flags()") that is reported to cause PCI device initialization issues on some systems.
--- drivers/pci/pci.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/pci/pci.c +13 -3
@@ -1666,11 +1666,21 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)int err;int i, bars =0 ; -if (atomic_inc_return (&dev->enable_cnt) >1 ) { -pci_update_current_state (dev, dev->current_state); -return 0 ;/* already enabled */ +/* +* Power state could be unknown at this point, either due to a fresh +* boot or a device removal call. So get the current power state +* so that things like MSI message writing will behave as expected +* (e.g. if the device really is in D0 at enable time). +*/ +if (dev->pm_cap) { +u16 pmcsr; +pci_read_config_word (dev, dev->pm_cap +PCI_PM_CTRL , &pmcsr); + dev->current_state = (pmcsr &PCI_PM_CTRL_STATE_MASK ); } +if (atomic_inc_return (&dev->enable_cnt) >1 ) +return 0 ;/* already enabled */ + bridge =pci_upstream_bridge (dev);if (bridge)pci_enable_bridge (bridge);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 13/71 dmaengine: zynqmp_dma: Fix PM reference leak in zynqmp_dma_alloc_chan_resourc()
In reply to Sasha LevinFrom: Yu Kuai <[email protected]>
[ Upstream commit 8982d48af36d2562c0f904736b0fc80efc9f2532 ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/dma/xilinx/zynqmp_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/xilinx/zynqmp_dma.c +1 -1
@@ -467,7 +467,7 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)struct zynqmp_dma_desc_sw *desc;int i, ret; - ret =pm_runtime_get_sync (chan->dev); + ret =pm_runtime_resume_and_get (chan->dev);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 14/71 mac80211: remove warning in ieee80211_get_sband()
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 0ee4d55534f82a0624701d0bb9fc2304d4529086 ]
Syzbot reports that it's possible to hit this from userspace, by trying to add a station before any other connection setup has been done. Instead of trying to catch this in some other way simply remove the warning, that will appropriately reject the call from userspace.
--- net/mac80211/ieee80211_i.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/ieee80211_i.h +1 -1
@@ -1420,7 +1420,7 @@ ieee80211_get_sband(struct ieee80211_sub_if_data *sdata)rcu_read_lock (); chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); -if (WARN_ON_ONCE (!chanctx_conf)) { +if (!chanctx_conf) {rcu_read_unlock ();return NULL ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 15/71 mac80211_hwsim: drop pending frames on stop
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit bd18de517923903a177508fc8813f44e717b1c00 ]
Syzbot reports that we may be able to get into a situation where mac80211 has pending ACK frames on shutdown with hwsim. It appears that the reason for this is that syzbot uses the wmediumd hooks to intercept/injection frames, and may shut down hwsim, removing the radio(s), while frames are pending in the air simulation.
Clean out the pending queue when the interface is stopped, after this the frames can't be reported back to mac80211 properly anyway.
--- drivers/net/wireless/mac80211_hwsim.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/mac80211_hwsim.c +5 -0
@@ -1458,8 +1458,13 @@ static int mac80211_hwsim_start(struct ieee80211_hw *hw)static void mac80211_hwsim_stop (struct ieee80211_hw *hw) {struct mac80211_hwsim_data *data = hw->priv; + data->started = false;hrtimer_cancel (&data->beacon_timer); + +while (!skb_queue_empty (&data->pending)) +ieee80211_free_txskb (hw,skb_dequeue (&data->pending)); +wiphy_dbg (hw->wiphy,"%s\n" , __func__); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 16/71 cfg80211: call cfg80211_leave_ocb when switching away from OCB
In reply to Sasha LevinFrom: Du Cheng <[email protected]>
[ Upstream commit a64b6a25dd9f984ed05fade603a00e2eae787d2f ]
If the userland switches back-and-forth between NL80211_IFTYPE_OCB and NL80211_IFTYPE_ADHOC via send_msg(NL80211_CMD_SET_INTERFACE), there is a chance where the cleanup cfg80211_leave_ocb() is not called. This leads to initialization of in-use memory (e.g. init u.ibss while in-use by u.ocb) due to a shared struct/union within ieee80211_sub_if_data:
struct ieee80211_sub_if_data {
...
union {
struct ieee80211_if_ap ap;
struct ieee80211_if_vlan vlan;
struct ieee80211_if_managed mgd;
struct ieee80211_if_ibss ibss; // <- shares address
struct ieee80211_if_mesh mesh;
struct ieee80211_if_ocb ocb; // <- shares address
struct ieee80211_if_mntr mntr;
struct ieee80211_if_nan nan;
} u;
...
}Therefore add handling of otype == NL80211_IFTYPE_OCB, during cfg80211_change_iface() to perform cleanup when leaving OCB mode.
link to syzkaller bug:
https://syzkaller.appspot.com/bug?id=0612dbfa595bf4b9b680ff7b4948257b8e3732d5
--- net/wireless/util.c | 3 +++ 1 file changed, 3 insertions(+)
net/wireless/util.c +3 -0
@@ -1006,6 +1006,9 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,case NL80211_IFTYPE_MESH_POINT :/* mesh should be handled? */ break ; +case NL80211_IFTYPE_OCB : +cfg80211_leave_ocb (rdev, dev); +break ;default :break ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 17/71 dmaengine: rcar-dmac: Fix PM reference leak in rcar_dmac_probe()
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ Upstream commit dea8464ddf553803382efb753b6727dbf3931d06 ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/dma/sh/rcar-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/sh/rcar-dmac.c +1 -1
@@ -1855,7 +1855,7 @@ static int rcar_dmac_probe(struct platform_device *pdev)/* Enable runtime PM and initialize the device. */ pm_runtime_enable (&pdev->dev); - ret =pm_runtime_get_sync (&pdev->dev); + ret =pm_runtime_resume_and_get (&pdev->dev);if (ret <0 ) {dev_err (&pdev->dev,"runtime PM get sync failed (%d)\n" , ret);return ret;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 18/71 dmaengine: mediatek: free the proper desc in desc_free handler
In reply to Sasha LevinFrom: Guillaume Ranquet <[email protected]>
[ Upstream commit 0a2ff58f9f8f95526ecb0ccd7517fefceb96f661 ]
The desc_free handler assumed that the desc we want to free was always
the current one associated with the channel.
This is seldom the case and this is causing use after free crashes in
multiple places (tx/rx/terminate...).
BUG: KASAN: use-after-free in mtk_uart_apdma_rx_handler+0x120/0x304 Call trace: dump_backtrace+0x0/0x1b0 show_stack+0x24/0x34 dump_stack+0xe0/0x150 print_address_description+0x8c/0x55c __kasan_report+0x1b8/0x218 kasan_report+0x14/0x20 __asan_load4+0x98/0x9c mtk_uart_apdma_rx_handler+0x120/0x304 mtk_uart_apdma_irq_handler+0x50/0x80 __handle_irq_event_percpu+0xe0/0x210 handle_irq_event+0x8c/0x184 handle_fasteoi_irq+0x1d8/0x3ac __handle_domain_irq+0xb0/0x110 gic_handle_irq+0x50/0xb8 el0_irq_naked+0x60/0x6c Allocated by task 3541: __kasan_kmalloc+0xf0/0x1b0 kasan_kmalloc+0x10/0x1c kmem_cache_alloc_trace+0x90/0x2dc mtk_uart_apdma_prep_slave_sg+0x6c/0x1a0 mtk8250_dma_rx_complete+0x220/0x2e4 vchan_complete+0x290/0x340 tasklet_action_common+0x220/0x298 tasklet_action+0x28/0x34 __do_softirq+0x158/0x35c Freed by task 3541: __kasan_slab_free+0x154/0x224 kasan_slab_free+0x14/0x24 slab_free_freelist_hook+0xf8/0x15c kfree+0xb4/0x278 mtk_uart_apdma_desc_free+0x34/0x44 vchan_complete+0x1bc/0x340 tasklet_action_common+0x220/0x298 tasklet_action+0x28/0x34 __do_softirq+0x158/0x35c The buggy address belongs to the object at ffff000063606800 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 176 bytes inside of 256-byte region [ffff000063606800, ffff000063606900) The buggy address belongs to the page: page:fffffe00016d8180 refcount:1 mapcount:0 mapping:ffff00000302f600 index:0x0 compound_mapcount: 0 flags: 0xffff00000010200(slab|head) raw: 0ffff00000010200 dead000000000100 dead000000000122 ffff00000302f600 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected
--- drivers/dma/mediatek/mtk-uart-apdma.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/dma/mediatek/mtk-uart-apdma.c +1 -4
@@ -131,10 +131,7 @@ static unsigned int mtk_uart_apdma_read(struct mtk_chan *c, unsigned int reg)static void mtk_uart_apdma_desc_free (struct virt_dma_desc *vd) { -struct dma_chan *chan = vd->tx.chan; -struct mtk_chan *c =to_mtk_uart_apdma_chan (chan); - -kfree (c->desc); +kfree (container_of(vd ,struct mtk_uart_apdma_desc ,vd )); }static void mtk_uart_apdma_start_tx (struct mtk_chan *c)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 19/71 dmaengine: mediatek: do not issue a new desc if one is still current
In reply to Sasha LevinFrom: Guillaume Ranquet <[email protected]>
[ Upstream commit 2537b40b0a4f61d2c83900744fe89b09076be9c6 ]
Avoid issuing a new desc if one is still being processed as this can lead to some desc never being marked as completed.
--- drivers/dma/mediatek/mtk-uart-apdma.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/dma/mediatek/mtk-uart-apdma.c +12 -8
@@ -204,14 +204,9 @@ static void mtk_uart_apdma_start_rx(struct mtk_chan *c)static void mtk_uart_apdma_tx_handler (struct mtk_chan *c) { -struct mtk_uart_apdma_desc *d = c->desc; -mtk_uart_apdma_write (c,VFF_INT_FLAG ,VFF_TX_INT_CLR_B );mtk_uart_apdma_write (c,VFF_INT_EN ,VFF_INT_EN_CLR_B );mtk_uart_apdma_write (c,VFF_EN ,VFF_EN_CLR_B ); - -list_del (&d->vd.node); -vchan_cookie_complete (&d->vd); }static void mtk_uart_apdma_rx_handler (struct mtk_chan *c)
@@ -242,9 +237,17 @@ static void mtk_uart_apdma_rx_handler(struct mtk_chan *c) c->rx_status = d->avail_len - cnt;mtk_uart_apdma_write (c,VFF_RPT , wg); +} -list_del (&d->vd.node); -vchan_cookie_complete (&d->vd); +static void mtk_uart_apdma_chan_complete_handler (struct mtk_chan *c) +{ +struct mtk_uart_apdma_desc *d = c->desc; + +if (d) { +list_del (&d->vd.node); +vchan_cookie_complete (&d->vd); + c->desc =NULL ; + } }static irqreturn_t mtk_uart_apdma_irq_handler (int irq,void *dev_id)
@@ -258,6 +261,7 @@ static irqreturn_t mtk_uart_apdma_irq_handler(int irq, void *dev_id)mtk_uart_apdma_rx_handler (c); else if (c->dir == DMA_MEM_TO_DEV) mtk_uart_apdma_tx_handler(c); +mtk_uart_apdma_chan_complete_handler (c );spin_unlock_irqrestore (&c->vc.lock, flags);return IRQ_HANDLED ;
@@ -363,7 +367,7 @@ static void mtk_uart_apdma_issue_pending(struct dma_chan *chan)unsigned long flags;spin_lock_irqsave (&c->vc.lock, flags); -if (vchan_issue_pending (&c->vc)) { +if (vchan_issue_pending (&c->vc) && !c->desc) { vd =vchan_next_desc (&c->vc); c->desc =to_mtk_uart_apdma_desc (&vd->tx);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 20/71 dmaengine: mediatek: use GFP_NOWAIT instead of GFP_ATOMIC in prep_dma
In reply to Sasha LevinFrom: Guillaume Ranquet <[email protected]>
[ Upstream commit 9041575348b21ade1fb74d790f1aac85d68198c7 ]
As recommended by the doc in:Documentation/drivers-api/dmaengine/provider.rst
Use GFP_NOWAIT to not deplete the emergency pool.
--- drivers/dma/mediatek/mtk-uart-apdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/mediatek/mtk-uart-apdma.c +1 -1
@@ -349,7 +349,7 @@ static struct dma_async_tx_descriptor *mtk_uart_apdma_prep_slave_sgreturn NULL ;/* Now allocate and setup the descriptor */ - d =kzalloc (sizeof (*d),GFP_ATOMIC ); + d =kzalloc (sizeof (*d),GFP_NOWAIT );if (!d)return NULL ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 21/71 net: ipv4: Remove unneed BUG() function
In reply to Sasha LevinFrom: Zheng Yongjun <[email protected]>
[ Upstream commit 5ac6b198d7e312bd10ebe7d58c64690dc59cc49a ]
When 'nla_parse_nested_deprecated' failed, it's no need to BUG() here, return -EINVAL is ok.
--- net/ipv4/devinet.c | 2 +- net/ipv6/addrconf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/devinet.c +1 -1
@@ -1989,7 +1989,7 @@ static int inet_set_link_af(struct net_device *dev, const struct nlattr *nla)return -EAFNOSUPPORT ;if (nla_parse_nested_deprecated (tb,IFLA_INET_MAX , nla,NULL ,NULL ) <0 ) -BUG (); +return -EINVAL ;if (tb[IFLA_INET_CONF ]) {nla_for_each_nested (a, tb[IFLA_INET_CONF ], rem)
net/ipv6/addrconf.c +1 -1
@@ -5761,7 +5761,7 @@ static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla)return -EAFNOSUPPORT ;if (nla_parse_nested_deprecated (tb,IFLA_INET6_MAX , nla,NULL ,NULL ) <0 ) -BUG (); +return -EINVAL ;if (tb[IFLA_INET6_TOKEN ]) { err =inet6_set_iftoken (idev,nla_data (tb[IFLA_INET6_TOKEN ]));
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 22/71 mac80211: drop multicast fragments
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit a9799541ca34652d9996e45f80e8e03144c12949 ]
These are not permitted by the spec, just drop them.
--- net/mac80211/rx.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
net/mac80211/rx.c +3 -6
@@ -2200,17 +2200,15 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) sc =le16_to_cpu (hdr->seq_ctrl); frag = sc &IEEE80211_SCTL_FRAG ; -if (is_multicast_ether_addr (hdr->addr1)) { -I802_DEBUG_INC (rx->local->dot11MulticastReceivedFrameCount); - goto out_no_led; - } -if (rx->sta) cache = &rx->sta->frags;if (likely (!ieee80211_has_morefrags (fc) && frag ==0 )) goto out; +if (is_multicast_ether_addr (hdr->addr1)) +return RX_DROP_MONITOR ; +I802_DEBUG_INC (rx->local->rx_handlers_fragments);if (skb_linearize (rx->skb))
@@ -2336,7 +2334,6 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) out:ieee80211_led_rx (rx->local); - out_no_led:if (rx->sta) rx->sta->rx_stats.packets++;return RX_CONTINUE ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 23/71 net: ethtool: clear heap allocations for ethtool function
In reply to Sasha LevinFrom: Austin Kim <[email protected]>
[ Upstream commit 80ec82e3d2c1fab42eeb730aaa7985494a963d3f ]
Several ethtool functions leave heap uncleared (potentially) by drivers. This will leave the unused portion of heap unchanged and might copy the full contents back to userspace.
--- net/core/ethtool.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/core/ethtool.c +5 -5
@@ -1508,7 +1508,7 @@ static int ethtool_get_any_eeprom(struct net_device *dev, void __user *useraddr,if (eeprom.offset + eeprom.len > total_len)return -EINVAL ; - data =kmalloc (PAGE_SIZE ,GFP_USER ); + data =kzalloc (PAGE_SIZE ,GFP_USER );if (!data)return -ENOMEM ;
@@ -1573,7 +1573,7 @@ static int ethtool_set_eeprom(struct net_device *dev, void __user *useraddr)if (eeprom.offset + eeprom.len > ops->get_eeprom_len (dev))return -EINVAL ; - data =kmalloc (PAGE_SIZE ,GFP_USER ); + data =kzalloc (PAGE_SIZE ,GFP_USER );if (!data)return -ENOMEM ;
@@ -1764,7 +1764,7 @@ static int ethtool_self_test(struct net_device *dev, char __user *useraddr)return -EFAULT ; test.len = test_len; - data =kmalloc_array (test_len,sizeof (u64),GFP_USER ); + data =kcalloc (test_len,sizeof (u64),GFP_USER );if (!data)return -ENOMEM ;
@@ -2295,7 +2295,7 @@ static int ethtool_get_tunable(struct net_device *dev, void __user *useraddr) ret =ethtool_tunable_valid (&tuna);if (ret)return ret; - data =kmalloc (tuna.len,GFP_USER ); + data =kzalloc (tuna.len,GFP_USER );if (!data)return -ENOMEM ; ret = ops->get_tunable (dev, &tuna, data);
@@ -2481,7 +2481,7 @@ static int get_phy_tunable(struct net_device *dev, void __user *useraddr) ret =ethtool_phy_tunable_valid (&tuna);if (ret)return ret; - data =kmalloc (tuna.len,GFP_USER ); + data =kzalloc (tuna.len,GFP_USER );if (!data)return -ENOMEM ;mutex_lock (&phydev->lock);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 24/71 ping: Check return value of function 'ping_queue_rcv_skb'
In reply to Sasha LevinFrom: Zheng Yongjun <[email protected]>
[ Upstream commit 9d44fa3e50cc91691896934d106c86e4027e61ca ]
Function 'ping_queue_rcv_skb' not always return success, which will also return fail. If not check the wrong return value of it, lead to function ping_rcv return success.
--- net/ipv4/ping.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/ipv4/ping.c +7 -5
@@ -963,6 +963,7 @@ bool ping_rcv(struct sk_buff *skb)struct sock *sk;struct net *net =dev_net (skb->dev);struct icmphdr *icmph =icmp_hdr (skb); +bool rc = false;/* We assume the packet has already been checked by icmp_rcv */
@@ -977,14 +978,15 @@ bool ping_rcv(struct sk_buff *skb)struct sk_buff *skb2 =skb_clone (skb,GFP_ATOMIC );pr_debug ("rcv on socket %p\n" , sk); -if (skb2) -ping_queue_rcv_skb (sk, skb2); +if (skb2 && !ping_queue_rcv_skb (sk, skb2)) + rc = true;sock_put (sk); -return true; } -pr_debug ("no socket, dropping\n" ); -return false; +if (!rc) +pr_debug ("no socket, dropping\n" ); + +return rc; }EXPORT_SYMBOL_GPL (ping_rcv);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 25/71 inet: annotate date races around sk->sk_txhash
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit b71eaed8c04f72a919a9c44e83e4ee254e69e7f3 ]
UDP sendmsg() path can be lockless, it is possible for another thread to re-connect an change sk->sk_txhash under us.
There is no serious impact, but we can use READ_ONCE()/WRITE_ONCE() pair to document the race.
BUG: KCSAN: data-race in __ip4_datagram_connect / skb_set_owner_w
write to 0xffff88813397920c of 4 bytes by task 30997 on cpu 1:
sk_set_txhash include/net/sock.h:1937 [inline] __ip4_datagram_connect+0x69e/0x710 net/ipv4/datagram.c:75 __ip6_datagram_connect+0x551/0x840 net/ipv6/datagram.c:189 ip6_datagram_connect+0x2a/0x40 net/ipv6/datagram.c:272 inet_dgram_connect+0xfd/0x180 net/ipv4/af_inet.c:580 __sys_connect_file net/socket.c:1837 [inline] __sys_connect+0x245/0x280 net/socket.c:1854 __do_sys_connect net/socket.c:1864 [inline] __se_sys_connect net/socket.c:1861 [inline] __x64_sys_connect+0x3d/0x50 net/socket.c:1861 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffff88813397920c of 4 bytes by task 31039 on cpu 0:
skb_set_hash_from_sk include/net/sock.h:2211 [inline] skb_set_owner_w+0x118/0x220 net/core/sock.c:2101 sock_alloc_send_pskb+0x452/0x4e0 net/core/sock.c:2359 sock_alloc_send_skb+0x2d/0x40 net/core/sock.c:2373 __ip6_append_data+0x1743/0x21a0 net/ipv6/ip6_output.c:1621 ip6_make_skb+0x258/0x420 net/ipv6/ip6_output.c:1983 udpv6_sendmsg+0x160a/0x16b0 net/ipv6/udp.c:1527 inet6_sendmsg+0x5f/0x80 net/ipv6/af_inet6.c:642 sock_sendmsg_nosec net/socket.c:654 [inline] sock_sendmsg net/socket.c:674 [inline] ____sys_sendmsg+0x360/0x4d0 net/socket.c:2350 ___sys_sendmsg net/socket.c:2404 [inline] __sys_sendmmsg+0x315/0x4b0 net/socket.c:2490 __do_sys_sendmmsg net/socket.c:2519 [inline] __se_sys_sendmmsg net/socket.c:2516 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2516 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
value changed: 0xbca3c43d -> 0xfdb309e0
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 31039 Comm: syz-executor.2 Not tainted 5.13.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- include/net/sock.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
include/net/sock.h +7 -3
@@ -1860,7 +1860,8 @@ static inline u32 net_tx_rndhash(void)static inline void sk_set_txhash (struct sock *sk) { - sk->sk_txhash =net_tx_rndhash (); +/* This pairs with READ_ONCE() in skb_set_hash_from_sk() */ +WRITE_ONCE (sk->sk_txhash,net_tx_rndhash ()); }static inline void sk_rethink_txhash (struct sock *sk)
@@ -2125,9 +2126,12 @@ static inline void sock_poll_wait(struct file *filp, struct socket *sock,static inline void skb_set_hash_from_sk (struct sk_buff *skb,struct sock *sk) { -if (sk->sk_txhash) { +/* This pairs with WRITE_ONCE() in sk_set_txhash() */ +u32 txhash =READ_ONCE (sk->sk_txhash); + +if (txhash) { skb->l4_hash =1 ; - skb->hash = sk->sk_txhash; + skb->hash = txhash; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 26/71 net: phy: dp83867: perform soft reset and retain established link
In reply to Sasha LevinFrom: Praneeth Bajjuri <[email protected]>
[ Upstream commit da9ef50f545f86ffe6ff786174d26500c4db737a ]
Current logic is performing hard reset and causing the programmed registers to be wiped out.
as per datasheet: https://www.ti.com/lit/ds/symlink/dp83867cr.pdf
8.6.26 Control Register (CTRL)
do SW_RESTART to perform a reset not including the registers, If performed when link is already present,
it will drop the link and trigger re-auto negotiation.
--- drivers/net/phy/dp83867.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/phy/dp83867.c +1 -5
@@ -468,16 +468,12 @@ static int dp83867_phy_reset(struct phy_device *phydev) {int err; - err =phy_write (phydev,DP83867_CTRL ,DP83867_SW_RESET ); + err =phy_write (phydev,DP83867_CTRL ,DP83867_SW_RESTART );if (err <0 )return err;usleep_range (10 ,20 ); -/* After reset FORCE_LINK_GOOD bit is set. Although the -* default value should be unset. Disable FORCE_LINK_GOOD -* for the phy to work properly. -*/ return phy_modify (phydev,MII_DP83867_PHYCTRL ,DP83867_PHYCR_FORCE_LINK_GOOD ,0 ); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 27/71 net: caif: fix memory leak in ldisc_open
In reply to Sasha LevinFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 58af3d3d54e87bfc1f936e16c04ade3369d34011 ]
Syzbot reported memory leak in tty_init_dev().
The problem was in unputted tty in ldisc_open()
static int ldisc_open(struct tty_struct *tty)
{
...
ser->tty = tty_kref_get(tty);
...
result = register_netdevice(dev);
if (result) {
rtnl_unlock();
free_netdev(dev);
return -ENODEV;
}...
}
Ser pointer is netdev private_data, so after free_netdev() this pointer goes away with unputted tty reference. So, fix it by adding tty_kref_put() before freeing netdev.
--- drivers/net/caif/caif_serial.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/caif/caif_serial.c +1 -0
@@ -351,6 +351,7 @@ static int ldisc_open(struct tty_struct *tty)rtnl_lock (); result =register_netdevice (dev);if (result) { +tty_kref_put (tty);rtnl_unlock ();free_netdev (dev);return -ENODEV ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 28/71 net/packet: annotate accesses to po->bind
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit c7d2ef5dd4b03ed0ee1d13bc0c55f9cf62d49bd6 ]
tpacket_snd(), packet_snd(), packet_getname() and packet_seq_show() can read po->num without holding a lock. This means other threads can change po->num at the same time.
KCSAN complained about this known fact [1] Add READ_ONCE()/WRITE_ONCE() to address the issue.
[1] BUG: KCSAN: data-race in packet_do_bind / packet_sendmsg
write to 0xffff888131a0dcc0 of 2 bytes by task 24714 on cpu 0:
packet_do_bind+0x3ab/0x7e0 net/packet/af_packet.c:3181 packet_bind+0xc3/0xd0 net/packet/af_packet.c:3255 __sys_bind+0x200/0x290 net/socket.c:1637 __do_sys_bind net/socket.c:1648 [inline] __se_sys_bind net/socket.c:1646 [inline] __x64_sys_bind+0x3d/0x50 net/socket.c:1646 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffff888131a0dcc0 of 2 bytes by task 24719 on cpu 1:
packet_snd net/packet/af_packet.c:2899 [inline] packet_sendmsg+0x317/0x3570 net/packet/af_packet.c:3040 sock_sendmsg_nosec net/socket.c:654 [inline] sock_sendmsg net/socket.c:674 [inline] ____sys_sendmsg+0x360/0x4d0 net/socket.c:2350 ___sys_sendmsg net/socket.c:2404 [inline] __sys_sendmsg+0x1ed/0x270 net/socket.c:2433 __do_sys_sendmsg net/socket.c:2442 [inline] __se_sys_sendmsg net/socket.c:2440 [inline] __x64_sys_sendmsg+0x42/0x50 net/socket.c:2440 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
value changed: 0x0000 -> 0x1200
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 24719 Comm: syz-executor.5 Not tainted 5.13.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/packet/af_packet.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
net/packet/af_packet.c +8 -8
@@ -2656,7 +2656,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) }if (likely (saddr ==NULL )) { dev =packet_cached_dev_get (po); - proto = po->num; + proto =READ_ONCE (po->num); }else { err = -EINVAL ;if (msg->msg_namelen <sizeof (struct sockaddr_ll ))
@@ -2869,7 +2869,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)if (likely (saddr ==NULL )) { dev =packet_cached_dev_get (po); - proto = po->num; + proto =READ_ONCE (po->num); }else { err = -EINVAL ;if (msg->msg_namelen <sizeof (struct sockaddr_ll ))
@@ -3141,7 +3141,7 @@ static int packet_do_bind(struct sock *sk, const char *name, int ifindex,/* prevents packet_notifier() from calling * register_prot_hook() */ - po->num =0 ; +WRITE_ONCE (po->num,0 );__unregister_prot_hook (sk, true);rcu_read_lock (); dev_curr = po->prot_hook.dev;
@@ -3151,7 +3151,7 @@ static int packet_do_bind(struct sock *sk, const char *name, int ifindex, }BUG_ON (po->running); - po->num = proto; +WRITE_ONCE (po->num, proto); po->prot_hook.type = proto;if (unlikely (unlisted)) {
@@ -3496,7 +3496,7 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr, sll->sll_family =AF_PACKET ; sll->sll_ifindex = po->ifindex; - sll->sll_protocol = po->num; + sll->sll_protocol =READ_ONCE (po->num); sll->sll_pkttype =0 ;rcu_read_lock (); dev =dev_get_by_index_rcu (sock_net (sk), po->ifindex);
@@ -4405,7 +4405,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, was_running = po->running; num = po->num;if (was_running) { - po->num =0 ; +WRITE_ONCE (po->num,0 );__unregister_prot_hook (sk, false); }spin_unlock (&po->bind_lock);
@@ -4440,7 +4440,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,spin_lock (&po->bind_lock);if (was_running) { - po->num = num; +WRITE_ONCE (po->num, num);register_prot_hook (sk); }spin_unlock (&po->bind_lock);
@@ -4613,7 +4613,7 @@ static int packet_seq_show(struct seq_file *seq, void *v) s,refcount_read (&s->sk_refcnt), s->sk_type, -ntohs (po->num), +ntohs (READ_ONCE (po->num)), po->ifindex, po->running, atomic_read(&s->sk_rmem_alloc),
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 29/71 net/packet: annotate accesses to po->ifindex
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit e032f7c9c7cefffcfb79b9fc16c53011d2d9d11f ]
Like prior patch, we need to annotate lockless accesses to po->ifindex For instance, packet_getname() is reading po->ifindex (twice) while another thread is able to change po->ifindex.
KCSAN reported:
BUG: KCSAN: data-race in packet_do_bind / packet_getname
write to 0xffff888143ce3cbc of 4 bytes by task 25573 on cpu 1:
packet_do_bind+0x420/0x7e0 net/packet/af_packet.c:3191 packet_bind+0xc3/0xd0 net/packet/af_packet.c:3255 __sys_bind+0x200/0x290 net/socket.c:1637 __do_sys_bind net/socket.c:1648 [inline] __se_sys_bind net/socket.c:1646 [inline] __x64_sys_bind+0x3d/0x50 net/socket.c:1646 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffff888143ce3cbc of 4 bytes by task 25578 on cpu 0:
packet_getname+0x5b/0x1a0 net/packet/af_packet.c:3525 __sys_getsockname+0x10e/0x1a0 net/socket.c:1887 __do_sys_getsockname net/socket.c:1902 [inline] __se_sys_getsockname net/socket.c:1899 [inline] __x64_sys_getsockname+0x3e/0x50 net/socket.c:1899 do_syscall_64+0x4a/0x90 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae
value changed: 0x00000000 -> 0x00000001
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 25578 Comm: syz-executor.5 Not tainted 5.13.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/packet/af_packet.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
net/packet/af_packet.c +9 -7
@@ -3157,11 +3157,11 @@ static int packet_do_bind(struct sock *sk, const char *name, int ifindex,if (unlikely (unlisted)) {dev_put (dev); po->prot_hook.dev =NULL ; - po->ifindex =-1 ; +WRITE_ONCE (po->ifindex,-1 );packet_cached_dev_reset (po); }else { po->prot_hook.dev = dev; - po->ifindex = dev ? dev->ifindex :0 ; +WRITE_ONCE (po->ifindex, dev ? dev->ifindex :0 );packet_cached_dev_assign (po, dev); } }
@@ -3475,7 +3475,7 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, uaddr->sa_family =AF_PACKET ;memset (uaddr->sa_data,0 ,sizeof (uaddr->sa_data));rcu_read_lock (); - dev =dev_get_by_index_rcu (sock_net (sk),pkt_sk (sk)->ifindex); + dev =dev_get_by_index_rcu (sock_net (sk),READ_ONCE (pkt_sk (sk)->ifindex));if (dev)strlcpy (uaddr->sa_data, dev->name,sizeof (uaddr->sa_data));rcu_read_unlock ();
@@ -3490,16 +3490,18 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr,struct sock *sk = sock->sk;struct packet_sock *po =pkt_sk (sk); DECLARE_SOCKADDR(struct sockaddr_ll *, sll, uaddr); +int ifindex;if (peer)return -EOPNOTSUPP ; + ifindex =READ_ONCE (po->ifindex); sll->sll_family =AF_PACKET ; - sll->sll_ifindex = po->ifindex; + sll->sll_ifindex = ifindex; sll->sll_protocol =READ_ONCE (po->num); sll->sll_pkttype =0 ;rcu_read_lock (); - dev =dev_get_by_index_rcu (sock_net (sk), po->ifindex); + dev =dev_get_by_index_rcu (sock_net (sk), ifindex);if (dev) { sll->sll_hatype = dev->type; sll->sll_halen = dev->addr_len;
@@ -4099,7 +4101,7 @@ static int packet_notifier(struct notifier_block *this, }if (msg ==NETDEV_UNREGISTER ) {packet_cached_dev_reset (po); - po->ifindex =-1 ; +WRITE_ONCE (po->ifindex,-1 );if (po->prot_hook.dev)dev_put (po->prot_hook.dev); po->prot_hook.dev =NULL ;
@@ -4614,7 +4616,7 @@ static int packet_seq_show(struct seq_file *seq, void *v)refcount_read (&s->sk_refcnt), s->sk_type,ntohs (READ_ONCE (po->num)), - po->ifindex, +READ_ONCE (po->ifindex), po->running,atomic_read (&s->sk_rmem_alloc), from_kuid_munged(seq_user_ns(seq), sock_i_uid(s)),
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 30/71 r8152: Avoid memcpy() over-reading of ETH_SS_STATS
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 99718abdc00e86e4f286dd836408e2834886c16e ]
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally reading across neighboring array fields.
The memcpy() is copying the entire structure, not just the first array. Adjust the source argument so the compiler can do appropriate bounds checking.
--- drivers/net/usb/r8152.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/r8152.c +1 -1
@@ -5065,7 +5065,7 @@ static void rtl8152_get_strings(struct net_device *dev, u32 stringset, u8 *data) {switch (stringset) {case ETH_SS_STATS : -memcpy (data, *rtl8152_gstrings,sizeof (rtl8152_gstrings)); +memcpy (data, rtl8152_gstrings,sizeof (rtl8152_gstrings));break ; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 31/71 sh_eth: Avoid memcpy() over-reading of ETH_SS_STATS
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 224004fbb033600715dbd626bceec10bfd9c58bc ]
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally reading across neighboring array fields.
The memcpy() is copying the entire structure, not just the first array. Adjust the source argument so the compiler can do appropriate bounds checking.
--- drivers/net/ethernet/renesas/sh_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/renesas/sh_eth.c +1 -1
@@ -2322,7 +2322,7 @@ static void sh_eth_get_strings(struct net_device *ndev, u32 stringset, u8 *data) {switch (stringset) {case ETH_SS_STATS : -memcpy (data, *sh_eth_gstrings_stats, +memcpy (data, sh_eth_gstrings_stats,sizeof (sh_eth_gstrings_stats));break ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 32/71 r8169: Avoid memcpy() over-reading of ETH_SS_STATS
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit da5ac772cfe2a03058b0accfac03fad60c46c24d ]
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally reading across neighboring array fields.
The memcpy() is copying the entire structure, not just the first array. Adjust the source argument so the compiler can do appropriate bounds checking.
--- drivers/net/ethernet/realtek/r8169_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169_main.c +1 -1
@@ -1801,7 +1801,7 @@ static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data) {switch (stringset) {case ETH_SS_STATS : -memcpy (data, *rtl8169_gstrings,sizeof (rtl8169_gstrings)); +memcpy (data, rtl8169_gstrings,sizeof (rtl8169_gstrings));break ; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 33/71 KVM: selftests: Fix kvm_check_cap() assertion
In reply to Sasha LevinFrom: Fuad Tabba <[email protected]>
[ Upstream commit d8ac05ea13d789d5491a5920d70a05659015441d ]
KVM_CHECK_EXTENSION ioctl can return any negative value on error, and not necessarily -1. Change the assertion to reflect that.
Message-Id: <[email protected]>
--- tools/testing/selftests/kvm/lib/kvm_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kvm/lib/kvm_util.c +1 -1
@@ -54,7 +54,7 @@ int kvm_check_cap(long cap)exit (KSFT_SKIP ); ret =ioctl (kvm_fd,KVM_CHECK_EXTENSION , cap); -TEST_ASSERT (ret !=-1 ,"KVM_CHECK_EXTENSION IOCTL failed,\n" +TEST_ASSERT (ret >=0 ,"KVM_CHECK_EXTENSION IOCTL failed,\n" " rc: %i errno: %i" , ret, errno);close (kvm_fd);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 34/71 net: qed: Fix memcpy() overflow of qed_dcbx_params()
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 1c200f832e14420fa770193f9871f4ce2df00d07 ]
The source (&dcbx_info->operational.params) and dest (&p_hwfn->p_dcbx_info->set.config.params) are both struct qed_dcbx_params (560 bytes), not struct qed_dcbx_admin_params (564 bytes), which is used as the memcpy() size.
However it seems that struct qed_dcbx_operational_params (dcbx_info->operational)'s layout matches struct qed_dcbx_admin_params (p_hwfn->p_dcbx_info->set.config)'s 4 byte difference (3 padding, 1 byte for "valid").
On the assumption that the size is wrong (rather than the source structure type), adjust the memcpy() size argument to be 4 bytes smaller and add a BUILD_BUG_ON() to validate any changes to the structure sizes.
--- drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qed/qed_dcbx.c +3 -1
@@ -1293,9 +1293,11 @@ int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn, p_hwfn->p_dcbx_info->set.ver_num |=DCBX_CONFIG_VERSION_STATIC ; p_hwfn->p_dcbx_info->set.enabled = dcbx_info->operational.enabled; +BUILD_BUG_ON (sizeof (dcbx_info->operational.params) != +sizeof (p_hwfn->p_dcbx_info->set.config.params));memcpy (&p_hwfn->p_dcbx_info->set.config.params, &dcbx_info->operational.params, -sizeof (struct qed_dcbx_admin_params )); +sizeof (p_hwfn->p_dcbx_info->set.config.params)); p_hwfn->p_dcbx_info->set.config.valid = true;memcpy (params, &p_hwfn->p_dcbx_info->set,sizeof (struct qed_dcbx_set ));
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 35/71 recordmcount: Correct st_shndx handling
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit fb780761e7bd9f2e94f5b9a296ead6b35b944206 ]
One should only use st_shndx when >SHN_UNDEF and <SHN_LORESERVE. When SHN_XINDEX, then use .symtab_shndx. Otherwise use 0.
This handles the case: st_shndx >= SHN_LORESERVE && st_shndx != SHN_XINDEX.
--- scripts/recordmcount.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
scripts/recordmcount.h +10 -5
@@ -192,15 +192,20 @@ static unsigned int get_symindex(Elf_Sym const *sym, Elf32_Word const *symtab, Elf32_Word const *symtab_shndx) {unsigned long offset; +unsigned short shndx =w2 (sym->st_shndx);int index; -if (sym->st_shndx !=SHN_XINDEX ) -return w2 (sym->st_shndx); +if (shndx >SHN_UNDEF && shndx <SHN_LORESERVE ) +return shndx; - offset = (unsigned long )sym - (unsigned long )symtab; - index = offset /sizeof (*sym); +if (shndx ==SHN_XINDEX ) { + offset = (unsigned long )sym - (unsigned long )symtab; + index = offset /sizeof (*sym); -return w (symtab_shndx[index]); +return w (symtab_shndx[index]); + } + +return 0 ; }static unsigned int get_shnum (Elf_Ehdr const *ehdr,Elf_Shdr const *shdr0)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 36/71 PCI: Add AMD RS690 quirk to enable 64-bit DMA
In reply to Sasha LevinFrom: Mikel Rychliski <[email protected]>
[ Upstream commit cacf994a91d3a55c0c2f853d6429cd7b86113915 ]
Although the AMD RS690 chipset has 64-bit DMA support, BIOS implementations sometimes fail to configure the memory limit registers correctly.
The Acer F690GVM mainboard uses this chipset and a Marvell 88E8056 NIC. The sky2 driver programs the NIC to use 64-bit DMA, which will not work:
sky2 0000:02:00.0: error interrupt status=0x8
sky2 0000:02:00.0 eth0: tx timeout
sky2 0000:02:00.0 eth0: transmit ring 0 .. 22 report=0 done=0
Other drivers required by this mainboard either don't support 64-bit DMA, or have it disabled using driver specific quirks. For example, the ahci driver has quirks to enable or disable 64-bit DMA depending on the BIOS version (see ahci_sb600_enable_64bit() in ahci.c). This ahci quirk matches against the SB600 SATA controller, but the real issue is almost certainly with the RS690 PCI host that it was commonly attached to.
To avoid this issue in all drivers with 64-bit DMA support, fix the configuration of the PCI host. If the kernel is aware of physical memory above 4GB, but the BIOS never configured the PCI host with this information, update the registers with our values.
--- arch/x86/pci/fixup.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
arch/x86/pci/fixup.c +44 -0
@@ -779,4 +779,48 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1571, pci_amd_enable_64bit_bar);DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_AMD ,0x15b1 , pci_amd_enable_64bit_bar);DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_AMD ,0x1601 , pci_amd_enable_64bit_bar); +#define RS690_LOWER_TOP_OF_DRAM2 0x30 +#define RS690_LOWER_TOP_OF_DRAM2_VALID 0x1 +#define RS690_UPPER_TOP_OF_DRAM2 0x31 +#define RS690_HTIU_NB_INDEX 0xA8 +#define RS690_HTIU_NB_INDEX_WR_ENABLE 0x100 +#define RS690_HTIU_NB_DATA 0xAC + +/* +* Some BIOS implementations support RAM above 4GB, but do not configure the +* PCI host to respond to bus master accesses for these addresses. These +* implementations set the TOP_OF_DRAM_SLOT1 register correctly, so PCI DMA +* works as expected for addresses below 4GB. +* +* Reference: "AMD RS690 ASIC Family Register Reference Guide" (pg. 2-57) +* https://www.amd.com/system/files/TechDocs/43372_rs690_rrg_3.00o.pdf +*/ +static void rs690_fix_64bit_dma (struct pci_dev *pdev) +{ +u32 val =0 ; +phys_addr_t top_of_dram =__pa (high_memory -1 ) +1 ; + +if (top_of_dram <= (1ULL <<32 )) +return ; + +pci_write_config_dword (pdev,RS690_HTIU_NB_INDEX , +RS690_LOWER_TOP_OF_DRAM2 ); +pci_read_config_dword (pdev,RS690_HTIU_NB_DATA , &val); + +if (val) +return ; + +pci_info (pdev,"Adjusting top of DRAM to %pa for 64-bit DMA support\n" , &top_of_dram); + +pci_write_config_dword (pdev,RS690_HTIU_NB_INDEX , +RS690_UPPER_TOP_OF_DRAM2 |RS690_HTIU_NB_INDEX_WR_ENABLE ); +pci_write_config_dword (pdev,RS690_HTIU_NB_DATA , top_of_dram >>32 ); + +pci_write_config_dword (pdev,RS690_HTIU_NB_INDEX , +RS690_LOWER_TOP_OF_DRAM2 |RS690_HTIU_NB_INDEX_WR_ENABLE ); +pci_write_config_dword (pdev,RS690_HTIU_NB_DATA , + top_of_dram |RS690_LOWER_TOP_OF_DRAM2_VALID ); +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x7910 , rs690_fix_64bit_dma); +#endif
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 37/71 net: ll_temac: Add memory-barriers for TX BD access
In reply to Sasha LevinFrom: Esben Haabendal <[email protected]>
[ Upstream commit 28d9fab458b16bcd83f9dd07ede3d585c3e1a69e ]
Add a couple of memory-barriers to ensure correct ordering of read/write access to TX BDs.
In xmit_done, we should ensure that reading the additional BD fields are only done after STS_CTRL_APP0_CMPLT bit is set.
When xmit_done marks the BD as free by setting APP0=0, we need to ensure that the other BD fields are reset first, so we avoid racing with the xmit path, which writes to the same fields.
Finally, making sure to read APP0 of next BD after the current BD, ensures that we see all available buffers.
--- drivers/net/ethernet/xilinx/ll_temac_main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/ethernet/xilinx/ll_temac_main.c +13 -1
@@ -770,12 +770,15 @@ static void temac_start_xmit_done(struct net_device *ndev) stat =be32_to_cpu (cur_p->app0);while (stat &STS_CTRL_APP0_CMPLT ) { +/* Make sure that the other fields are read after bd is +* released by dma +*/ +rmb ();dma_unmap_single (ndev->dev.parent,be32_to_cpu (cur_p->phys),be32_to_cpu (cur_p->len),DMA_TO_DEVICE ); skb = (struct sk_buff *)ptr_from_txbd (cur_p);if (skb)dev_consume_skb_irq (skb); - cur_p->app0 =0 ; cur_p->app1 =0 ; cur_p->app2 =0 ; cur_p->app3 =0 ;
@@ -784,6 +787,12 @@ static void temac_start_xmit_done(struct net_device *ndev) ndev->stats.tx_packets++; ndev->stats.tx_bytes +=be32_to_cpu (cur_p->len); +/* app0 must be visible last, as it is used to flag +* availability of the bd +*/ +smp_mb (); + cur_p->app0 =0 ; + lp->tx_bd_ci++;if (lp->tx_bd_ci >=TX_BD_NUM ) lp->tx_bd_ci =0 ;
@@ -810,6 +819,9 @@ static inline int temac_check_tx_bd_space(struct temac_local *lp, int num_frag)if (cur_p->app0)return NETDEV_TX_BUSY ; +/* Make sure to read next bd app0 after this one */ +rmb (); + tail++;if (tail >=TX_BD_NUM ) tail =0 ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 38/71 net: ll_temac: Avoid ndo_start_xmit returning NETDEV_TX_BUSY
In reply to Sasha LevinFrom: Esben Haabendal <[email protected]>
[ Upstream commit f6396341194234e9b01cd7538bc2c6ac4501ab14 ]
As documented in Documentation/networking/driver.rst, the ndo_start_xmit method must not return NETDEV_TX_BUSY under any normal circumstances, and as recommended, we simply stop the tx queue in advance, when there is a risk that the next xmit would cause a NETDEV_TX_BUSY return.
--- drivers/net/ethernet/xilinx/ll_temac_main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/xilinx/ll_temac_main.c +5 -0
@@ -939,6 +939,11 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)wmb (); lp->dma_out (lp,TX_TAILDESC_PTR , tail_p);/* DMA start */ +if (temac_check_tx_bd_space (lp,MAX_SKB_FRAGS +1 )) { +netdev_info (ndev,"%s -> netif_stop_queue\n" , __func__); +netif_stop_queue (ndev); + } +return NETDEV_TX_OK ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 39/71 pinctrl: stm32: fix the reported number of GPIO lines per bank
In reply to Sasha LevinFrom: Fabien Dessenne <[email protected]>
[ Upstream commit 67e2996f72c71ebe4ac2fcbcf77e54479bb7aa11 ]
Each GPIO bank supports a variable number of lines which is usually 16, but is less in some cases : this is specified by the last argument of the "gpio-ranges" bank node property.
Report to the framework, the actual number of lines, so the libgpiod gpioinfo command lists the actually existing GPIO lines.
--- drivers/pinctrl/stm32/pinctrl-stm32.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pinctrl/stm32/pinctrl-stm32.c +7 -2
@@ -1153,7 +1153,7 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,struct resource res;struct reset_control *rstc;int npins =STM32_GPIO_PINS_PER_BANK ; -int bank_nr, err; +int bank_nr, err, i =0 ; rstc =of_reset_control_get_exclusive (np,NULL );if (!IS_ERR (rstc))
@@ -1182,9 +1182,14 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,of_property_read_string (np,"st,bank-name" , &bank->gpio_chip.label); -if (!of_parse_phandle_with_fixed_args (np,"gpio-ranges" ,3 ,0 , &args)) { +if (!of_parse_phandle_with_fixed_args (np,"gpio-ranges" ,3 , i, &args)) { bank_nr = args.args[1 ] /STM32_GPIO_PINS_PER_BANK ; bank->gpio_chip.base = args.args[1 ]; + + npins = args.args[2 ]; +while (!of_parse_phandle_with_fixed_args (np,"gpio-ranges" ,3 , + ++i, &args)) + npins += args.args[2 ]; }else { bank_nr = pctl->nbanks; bank->gpio_chip.base = bank_nr *STM32_GPIO_PINS_PER_BANK ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 40/71 nilfs2: fix memory leak in nilfs_sysfs_delete_device_group
In reply to Sasha LevinFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 8fd0c1b0647a6bda4067ee0cd61e8395954b6f28 ]
My local syzbot instance hit memory leak in nilfs2. The problem was in missing kobject_put() in nilfs_sysfs_delete_device_group().
kobject_del() does not call kobject_cleanup() for passed kobject and it leads to leaking duped kobject name if kobject_put() was not called.
Fail log:
BUG: memory leak
unreferenced object 0xffff8880596171e0 (size 8):
comm "syz-executor379", pid 8381, jiffies 4294980258 (age 21.100s)
hex dump (first 8 bytes):
6c 6f 6f 70 30 00 00 00 loop0...
backtrace:
kstrdup+0x36/0x70 mm/util.c:60
kstrdup_const+0x53/0x80 mm/util.c:83
kvasprintf_const+0x108/0x190 lib/kasprintf.c:48
kobject_set_name_vargs+0x56/0x150 lib/kobject.c:289
kobject_add_varg lib/kobject.c:384 [inline]
kobject_init_and_add+0xc9/0x160 lib/kobject.c:473
nilfs_sysfs_create_device_group+0x150/0x800 fs/nilfs2/sysfs.c:999
init_nilfs+0xe26/0x12b0 fs/nilfs2/the_nilfs.c:637--- fs/nilfs2/sysfs.c | 1 + 1 file changed, 1 insertion(+)
fs/nilfs2/sysfs.c +1 -0
@@ -1054,6 +1054,7 @@ void nilfs_sysfs_delete_device_group(struct the_nilfs *nilfs)nilfs_sysfs_delete_superblock_group (nilfs);nilfs_sysfs_delete_segctor_group (nilfs);kobject_del (&nilfs->ns_dev_kobj); +kobject_put (&nilfs->ns_dev_kobj);kfree (nilfs->ns_dev_subgroups); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 41/71 KVM: do not allow mapping valid but non-reference-counted pages
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
commit f8be156be163a052a067306417cd0ff679068c97 upstream.
It's possible to create a region which maps valid but non-refcounted pages (e.g., tail pages of non-compound higher order allocations). These host pages can then be returned by gfn_to_page, gfn_to_pfn, etc., family of APIs, which take a reference to the page, which takes it from 0 to 1. When the reference is dropped, this will free the page incorrectly.
Fix this by only taking a reference on valid pages if it was non-zero, which indicates it is participating in normal refcounting (and can be released with put_page).
This addresses CVE-2021-22543.
--- virt/kvm/kvm_main.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
virt/kvm/kvm_main.c +17 -2
@@ -1593,6 +1593,13 @@ static bool vma_is_valid(struct vm_area_struct *vma, bool write_fault)return true; } +static int kvm_try_get_pfn (kvm_pfn_t pfn) +{ +if (kvm_is_reserved_pfn (pfn)) +return 1 ; +return get_page_unless_zero (pfn_to_page (pfn)); +} + static int hva_to_pfn_remapped(struct vm_area_struct *vma, unsigned long addr, bool *async, bool write_fault, bool *writable,
@@ -1642,13 +1649,21 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma,* Whoever called remap_pfn_range is also going to call e.g. * unmap_mapping_range before the underlying pages are freed, * causing a call to our MMU notifier. +* +* Certain IO or PFNMAP mappings can be backed with valid +* struct pages, but be allocated without refcounting e.g., +* tail pages of non-compound higher order allocations, which +* would then underflow the refcount when the caller does the +* required put_page. Don't allow those pages here. */ -kvm_get_pfn (pfn); +if (!kvm_try_get_pfn (pfn)) + r = -EFAULT ; out:pte_unmap_unlock (ptep, ptl); *p_pfn = pfn; -return 0 ; + +return r; }/*
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 42/71 i2c: robotfuzz-osif: fix control-request directions
In reply to Sasha LevinFrom: Johan Hovold <[email protected]>
commit 4ca070ef0dd885616ef294d269a9bf8e3b258e1a upstream.
The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation.
Control transfers without a data stage are treated as OUT requests by the USB stack and should be using usb_sndctrlpipe(). Failing to do so will now trigger a warning.
Fix the OSIFI2C_SET_BIT_RATE and OSIFI2C_STOP requests which erroneously used the osif_usb_read() helper and set the IN direction bit.
--- drivers/i2c/busses/i2c-robotfuzz-osif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-robotfuzz-osif.c +2 -2
@@ -83,7 +83,7 @@ static int osif_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, } } - ret =osif_usb_read (adapter,OSIFI2C_STOP ,0 ,0 ,NULL ,0 ); + ret =osif_usb_write (adapter,OSIFI2C_STOP ,0 ,0 ,NULL ,0 );if (ret) {dev_err (&adapter->dev,"failure sending STOP\n" );return -EREMOTEIO ;
@@ -153,7 +153,7 @@ static int osif_probe(struct usb_interface *interface,* Set bus frequency. The frequency is: * 120,000,000 / ( 16 + 2 * div * 4^prescale). * Using dev = 52, prescale = 0 give 100KHz */ - ret =osif_usb_read (&priv->adapter,OSIFI2C_SET_BIT_RATE ,52 ,0 , + ret =osif_usb_write (&priv->adapter,OSIFI2C_SET_BIT_RATE ,52 ,0 ,NULL ,0 );if (ret) {dev_err (&interface->dev,"failure sending bit rate" );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 43/71 kthread_worker: split code for canceling the delayed work timer
In reply to Sasha LevinFrom: Petr Mladek <[email protected]>
commit 34b3d5344719d14fd2185b2d9459b3abcb8cf9d8 upstream.
Patch series "kthread_worker: Fix race between kthread_mod_delayed_work() and kthread_cancel_delayed_work_sync()".
This patchset fixes the race between kthread_mod_delayed_work() and kthread_cancel_delayed_work_sync() including proper return value handling.
This patch (of 2):
Simple code refactoring as a preparation step for fixing a race between kthread_mod_delayed_work() and kthread_cancel_delayed_work_sync().
It does not modify the existing behavior.
--- kernel/kthread.c | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-)
kernel/kthread.c +29 -17
@@ -1019,6 +1019,33 @@ void kthread_flush_work(struct kthread_work *work) }EXPORT_SYMBOL_GPL (kthread_flush_work); +/* +* Make sure that the timer is neither set nor running and could +* not manipulate the work list_head any longer. +* +* The function is called under worker->lock. The lock is temporary +* released but the timer can't be set again in the meantime. +*/ +static void kthread_cancel_delayed_work_timer (struct kthread_work *work, +unsigned long *flags) +{ +struct kthread_delayed_work *dwork = + container_of(work, struct kthread_delayed_work, work); +struct kthread_worker *worker = work->worker; + +/* +* del_timer_sync() must be called to make sure that the timer +* callback is not running. The lock must be temporary released +* to avoid a deadlock with the callback. In the meantime, +* any queuing is blocked by setting the canceling counter. +*/ + work->canceling++; +raw_spin_unlock_irqrestore (&worker->lock, *flags); +del_timer_sync (&dwork->timer); +raw_spin_lock_irqsave (&worker->lock, *flags); + work->canceling--; +} +/* * This function removes the work from the worker queue. Also it makes sure * that it won't get queued later via the delayed work's timer.
@@ -1033,23 +1060,8 @@ static bool __kthread_cancel_work(struct kthread_work *work, bool is_dwork, unsigned long *flags) {/* Try to cancel the timer if exists. */ -if (is_dwork) { -struct kthread_delayed_work *dwork = - container_of(work, struct kthread_delayed_work, work); -struct kthread_worker *worker = work->worker; - -/* -* del_timer_sync() must be called to make sure that the timer -* callback is not running. The lock must be temporary released -* to avoid a deadlock with the callback. In the meantime, -* any queuing is blocked by setting the canceling counter. -*/ - work->canceling++; -raw_spin_unlock_irqrestore (&worker->lock, *flags); -del_timer_sync (&dwork->timer); -raw_spin_lock_irqsave (&worker->lock, *flags); - work->canceling--; - } +if (is_dwork) +kthread_cancel_delayed_work_timer (work, flags);/* * Try to remove the work from a worker list. It might either
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 44/71 kthread: prevent deadlock when kthread_mod_delayed_work() races with kthread_cancel_delayed_work_sync()
In reply to Sasha LevinFrom: Petr Mladek <[email protected]>
commit 5fa54346caf67b4b1b10b1f390316ae466da4d53 upstream.
The system might hang with the following backtrace:
schedule+0x80/0x100 schedule_timeout+0x48/0x138 wait_for_common+0xa4/0x134 wait_for_completion+0x1c/0x2c kthread_flush_work+0x114/0x1cc kthread_cancel_work_sync.llvm.16514401384283632983+0xe8/0x144 kthread_cancel_delayed_work_sync+0x18/0x2c xxxx_pm_notify+0xb0/0xd8 blocking_notifier_call_chain_robust+0x80/0x194 pm_notifier_call_chain_robust+0x28/0x4c suspend_prepare+0x40/0x260 enter_state+0x80/0x3f4 pm_suspend+0x60/0xdc state_store+0x108/0x144 kobj_attr_store+0x38/0x88 sysfs_kf_write+0x64/0xc0 kernfs_fop_write_iter+0x108/0x1d0 vfs_write+0x2f4/0x368 ksys_write+0x7c/0xec
It is caused by the following race between kthread_mod_delayed_work() and kthread_cancel_delayed_work_sync():
CPU0 CPU1
Context: Thread A Context: Thread B
kthread_mod_delayed_work()
spin_lock()
__kthread_cancel_work()
spin_unlock()
del_timer_sync()
kthread_cancel_delayed_work_sync()
spin_lock()
__kthread_cancel_work()
spin_unlock()
del_timer_sync()
spin_lock()
work->canceling++
spin_unlock
spin_lock()
queue_delayed_work()
// dwork is put into the worker->delayed_work_list spin_unlock()
kthread_flush_work()
// flush_work is put at the tail of the dwork
wait_for_completion()Context: IRQ
kthread_delayed_work_timer_fn()
spin_lock()
list_del_init(&work->node);
spin_unlock()BANG: flush_work is not longer linked and will never get proceed.
The problem is that kthread_mod_delayed_work() checks work->canceling flag before canceling the timer.
A simple solution is to (re)check work->canceling after __kthread_cancel_work(). But then it is not clear what should be returned when __kthread_cancel_work() removed the work from the queue (list) and it can't queue it again with the new @delay.
The return value might be used for reference counting. The caller has to know whether a new work has been queued or an existing one was replaced.
The proper solution is that kthread_mod_delayed_work() will remove the work from the queue (list) _only_ when work->canceling is not set. The flag must be checked after the timer is stopped and the remaining operations can be done under worker->lock.
Note that kthread_mod_delayed_work() could remove the timer and then bail out. It is fine. The other canceling caller needs to cancel the timer as well. The important thing is that the queue (list) manipulation is done atomically under worker->lock.
--- kernel/kthread.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-)
kernel/kthread.c +24 -11
@@ -1047,8 +1047,11 @@ static void kthread_cancel_delayed_work_timer(struct kthread_work *work, }/* -* This function removes the work from the worker queue. Also it makes sure -* that it won't get queued later via the delayed work's timer. +* This function removes the work from the worker queue. +* +* It is called under worker->lock. The caller must make sure that +* the timer used by delayed work is not running, e.g. by calling +* kthread_cancel_delayed_work_timer(). * * The work might still be in use when this function finishes. See the * current_work proceed by the worker.
@@ -1056,13 +1059,8 @@ static void kthread_cancel_delayed_work_timer(struct kthread_work *work,* Return: %true if @work was pending and successfully canceled, * %false if @work was not pending */ -static bool __kthread_cancel_work (struct kthread_work *work,bool is_dwork, -unsigned long *flags) +static bool __kthread_cancel_work (struct kthread_work *work) { -/* Try to cancel the timer if exists. */ -if (is_dwork) -kthread_cancel_delayed_work_timer (work, flags); -/* * Try to remove the work from a worker list. It might either * be from worker->work_list or from worker->delayed_work_list.
@@ -1115,11 +1113,23 @@ bool kthread_mod_delayed_work(struct kthread_worker *worker,/* Work must not be used with >1 worker, see kthread_queue_work() */ WARN_ON_ONCE (work->worker != worker); -/* Do not fight with another command that is canceling this work. */ +/* +* Temporary cancel the work but do not fight with another command +* that is canceling the work as well. +* +* It is a bit tricky because of possible races with another +* mod_delayed_work() and cancel_delayed_work() callers. +* +* The timer must be canceled first because worker->lock is released +* when doing so. But the work can be removed from the queue (list) +* only when it can be queued again so that the return value can +* be used for reference counting. +*/ +kthread_cancel_delayed_work_timer (work, &flags);if (work->canceling) goto out; + ret =__kthread_cancel_work (work); - ret =__kthread_cancel_work (work, true, &flags); fast_queue:__kthread_queue_delayed_work (worker, dwork, delay); out:
@@ -1141,7 +1151,10 @@ static bool __kthread_cancel_work_sync(struct kthread_work *work, bool is_dwork)/* Work must not be used with >1 worker, see kthread_queue_work(). */ WARN_ON_ONCE (work->worker != worker); - ret =__kthread_cancel_work (work, is_dwork, &flags); +if (is_dwork) +kthread_cancel_delayed_work_timer (work, &flags); + + ret =__kthread_cancel_work (work);if (worker->current_work != work) goto out_fast;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 45/71 mm: add VM_WARN_ON_ONCE_PAGE() macro
In reply to Sasha LevinFrom: Alex Shi <[email protected]>
[ Upstream commit a4055888629bc0467d12d912cd7c90acdf3d9b12 part ]
Add VM_WARN_ON_ONCE_PAGE() macro.
Note on stable backport: original commit was titled mm/memcg: warning on !memcg after readahead page charged which included uses of this macro in mm/memcontrol.c: here omitted.
--- include/linux/mmdebug.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
include/linux/mmdebug.h +13 -0
@@ -37,6 +37,18 @@ void dump_mm(const struct mm_struct *mm);BUG (); \ } \ } while (0) +#define VM_WARN_ON_ONCE_PAGE (cond, page) ({ \ + static bool __section(".data.once") __warned; \ + int __ret_warn_once = !!(cond); \ + \ + if (unlikely(__ret_warn_once && !__warned)) { \ + dump_page(page, "VM_WARN_ON_ONCE_PAGE(" __stringify(cond)")");\ + __warned = true; \ + WARN_ON(1); \ + } \ + unlikely(__ret_warn_once); \ +}) +#define VM_WARN_ON (cond) (void)WARN_ON(cond)#define VM_WARN_ON_ONCE (cond) (void)WARN_ON_ONCE(cond) #define VM_WARN_ONCE(cond, format...) (void)WARN_ONCE(cond, format)
@@ -48,6 +60,7 @@ void dump_mm(const struct mm_struct *mm);#define VM_BUG_ON_MM (cond, mm) VM_BUG_ON(cond)#define VM_WARN_ON (cond) BUILD_BUG_ON_INVALID(cond)#define VM_WARN_ON_ONCE (cond) BUILD_BUG_ON_INVALID(cond) +#define VM_WARN_ON_ONCE_PAGE (cond, page) BUILD_BUG_ON_INVALID(cond) #define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond) #define VM_WARN(cond, format...) BUILD_BUG_ON_INVALID(cond)#endif
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 46/71 mm/rmap: remove unneeded semicolon in page_not_mapped()
In reply to Sasha LevinFrom: Miaohe Lin <[email protected]>
[ Upstream commit e0af87ff7afcde2660be44302836d2d5618185af ]
Remove extra semicolon without any functional change intended.
--- mm/rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/rmap.c +1 -1
@@ -1737,7 +1737,7 @@ bool try_to_unmap(struct page *page, enum ttu_flags flags)static int page_not_mapped (struct page *page) {return !page_mapped (page); -}; +}/** * try_to_munlock - try to munlock a page
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 47/71 mm/rmap: use page_not_mapped in try_to_unmap()
In reply to Sasha LevinFrom: Miaohe Lin <[email protected]>
[ Upstream commit b7e188ec98b1644ff70a6d3624ea16aadc39f5e0 ]
page_mapcount_is_zero() calculates accurately how many mappings a hugepage has in order to check against 0 only. This is a waste of cpu time. We can do this via page_not_mapped() to save some possible atomic_read cycles. Remove the function page_mapcount_is_zero() as it's not used anymore and move page_not_mapped() above try_to_unmap() to avoid identifier undeclared compilation error.
--- mm/rmap.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
mm/rmap.c +3 -8
@@ -1690,9 +1690,9 @@ static bool invalid_migration_vma(struct vm_area_struct *vma, void *arg)return is_vma_temporary_stack (vma); } -static int page_mapcount_is_zero (struct page *page) +static int page_not_mapped (struct page *page) { -return !total_mapcount (page); +return !page_mapped (page); }/**
@@ -1710,7 +1710,7 @@ bool try_to_unmap(struct page *page, enum ttu_flags flags)struct rmap_walk_control rwc = { .rmap_one = try_to_unmap_one, .arg = (void *)flags, - .done = page_mapcount_is_zero, + .done = page_not_mapped, .anon_lock = page_lock_anon_vma_read, };
@@ -1734,11 +1734,6 @@ bool try_to_unmap(struct page *page, enum ttu_flags flags)return !page_mapcount (page) ? true : false; } -static int page_not_mapped (struct page *page) -{ -return !page_mapped (page); -} -/** * try_to_munlock - try to munlock a page * @page: the page to be munlocked
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 48/71 mm, thp: use head page in __migration_entry_wait()
In reply to Sasha LevinFrom: Xu Yu <[email protected]>
commit ffc90cbb2970ab88b66ea51dd580469eede57b67 upstream.
We notice that hung task happens in a corner but practical scenario when CONFIG_PREEMPT_NONE is enabled, as follows.
Process 0 Process 1 Process 2..Infsplit_huge_page_to_list
unmap_page
split_huge_pmd_address
__migration_entry_wait(head)
__migration_entry_wait(tail)
remap_page (roll back)
remove_migration_ptes
rmap_walk_anon
cond_resched
Where __migration_entry_wait(tail) is occurred in kernel space, e.g., copy_to_user in fstat, which will immediately fault again without rescheduling, and thus occupy the cpu fully.
When there are too many processes performing __migration_entry_wait on tail page, remap_page will never be done after cond_resched.
This makes __migration_entry_wait operate on the compound head page, thus waits for remap_page to complete, whether the THP is split successfully or roll back.
Note that put_and_wait_on_page_locked helps to drop the page reference acquired with get_page_unless_zero, as soon as the page is on the wait queue, before actually waiting. So splitting the THP is only prevented for a brief interval.
--- mm/migrate.c | 1 + 1 file changed, 1 insertion(+)
mm/migrate.c +1 -0
@@ -321,6 +321,7 @@ void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep, goto out; page =migration_entry_to_page (entry); + page =compound_head (page);/* * Once page cache replacement of page migration started, page_count
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 49/71 mm/thp: fix __split_huge_pmd_locked() on shmem migration entry
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
[ Upstream commit 99fa8a48203d62b3743d866fc48ef6abaee682be ]
Patch series "mm/thp: fix THP splitting unmap BUGs and related", v10.
Here is v2 batch of long-standing THP bug fixes that I had not got around to sending before, but prompted now by Wang Yugui's report
https://lore.kernel.org/linux-mm/[email protected]/
Wang Yugui has tested a rollup of these fixes applied to 5.10.39, and they have done no harm, but have *not* fixed that issue: something more is needed and I have no idea of what.
This patch (of 7):
Stressing huge tmpfs page migration racing hole punch often crashed on the VM_BUG_ON(!pmd_present) in pmdp_huge_clear_flush(), with DEBUG_VM=y kernel; or shortly afterwards, on a bad dereference in __split_huge_pmd_locked() when DEBUG_VM=n. They forgot to allow for pmd migration entries in the non-anonymous case.
Full disclosure: those particular experiments were on a kernel with more relaxed mmap_lock and i_mmap_rwsem locking, and were not repeated on the vanilla kernel: it is conceivable that stricter locking happens to avoid those cases, or makes them less likely; but __split_huge_pmd_locked() already allowed for pmd migration entries when handling anonymous THPs, so this commit brings the shmem and file THP handling into line.
And while there: use old_pmd rather than _pmd, as in the following blocks; and make it clearer to the eye that the !vma_is_anonymous() block is self-contained, making an early return after accounting for unmapping.
Note on stable backport: this commit made intervening cleanups in pmdp_huge_clear_flush() redundant: here it's rediffed to skip them.
--- mm/huge_memory.c | 27 ++++++++++++++++++--------- mm/pgtable-generic.c | 4 ++-- 2 files changed, 20 insertions(+), 11 deletions(-)
mm/huge_memory.c +18 -9
@@ -2155,7 +2155,7 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,count_vm_event (THP_SPLIT_PMD );if (!vma_is_anonymous (vma)) { - _pmd =pmdp_huge_clear_flush_notify (vma, haddr, pmd); + old_pmd =pmdp_huge_clear_flush_notify (vma, haddr, pmd);/* * We are going to unmap this huge page. So * just go ahead and zap it
@@ -2164,16 +2164,25 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,zap_deposited_table (mm, pmd);if (vma_is_dax (vma))return ; - page =pmd_page (_pmd); -if (!PageDirty (page) &&pmd_dirty (_pmd)) -set_page_dirty (page); -if (!PageReferenced (page) &&pmd_young (_pmd)) -SetPageReferenced (page); -page_remove_rmap (page, true); -put_page (page); +if (unlikely (is_pmd_migration_entry (old_pmd))) { +swp_entry_t entry; + + entry =pmd_to_swp_entry (old_pmd); + page =migration_entry_to_page (entry); + }else { + page =pmd_page (old_pmd); +if (!PageDirty (page) &&pmd_dirty (old_pmd)) +set_page_dirty (page); +if (!PageReferenced (page) &&pmd_young (old_pmd)) +SetPageReferenced (page); +page_remove_rmap (page, true); +put_page (page); + }add_mm_counter (mm,mm_counter_file (page), -HPAGE_PMD_NR );return ; - }else if (pmd_trans_huge (*pmd) &&is_huge_zero_pmd (*pmd)) { + } + +if (pmd_trans_huge (*pmd) &&is_huge_zero_pmd (*pmd)) {/* * FIXME: Do we want to invalidate secondary mmu by calling * mmu_notifier_invalidate_range() see comments below inside
mm/pgtable-generic.c +2 -2
@@ -126,8 +126,8 @@ pmd_t pmdp_huge_clear_flush(struct vm_area_struct *vma, unsigned long address, {pmd_t pmd;VM_BUG_ON (address & ~HPAGE_PMD_MASK ); -VM_BUG_ON ((pmd_present (*pmdp) && !pmd_trans_huge (*pmdp) && - !pmd_devmap (*pmdp)) || !pmd_present (*pmdp)); +VM_BUG_ON (pmd_present (*pmdp) && !pmd_trans_huge (*pmdp) && + !pmd_devmap (*pmdp)); pmd =pmdp_huge_get_and_clear (vma->vm_mm, address, pmdp);flush_pmd_tlb_range (vma, address, address +HPAGE_PMD_SIZE );return pmd;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 50/71 mm/thp: make is_huge_zero_pmd() safe and quicker
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
commit 3b77e8c8cde581dadab9a0f1543a347e24315f11 upstream.
Most callers of is_huge_zero_pmd() supply a pmd already verified present; but a few (notably zap_huge_pmd()) do not - it might be a pmd migration entry, in which the pfn is encoded differently from a present
pmd: which might pass the is_huge_zero_pmd() test (though not on x86, since L1TF forced us to protect against that); or perhaps even crash in pmd_page() applied to a swap-like entry.
Make it safe by adding pmd_present() check into is_huge_zero_pmd() itself; and make it quicker by saving huge_zero_pfn, so that is_huge_zero_pmd() will not need to do that pmd_page() lookup each time.
__split_huge_pmd_locked() checked pmd_trans_huge() before: that worked, but is unnecessary now that is_huge_zero_pmd() checks present.
--- include/linux/huge_mm.h | 8 +++++++- mm/huge_memory.c | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-)
include/linux/huge_mm.h +7 -1
@@ -259,6 +259,7 @@ struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr,extern vm_fault_t do_huge_pmd_numa_page (struct vm_fault *vmf,pmd_t orig_pmd);extern struct page *huge_zero_page; +extern unsigned long huge_zero_pfn;static inline bool is_huge_zero_page (struct page *page) {
@@ -267,7 +268,7 @@ static inline bool is_huge_zero_page(struct page *page)static inline bool is_huge_zero_pmd (pmd_t pmd) { -return is_huge_zero_page (pmd_page (pmd)); +return READ_ONCE (huge_zero_pfn) ==pmd_pfn (pmd) &&pmd_present (pmd); }static inline bool is_huge_zero_pud (pud_t pud)
@@ -398,6 +399,11 @@ static inline bool is_huge_zero_page(struct page *page)return false; } +static inline bool is_huge_zero_pmd (pmd_t pmd) +{ +return false; +} +static inline bool is_huge_zero_pud (pud_t pud) {return false;
mm/huge_memory.c +4 -1
@@ -61,6 +61,7 @@ static struct shrinker deferred_split_shrinker;static atomic_t huge_zero_refcount;struct page *huge_zero_page__read_mostly ; +unsigned long huge_zero_pfn__read_mostly = ~0UL ;bool transparent_hugepage_enabled (struct vm_area_struct *vma) {
@@ -97,6 +98,7 @@ static struct page *get_huge_zero_page(void)__free_pages (zero_page,compound_order (zero_page)); goto retry; } +WRITE_ONCE (huge_zero_pfn,page_to_pfn (zero_page));/* We take additional reference here. It will be put back by shrinker */ atomic_set (&huge_zero_refcount,2 );
@@ -146,6 +148,7 @@ static unsigned long shrink_huge_zero_page_scan(struct shrinker *shrink,if (atomic_cmpxchg (&huge_zero_refcount,1 ,0 ) ==1 ) {struct page *zero_page =xchg (&huge_zero_page,NULL );BUG_ON (zero_page ==NULL ); +WRITE_ONCE (huge_zero_pfn, ~0UL );__free_pages (zero_page,compound_order (zero_page));return HPAGE_PMD_NR ; }
@@ -2182,7 +2185,7 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,return ; } -if (pmd_trans_huge (*pmd) &&is_huge_zero_pmd (*pmd)) { +if (is_huge_zero_pmd (*pmd)) {/* * FIXME: Do we want to invalidate secondary mmu by calling * mmu_notifier_invalidate_range() see comments below inside
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 51/71 mm/thp: try_to_unmap() use TTU_SYNC for safe splitting
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
[ Upstream commit 732ed55823fc3ad998d43b86bf771887bcc5ec67 ]
Stressing huge tmpfs often crashed on unmap_page()'s VM_BUG_ON_PAGE (!unmap_success): with dump_page() showing mapcount:1, but then its raw struct page output showing _mapcount ffffffff i.e. mapcount 0.
And even if that particular VM_BUG_ON_PAGE(!unmap_success) is removed, it is immediately followed by a VM_BUG_ON_PAGE(compound_mapcount(head)), and further down an IS_ENABLED(CONFIG_DEBUG_VM) total_mapcount BUG():
all indicative of some mapcount difficulty in development here perhaps. But the !CONFIG_DEBUG_VM path handles the failures correctly and silently.
I believe the problem is that once a racing unmap has cleared pte or pmd, try_to_unmap_one() may skip taking the page table lock, and emerge from try_to_unmap() before the racing task has reached decrementing mapcount.
Instead of abandoning the unsafe VM_BUG_ON_PAGE(), and the ones that follow, use PVMW_SYNC in try_to_unmap_one() in this case: adding TTU_SYNC to the options, and passing that from unmap_page().
When CONFIG_DEBUG_VM, or for non-debug too? Consensus is to do the same for both: the slight overhead added should rarely matter, except perhaps if splitting sparsely-populated multiply-mapped shmem. Once confident that bugs are fixed, TTU_SYNC here can be removed, and the race tolerated.
Note on stable backport: upstream TTU_SYNC 0x10 takes the value which 5.11 commit 013339df116c ("mm/rmap: always do TTU_IGNORE_ACCESS") freed. It is very tempting to backport that commit (as 5.10 already did) and make no change here; but on reflection, good as that commit is, I'm reluctant to include any possible side-effect of it in this series.
--- include/linux/rmap.h | 3 ++- mm/huge_memory.c | 2 +- mm/page_vma_mapped.c | 11 +++++++++++ mm/rmap.c | 17 ++++++++++++++++- 4 files changed, 30 insertions(+), 3 deletions(-)
include/linux/rmap.h +2 -1
@@ -98,7 +98,8 @@ enum ttu_flags {* do a final flush if necessary */ TTU_RMAP_LOCKED =0x80 ,/* do not grab rmap lock: * caller holds it */ - TTU_SPLIT_FREEZE = 0x100, /* freeze pte under splitting thp */ +TTU_SPLIT_FREEZE =0x100 ,/* freeze pte under splitting thp */ + TTU_SYNC = 0x200, /* avoid racy checks with PVMW_SYNC */ };#ifdef CONFIG_MMU
mm/huge_memory.c +1 -1
@@ -2461,7 +2461,7 @@ void vma_adjust_trans_huge(struct vm_area_struct *vma,static void unmap_page (struct page *page) {enum ttu_flags ttu_flags =TTU_IGNORE_MLOCK |TTU_IGNORE_ACCESS | -TTU_RMAP_LOCKED |TTU_SPLIT_HUGE_PMD ; +TTU_RMAP_LOCKED |TTU_SPLIT_HUGE_PMD |TTU_SYNC ;bool unmap_success;VM_BUG_ON_PAGE (!PageHead (page), page);
mm/page_vma_mapped.c +11 -0
@@ -207,6 +207,17 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) pvmw->ptl =NULL ; } }else if (!pmd_present (pmde)) { +/* +* If PVMW_SYNC, take and drop THP pmd lock so that we +* cannot return prematurely, while zap_huge_pmd() has +* cleared *pmd but not decremented compound_mapcount(). +*/ +if ((pvmw->flags &PVMW_SYNC ) && +PageTransCompound (pvmw->page)) { +spinlock_t *ptl =pmd_lock (mm, pvmw->pmd); + +spin_unlock (ptl); + }return false; }if (!map_pte (pvmw))
mm/rmap.c +16 -1
@@ -1353,6 +1353,15 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,struct mmu_notifier_range range;enum ttu_flags flags = (enum ttu_flags )arg; +/* +* When racing against e.g. zap_pte_range() on another cpu, +* in between its ptep_get_and_clear_full() and page_remove_rmap(), +* try_to_unmap() may return false when it is about to become true, +* if page table locking is skipped: use TTU_SYNC to wait for that. +*/ +if (flags &TTU_SYNC ) + pvmw.flags =PVMW_SYNC ; +/* munlock has nothing to gain from examining un-locked vmas */ if ((flags &TTU_MUNLOCK ) && !(vma->vm_flags &VM_LOCKED ))return true;
@@ -1731,7 +1740,13 @@ bool try_to_unmap(struct page *page, enum ttu_flags flags)else rmap_walk (page, &rwc); -return !page_mapcount (page) ? true : false; +/* +* When racing against e.g. zap_pte_range() on another cpu, +* in between its ptep_get_and_clear_full() and page_remove_rmap(), +* try_to_unmap() may return false when it is about to become true, +* if page table locking is skipped: use TTU_SYNC to wait for that. +*/ +return !page_mapcount (page); }/**
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 52/71 mm/thp: fix vma_address() if virtual address below file offset
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
[ Upstream commit 494334e43c16d63b878536a26505397fce6ff3a2 ]
Running certain tests with a DEBUG_VM kernel would crash within hours, on the total_mapcount BUG() in split_huge_page_to_list(), while trying to free up some memory by punching a hole in a shmem huge page: split's try_to_unmap() was unable to find all the mappings of the page (which, on a !DEBUG_VM kernel, would then keep the huge page pinned in memory).
When that BUG() was changed to a WARN(), it would later crash on the VM_BUG_ON_VMA(end < vma->vm_start || start >= vma->vm_end, vma) in mm/internal.h:vma_address(), used by rmap_walk_file() for try_to_unmap().
vma_address() is usually correct, but there's a wraparound case when the vm_start address is unusually low, but vm_pgoff not so low:vma_address() chooses max(start, vma->vm_start), but that decides on the wrong address, because start has become almost ULONG_MAX.
Rewrite vma_address() to be more careful about vm_pgoff; move the VM_BUG_ON_VMA() out of it, returning -EFAULT for errors, so that it can be safely used from page_mapped_in_vma() and page_address_in_vma() too.
Add vma_address_end() to apply similar care to end address calculation, in page_vma_mapped_walk() and page_mkclean_one() and try_to_unmap_one(); though it raises a question of whether callers would do better to supply pvmw->end to page_vma_mapped_walk() - I chose not, for a smaller patch.
An irritation is that their apparent generality breaks down on KSM pages, which cannot be located by the page->index that page_to_pgoff()
uses: as commit 4b0ece6fa016 ("mm: migrate: fix remove_migration_pte() for ksm pages") once discovered. I dithered over the best thing to do about that, and have ended up with a VM_BUG_ON_PAGE(PageKsm) in both vma_address() and vma_address_end(); though the only place in danger of using it on them was try_to_unmap_one().
Sidenote: vma_address() and vma_address_end() now use compound_nr() on a head page, instead of thp_size(): to make the right calculation on a hugetlbfs page, whether or not THPs are configured. try_to_unmap() is used on hugetlbfs pages, but perhaps the wrong calculation never mattered.
Note on stable backport: fixed up conflicts on intervening thp_size().
--- mm/internal.h | 53 ++++++++++++++++++++++++++++++++------------ mm/page_vma_mapped.c | 16 +++++-------- mm/rmap.c | 16 ++++++------- 3 files changed, 53 insertions(+), 32 deletions(-)
mm/internal.h +39 -14
@@ -339,27 +339,52 @@ static inline void mlock_migrate_page(struct page *newpage, struct page *page)extern pmd_t maybe_pmd_mkwrite (pmd_t pmd,struct vm_area_struct *vma);/* -* At what user virtual address is page expected in @vma? +* At what user virtual address is page expected in vma? +* Returns -EFAULT if all of the page is outside the range of vma. +* If page is a compound head, the entire compound page is considered. */ static inline unsigned long -__vma_address (struct page *page,struct vm_area_struct *vma) +vma_address (struct page *page,struct vm_area_struct *vma) { -pgoff_t pgoff =page_to_pgoff (page); -return vma->vm_start + ((pgoff - vma->vm_pgoff) <<PAGE_SHIFT ); +pgoff_t pgoff; +unsigned long address; + +VM_BUG_ON_PAGE (PageKsm (page), page);/* KSM page->index unusable */ + pgoff =page_to_pgoff (page); +if (pgoff >= vma->vm_pgoff) { + address = vma->vm_start + + ((pgoff - vma->vm_pgoff) <<PAGE_SHIFT ); +/* Check for address beyond vma (or wrapped through 0?) */ +if (address < vma->vm_start || address >= vma->vm_end) + address = -EFAULT ; + }else if (PageHead (page) && + pgoff +compound_nr (page) -1 >= vma->vm_pgoff) { +/* Test above avoids possibility of wrap to 0 on 32-bit */ + address = vma->vm_start; + }else { + address = -EFAULT ; + } +return address; } +/* +* Then at what user virtual address will none of the page be found in vma? +* Assumes that vma_address() already returned a good starting address. +* If page is a compound head, the entire compound page is considered. +*/ static inline unsigned long -vma_address (struct page *page,struct vm_area_struct *vma) +vma_address_end (struct page *page,struct vm_area_struct *vma) { -unsigned long start, end; - - start =__vma_address (page, vma); - end = start +PAGE_SIZE * (hpage_nr_pages (page) -1 ); - -/* page should be within @vma mapping range */ -VM_BUG_ON_VMA (end < vma->vm_start || start >= vma->vm_end, vma); - -return max (start, vma->vm_start); +pgoff_t pgoff; +unsigned long address; + +VM_BUG_ON_PAGE (PageKsm (page), page);/* KSM page->index unusable */ + pgoff =page_to_pgoff (page) +compound_nr (page); + address = vma->vm_start + ((pgoff - vma->vm_pgoff) <<PAGE_SHIFT ); +/* Check for address beyond vma (or wrapped through 0?) */ +if (address < vma->vm_start || address > vma->vm_end) + address = vma->vm_end; +return address; } static inline struct file *maybe_unlock_mmap_for_io(struct vm_fault *vmf,
mm/page_vma_mapped.c +6 -10
@@ -223,18 +223,18 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)if (!map_pte (pvmw)) goto next_pte;while (1 ) { +unsigned long end; +if (check_pte (pvmw))return true; next_pte:/* Seek to next pte only makes sense for THP */ if (!PageTransHuge (pvmw->page) ||PageHuge (pvmw->page))return not_found (pvmw); + end =vma_address_end (pvmw->page, pvmw->vma); do { pvmw->address += PAGE_SIZE; - if (pvmw->address >= pvmw->vma->vm_end || - pvmw->address >= - __vma_address(pvmw->page, pvmw->vma) + - hpage_nr_pages(pvmw->page) * PAGE_SIZE) + if (pvmw->address >= end) return not_found(pvmw); /* Did we cross page table boundary? */ if (pvmw->address % PMD_SIZE == 0) {
@@ -272,14 +272,10 @@ int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma) .vma = vma, .flags = PVMW_SYNC, }; -unsigned long start, end; - - start =__vma_address (page, vma); - end = start +PAGE_SIZE * (hpage_nr_pages (page) -1 ); -if (unlikely (end < vma->vm_start || start >= vma->vm_end)) + pvmw.address =vma_address (page, vma); +if (pvmw.address == -EFAULT )return 0 ; - pvmw.address =max (start, vma->vm_start);if (!page_vma_mapped_walk (&pvmw))return 0 ;page_vma_mapped_walk_done (&pvmw);
mm/rmap.c +8 -8
@@ -687,7 +687,6 @@ static bool should_defer_flush(struct mm_struct *mm, enum ttu_flags flags)*/ unsigned long page_address_in_vma (struct page *page,struct vm_area_struct *vma) { -unsigned long address;if (PageAnon (page)) {struct anon_vma *page__anon_vma =page_anon_vma (page);/*
@@ -702,10 +701,8 @@ unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)return -EFAULT ; }else return -EFAULT ; - address =__vma_address (page, vma); -if (unlikely (address < vma->vm_start || address >= vma->vm_end)) -return -EFAULT ; -return address; + +return vma_address (page, vma); }pmd_t *mm_find_pmd (struct mm_struct *mm,unsigned long address)
@@ -899,7 +896,7 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma,*/ mmu_notifier_range_init (&range,MMU_NOTIFY_PROTECTION_PAGE ,0 , vma, vma->vm_mm, address, -min (vma->vm_end, address +page_size (page))); +vma_address_end (page, vma));mmu_notifier_invalidate_range_start (&range);while (page_vma_mapped_walk (&pvmw)) {
@@ -1383,9 +1380,10 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,* Note that the page can not be free in this function as call of * try_to_unmap() must hold a reference on the page. */ + range.end =PageKsm (page) ? + address +PAGE_SIZE :vma_address_end (page, vma);mmu_notifier_range_init (&range,MMU_NOTIFY_CLEAR ,0 , vma, vma->vm_mm, - address, -min (vma->vm_end, address +page_size (page))); + address, range.end);if (PageHuge (page)) {/* * If sharing is possible, start and end will be adjusted
@@ -1843,6 +1841,7 @@ static void rmap_walk_anon(struct page *page, struct rmap_walk_control *rwc,struct vm_area_struct *vma = avc->vma;unsigned long address =vma_address (page, vma); +VM_BUG_ON_VMA (address == -EFAULT , vma);cond_resched ();if (rwc->invalid_vma && rwc->invalid_vma (vma, rwc->arg))
@@ -1897,6 +1896,7 @@ static void rmap_walk_file(struct page *page, struct rmap_walk_control *rwc, pgoff_start, pgoff_end) {unsigned long address =vma_address (page, vma); +VM_BUG_ON_VMA (address == -EFAULT , vma);cond_resched ();if (rwc->invalid_vma && rwc->invalid_vma (vma, rwc->arg))
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 53/71 mm/thp: fix page_address_in_vma() on file THP tails
In reply to Sasha LevinFrom: Jue Wang <[email protected]>
commit 31657170deaf1d8d2f6a1955fbc6fa9d228be036 upstream.
Anon THP tails were already supported, but memory-failure may need to use page_address_in_vma() on file THP tails, which its page->mapping check did not permit: fix it.
hughd adds: no current usage is known to hit the issue, but this does fix a subtle trap in a general helper: best fixed in stable sooner than later.
--- mm/rmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
mm/rmap.c +4 -4
@@ -696,11 +696,11 @@ unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)if (!vma->anon_vma || !page__anon_vma || vma->anon_vma->root != page__anon_vma->root)return -EFAULT ; - }else if (page->mapping) { -if (!vma->vm_file || vma->vm_file->f_mapping != page->mapping) -return -EFAULT ; - }else + }else if (!vma->vm_file) { +return -EFAULT ; + }else if (vma->vm_file->f_mapping !=compound_head (page)->mapping) {return -EFAULT ; + }return vma_address (page, vma); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 54/71 mm/thp: unmap_mapping_page() to fix THP truncate_cleanup_page()
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
[ Upstream commit 22061a1ffabdb9c3385de159c5db7aac3a4df1cc ]
There is a race between THP unmapping and truncation, when truncate sees pmd_none() and skips the entry, after munmap's zap_huge_pmd() cleared it, but before its page_remove_rmap() gets to decrementcompound_mapcount: generating false "BUG: Bad page cache" reports that the page is still mapped when deleted. This commit fixes that, but not in the way I hoped.
The first attempt used try_to_unmap(page, TTU_SYNC|TTU_IGNORE_MLOCK) instead of unmap_mapping_range() in truncate_cleanup_page(): it has often been an annoyance that we usually call unmap_mapping_range() with no pages locked, but there apply it to a single locked page. try_to_unmap() looks more suitable for a single locked page.
However, try_to_unmap_one() contains a VM_BUG_ON_PAGE(!pvmw.pte,page):
it is used to insert THP migration entries, but not used to unmap THPs. Copy zap_huge_pmd() and add THP handling now? Perhaps, but their TLB needs are different, I'm too ignorant of the DAX cases, and couldn't decide how far to go for anon+swap. Set that aside.
The second attempt took a different tack: make no change in truncate.c, but modify zap_huge_pmd() to insert an invalidated huge pmd instead of clearing it initially, then pmd_clear() between page_remove_rmap() and unlocking at the end. Nice. But powerpc blows that approach out of the water, with its serialize_against_pte_lookup(), and interesting pgtable usage. It would need serious help to get working on powerpc (with a minor optimization issue on s390 too). Set that aside.
Just add an "if (page_mapped(page)) synchronize_rcu();" or other such delay, after unmapping in truncate_cleanup_page()? Perhaps, but though that's likely to reduce or eliminate the number of incidents, it would give less assurance of whether we had identified the problem correctly.
This successful iteration introduces "unmap_mapping_page(page)" instead of try_to_unmap(), and goes the usual unmap_mapping_range_tree() route, with an addition to details. Then zap_pmd_range() watches for this case, and does spin_unlock(pmd_lock) if so - just like page_vma_mapped_walk() now does in the PVMW_SYNC case. Not pretty, but safe.
Note that unmap_mapping_page() is doing a VM_BUG_ON(!PageLocked) to assert its interface; but currently that's only used to make sure that page->mapping is stable, and zap_pmd_range() doesn't care if the page is locked or not. Along these lines, in invalidate_inode_pages2_range() move the initial unmap_mapping_range() out from under page lock, before then calling unmap_mapping_page() under page lock if still mapped.
Note on stable backport: fixed up call to truncate_cleanup_page() in truncate_inode_pages_range(). Use hpage_nr_pages() in unmap_mapping_page().
--- include/linux/mm.h | 3 +++ mm/memory.c | 41 +++++++++++++++++++++++++++++++++++++++++ mm/truncate.c | 43 +++++++++++++++++++------------------------ 3 files changed, 63 insertions(+), 24 deletions(-)
include/linux/mm.h +3 -0
@@ -1459,6 +1459,7 @@ struct zap_details {struct address_space *check_mapping;/* Check page->mapping if set */ pgoff_t first_index;/* Lowest page->index to unmap */ pgoff_t last_index;/* Highest page->index to unmap */ +struct page *single_page;/* Locked page to be unmapped */ }; struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
@@ -1505,6 +1506,7 @@ extern vm_fault_t handle_mm_fault(struct vm_area_struct *vma,extern int fixup_user_fault (struct task_struct *tsk,struct mm_struct *mm,unsigned long address,unsigned int fault_flags,bool *unlocked); +void unmap_mapping_page (struct page *page);void unmap_mapping_pages (struct address_space *mapping,pgoff_t start,pgoff_t nr,bool even_cows); void unmap_mapping_range(struct address_space *mapping,
@@ -1525,6 +1527,7 @@ static inline int fixup_user_fault(struct task_struct *tsk,BUG ();return -EFAULT ; } +static inline void unmap_mapping_page (struct page *page) { }static inline void unmap_mapping_pages (struct address_space *mapping,pgoff_t start,pgoff_t nr,bool even_cows) { } static inline void unmap_mapping_range(struct address_space *mapping,
mm/memory.c +41 -0
54 lines not on this page · raw message
mm/truncate.c +19 -24
75 lines not on this page · raw message
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 55/71 mm: thp: replace DEBUG_VM BUG with VM_WARN when unmap fails for split
In reply to Sasha LevinFrom: Yang Shi <[email protected]>
[ Upstream commit 504e070dc08f757bccaed6d05c0f53ecbfac8a23 ]
When debugging the bug reported by Wang Yugui [1], try_to_unmap() may fail, but the first VM_BUG_ON_PAGE() just checks page_mapcount() however it may miss the failure when head page is unmapped but other subpage is mapped. Then the second DEBUG_VM BUG() that check total mapcount would catch it. This may incur some confusion.
As this is not a fatal issue, so consolidate the two DEBUG_VM checks into one VM_WARN_ON_ONCE_PAGE().
[1] https://lore.kernel.org/linux-mm/[email protected]/
Note on stable backport: fixed up variables in split_huge_page_to_list(), and fixed up the conflict on ttu_flags in unmap_page().
--- mm/huge_memory.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-)
mm/huge_memory.c +7 -17
@@ -2462,15 +2462,15 @@ static void unmap_page(struct page *page) {enum ttu_flags ttu_flags =TTU_IGNORE_MLOCK |TTU_IGNORE_ACCESS |TTU_RMAP_LOCKED |TTU_SPLIT_HUGE_PMD |TTU_SYNC ; -bool unmap_success;VM_BUG_ON_PAGE (!PageHead (page), page);if (PageAnon (page)) ttu_flags |=TTU_SPLIT_FREEZE ; - unmap_success =try_to_unmap (page, ttu_flags); -VM_BUG_ON_PAGE (!unmap_success, page); +try_to_unmap (page, ttu_flags); + +VM_WARN_ON_ONCE_PAGE (page_mapped (page), page); }static void remap_page (struct page *page)
@@ -2749,7 +2749,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)struct deferred_split *ds_queue =get_deferred_split_queue (page);struct anon_vma *anon_vma =NULL ;struct address_space *mapping =NULL ; -int count, mapcount, extra_pins, ret; +int extra_pins, ret;bool mlocked;unsigned long flags;pgoff_t end;
@@ -2811,7 +2811,6 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) mlocked =PageMlocked (page);unmap_page (head); -VM_BUG_ON_PAGE (compound_mapcount (head), head);/* Make sure the page is not on per-CPU pagevec as it takes pin */ if (mlocked)
@@ -2834,9 +2833,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)/* Prevent deferred_split_scan() touching ->_refcount */ spin_lock (&ds_queue->split_queue_lock); - count =page_count (head); - mapcount =total_mapcount (head); -if (!mapcount &&page_ref_freeze (head,1 + extra_pins)) { +if (page_ref_freeze (head,1 + extra_pins)) {if (!list_empty (page_deferred_list (head))) { ds_queue->split_queue_len--;list_del (page_deferred_list (head));
@@ -2857,16 +2854,9 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) }else ret =0 ; }else { -if (IS_ENABLED (CONFIG_DEBUG_VM ) && mapcount) { -pr_alert ("total_mapcount: %u, page_count(): %u\n" , - mapcount, count); -if (PageTail (page)) -dump_page (head,NULL ); -dump_page (page,"total_mapcount(head) > 0" ); -BUG (); - }spin_unlock (&ds_queue->split_queue_lock); -fail:if (mapping) +fail: +if (mapping)xa_unlock (&mapping->i_pages);spin_unlock_irqrestore (&pgdata->lru_lock, flags);remap_page (head);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 56/71 mm: page_vma_mapped_walk(): use page for pvmw->page
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
Patch series "mm: page_vma_mapped_walk() cleanup and THP fixes".
I've marked all of these for stable: many are merely cleanups, but I think they are much better before the main fix than after.
This patch (of 11):
page_vma_mapped_walk() cleanup: sometimes the local copy of pvwm->page was used, sometimes pvmw->page itself: use the local copy "page" throughout.
--- mm/page_vma_mapped.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
mm/page_vma_mapped.c +4 -5
@@ -151,7 +151,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)if (pvmw->pte) goto next_pte; -if (unlikely (PageHuge (pvmw->page))) { +if (unlikely (PageHuge (page))) {/* when pud is not present, pte will be NULL */ pvmw->pte =huge_pte_offset (mm, pvmw->address,page_size (page));if (!pvmw->pte)
@@ -212,8 +212,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)* cannot return prematurely, while zap_huge_pmd() has * cleared *pmd but not decremented compound_mapcount(). */ -if ((pvmw->flags &PVMW_SYNC ) && -PageTransCompound (pvmw->page)) { +if ((pvmw->flags &PVMW_SYNC ) &&PageTransCompound (page)) {spinlock_t *ptl =pmd_lock (mm, pvmw->pmd);spin_unlock (ptl);
@@ -229,9 +228,9 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)return true; next_pte:/* Seek to next pte only makes sense for THP */ -if (!PageTransHuge (pvmw->page) ||PageHuge (pvmw->page)) +if (!PageTransHuge (page) ||PageHuge (page))return not_found (pvmw); - end =vma_address_end (pvmw->page, pvmw->vma); + end =vma_address_end (page, pvmw->vma); do { pvmw->address += PAGE_SIZE; if (pvmw->address >= end)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 57/71 mm: page_vma_mapped_walk(): settle PageHuge on entry
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
page_vma_mapped_walk() cleanup: get the hugetlbfs PageHuge case out of the way at the start, so no need to worry about it later.
--- mm/page_vma_mapped.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
mm/page_vma_mapped.c +8 -4
@@ -148,10 +148,11 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)if (pvmw->pmd && !pvmw->pte)return not_found (pvmw); -if (pvmw->pte) - goto next_pte; -if (unlikely (PageHuge (page))) { +/* The only possible mapping was handled on last iteration */ +if (pvmw->pte) +return not_found (pvmw); +/* when pud is not present, pte will be NULL */ pvmw->pte =huge_pte_offset (mm, pvmw->address,page_size (page));if (!pvmw->pte)
@@ -163,6 +164,9 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)return not_found (pvmw);return true; } + +if (pvmw->pte) + goto next_pte; restart: pgd =pgd_offset (mm, pvmw->address);if (!pgd_present (*pgd))
@@ -228,7 +232,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)return true; next_pte:/* Seek to next pte only makes sense for THP */ -if (!PageTransHuge (page) ||PageHuge (page)) +if (!PageTransHuge (page))return not_found (pvmw); end =vma_address_end (page, pvmw->vma); do {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 58/71 mm: page_vma_mapped_walk(): use pmde for *pvmw->pmd
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
page_vma_mapped_walk() cleanup: re-evaluate pmde after taking lock, then use it in subsequent tests, instead of repeatedly dereferencing pointer.
--- mm/page_vma_mapped.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
mm/page_vma_mapped.c +6 -5
@@ -186,18 +186,19 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) pmde =READ_ONCE (*pvmw->pmd);if (pmd_trans_huge (pmde) ||is_pmd_migration_entry (pmde)) { pvmw->ptl =pmd_lock (mm, pvmw->pmd); -if (likely (pmd_trans_huge (*pvmw->pmd))) { + pmde = *pvmw->pmd; +if (likely (pmd_trans_huge (pmde))) {if (pvmw->flags &PVMW_MIGRATION )return not_found (pvmw); -if (pmd_page (*pvmw->pmd) != page) +if (pmd_page (pmde) != page)return not_found (pvmw);return true; - }else if (!pmd_present (*pvmw->pmd)) { + }else if (!pmd_present (pmde)) {if (thp_migration_supported ()) {if (!(pvmw->flags &PVMW_MIGRATION ))return not_found (pvmw); -if (is_migration_entry (pmd_to_swp_entry (*pvmw->pmd))) { -swp_entry_t entry =pmd_to_swp_entry (*pvmw->pmd); +if (is_migration_entry (pmd_to_swp_entry (pmde))) { +swp_entry_t entry =pmd_to_swp_entry (pmde);if (migration_entry_to_page (entry) != page)return not_found (pvmw);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 59/71 mm: page_vma_mapped_walk(): prettify PVMW_MIGRATION block
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
page_vma_mapped_walk() cleanup: rearrange the !pmd_present() block to follow the same "return not_found, return not_found, return true" pattern as the block above it (note: returning not_found there is never premature, since existence or prior existence of huge pmd guarantees good alignment).
--- mm/page_vma_mapped.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)
mm/page_vma_mapped.c +14 -16
@@ -193,24 +193,22 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)if (pmd_page (pmde) != page)return not_found (pvmw);return true; - }else if (!pmd_present (pmde)) { -if (thp_migration_supported ()) { -if (!(pvmw->flags &PVMW_MIGRATION )) -return not_found (pvmw); -if (is_migration_entry (pmd_to_swp_entry (pmde))) { -swp_entry_t entry =pmd_to_swp_entry (pmde); + } +if (!pmd_present (pmde)) { +swp_entry_t entry; -if (migration_entry_to_page (entry) != page) -return not_found (pvmw); -return true; - } - } -return not_found (pvmw); - }else { -/* THP pmd was split under us: handle on pte level */ -spin_unlock (pvmw->ptl); - pvmw->ptl =NULL ; +if (!thp_migration_supported () || + !(pvmw->flags &PVMW_MIGRATION )) +return not_found (pvmw); + entry =pmd_to_swp_entry (pmde); +if (!is_migration_entry (entry) || +migration_entry_to_page (entry) != page) +return not_found (pvmw); +return true; } +/* THP pmd was split under us: handle on pte level */ +spin_unlock (pvmw->ptl); + pvmw->ptl =NULL ; }else if (!pmd_present (pmde)) {/* * If PVMW_SYNC, take and drop THP pmd lock so that we
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 60/71 mm: page_vma_mapped_walk(): crossing page table boundary
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
page_vma_mapped_walk() cleanup: adjust the test for crossing page table boundary - I believe pvmw->address is always page-aligned, but nothing else here assumed that; and remember to reset pvmw->pte to NULL after unmapping the page table, though I never saw any bug from that.
--- mm/page_vma_mapped.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
mm/page_vma_mapped.c +4 -4
@@ -239,16 +239,16 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)if (pvmw->address >= end)return not_found (pvmw);/* Did we cross page table boundary? */ -if (pvmw->address %PMD_SIZE ==0 ) { -pte_unmap (pvmw->pte); +if ((pvmw->address & (PMD_SIZE -PAGE_SIZE )) ==0 ) {if (pvmw->ptl) {spin_unlock (pvmw->ptl); pvmw->ptl =NULL ; } +pte_unmap (pvmw->pte); + pvmw->pte =NULL ; goto restart; - }else { - pvmw->pte++; } + pvmw->pte++; }while (pte_none (*pvmw->pte));if (!pvmw->ptl) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 61/71 mm: page_vma_mapped_walk(): add a level of indentation
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
page_vma_mapped_walk() cleanup: add a level of indentation to much of the body, making no functional change in this commit, but reducing the later diff when this is all converted to a loop.
--- mm/page_vma_mapped.c | 105 ++++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 50 deletions(-)
mm/page_vma_mapped.c +55 -50
@@ -168,62 +168,67 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)if (pvmw->pte) goto next_pte; restart: - pgd =pgd_offset (mm, pvmw->address); -if (!pgd_present (*pgd)) -return false; - p4d =p4d_offset (pgd, pvmw->address); -if (!p4d_present (*p4d)) -return false; - pud =pud_offset (p4d, pvmw->address); -if (!pud_present (*pud)) -return false; - pvmw->pmd =pmd_offset (pud, pvmw->address); -/* -* Make sure the pmd value isn't cached in a register by the -* compiler and used as a stale value after we've observed a -* subsequent update. -*/ - pmde =READ_ONCE (*pvmw->pmd); -if (pmd_trans_huge (pmde) ||is_pmd_migration_entry (pmde)) { - pvmw->ptl =pmd_lock (mm, pvmw->pmd); - pmde = *pvmw->pmd; -if (likely (pmd_trans_huge (pmde))) { -if (pvmw->flags &PVMW_MIGRATION ) -return not_found (pvmw); -if (pmd_page (pmde) != page) -return not_found (pvmw); -return true; - } -if (!pmd_present (pmde)) { -swp_entry_t entry; + { + pgd =pgd_offset (mm, pvmw->address); +if (!pgd_present (*pgd)) +return false; + p4d =p4d_offset (pgd, pvmw->address); +if (!p4d_present (*p4d)) +return false; + pud =pud_offset (p4d, pvmw->address); +if (!pud_present (*pud)) +return false; -if (!thp_migration_supported () || - !(pvmw->flags &PVMW_MIGRATION )) -return not_found (pvmw); - entry =pmd_to_swp_entry (pmde); -if (!is_migration_entry (entry) || -migration_entry_to_page (entry) != page) -return not_found (pvmw); -return true; - } -/* THP pmd was split under us: handle on pte level */ -spin_unlock (pvmw->ptl); - pvmw->ptl =NULL ; - }else if (!pmd_present (pmde)) { + pvmw->pmd =pmd_offset (pud, pvmw->address);/* -* If PVMW_SYNC, take and drop THP pmd lock so that we -* cannot return prematurely, while zap_huge_pmd() has -* cleared *pmd but not decremented compound_mapcount(). +* Make sure the pmd value isn't cached in a register by the +* compiler and used as a stale value after we've observed a +* subsequent update. */ -if ((pvmw->flags &PVMW_SYNC ) &&PageTransCompound (page)) { -spinlock_t *ptl =pmd_lock (mm, pvmw->pmd); + pmde =READ_ONCE (*pvmw->pmd); -spin_unlock (ptl); +if (pmd_trans_huge (pmde) ||is_pmd_migration_entry (pmde)) { + pvmw->ptl =pmd_lock (mm, pvmw->pmd); + pmde = *pvmw->pmd; +if (likely (pmd_trans_huge (pmde))) { +if (pvmw->flags &PVMW_MIGRATION ) +return not_found (pvmw); +if (pmd_page (pmde) != page) +return not_found (pvmw); +return true; + } +if (!pmd_present (pmde)) { +swp_entry_t entry; + +if (!thp_migration_supported () || + !(pvmw->flags &PVMW_MIGRATION )) +return not_found (pvmw); + entry =pmd_to_swp_entry (pmde); +if (!is_migration_entry (entry) || +migration_entry_to_page (entry) != page) +return not_found (pvmw); +return true; + } +/* THP pmd was split under us: handle on pte level */ +spin_unlock (pvmw->ptl); + pvmw->ptl =NULL ; + }else if (!pmd_present (pmde)) { +/* +* If PVMW_SYNC, take and drop THP pmd lock so that we +* cannot return prematurely, while zap_huge_pmd() has +* cleared *pmd but not decremented compound_mapcount(). +*/ +if ((pvmw->flags &PVMW_SYNC ) && +PageTransCompound (page)) { +spinlock_t *ptl =pmd_lock (mm, pvmw->pmd); + +spin_unlock (ptl); + } +return false; } -return false; +if (!map_pte (pvmw)) + goto next_pte; } -if (!map_pte (pvmw)) - goto next_pte;while (1 ) {unsigned long end;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 62/71 mm: page_vma_mapped_walk(): use goto instead of while (1)
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
page_vma_mapped_walk() cleanup: add a label this_pte, matching next_pte, and use "goto this_pte", in place of the "while (1)" loop at the end.
--- mm/page_vma_mapped.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
mm/page_vma_mapped.c +3 -4
@@ -139,6 +139,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) {struct mm_struct *mm = pvmw->vma->vm_mm;struct page *page = pvmw->page; +unsigned long end;pgd_t *pgd;p4d_t *p4d;pud_t *pud;
@@ -228,10 +229,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) }if (!map_pte (pvmw)) goto next_pte; - } -while (1 ) { -unsigned long end; - +this_pte:if (check_pte (pvmw))return true; next_pte:
@@ -260,6 +258,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) pvmw->ptl =pte_lockptr (mm, pvmw->pmd);spin_lock (pvmw->ptl); } + goto this_pte; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 63/71 mm: page_vma_mapped_walk(): get vma_address_end() earlier
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
page_vma_mapped_walk() cleanup: get THP's vma_address_end() at the start, rather than later at next_pte.
It's a little unnecessary overhead on the first call, but makes for a simpler loop in the following commit.
--- mm/page_vma_mapped.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
mm/page_vma_mapped.c +9 -4
@@ -166,6 +166,15 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)return true; } +/* +* Seek to next pte only makes sense for THP. +* But more important than that optimization, is to filter out +* any PageKsm page: whose page->index misleads vma_address() +* and vma_address_end() to disaster. +*/ + end =PageTransCompound (page) ? +vma_address_end (page, pvmw->vma) : + pvmw->address +PAGE_SIZE ;if (pvmw->pte) goto next_pte; restart:
@@ -233,10 +242,6 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)if (check_pte (pvmw))return true; next_pte: -/* Seek to next pte only makes sense for THP */ -if (!PageTransHuge (page)) -return not_found (pvmw); - end =vma_address_end (page, pvmw->vma); do { pvmw->address += PAGE_SIZE; if (pvmw->address >= end)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 64/71 mm/thp: fix page_vma_mapped_walk() if THP mapped by ptes
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
Running certain tests with a DEBUG_VM kernel would crash within hours, on the total_mapcount BUG() in split_huge_page_to_list(), while trying to free up some memory by punching a hole in a shmem huge page: split's try_to_unmap() was unable to find all the mappings of the page (which, on a !DEBUG_VM kernel, would then keep the huge page pinned in memory).
Crash dumps showed two tail pages of a shmem huge page remained mapped by pte: ptes in a non-huge-aligned vma of a gVisor process, at the end of a long unmapped range; and no page table had yet been allocated for the head of the huge page to be mapped into.
Although designed to handle these odd misaligned huge-page-mapped-by-pte cases, page_vma_mapped_walk() falls short by returning false prematurely when !pmd_present or !pud_present or !p4d_present or !pgd_present: there are cases when a huge page may span the boundary, with ptes present in the next.
Restructure page_vma_mapped_walk() as a loop to continue in these cases, while keeping its layout much as before. Add a step_forward() helper to advance pvmw->address across those boundaries: originally I tried to use mm's standard p?d_addr_end() macros, but hit the same crash 512 times less often: because of the way redundant levels are folded together, but folded differently in different configurations, it was just too difficult to use them correctly; and step_forward() is simpler anyway.
--- mm/page_vma_mapped.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)
mm/page_vma_mapped.c +25 -9
@@ -111,6 +111,13 @@ static bool check_pte(struct page_vma_mapped_walk *pvmw)return pfn_in_hpage (pvmw->page, pfn); } +static void step_forward (struct page_vma_mapped_walk *pvmw,unsigned long size) +{ + pvmw->address = (pvmw->address + size) & ~(size -1 ); +if (!pvmw->address) + pvmw->address =ULONG_MAX ; +} +/** * page_vma_mapped_walk - check if @pvmw->page is mapped in @pvmw->vma at * @pvmw->address
@@ -178,16 +185,22 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)if (pvmw->pte) goto next_pte; restart: - { + do { pgd = pgd_offset(mm, pvmw->address); -if (!pgd_present (*pgd)) -return false; + if (!pgd_present(*pgd)) { + step_forward(pvmw, PGDIR_SIZE); + continue; + } p4d = p4d_offset(pgd, pvmw->address); -if (!p4d_present (*p4d)) -return false; + if (!p4d_present(*p4d)) { + step_forward(pvmw, P4D_SIZE); + continue; + } pud = pud_offset(p4d, pvmw->address); -if (!pud_present (*pud)) -return false; + if (!pud_present(*pud)) { + step_forward(pvmw, PUD_SIZE); + continue; + } pvmw->pmd = pmd_offset(pud, pvmw->address); /*
@@ -234,7 +247,8 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)spin_unlock (ptl); } -return false; +step_forward (pvmw,PMD_SIZE ); +continue ; }if (!map_pte (pvmw)) goto next_pte;
@@ -264,7 +278,9 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)spin_lock (pvmw->ptl); } goto this_pte; - } + }while (pvmw->address < end); + +return false; }/**
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 65/71 mm/thp: another PVMW_SYNC fix in page_vma_mapped_walk()
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
Aha! Shouldn't that quick scan over pte_none()s make sure that it holds ptlock in the PVMW_SYNC case? That too might have been responsible for BUGs or WARNs in split_huge_page_to_list() or its unmap_page(), though I've never seen any.
--- mm/page_vma_mapped.c | 4 ++++ 1 file changed, 4 insertions(+)
mm/page_vma_mapped.c +4 -0
@@ -271,6 +271,10 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) goto restart; } pvmw->pte++; +if ((pvmw->flags &PVMW_SYNC ) && !pvmw->ptl) { + pvmw->ptl =pte_lockptr (mm, pvmw->pmd); +spin_lock (pvmw->ptl); + } }while (pte_none (*pvmw->pte));if (!pvmw->ptl) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 66/71 mm, futex: fix shared futex pgoff on shmem huge page
In reply to Sasha LevinFrom: Hugh Dickins <[email protected]>
[ Upstream commit fe19bd3dae3d15d2fbfdb3de8839a6ea0fe94264 ]
If more than one futex is placed on a shmem huge page, it can happen that waking the second wakes the first instead, and leaves the second
waiting: the key's shared.pgoff is wrong.
When 3.11 commit 13d60f4b6ab5 ("futex: Take hugepages into account when generating futex_key"), the only shared huge pages came from hugetlbfs, and the code added to deal with its exceptional page->index was put into hugetlb source. Then that was missed when 4.8 added shmem huge pages.
page_to_pgoff() is what others use for this nowadays: except that, as currently written, it gives the right answer on hugetlbfs head, but nonsense on hugetlbfs tails. Fix that by calling hugetlbfs-specific hugetlb_basepage_index() on PageHuge tails as well as on head.
Yes, it's unconventional to declare hugetlb_basepage_index() there in pagemap.h, rather than in hugetlb.h; but I do not expect anything but page_to_pgoff() ever to need it.
[[email protected]: give hugetlb_basepage_index() prototype the correct scope]
Note on stable backport: leave redundant #include <linux/hugetlb.h> in kernel/futex.c, to avoid conflict over the header files included.
--- include/linux/hugetlb.h | 16 ---------------- include/linux/pagemap.h | 13 +++++++------ kernel/futex.c | 2 +- mm/hugetlb.c | 5 +---- 4 files changed, 9 insertions(+), 27 deletions(-)
include/linux/hugetlb.h +0 -16
@@ -469,17 +469,6 @@ static inline int hstate_index(struct hstate *h)return h - hstates; } -pgoff_t __basepage_index (struct page *page); - -/* Return page->index in PAGE_SIZE units */ -static inline pgoff_t basepage_index (struct page *page) -{ -if (!PageCompound (page)) -return page->index; - -return __basepage_index (page); -} -extern int dissolve_free_huge_page (struct page *page);extern int dissolve_free_huge_pages (unsigned long start_pfn,unsigned long end_pfn);
@@ -695,11 +684,6 @@ static inline int hstate_index(struct hstate *h)return 0 ; } -static inline pgoff_t basepage_index (struct page *page) -{ -return page->index; -} -static inline int dissolve_free_huge_page (struct page *page) {return 0 ;
include/linux/pagemap.h +7 -6
@@ -397,7 +397,7 @@ static inline struct page *read_mapping_page(struct address_space *mapping, }/* -* Get index of the page with in radix-tree +* Get index of the page within radix-tree (but not for hugetlb pages). * (TODO: remove once hugetlb pages will have ->index in PAGE_SIZE) */ static inline pgoff_t page_to_index (struct page *page)
@@ -416,15 +416,16 @@ static inline pgoff_t page_to_index(struct page *page)return pgoff; } +extern pgoff_t hugetlb_basepage_index (struct page *page); +/* -* Get the offset in PAGE_SIZE. -* (TODO: hugepage should have ->index in PAGE_SIZE) +* Get the offset in PAGE_SIZE (even for hugetlb pages). +* (TODO: hugetlb pages should have ->index in PAGE_SIZE) */ static inline pgoff_t page_to_pgoff (struct page *page) { -if (unlikely (PageHeadHuge (page))) -return page->index <<compound_order (page); - +if (unlikely (PageHuge (page))) +return hugetlb_basepage_index (page);return page_to_index (page); }
kernel/futex.c +1 -1
@@ -737,7 +737,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, enum futex_a key->both.offset |=FUT_OFF_INODE ;/* inode-based key */ key->shared.i_seq =get_inode_sequence_number (inode); - key->shared.pgoff =basepage_index (tail); + key->shared.pgoff =page_to_pgoff (tail);rcu_read_unlock (); }
mm/hugetlb.c +1 -4
@@ -1461,15 +1461,12 @@ int PageHeadHuge(struct page *page_head)return get_compound_page_dtor (page_head) == free_huge_page; } -pgoff_t __basepage_index (struct page *page) +pgoff_t hugetlb_basepage_index (struct page *page) {struct page *page_head =compound_head (page);pgoff_t index =page_index (page_head);unsigned long compound_idx; -if (!PageHuge (page_head)) -return page_index (page); -if (compound_order (page_head) >=MAX_ORDER ) compound_idx =page_to_pfn (page) -page_to_pfn (page_head);else
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 67/71 certs: Add wrapper function to check blacklisted binary hash
In reply to Sasha LevinFrom: Nayna Jain <[email protected]>
[ Upstream commit 2434f7d2d488c3301ae81f1031e1c66c6f076fb7 ]
The -EKEYREJECTED error returned by existing is_hash_blacklisted() is misleading when called for checking against blacklisted hash of a binary.
This patch adds a wrapper function is_binary_blacklisted() to return -EPERM error if binary is blacklisted.
--- certs/blacklist.c | 9 +++++++++ include/keys/system_keyring.h | 6 ++++++ 2 files changed, 15 insertions(+)
certs/blacklist.c +9 -0
@@ -135,6 +135,15 @@ int is_hash_blacklisted(const u8 *hash, size_t hash_len, const char *type) }EXPORT_SYMBOL_GPL (is_hash_blacklisted); +int is_binary_blacklisted (const u8 *hash,size_t hash_len) +{ +if (is_hash_blacklisted (hash, hash_len,"bin" ) == -EKEYREJECTED ) +return -EPERM ; + +return 0 ; +} +EXPORT_SYMBOL_GPL (is_binary_blacklisted); +/* * Initialise the blacklist */
include/keys/system_keyring.h +6 -0
@@ -35,12 +35,18 @@ extern int restrict_link_by_builtin_and_secondary_trusted(extern int mark_hash_blacklisted (const char *hash);extern int is_hash_blacklisted (const u8 *hash,size_t hash_len,const char *type); +extern int is_binary_blacklisted (const u8 *hash,size_t hash_len);#else static inline int is_hash_blacklisted (const u8 *hash,size_t hash_len,const char *type) {return 0 ; } + +static inline int is_binary_blacklisted (const u8 *hash,size_t hash_len) +{ +return 0 ; +}#endif #ifdef CONFIG_IMA_BLACKLIST_KEYRING
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 68/71 x86/efi: move common keyring handler functions to new file
In reply to Sasha LevinFrom: Nayna Jain <[email protected]>
[ Upstream commit ad723674d6758478829ee766e3f1a2a24d56236f ]
The handlers to add the keys to the .platform keyring and blacklisted hashes to the .blacklist keyring is common for both the uefi and powerpc mechanisms of loading the keys/hashes from the firmware.
This patch moves the common code from load_uefi.c to keyring_handler.c
--- security/integrity/Makefile | 3 +- .../platform_certs/keyring_handler.c | 80 +++++++++++++++++++ .../platform_certs/keyring_handler.h | 32 ++++++++ security/integrity/platform_certs/load_uefi.c | 67 +--------------- 4 files changed, 115 insertions(+), 67 deletions(-) create mode 100644 security/integrity/platform_certs/keyring_handler.c create mode 100644 security/integrity/platform_certs/keyring_handler.h
security/integrity/Makefile +2 -1
@@ -11,7 +11,8 @@ integrity-$(CONFIG_INTEGRITY_SIGNATURE) += digsig.o integrity-$(CONFIG_INTEGRITY_ASYMMETRIC_KEYS) += digsig_asymmetric.o integrity-$(CONFIG_INTEGRITY_PLATFORM_KEYRING) += platform_certs/platform_keyring.o integrity-$(CONFIG_LOAD_UEFI_KEYS) += platform_certs/efi_parser.o \ - platform_certs/load_uefi.o + platform_certs/load_uefi.o \ + platform_certs/keyring_handler.o integrity-$(CONFIG_LOAD_IPL_KEYS) += platform_certs/load_ipl_s390.o obj-$(CONFIG_IMA) += ima/
security/integrity/platform_certs/keyring_handler.c new file +80 -0
80 lines not on this page · raw message
security/integrity/platform_certs/keyring_handler.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef PLATFORM_CERTS_INTERNAL_H +#define PLATFORM_CERTS_INTERNAL_H + +#include <linux/efi.h> + +void blacklist_hash (const char *source,const void *data, +size_t len,const char *type, +size_t type_len); + +/* +* Blacklist an X509 TBS hash. +*/ +void blacklist_x509_tbs (const char *source,const void *data,size_t len); + +/* +* Blacklist the hash of an executable. +*/ +void blacklist_binary (const char *source,const void *data,size_t len); + +/* +* Return the handler for particular signature list types found in the db. +*/ +efi_element_handler_t get_handler_for_db (const efi_guid_t *sig_type); + +/* +* Return the handler for particular signature list types found in the dbx. +*/ +efi_element_handler_t get_handler_for_dbx (const efi_guid_t *sig_type); + +#endif
security/integrity/platform_certs/load_uefi.c +1 -66
79 lines not on this page · raw message
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 69/71 certs: Add EFI_CERT_X509_GUID support for dbx entries
In reply to Sasha LevinFrom: Eric Snowberg <[email protected]>
[ Upstream commit 56c5812623f95313f6a46fbf0beee7fa17c68bbf ]
This fixes CVE-2020-26541.
The Secure Boot Forbidden Signature Database, dbx, contains a list of now revoked signatures and keys previously approved to boot with UEFI Secure Boot enabled. The dbx is capable of containing any number of EFI_CERT_X509_SHA256_GUID, EFI_CERT_SHA256_GUID, and EFI_CERT_X509_GUID entries.
Currently when EFI_CERT_X509_GUID are contained in the dbx, the entries are skipped.
Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.
[DH: Made the following changes:
- Added to have a config option to enable the facility. This allows a Kconfig solution to make sure that pkcs7_validate_trust() is enabled.[1][2]
- Moved the functions out from the middle of the blacklist functions.
- Added kerneldoc comments.]
--- certs/Kconfig | 9 ++++ certs/blacklist.c | 43 +++++++++++++++++++ certs/blacklist.h | 2 + certs/system_keyring.c | 6 +++ include/keys/system_keyring.h | 15 +++++++ .../platform_certs/keyring_handler.c | 11 +++++ 6 files changed, 86 insertions(+)
certs/Kconfig +9 -0
@@ -83,4 +83,13 @@ config SYSTEM_BLACKLIST_HASH_LIST wrapper to incorporate the list into the kernel. Each <hash> should be a string of hex digits. +config SYSTEM_REVOCATION_LIST + bool "Provide system-wide ring of revocation certificates" + depends on SYSTEM_BLACKLIST_KEYRING + depends on PKCS7_MESSAGE_PARSER=y + help + If set, this allows revocation certificates to be stored in the + blacklist keyring and implements a hook whereby a PKCS#7 message can + be checked to see if it matches such a certificate. + endmenu
certs/blacklist.c +43 -0
49 lines not on this page · raw message
certs/blacklist.h +2 -0
@@ -1,3 +1,5 @@#include <linux/kernel.h> +#include <linux/errno.h> +#include <crypto/pkcs7.h> extern const char __initconst *const blacklist_hashes[];
certs/system_keyring.c +6 -0
@@ -241,6 +241,12 @@ int verify_pkcs7_message_sig(const void *data, size_t len,pr_devel ("PKCS#7 platform keyring is not available\n" ); goto error; } + + ret =is_key_on_revocation_list (pkcs7); +if (ret != -ENOKEY ) { +pr_devel ("PKCS#7 platform key is on revocation list\n" ); + goto error; + } } ret =pkcs7_validate_trust (pkcs7, trusted_keys);if (ret <0 ) {
include/keys/system_keyring.h +15 -0
@@ -31,6 +31,7 @@ extern int restrict_link_by_builtin_and_secondary_trusted(#define restrict_link_by_builtin_and_secondary_trusted restrict_link_by_builtin_trusted#endif +extern struct pkcs7_message *pkcs7;#ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING extern int mark_hash_blacklisted (const char *hash); extern int is_hash_blacklisted(const u8 *hash, size_t hash_len,
@@ -49,6 +50,20 @@ static inline int is_binary_blacklisted(const u8 *hash, size_t hash_len) }#endif +#ifdef CONFIG_SYSTEM_REVOCATION_LIST +extern int add_key_to_revocation_list (const char *data,size_t size); +extern int is_key_on_revocation_list (struct pkcs7_message *pkcs7); +#else +static inline int add_key_to_revocation_list (const char *data,size_t size) +{ +return 0 ; +} +static inline int is_key_on_revocation_list (struct pkcs7_message *pkcs7) +{ +return -ENOKEY ; +} +#endif +#ifdef CONFIG_IMA_BLACKLIST_KEYRING extern struct key *ima_blacklist_keyring;
security/integrity/platform_certs/keyring_handler.c +11 -0
@@ -55,6 +55,15 @@ static __init void uefi_blacklist_binary(const char *source,uefi_blacklist_hash (source, data, len,"bin:" ,4 ); } +/* +* Add an X509 cert to the revocation list. +*/ +static __init void uefi_revocation_list_x509 (const char *source, +const void *data,size_t len) +{ +add_key_to_revocation_list (data, len); +} +/* * Return the appropriate handler for particular signature list types found in * the UEFI db and MokListRT tables.
@@ -76,5 +85,7 @@ __init efi_element_handler_t get_handler_for_dbx(const efi_guid_t *sig_type)return uefi_blacklist_x509_tbs;if (efi_guidcmp (*sig_type, efi_cert_sha256_guid) ==0 )return uefi_blacklist_binary; +if (efi_guidcmp (*sig_type, efi_cert_x509_guid) ==0 ) +return uefi_revocation_list_x509;return 0 ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 70/71 certs: Move load_system_certificate_list to a common function
In reply to Sasha LevinFrom: Eric Snowberg <[email protected]>
[ Upstream commit 2565ca7f5ec1a98d51eea8860c4ab923f1ca2c85 ]
Move functionality within load_system_certificate_list to a common function, so it can be reused in the future.
DH Changes:
- Added inclusion of common.h to common.c (Eric [1]).
--- certs/Makefile | 2 +- certs/common.c | 57 ++++++++++++++++++++++++++++++++++++++++++ certs/common.h | 9 +++++++ certs/system_keyring.c | 49 +++--------------------------------- 4 files changed, 70 insertions(+), 47 deletions(-) create mode 100644 certs/common.c create mode 100644 certs/common.h
certs/Makefile +1 -1
@@ -3,7 +3,7 @@ # Makefile for the linux kernel signature checking certificates. # -obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o +obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o common.o obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o ifneq ($(CONFIG_SYSTEM_BLACKLIST_HASH_LIST),"") obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_hashes.o
certs/common.c new file +57 -0
57 lines not on this page · raw message
certs/common.h new file +9 -0
@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef _CERT_COMMON_H +#define _CERT_COMMON_H + +int load_certificate_list (const u8 cert_list[],const unsigned long list_size, +const struct key *keyring); + +#endif
certs/system_keyring.c +3 -46
63 lines not on this page · raw message
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 71/71 Linux 5.4.129-rc1
In reply to Sasha Levin--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -1,8 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 4 -SUBLEVEL = 128 -EXTRAVERSION = +SUBLEVEL = 129 +EXTRAVERSION = -rc1 NAME = Kleptomaniac Octopus # *DOCUMENTATION*
Signature · 1 line
2.30.2
Quoted 11 lines · Sasha Levin
This is the start of the stable review cycle for the 5.4.129 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:29:43 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.4.y&id2=v5.4.128
My tools are failing on this link. Is it possible to keep the rc patch convention consistent with Greg KH's naming scheme?
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.128-rc1.gz
thanks,
-- Shuah
Sasha Levin
maintainerQuoted 10 lines · Shuah Khan
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.4.129 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:29:43 PM UTC. Anything received after that time might be too late.
Quoted 8 lines
Quoted 2 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.4.y&id2=v5.4.128My tools are failing on this link. Is it possible to keep the rc patch convention consistent with Greg KH's naming scheme?
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.128-rc1.gz
I don't mind changing that if Greg can set up the permissions around it. Last time we discussed it, it seemed like a pain to do so.
Signature · 2 lines
Thanks, Sasha
Greg Kroah-Hartman
maintainerQuoted 17 lines · Sasha Levin
Quoted 16 lines · Shuah Khan
Quoted 11 lines · Sasha Levin
This is the start of the stable review cycle for the 5.4.129 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:29:43 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.4.y&id2=v5.4.128My tools are failing on this link. Is it possible to keep the rc patch convention consistent with Greg KH's naming scheme?
Quoted 6 lines
Quoted 3 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.128-rc1.gzI don't mind changing that if Greg can set up the permissions around it. Last time we discussed it, it seemed like a pain to do so.
Last I looked, it was a pain :)
Greg Kroah-Hartman
maintainerQuoted 7 lines · Shuah Khan
Quoted 6 lines · Sasha Levin
This is the start of the stable review cycle for the 5.4.129 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Quoted 5 lines
Responses should be made by Wed 30 Jun 2021 02:29:43 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.4.y&id2=v5.4.128My tools are failing on this link. Is it possible to keep the rc patch convention consistent with Greg KH's naming scheme?
What is failing on this, the use of "&" in the link? The patch itself from this link works for me.
thanks,
greg k-h
Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Shuah Khan
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.4.129 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:29:43 PM UTC. Anything received after that time might be too late.
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.4.y&id2=v5.4.128My tools are failing on this link. Is it possible to keep the rc patch convention consistent with Greg KH's naming scheme?
What is failing on this, the use of "&" in the link? The patch itself from this link works for me.
The link itself is good. My scripts assumes patch-5.4.128-rc1.gz naming convention. I can adjust my scripts to work with either.
Easier to adjust my script if it is a pain to adjust on your end. :)
thanks,
-- Shuah
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.4.129 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:29:43 PM UTC. Anything received after that time might be too late.
Quoted 9 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.4.y&id2=v5.4.128or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.Thanks,
Sasha
Tested on arm64 and x86 for 5.4.129-rc1,
Kernel repo:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Branch: linux-5.4.y
Version: 5.4.129-rc1
Commit: 34ca10ff0a1cff9337369b26c66bb5fb1ce1f8d8
Compiler: gcc version 7.3.0 (GCC)
arm64:
--------------------------------------------------------------------
Testcase Result Summary:
total: 8905
passed: 8905
failed: 0
timeout: 0
--------------------------------------------------------------------
x86:
--------------------------------------------------------------------
Testcase Result Summary:
total: 8905
passed: 8905
failed: 0
timeout: 0
--------------------------------------------------------------------
Quoted 10 lines · Sasha Levin
This is the start of the stable review cycle for the 5.4.129 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:29:43 PM UTC. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.4.y&id2=v5.4.128or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.Thanks,
Sasha
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 5.4.129-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git branch: linux-5.4.y
* git commit: aeef06043807450ba2a47bc9f5f06c23fc8d9ff9
* git describe: v5.4.128-71-gaeef06043807
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.4.y/build/v5.4.128-71-gaeef06043807
## No regressions (compared to v5.4.128-11-g44abe5613656)
## No fixes (compared to v5.4.128-11-g44abe5613656)
## Test result summary
total: 69899, pass: 56272, fail: 1308, skip: 11360, xfail: 959,
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 192 total, 192 passed, 0 failed
* arm64: 26 total, 26 passed, 0 failed
* dragonboard-410c: 1 total, 1 passed, 0 failed
* hi6220-hikey: 1 total, 1 passed, 0 failed
* i386: 15 total, 15 passed, 0 failed
* juno-r2: 1 total, 1 passed, 0 failed
* mips: 45 total, 45 passed, 0 failed
* parisc: 9 total, 9 passed, 0 failed
* powerpc: 27 total, 27 passed, 0 failed
* riscv: 21 total, 21 passed, 0 failed
* s390: 9 total, 9 passed, 0 failed
* sh: 18 total, 18 passed, 0 failed
* sparc: 9 total, 9 passed, 0 failed
* x15: 1 total, 1 passed, 0 failed
* x86: 1 total, 1 passed, 0 failed
* x86_64: 26 total, 26 passed, 0 failed
## Test suites summary
* fwts
* igt-gpu-tools
* install-android-platform-tools-r2600
* kselftest-
* kselftest-android
* kselftest-bpf
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* rcutorture
* ssuite
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.4.129 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:29:43 PM UTC. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.4.y&id2=v5.4.128or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.Thanks,
Sasha
All tests passing for Tegra ...
Test results for stable-v5.4:
12 builds: 12 pass, 0 fail
26 boots: 26 pass, 0 fail
59 tests: 59 pass, 0 failLinux version: 5.4.129-rc1-gaeef06043807
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Jon
Hi Sasha,
Quoted 8 lines · Sasha Levin
This is the start of the stable review cycle for the 5.4.129 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:29:43 PM UTC. Anything received after that time might be too late.
Build test:
mips (gcc version 11.1.1 20210615): 65 configs -> no failure arm (gcc version 11.1.1 20210615): 107 configs -> no new failure arm64 (gcc version 11.1.1 20210615): 2 configs -> no failure x86_64 (gcc version 10.2.1 20210110): 2 configs -> no failure
Boot test:x86_64: Booted on my test laptop. No regression.x86_64: Booted on qemu. No regression.
--
Regards
Sudip
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.4.129 release. There are 71 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed 30 Jun 2021 02:29:43 PM UTC. Anything received after that time might be too late.
Build results:
total: 157 pass: 157 fail: 0 Qemu test results: total: 428 pass: 428 fail: 0
Guenter