From patchwork Thu Feb 4 17:16:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 12067979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF412C433DB for ; Thu, 4 Feb 2021 17:16:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 61A0A64DFA for ; Thu, 4 Feb 2021 17:16:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61A0A64DFA Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A03C56B006E; Thu, 4 Feb 2021 12:16:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DAEB6B0070; Thu, 4 Feb 2021 12:16:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F18D6B0071; Thu, 4 Feb 2021 12:16:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id 7998A6B006E for ; Thu, 4 Feb 2021 12:16:28 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 32FFB3635 for ; Thu, 4 Feb 2021 17:16:28 +0000 (UTC) X-FDA: 77781239256.20.pest45_440f67e275dd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id E2F46180C0609 for ; Thu, 4 Feb 2021 17:16:27 +0000 (UTC) X-HE-Tag: pest45_440f67e275dd X-Filterd-Recvd-Size: 3883 Received: from mail-qk1-f202.google.com (mail-qk1-f202.google.com [209.85.222.202]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Feb 2021 17:16:27 +0000 (UTC) Received: by mail-qk1-f202.google.com with SMTP id u66so3235884qkd.13 for ; Thu, 04 Feb 2021 09:16:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:message-id:mime-version:subject:from:to:cc; bh=CWs5UE8Kdmh+MQd8bFvaWH6vN8MkKdop27j3PZaaEEk=; b=RvmiSNnpq5dIjK/KsaaPz8Tfp6HEdpvhnnQHoDk1y6rJOw7daASh69I/9qr3eTxurJ QxdhYhSdCRC08n+OT+0GZ83cLaNqw8d0GXASpB0CVFn8RkwilEwy/NfTqX22URgGRg64 h3KIvUZs4chncId+curUsRE0pLO7Qk31y2+vE78sNziBdjWR1qR6PCBZC9QgvrfJjL0A uhQD3QJlhZNqHAcsVO+a9GjOG0v0uV3LSt6omfqA4hkO95jxobHq2J6wIj53soo6ksOO 3HxqpLQd7qeK8fsN1id0eKJkt82pcGtts9Ly+gZIAo4N4PApGtoJrlf0vBO+AA+KiQ5z iICg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:message-id:mime-version :subject:from:to:cc; bh=CWs5UE8Kdmh+MQd8bFvaWH6vN8MkKdop27j3PZaaEEk=; b=sXaSujiesEJEyArcQbHZJdHYy6RQKyMP94oPCkQWzQvooZztAGije29JpZUg1dtOS4 9l59ReLLWVHDrvLykM4BgoSX9w8COub6eNtjEobzOWVg8L7pTzetaM4pjZ4CkQsNUEcV R9NPjR5IDNiZt9gQKoag/pEYwjFNFxqsJMJ/G/H/YcfUx+3sF8U2KJt3aRJGjKyymNK+ 3nLvR0KFecR6WiGe0s7vq7TFchQGBQyXmU5CWu6Q3lk5xQ8/eOEdoubyCFAoRPkmSotY YRiCFnOSG2eZEDR6nLN2uK1k6BUYW+kelfCVFz9A5/BB/c5pqMM6lHdYuR/uDNm3bXPs GfUg== X-Gm-Message-State: AOAM533FeQVB7qg/bRuWNNqn8xK+wUt12sswhVUSSikaj+xAO6k8vRHm RVUOIHQPmhZkuLUiG6xOIbO8kJtW++A= X-Google-Smtp-Source: ABdhPJwNFc/pfbYrCPQH1RwiV0zjReAT9g+Rvj4tY5TqJz3Zs1352G0A33nGNamEpCBSQz/ihOce7ZsjK2o= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:f16f:a28e:552e:abea]) (user=seanjc job=sendgmr) by 2002:a05:6214:592:: with SMTP id bx18mr236964qvb.32.1612458986469; Thu, 04 Feb 2021 09:16:26 -0800 (PST) Reply-To: Sean Christopherson Date: Thu, 4 Feb 2021 09:16:19 -0800 Message-Id: <20210204171619.3640084-1-seanjc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog Subject: [PATCH] mm: Export follow_pte() for KVM so that KVM can stop using follow_pfn() From: Sean Christopherson To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Stevens , Jann Horn , Jason Gunthorpe , Paolo Bonzini , kvm@vger.kernel.org, Sean Christopherson 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: Export follow_pte() to fix build breakage when KVM is built as a module. An in-flight KVM fix switches from follow_pfn() to follow_pte() in order to grab the page protections along with the PFN. Fixes: bd2fae8da794 ("KVM: do not assume PTE is writable after follow_pfn") Cc: David Stevens Cc: Jann Horn Cc: Jason Gunthorpe Cc: Paolo Bonzini Cc: kvm@vger.kernel.org Signed-off-by: Sean Christopherson --- Paolo, maybe you can squash this with the appropriate acks? mm/memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/memory.c b/mm/memory.c index feff48e1465a..15cbd10afd59 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4775,6 +4775,7 @@ int follow_pte(struct mm_struct *mm, unsigned long address, out: return -EINVAL; } +EXPORT_SYMBOL_GPL(follow_pte); /** * follow_pfn - look up PFN at a user virtual address