Received: by 10.223.185.116 with SMTP id b49csp6337387wrg; Wed, 28 Feb 2018 07:48:20 -0800 (PST) X-Google-Smtp-Source: AG47ELvnQ8bh9QsWeEpDb4ZdTsW+EIo9Rbrsw7E4sct7y911kImEQQWHQ4lHoZe0PnezUSl8Y3CH X-Received: by 2002:a17:902:d807:: with SMTP id a7-v6mr6865461plz.330.1519832900037; Wed, 28 Feb 2018 07:48:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519832900; cv=none; d=google.com; s=arc-20160816; b=fKQwXwvg/P4DygIMCNxGHEfM4KQQR/3J/bJo6LY28MLF45UqvLczUUoFM37x/bYSjO NlTPgbuqajG43RgxQOIIKx8e+qhowt0gTXKYQ6izBZxyb+144ATC51esm7VL9Gs/pyqv 4EKaRe2m1Qtcm7/8ZTyBU+iF5fZnTewS2ZCkHPi3MT5CoxbLJVY9eGXx7PNVCA64+tnc M+KUJWJZLll9qggfbiktqqqRIGI6Tuhx3UxJud4JT5ppNiMG9wWME9WJfd+w9Y2u33U/ D6b9QJCIxrotipLmDfuxbtIEM+9ljJ7Q5rkydwmny78IvB0ca1iQM48wV1/pxiaeD5jD 8img== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from :arc-authentication-results; bh=0DqD3AfyJntSZfJrkDhaspcvuOOGdX+mlJ0pYFzuuAQ=; b=fbY1Hkbec+S8dOp7OWAaNc/F2ardNB4pT8h2C+WE6zUDhZiXyKOaYxvLokO0wTPQMz U6aCS1UjVkVul6v7/ZZ6Uun0HA2GyfwIszek8mWqCpo9BHxQrLnhLaXxNf9PpB9VNNfc TdAuH8RuX3bn07NOQ2I4CpDxvtf6UtUEJjA7OLFtiHkhxnLb7IFFhNoAYepibnZBoLdW Lnz4N20ZIKLm0NGQlk21alzTx8YycUBEuHPJTHxdyQhKmSOLwxSf24EAzEOaBDN3QwwB bn2WIdUMJemSMCWB65WRVDI7yApwQn8A8Rmm0Qm2RhO5zo6ERNqD5uk5uoHpNqPONNo1 rS8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y131si1402776pfg.44.2018.02.28.07.48.05; Wed, 28 Feb 2018 07:48:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933281AbeB1PrB (ORCPT + 99 others); Wed, 28 Feb 2018 10:47:01 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52098 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932668AbeB1PrA (ORCPT ); Wed, 28 Feb 2018 10:47:00 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EB3BB1529; Wed, 28 Feb 2018 07:46:59 -0800 (PST) Received: from localhost (e105922-lin.cambridge.arm.com [10.1.207.29]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8F1823F246; Wed, 28 Feb 2018 07:46:59 -0800 (PST) From: Punit Agrawal To: Ioana Ciornei Cc: Greg Kroah-Hartman , "linux-kernel\@vger.kernel.org" , "stable\@vger.kernel.org" , Marc Zyngier , "Christoffer Dall" Subject: Re: [PATCH 4.9 09/66] KVM: arm/arm64: Check pagesize when allocating a hugepage at Stage 2 References: <20180129123839.842860149@linuxfoundation.org> <20180129123840.324072883@linuxfoundation.org> Date: Wed, 28 Feb 2018 15:46:58 +0000 In-Reply-To: (Ioana Ciornei's message of "Wed, 28 Feb 2018 15:33:03 +0000") Message-ID: <87efl515hp.fsf@e105922-lin.cambridge.arm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ioana, Ioana Ciornei writes: >> 4.9-stable review patch. If anyone has any objections, please let me know. > > I know that my response comes late but I just found out that the version of the patch applied in 4.9-stable, the one in this email, is different than the one applied on 4.14-stable. > This is the one applied on 4.14: https://patchwork.kernel.org/patch/10177715/ > > As you can see, the check against PMD_SIZE which is present in 4.14 is not present in this version of the patch. > > Am I missing something or should I send a patch to rectify this? You're right. The check against PMD_SIZE was lost during the rebase to v4.9. I should've noticed this before it got sent. Please send a patch to fix this. Alternately, I can fix this with your reported by. Thanks, Punit > > Thanks, > Ioana Ciornei > >> >> ------------------ >> >> From: Punit Agrawal >> >> commit c507babf10ead4d5c8cca704539b170752a8ac84 upstream. >> >> KVM only supports PMD hugepages at stage 2 but doesn't actually check that >> the provided hugepage memory pagesize is PMD_SIZE before populating >> stage 2 entries. >> >> In cases where the backing hugepage size is smaller than PMD_SIZE (such as >> when using contiguous hugepages), KVM can end up creating stage 2 >> mappings that extend beyond the supplied memory. >> >> Fix this by checking for the pagesize of userspace vma before creating PMD >> hugepage at stage 2. >> >> Fixes: 66b3923a1a0f77a ("arm64: hugetlb: add support for PTE contiguous >> bit") >> Signed-off-by: Punit Agrawal >> Cc: Marc Zyngier >> Reviewed-by: Christoffer Dall >> Signed-off-by: Christoffer Dall >> Signed-off-by: Greg Kroah-Hartman >> >> --- >> arch/arm/kvm/mmu.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> --- a/arch/arm/kvm/mmu.c >> +++ b/arch/arm/kvm/mmu.c >> @@ -1284,7 +1284,7 @@ static int user_mem_abort(struct kvm_vcp >> return -EFAULT; >> } >> >> - if (is_vm_hugetlb_page(vma) && !logging_active) { >> + if (vma_kernel_pagesize(vma) && !logging_active) { >> hugetlb = true; >> gfn = (fault_ipa & PMD_MASK) >> PAGE_SHIFT; >> } else { >> > -- Being overloaded is the sign of a true Debian maintainer.