From patchwork Fri Apr 29 13:35:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 12832006 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECC2BC433EF for ; Fri, 29 Apr 2022 13:36:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6EE096B0073; Fri, 29 Apr 2022 09:36:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 672CF6B0074; Fri, 29 Apr 2022 09:36:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 53B7C6B0075; Fri, 29 Apr 2022 09:36:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 45F096B0073 for ; Fri, 29 Apr 2022 09:36:23 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 1980B12069C for ; Fri, 29 Apr 2022 13:36:23 +0000 (UTC) X-FDA: 79410015846.19.546BDB7 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by imf25.hostedemail.com (Postfix) with ESMTP id 6329BA0076 for ; Fri, 29 Apr 2022 13:36:13 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id w17-20020a17090a529100b001db302efed6so5763916pjh.4 for ; Fri, 29 Apr 2022 06:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L6JfYichFyXFsf3r/4znwUIKw3e8Xt3i1DYSf+5mskE=; b=uiu5RLuEB7qSCoidGIQkJZQf2tXs/EuKorStHUYGrE3Q5/xwMjpvGCmRYxjgJA6Ctu 75nC7BuohPGVHhHiVloQeiByLs8cb+N0Ed8rJ3utK+A6gQToV+GujF6l5qKhJ6c7EtGn NGGslCeqHkUhC439mUKObKU0nONs9Y2XDO0mRRIdYkuP+YXoGmTiT18RjaEEpxX9bPsh AAQJ8XZb1PV/10ty6IAIC9mYDPdZ84ojotFDfykLySr4Rl5A0JazS0rcCBaq64jgtFXH n+rOZQhRPeLRzNBkYnF0c08yntciuvNCXpZK09/v/tg0M7w22eVyLTCmchLVjWICGks9 yfeQ== 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=L6JfYichFyXFsf3r/4znwUIKw3e8Xt3i1DYSf+5mskE=; b=Uv4Psu0nLRawgpo7ASIYs19Cmy8oaEN96avcVE+r9xmnrwQ51sx5cMV5PQVCaiIuu8 sDUexjw92uFden+H+YQA2GFyF4lOJQRQaOZ+KTVZnweF+q6VH3lJUYcFne+PEohRROUQ g5gU/o4rlBAJ3WJBQmzPSLhbQKXTNvsoYrCaJrCe6R4kpXTdv4aPpaazBms5mBcsFJU8 mYvl1a8uRBXKAo17Xfv9xDejrDpEwG6VjMDUjoYzpHDyBiCq3YY1gq2lpHrv6hUv+axo cbtUpP3AP9/ufHVffUasvnfhuDCPLEUV7y/l5S5kE405KK+Jfa6PRE/fbjNv14pplMmQ Y+WQ== X-Gm-Message-State: AOAM530oKq1yrbBBuJmpb9K8tdtNroW1qfs1gQLpsPctfpuSNFRyf7Ux 6WUSJmWWeaC8pd+t/K3YG4UtvQ== X-Google-Smtp-Source: ABdhPJx+W1PxtRy+jGpbbBvOatDdA/DNvTfTbEwQM2M30hTFb7Isln+pU5bpMFj6BaOrsgTZDYJFuQ== X-Received: by 2002:a17:902:ed89:b0:15a:d3e:ada6 with SMTP id e9-20020a170902ed8900b0015a0d3eada6mr39276616plj.94.1651239381708; Fri, 29 Apr 2022 06:36:21 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.240]) by smtp.gmail.com with ESMTPSA id m8-20020a17090a414800b001d81a30c437sm10681977pjg.50.2022.04.29.06.36.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 06:36:21 -0700 (PDT) From: Qi Zheng To: akpm@linux-foundation.org, tglx@linutronix.de, kirill.shutemov@linux.intel.com, mika.penttila@nextfour.com, david@redhat.com, jgg@nvidia.com, tj@kernel.org, dennis@kernel.org, ming.lei@redhat.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, songmuchun@bytedance.com, zhouchengming@bytedance.com, Qi Zheng Subject: [RFC PATCH 01/18] x86/mm/encrypt: add the missing pte_unmap() call Date: Fri, 29 Apr 2022 21:35:35 +0800 Message-Id: <20220429133552.33768-2-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20220429133552.33768-1-zhengqi.arch@bytedance.com> References: <20220429133552.33768-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 6329BA0076 X-Stat-Signature: 45rt3mjwaa7o57gjkinyhoauxfnbhnco Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=uiu5RLuE; spf=pass (imf25.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.52 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-HE-Tag: 1651239373-448336 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The paired pte_unmap() call is missing before the sme_populate_pgd() returns. Although this code only runs under the CONFIG_X86_64, for the correctness of the code semantics, it is necessary to add a paired pte_unmap() call. Signed-off-by: Qi Zheng --- arch/x86/mm/mem_encrypt_identity.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c index b43bc24d2bb6..6d323230320a 100644 --- a/arch/x86/mm/mem_encrypt_identity.c +++ b/arch/x86/mm/mem_encrypt_identity.c @@ -190,6 +190,7 @@ static void __init sme_populate_pgd(struct sme_populate_pgd_data *ppd) pte = pte_offset_map(pmd, ppd->vaddr); if (pte_none(*pte)) set_pte(pte, __pte(ppd->paddr | ppd->pte_flags)); + pte_unmap(pte); } static void __init __sme_map_range_pmd(struct sme_populate_pgd_data *ppd)