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 8B597C433EF for ; Fri, 12 Nov 2021 14:51:04 +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 551FE61039 for ; Fri, 12 Nov 2021 14:51:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 551FE61039 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZdQ/E/q7apEImKp+qFgSfMSmsfmlckLa+e96zDjQSNc=; b=LF6O4wo93e9p1N OG7lp6jcRAU00HklnlWcTJsq2DEYlb1cxsi6V/Lqc2sTMHm+px7euMbva0mRoSU9HGcU8HweGGBjm 0N2PMk9rqcQAIw1qyK0ETCv2ciiTOIvXflxOfFrQ1tpiaY7ojUbqlC9f9lFEcKZLvIE6i0iWGHuTe 3EPjwfvUWDh3Q7hyjzqBxs1NK5qZVPiweib5KT1n//yDrnqc0Fw9j3hLilnRMHWAqgvKA2dRsJhQV 7HCfCdLpxykT26YeUykEA2y2XpHF/5TOFPi7iikuSvqaYNTKg6vwBZf7/ItWCndD/VbYcgmz1pkt7 YSmpaZ6RornZpzzAxNFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlXri-00Atpu-NN; Fri, 12 Nov 2021 14:49:19 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlXgj-00Aph9-C0 for linux-arm-kernel@lists.infradead.org; Fri, 12 Nov 2021 14:37:59 +0000 Received: by mail-ed1-x533.google.com with SMTP id m14so38855950edd.0 for ; Fri, 12 Nov 2021 06:37:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yk9FKZracctE3FVNHp58DwBX3GRuq39PGyqtNlx8mKw=; b=fq5/Fnx06ZKv5TJCgXd27CKYgyPGq+J0LKv5OFIGV8fzISED6UfKIPROXOUtkBkm7R v7OMSuIxH0RPgykzpCnl2vJ6MBwKAslMbMlgMxwcQWnBIaI0C5HXVrvmI5pjXF9ICjd+ RWigdhFxMoW5y/m6gk1C/sX57kszNZ++hk5WbrlMGOi/AxqhMEERjx7Q3RiRiXYhfwz/ j19d551DCAx7gTRG/lr4hgB8ARa0AlCJ9U32LxdQYPAfBEYRw70UjDdZSBq8MwuymY/k TIU+FDDgz9QTGOnoGLLp6D7dw1rhM+HxHnMoP2svb7xPg5E0obTKzH60lGmEzNdI3XpP c1Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yk9FKZracctE3FVNHp58DwBX3GRuq39PGyqtNlx8mKw=; b=Dcjtb1CRDc1h531dsN41L5hH5bJYv4jQdw5HYWyYKtXndIwD6w5sylwPvWwYCfExbF HOdIQllJm4fc5mdss4bUHFA9EOKzCN93ga5bmrRWLs70jTtp8XYLRTdSBGeF6On0tyfz aAyHioDGJz7D9BF1WcD8wT9kggAtmVe45VTGZPIcQBEluRRkdxBQw+CYNjepF8AWPCDV EQjoZr19rfzErLxD4aPoDeE9CWN3rZeibRKVZk56+naYvMv7wXoZa9ud6AJ3TgmxqAAI SjjsnzsdfpQzz4qliBUR96sZ76xNkVxlf5toYwTGovTeRMC9+JAUShlXmGibMngVbxXy Tl1g== X-Gm-Message-State: AOAM530juyNKNjBpf//PWSFhNturUR5Nsim9ZinxqUeWPgzK/e4scGgs 4vynwDTQLB48gYyLftPuibNByi77I3CSmlE0nQ2DOw== X-Google-Smtp-Source: ABdhPJy7TA9pCJYrzRPFPTobcEPSO1k5r6WqT+Tv3W7xmoMbri0KFNvWeQXecOxaQPcLNV6k2o+L7JxSnOt+8Vb991w= X-Received: by 2002:a17:906:a041:: with SMTP id bg1mr19991365ejb.470.1636727875298; Fri, 12 Nov 2021 06:37:55 -0800 (PST) MIME-Version: 1.0 References: <20211111060316.12438-1-kernelfans@gmail.com> <20211112052214.9086-1-kernelfans@gmail.com> In-Reply-To: <20211112052214.9086-1-kernelfans@gmail.com> From: Pasha Tatashin Date: Fri, 12 Nov 2021 09:37:18 -0500 Message-ID: Subject: Re: [PATCHv2] arm64: mm: Fix VM_BUG_ON(mm != &init_mm) for trans_pgd To: Pingfan Liu Cc: Linux ARM , Catalin Marinas , Ard Biesheuvel , Will Deacon , James Morse , Matthias Brugger X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211112_063757_501205_984A0447 X-CRM114-Status: GOOD ( 20.82 ) 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 Fri, Nov 12, 2021 at 12:22 AM Pingfan Liu wrote: > > trans_pgd_create_copy() can hit "VM_BUG_ON(mm != &init_mm)" in the > function pmd_populate_kernel(). > > This is the combined consequence of commit 5de59884ac0e ("arm64: > trans_pgd: pass NULL instead of init_mm to *_populate functions"), which > replaced &init_mm with NULL and commit 59511cfd08f3 ("arm64: mm: use XN > table mapping attributes for user/kernel mappings"), which introduced > the VM_BUG_ON. > > Since the former sounds reasonable, it is better to work on the later. > From the perspective of trans_pgd, two groups of functions are > considered in the later one: > > pmd_populate_kernel() > mm == NULL should be fixed, else it hits VM_BUG_ON() > p?d_populate() > mm == NULL means PXN, that is OK, since trans_pgd only copies a > linear map, no execution will happen on the map. > > So it is good enough to just relax VM_BUG_ON() to disregard mm == NULL > > Fixes: 59511cfd08f3 ("arm64: mm: use XN table mapping attributes for user/kernel mappings") > Signed-off-by: Pingfan Liu > Cc: Catalin Marinas > Cc: Ard Biesheuvel > Cc: Will Deacon > Cc: Pasha Tatashin > Cc: James Morse > Cc: Matthias Brugger > To: linux-arm-kernel@lists.infradead.org > --- > arch/arm64/include/asm/pgalloc.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h > index 8433a2058eb1..237224484d0f 100644 > --- a/arch/arm64/include/asm/pgalloc.h > +++ b/arch/arm64/include/asm/pgalloc.h > @@ -76,7 +76,7 @@ static inline void __pmd_populate(pmd_t *pmdp, phys_addr_t ptep, > static inline void > pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep) > { > - VM_BUG_ON(mm != &init_mm); > + VM_BUG_ON(mm && mm != &init_mm); LGTM Reviewed-by: Pasha Tatashin Pasha _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel