lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c73d1543-532c-3da2-8cf2-a95363a14116@google.com>
Date:   Sun, 23 Jul 2023 15:26:02 -0700 (PDT)
From:   Hugh Dickins <hughd@...gle.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
cc:     Jay Patel <jaypatel@...ux.ibm.com>,
        Aneesh Kumar K V <aneesh.kumar@...ux.ibm.com>,
        Hugh Dickins <hughd@...gle.com>,
        Miaohe Lin <linmiaohe@...wei.com>,
        David Hildenbrand <david@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Yang Shi <shy828301@...il.com>, Peter Xu <peterx@...hat.com>,
        linux-kernel@...r.kernel.org, Song Liu <song@...nel.org>,
        sparclinux@...r.kernel.org,
        Alexander Gordeev <agordeev@...ux.ibm.com>,
        Claudio Imbrenda <imbrenda@...ux.ibm.com>,
        Will Deacon <will@...nel.org>, linux-s390@...r.kernel.org,
        Yu Zhao <yuzhao@...gle.com>, Ira Weiny <ira.weiny@...el.com>,
        Alistair Popple <apopple@...dia.com>,
        Russell King <linux@...linux.org.uk>,
        Matthew Wilcox <willy@...radead.org>,
        Steven Price <steven.price@....com>,
        Christoph Hellwig <hch@...radead.org>,
        Jason Gunthorpe <jgg@...pe.ca>,
        linux-arm-kernel@...ts.infradead.org, Zi Yan <ziy@...dia.com>,
        Huang Ying <ying.huang@...el.com>,
        Axel Rasmussen <axelrasmussen@...gle.com>,
        Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...ux.ibm.com>,
        Thomas Hellstrom <thomas.hellstrom@...ux.intel.com>,
        Ralph Camp bell <rcampbell@...dia.com>,
        Pasha Tatashin <pasha.tatashin@...een.com>,
        Vasily Gorbik <gor@...ux.ibm.com>,
        Anshuman Khandual <anshuman.khandual@....com>,
        Heiko Carstens <hca@...ux.ibm.com>,
        Qi Zheng <zhengqi.arch@...edance.com>,
        Suren Baghdasaryan <surenb@...gle.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        SeongJae Park <sj@...nel.org>,
        Lorenzo Stoakes <lstoakes@...il.com>,
        Jann Horn <jannh@...gle.com>, linux-mm@...ck.org,
        linuxppc-dev@...ts.ozlabs.org,
        Naoya Horiguchi <naoya.horiguchi@....com>,
        Zack Rusin <zackr@...are.com>,
        Vishal Moola <vishal.moola@...il.com>,
        Minchan Kim <minchan@...nel.org>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Mel Gorman <mgorman@...hsingularity.net>,
        "David S. Miller" <davem@...emloft.net>,
        Mike Rapoport <rppt@...nel.org>,
        Mike Kravetz <mike.kravetz@...cle.com>
Subject: [PATCH v3 04/13 fix] powerpc: assert_pte_locked() use pte_offset_map_nolock():
 fix

Aneesh points out that assert_pte_locked() still needs the pmd_none()
check, to stop crashing in khugepaged: restore that comment and check.

Andrew, when merging with original commit, please edit its 1st para to:

Instead of pte_lockptr(), use the recently added pte_offset_map_nolock()
in assert_pte_locked().  BUG if pte_offset_map_nolock() fails.

Signed-off-by: Hugh Dickins <hughd@...gle.com>
---
 arch/powerpc/mm/pgtable.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index 16b061af86d7..a3dcdb2d5b4b 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -323,6 +323,14 @@ void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
 	pud = pud_offset(p4d, addr);
 	BUG_ON(pud_none(*pud));
 	pmd = pmd_offset(pud, addr);
+	/*
+	 * khugepaged to collapse normal pages to hugepage, first set
+	 * pmd to none to force page fault/gup to take mmap_lock. After
+	 * pmd is set to none, we do a pte_clear which does this assertion
+	 * so if we find pmd none, return.
+	 */
+	if (pmd_none(*pmd))
+		return;
 	pte = pte_offset_map_nolock(mm, pmd, addr, &ptl);
 	BUG_ON(!pte);
 	assert_spin_locked(ptl);
-- 
2.35.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ