[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/arm: optee: Allocate anonymous domheap pages


  • To: Oleksandr Tyshchenko <olekstysh@xxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Thu, 23 Sep 2021 14:51:44 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=zUDPicpPpTARMQlSPA5/agCsr7gquYRqozuTjvJn4vY=; b=J6oB2bcC5RLfTX/Rkm7pM814/stXOGd67THSVESr0jdXziVdD7bLleJ2N0bVAIGn9qAlQi7iZcvH/o8OrcYpE75Dlayq9flKUN3Mqs1B2AcjxVUuib+HzO87NMXK/aOFvpEHXMmgjs4E1p8hyPteJ8xEMVRb3PQ/xrtnI2fCfbtfKYncbmAe/bTd+9AhsJH27wotD+8TMIZohB2FySp48b8otmC3MD4wlfqNIeUhkPA/g2+4NG2G/uuCsfm3eV6TDbD//LdcJm8SZRARZ7hZmCHaCJoMFhiSmwiDSNT7KKaAT1gkXF9kozUogv8nv36wg8F7Nx921z9wBOCGxU/7yw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xtyf9J6Inq/YlsZoJt6hT6mWEJTAuv95TzmQp29x9Bto1ppLDUAhZGSQaT9EzgK1uh+DI2a0ukWKqTtFsdc1XqaZBBsYxMy6HHqSaVNmBnmdIDrYz4QaLFXDgiUNfuFbh6/GH6pyc/FIXR1Sm+I407iNEku652GbJNXPnFh9w5png5FUgHKiqoYJjPf/zP9c2Glk93lQrVSxImEWecfL96+m2NnP8dBIVsHcj7XZcdYu/pDSYiBVvaocBXFw+NvvZm2Yit9ja2NkTsK/gsKMXi3UX1msHZbNeEo+ibznfCNpDcxQle2xIfD4XNRps2Q5Lr5yDLIqqvzJ+tcrlwDpYQ==
  • Authentication-results-original: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>
  • Delivery-date: Thu, 23 Sep 2021 14:52:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXoyUczCdL3CcIR0eYq/JO8eFke6uxzsGA
  • Thread-topic: [PATCH] xen/arm: optee: Allocate anonymous domheap pages

Hi Oleksandr,

> On 6 Sep 2021, at 14:42, Oleksandr Tyshchenko <olekstysh@xxxxxxxxx> wrote:
> 
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
> 
> Allocate anonymous domheap pages as there is no strict need to
> account them to a particular domain.
> 
> Since XSA-383 "xen/arm: Restrict the amount of memory that dom0less
> domU and dom0 can allocate" the dom0 cannot allocate memory outside
> of the pre-allocated region. This means if we try to allocate
> non-anonymous page to be accounted to dom0 we will get an
> over-allocation issue when assigning that page to the domain.
> The anonymous page, in turn, is not assigned to any domain.
> 
> CC: Julien Grall <jgrall@xxxxxxxxxx>
> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
> Acked-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>

Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> xen/arch/arm/tee/optee.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
> index 3453615..83b4994 100644
> --- a/xen/arch/arm/tee/optee.c
> +++ b/xen/arch/arm/tee/optee.c
> @@ -410,7 +410,7 @@ static struct shm_rpc *allocate_and_pin_shm_rpc(struct 
> optee_domain *ctx,
>     if ( !shm_rpc )
>         return ERR_PTR(-ENOMEM);
> 
> -    shm_rpc->xen_arg_pg = alloc_domheap_page(current->domain, 0);
> +    shm_rpc->xen_arg_pg = alloc_domheap_page(NULL, 0);
>     if ( !shm_rpc->xen_arg_pg )
>     {
>         xfree(shm_rpc);
> @@ -774,7 +774,7 @@ static int translate_noncontig(struct optee_domain *ctx,
>      * - There is a plan to implement preemption in the code below, which
>      *   will allow use to increase default MAX_SHM_BUFFER_PG value.
>      */
> -    xen_pgs = alloc_domheap_pages(current->domain, order, 0);
> +    xen_pgs = alloc_domheap_pages(NULL, order, 0);
>     if ( !xen_pgs )
>         return -ENOMEM;
> 
> @@ -938,7 +938,7 @@ static bool copy_std_request(struct cpu_user_regs *regs,
> 
>     BUILD_BUG_ON(OPTEE_MSG_NONCONTIG_PAGE_SIZE > PAGE_SIZE);
> 
> -    call->xen_arg_pg = alloc_domheap_page(current->domain, 0);
> +    call->xen_arg_pg = alloc_domheap_page(NULL, 0);
>     if ( !call->xen_arg_pg )
>     {
>         set_user_reg(regs, 0, OPTEE_SMC_RETURN_ENOMEM);
> -- 
> 2.7.4
> 
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.