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 2234BC433F5 for ; Fri, 12 Nov 2021 05:23:56 +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 CB34C601FF for ; Fri, 12 Nov 2021 05:23:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CB34C601FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xzlDksS/BH83hNuviD6FCubUiUEkmb1nW1VFbOcX0AQ=; b=x4R3eaDOZobT3k T/Ckpm4LAi8plt14QhVpGWys+Z2ismsR1kkKfr9X9DDcf8LhI+1aMx9yFqRVqDDPOAaUIDEIaCdCC KURoFtPP2bRTWHLfrR8lX1ZvyPi7YbePqAbEXlSvYakcHoffo/9BKqrletRzi/HA+2ZlBN8lL8dG7 UpfUOf+z3Bn7OVsRSKECOvGEM7tBHatIKFIkBTBLTpyLLI3bp5hEuGy1CDQ6LTyeGeXAL2uENqDKl CaFl6EunXzsatC6HCL11/n55lpiZx4tqWqIaktWagRBKxS9w15eisFXnQdHEPlL4oYls2Ted71nn2 m9xSGLKdzfT9b19tCn7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlP1K-009Q6K-NC; Fri, 12 Nov 2021 05:22:38 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlP1G-009Q5r-Am for linux-arm-kernel@lists.infradead.org; Fri, 12 Nov 2021 05:22:35 +0000 Received: by mail-pj1-x102f.google.com with SMTP id fv9-20020a17090b0e8900b001a6a5ab1392so6664734pjb.1 for ; Thu, 11 Nov 2021 21:22:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Uvg0clLCbr+B78xVjeJ/5yRXhc0KdRl35Apacden8PQ=; b=cTkvmXdZ4Xuv6ECGXlFf+IdDWviBMkA5CGCJhzeMqcGT65R63YID2MOvuSXQnpaDeP t1cr6bH+Qgh/M2rhQaxfqlfFHPUN2SlIKgYF+bqKyYZZpnE738V81D9hMCX5h15O+WvQ qcfsZ5eqpCALMYfkzFi1+z1D2JUtU0dyTIjxML2iMACgRbxldlDl3iRsfoqVd8bDRaIA 9AGfaQwUrLctj5iwj/aQ84WDSKiZ4RBUeLG3k+P7yDAvGKrSajjSDV2EIbMKpOBPUjKb 7VS99g9OubXKSlUOvP3XzDI/Tazk1z4ICqqaHo1H11jxxfeaCkYZ24gFuThQuEAowH8/ GXKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Uvg0clLCbr+B78xVjeJ/5yRXhc0KdRl35Apacden8PQ=; b=1j+NP7RBhxxfOVnZJcsVTRxdeu142rV33x4evvDmlR/RZRfh1QFEwzKA16sHIqwL1O N/hCez69qXm3roXL/VJ8pnjCl4IhTMiHcL2GYJqYHoKg6FiQGgSySqUab/y5O2KCTL8d 7uW+E7zj98G9m0ObhXhYAkRLaHPYLnYAg8lkejAAy6hbi0zMpqn9AyMJNGJdpyMKKoez RJjWRYj0LfTLLOOU/HfgaoPOOcbz81UGTLEM3sb/Lf13gDMf/hRqjQuHKCVaNiELOdWl YAZV9KUfsVHd6Pcf1uAb6Ids4FfVFmw1+Qrwoz/lB8xFs7giJ1HGlEAkRglh/hV8rne3 +38Q== X-Gm-Message-State: AOAM531yROzlcC4E9pBjPtn8OlhYh6zmEAZ8aC5bXrAykaVlNit0yv9l JOMlNtRlyogupgqljL6cAsrDqmSxGw== X-Google-Smtp-Source: ABdhPJwHUBSE+7b2tiXcZh51gfymlhELXTjd2rGb8zP2chhrwJexvyYWNXQEoYKyoYjr/dFlNfUgZA== X-Received: by 2002:a17:90a:b795:: with SMTP id m21mr14639773pjr.143.1636694553092; Thu, 11 Nov 2021 21:22:33 -0800 (PST) Received: from piliu.users.ipa.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id h4sm10122624pjm.14.2021.11.11.21.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 21:22:32 -0800 (PST) From: Pingfan Liu To: linux-arm-kernel@lists.infradead.org Cc: Pingfan Liu , Catalin Marinas , Ard Biesheuvel , Will Deacon , Pasha Tatashin , James Morse , Matthias Brugger Subject: [PATCHv2] arm64: mm: Fix VM_BUG_ON(mm != &init_mm) for trans_pgd Date: Fri, 12 Nov 2021 13:22:14 +0800 Message-Id: <20211112052214.9086-1-kernelfans@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111060316.12438-1-kernelfans@gmail.com> References: <20211111060316.12438-1-kernelfans@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211111_212234_412348_D04B69DC X-CRM114-Status: GOOD ( 14.72 ) 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 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); __pmd_populate(pmdp, __pa(ptep), PMD_TYPE_TABLE | PMD_TABLE_UXN); } -- 2.31.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel