From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF66DC433EF for ; Thu, 11 Nov 2021 16:11:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C38861252 for ; Thu, 11 Nov 2021 16:11:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8C38861252 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Rw2F8BYRkKRFKUMhDmyg582bbYn4dOAr8EJ0yNH8LHg=; b=v5ngM/tdfxJm+8 WG3Kx4jq4vU5Vd5M4/bkJ2s3Pd3h+RJDcoXlWN8q9y+mY8Oqz+kxymeC4nvXjqlJAp3BibcpxmgVD Zd/IQoJ95iZU/EPlBQYNTNP1kNFkC9Sf3iyvDMkVqosBwkg+Ogizvnb7I/hNCE4W+0jByZ0ajwxkH TS01f0YsOjX7D3U9Wa8sXO3PKf1Tn+522nJoI5rxg3HbwZJeOt85SG/Tc15vdYWOig6KH6J0hRfxR 2zt6/IE5Q20KrJif5+Z5Uys1xI0Cm2FEOccr8OpWGsJE3GdoQ3MjCfoQO2hInc7ErMNWu4LZWHClx 7egRdo2w6J/0wRtU6qtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlCeI-008KTd-Ki; Thu, 11 Nov 2021 16:10:02 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlCeE-008KT1-SR for linux-arm-kernel@lists.infradead.org; Thu, 11 Nov 2021 16:10:00 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5088F6124C; Thu, 11 Nov 2021 16:09:57 +0000 (UTC) Date: Thu, 11 Nov 2021 16:09:54 +0000 From: Catalin Marinas To: Pingfan Liu Cc: linux-arm-kernel@lists.infradead.org, Will Deacon , Pasha Tatashin , James Morse , Matthias Brugger , Ard Biesheuvel Subject: Re: [PATCH] arm64: mm: assign PXN permission in trans_pgd Message-ID: References: <20211111060316.12438-1-kernelfans@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211111060316.12438-1-kernelfans@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211111_080958_955842_F4C6371A X-CRM114-Status: GOOD ( 18.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Nov 11, 2021 at 02:03:16PM +0800, Pingfan Liu wrote: > trans_pgd_create_copy() can hit "VM_BUG_ON(mm != &init_mm)" in the > function pmd_populate_kernel(). I think that's more important to fix than the PXN. You may want to change the subject to something like "Fix VM_BUG_ON ..." > p?d_populate() helpers resort to the input parameter mm_struct to decide > the attribute: UXN or PXN. And plus the fact, either hibernation or > kexec runs in privilege mode. So the bug can be fixed by assigning > &init_mm to the callsites of these helpers. That's the table PXN, so it's not a big deal if we miss it. > Signed-off-by: Pingfan Liu > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Pasha Tatashin > Cc: James Morse > Cc: Matthias Brugger > To: linux-arm-kernel@lists.infradead.org A Fixes: tag would be nice, we just need to decide which. > --- > arch/arm64/mm/trans_pgd.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/mm/trans_pgd.c b/arch/arm64/mm/trans_pgd.c > index d7da8ca40d2e..7b43d179e94d 100644 > --- a/arch/arm64/mm/trans_pgd.c > +++ b/arch/arm64/mm/trans_pgd.c > @@ -67,7 +67,7 @@ static int copy_pte(struct trans_pgd_info *info, pmd_t *dst_pmdp, > dst_ptep = trans_alloc(info); > if (!dst_ptep) > return -ENOMEM; > - pmd_populate_kernel(NULL, dst_pmdp, dst_ptep); > + pmd_populate_kernel(&init_mm, dst_pmdp, dst_ptep); > dst_ptep = pte_offset_kernel(dst_pmdp, start); Commit 5de59884ac0e ("arm64: trans_pgd: pass NULL instead of init_mm to *_populate functions") actually replaced &init_mm with NULL. Commit 59511cfd08f3 ("arm64: mm: use XN table mapping attributes for user/kernel mappings") introduced the VM_BUG_ON. So we either revert Pasha's trans_pgd commit (as per your patch) or we fix Ard's commit to make it aware of a NULL mm and either skip the table UXN altogether or treat it as init_mm. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel