This is the start of the stable review cycle for the 4.14.311 release.
There are 30 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, 22 Mar 2023 14:54:08 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.311-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.14.311-rc1
Lee Jones <lee(a)kernel.org>
HID: uhid: Over-ride the default maximum data buffer value with our own
Lee Jones <lee(a)kernel.org>
HID: core: Provide new max_buffer_size attribute to over-ride the default
Biju Das <biju.das.jz(a)bp.renesas.com>
serial: 8250_em: Fix UART port type
John Harrison <John.C.Harrison(a)Intel.com>
drm/i915: Don't use stolen memory for ring buffers with LLC
Helge Deller <deller(a)gmx.de>
fbdev: stifb: Provide valid pixelclock and add fb_check_var() checks
Chen Zhongjin <chenzhongjin(a)huawei.com>
ftrace: Fix invalid address access in lookup_rec() when index is 0
Michael Karcher <kernel(a)mkarcher.dialup.fu-berlin.de>
sh: intc: Avoid spurious sizeof-pointer-div warning
Baokun Li <libaokun1(a)huawei.com>
ext4: fix task hung in ext4_xattr_delete_inode
Baokun Li <libaokun1(a)huawei.com>
ext4: fail ext4_iget if special inode unallocated
David Gow <davidgow(a)google.com>
rust: arch/um: Disable FP/SIMD instruction to match x86
Tobias Schramm <t.schramm(a)manjaro.org>
mmc: atmel-mci: fix race between stop command and start of next command
Linus Torvalds <torvalds(a)linux-foundation.org>
media: m5mols: fix off-by-one loop termination error
Zheng Wang <zyytlz.wz(a)163.com>
hwmon: (xgene) Fix use after free bug in xgene_hwmon_remove due to race condition
Tony O'Brien <tony.obrien(a)alliedtelesis.co.nz>
hwmon: (adt7475) Fix masking of hysteresis registers
Tony O'Brien <tony.obrien(a)alliedtelesis.co.nz>
hwmon: (adt7475) Display smoothing attributes in correct order
Liang He <windhl(a)126.com>
ethernet: sun: add check for the mdesc_grab()
Alexandra Winter <wintera(a)linux.ibm.com>
net/iucv: Fix size of interrupt data
Szymon Heidrich <szymon.heidrich(a)gmail.com>
net: usb: smsc75xx: Move packet length check to prevent kernel panic in skb_pull
Ido Schimmel <idosch(a)nvidia.com>
ipv4: Fix incorrect table ID in IOCTL path
Liang He <windhl(a)126.com>
block: sunvdc: add check for mdesc_grab() returning NULL
Damien Le Moal <damien.lemoal(a)opensource.wdc.com>
nvmet: avoid potential UAF in nvmet_req_complete()
Szymon Heidrich <szymon.heidrich(a)gmail.com>
net: usb: smsc75xx: Limit packet length to skb->len
Zheng Wang <zyytlz.wz(a)163.com>
nfc: st-nci: Fix use after free bug in ndlc_remove due to race condition
Heiner Kallweit <hkallweit1(a)gmail.com>
net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails
Eric Dumazet <edumazet(a)google.com>
net: tunnels: annotate lockless accesses to dev->needed_headroom
Daniil Tatianin <d-tatianin(a)yandex-team.ru>
qed/qed_dev: guard against a possible division by zero
Fedor Pchelkin <pchelkin(a)ispras.ru>
nfc: pn533: initialize struct pn533_out_arg properly
Breno Leitao <leitao(a)debian.org>
tcp: tcp_make_synack() can be called from process context
Eric Biggers <ebiggers(a)kernel.org>
fs: sysfs_emit_at: Remove PAGE_SIZE alignment check
Eric Biggers <ebiggers(a)google.com>
ext4: fix cgroup writeback accounting with fs-layer encryption
-------------
Diffstat:
Makefile | 4 ++--
arch/x86/Makefile.um | 6 ++++++
drivers/block/sunvdc.c | 2 ++
drivers/gpu/drm/i915/intel_ringbuffer.c | 5 +++--
drivers/hid/hid-core.c | 18 +++++++++++++-----
drivers/hid/uhid.c | 1 +
drivers/hwmon/adt7475.c | 8 ++++----
drivers/hwmon/xgene-hwmon.c | 1 +
drivers/media/i2c/m5mols/m5mols_core.c | 2 +-
drivers/mmc/host/atmel-mci.c | 3 ---
drivers/net/ethernet/qlogic/qed/qed_dev.c | 5 +++++
drivers/net/ethernet/sun/ldmvsw.c | 3 +++
drivers/net/ethernet/sun/sunvnet.c | 3 +++
drivers/net/phy/smsc.c | 5 ++++-
drivers/net/usb/smsc75xx.c | 7 +++++++
drivers/nfc/pn533/usb.c | 1 +
drivers/nfc/st-nci/ndlc.c | 6 ++++--
drivers/nvme/target/core.c | 4 +++-
drivers/tty/serial/8250/8250_em.c | 4 ++--
drivers/video/fbdev/stifb.c | 27 +++++++++++++++++++++++++++
fs/ext4/inode.c | 18 ++++++++----------
fs/ext4/page-io.c | 11 ++++++-----
fs/ext4/xattr.c | 11 +++++++++++
fs/sysfs/file.c | 2 +-
include/linux/hid.h | 3 +++
include/linux/netdevice.h | 6 ++++--
include/linux/sh_intc.h | 5 ++++-
kernel/trace/ftrace.c | 3 ++-
net/ipv4/fib_frontend.c | 3 +++
net/ipv4/ip_tunnel.c | 12 ++++++------
net/ipv4/tcp_output.c | 2 +-
net/ipv6/ip6_tunnel.c | 4 ++--
net/iucv/iucv.c | 2 +-
33 files changed, 144 insertions(+), 53 deletions(-)
The patch titled
Subject: mm/hugetlb: fix uffd wr-protection for CoW optimization path
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patche…
This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Peter Xu <peterx(a)redhat.com>
Subject: mm/hugetlb: fix uffd wr-protection for CoW optimization path
Date: Tue, 21 Mar 2023 15:18:40 -0400
This patch fixes an issue that a hugetlb uffd-wr-protected mapping can be
writable even with uffd-wp bit set. It only happens with all these
conditions met: (1) hugetlb memory (2) private mapping (3) original
mapping was missing, then (4) being wr-protected (IOW, pte marker
installed). Then write to the page to trigger.
Userfaultfd-wp trap for hugetlb was implemented in hugetlb_fault() before
even reaching hugetlb_wp() to avoid taking more locks that userfault won't
need. However there's one CoW optimization path for missing hugetlb page
that can trigger hugetlb_wp() inside hugetlb_no_page(), that can bypass
the userfaultfd-wp traps.
A few ways to resolve this:
(1) Skip the CoW optimization for hugetlb private mapping, considering
that private mappings for hugetlb should be very rare, so it may not
really be helpful to major workloads. The worst case is we only skip the
optimization if userfaultfd_wp(vma)==true, because uffd-wp needs another
fault anyway.
(2) Move the userfaultfd-wp handling for hugetlb from hugetlb_fault()
into hugetlb_wp(). The major cons is there're a bunch of locks taken
when calling hugetlb_wp(), and that will make the changeset unnecessarily
complicated due to the lock operations.
(3) Carry over uffd-wp bit in hugetlb_wp(), so it'll need to fault again
for uffd-wp privately mapped pages.
This patch chose option (3) which contains the minimum changeset (simplest
for backport) and also make sure hugetlb_wp() itself will start to be
always safe with uffd-wp ptes even if called elsewhere in the future.
This patch will be needed for v5.19+ hence copy stable.
Link: https://lkml.kernel.org/r/20230321191840.1897940-1-peterx@redhat.com
Fixes: 166f3ecc0daf ("mm/hugetlb: hook page faults for uffd write protection")
Signed-off-by: Peter Xu <peterx(a)redhat.com>
Reported-by: Muhammad Usama Anjum <usama.anjum(a)collabora.com>
Acked-by: David Hildenbrand <david(a)redhat.com>
Reviewed-by: Mike Kravetz <mike.kravetz(a)oracle.com>
Cc: Andrea Arcangeli <aarcange(a)redhat.com>
Cc: Axel Rasmussen <axelrasmussen(a)google.com>
Cc: Mike Rapoport <rppt(a)linux.vnet.ibm.com>
Cc: Nadav Amit <nadav.amit(a)gmail.com>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
mm/hugetlb.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- a/mm/hugetlb.c~mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path
+++ a/mm/hugetlb.c
@@ -5478,7 +5478,7 @@ static vm_fault_t hugetlb_wp(struct mm_s
struct folio *pagecache_folio, spinlock_t *ptl)
{
const bool unshare = flags & FAULT_FLAG_UNSHARE;
- pte_t pte;
+ pte_t pte, newpte;
struct hstate *h = hstate_vma(vma);
struct page *old_page;
struct folio *new_folio;
@@ -5622,8 +5622,10 @@ retry_avoidcopy:
mmu_notifier_invalidate_range(mm, range.start, range.end);
page_remove_rmap(old_page, vma, true);
hugepage_add_new_anon_rmap(new_folio, vma, haddr);
- set_huge_pte_at(mm, haddr, ptep,
- make_huge_pte(vma, &new_folio->page, !unshare));
+ newpte = make_huge_pte(vma, &new_folio->page, !unshare);
+ if (huge_pte_uffd_wp(pte))
+ newpte = huge_pte_mkuffd_wp(newpte);
+ set_huge_pte_at(mm, haddr, ptep, newpte);
folio_set_hugetlb_migratable(new_folio);
/* Make the old page be freed below */
new_folio = page_folio(old_page);
_
Patches currently in -mm which might be from peterx(a)redhat.com are
kselftest-vm-fix-unused-variable-warning.patch
tools-headers-uapi-sync-linux-prctlh-with-the-kernel-sources.patch
mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path.patch
mm-khugepaged-alloc_charge_hpage-take-care-of-mem-charge-errors.patch
mm-khugepaged-cleanup-memcg-uncharge-for-failure-path.patch
mm-uffd-uffd_feature_wp_unpopulated.patch
selftests-mm-smoke-test-uffd_feature_wp_unpopulated.patch
mm-thp-rename-transparent_hugepage_never_dax-to-_unsupported.patch
mm-thp-rename-transparent_hugepage_never_dax-to-_unsupported-fix.patch