lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r17j0wsi.wl-maz@kernel.org>
Date:   Thu, 03 Mar 2022 17:29:33 +0000
From:   Marc Zyngier <maz@...nel.org>
To:     Kalesh Singh <kaleshsingh@...gle.com>
Cc:     Will Deacon <will@...nel.org>, Quentin Perret <qperret@...gle.com>,
        Fuad Tabba <tabba@...gle.com>,
        Suren Baghdasaryan <surenb@...gle.com>,
        "Cc: Android Kernel" <kernel-team@...roid.com>,
        James Morse <james.morse@....com>,
        Alexandru Elisei <alexandru.elisei@....com>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        Catalin Marinas <catalin.marinas@....com>,
        Mark Rutland <mark.rutland@....com>,
        Mark Brown <broonie@...nel.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Peter Collingbourne <pcc@...gle.com>,
        "Madhavan T. Venkataraman" <madvenka@...ux.microsoft.com>,
        Andrew Scull <ascull@...gle.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Ard Biesheuvel <ardb@...nel.org>,
        "moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)" 
        <linux-arm-kernel@...ts.infradead.org>,
        kvmarm <kvmarm@...ts.cs.columbia.edu>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 2/8] KVM: arm64: Introduce pkvm_alloc_private_va_range()

Hi Kalesh,

On Wed, 02 Mar 2022 17:24:53 +0000,
Kalesh Singh <kaleshsingh@...gle.com> wrote:
> 
> On Tue, Mar 1, 2022 at 11:46 PM Marc Zyngier <maz@...nel.org> wrote:
> >
> > On Fri, 25 Feb 2022 03:34:47 +0000,
> > Kalesh Singh <kaleshsingh@...gle.com> wrote:
> > >
> > > pkvm_hyp_alloc_private_va_range() can be used to reserve private VA ranges
> > > in the pKVM nVHE hypervisor (). Also update __pkvm_create_private_mapping()
> > > to allow specifying an alignment for the private VA mapping.
> > >
> > > These will be used to implement stack guard pages for pKVM nVHE hypervisor
> > > (in a subsequent patch in the series).
> > >
> > > Credits to Quentin Perret <qperret@...gle.com> for the idea of moving
> > > private VA allocation out of __pkvm_create_private_mapping()
> > >
> > > Signed-off-by: Kalesh Singh <kaleshsingh@...gle.com>
> > > ---
> > >
> > > Changes in v4:
> > >   - Handle null ptr in pkvm_alloc_private_va_range() and replace
> > >     IS_ERR_OR_NULL checks in callers with IS_ERR checks, per Fuad
> > >   - Fix kernel-doc comments format, per Fuad
> > >   - Format __pkvm_create_private_mapping() prototype args (< 80 col), per Fuad
> > >
> > > Changes in v3:
> > >   - Handle null ptr in IS_ERR_OR_NULL checks, per Mark
> > >
> > > Changes in v2:
> > >   - Allow specifying an alignment for the private VA allocations, per Marc
> >
> > I probably badly expressed my earlier concern.
> >
> > Yes, an alignment is necessary. But how often do we want an alignment
> > that isn't naturally aligned to the size of the allocation (i.e. the
> > power of 2 >= the size of the allocation)? This is what the rest of
> > the kernel does (get_order() and co), and I thing we should follow
> > this.
> 
> Hi Marc,
> 
> Thanks for clarifying. I think making the alignment implicitly based
> on the size here will create unnecessary holes where PAGE_SIZE
> alignment would be ok and potentially overflow the private VA space
> earlier. Is it not a concern?

I don't think we should worry too much about this. Even when building
the kernel with a very small VA space (commonly 39 bits), we still
have a quarter of that reserved for private EL2 mappings. That's
pretty big.

We will use a bit more of the memory that is set aside for EL2 page
tables, but this shouldn't be a problem either.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

Powered by blists - more mailing lists