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

Re: [PATCH 2/6] xen/arm: Introduce flags_has_rwx helper


  • To: Hari Limaye <hari.limaye@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Fri, 27 Jun 2025 13:31:07 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SsEPaB386by8MqkeC4YIuTeuzHEcNVqvtb0Vf0KcAzg=; b=cj+XZBAAblgYiFpob7980e8bYviCccT+ClafsSGoxfZ+8Hj9EjCCHAMBRKRKxtQh49f9PYem/W4h3pF101qzQK4lYe0YydpnU0h+FCge2hoaulOg8bzTD4RiYSEacNWpzdMzlAr1gyPl6AX30Ym94YpHALc2GmLbVKA8o6XPBqpkO01EaB2tQ46yhzOwnDc1H3+7L1dh1QppGEiht8YqU+nKxBkG9hDeyAV/MobMhtMx69HfSGHsj0jDPO57hSzL5sgbGE+3bMEmrtGqfDR0SSA8ePOMZNXPlsLWCHzYNkizLj1FGUHqNY0AeE9S2EWOd0qmomI19WRf6/Thdua7qA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vMYVL6zUxiwQ75lGmFF6XiuAqxumWRt4sDgjlYlL1L6RWJkRGTAL7aiLeT2mg+qOXSDmhJUEeJRwzIrKs1W2m9HS6LIa4J4Ym2ua1iSNbK0trq9gzvP5PzzNDyVRsfn7S7gGR5nksM1Dqt1CwALz8gd6nIrwOvqNxF9ENip5JUVVlsyQTt1wUr501rEMBELOHiCVnBLbG1ZRMR+pHSD9OjeBSLEaUNBz6yziF0wTEXLqL4gleETxNDs5Eamer2+Vou2QPA6gzNqY7Zh+youcCxehNUP/nK/jX3XGOjZ23ipKxBMM1fZgnAUg65TDUHc4VitzRw/E1C6TenOCaHjwpQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: luca.fancellu@xxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 27 Jun 2025 11:31:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 20/06/2025 11:49, Hari Limaye wrote:
> From: Luca Fancellu <luca.fancellu@xxxxxxx>
> 
> Introduce flags_has_rwx() function that will check if a
> mapping is both writable and executable when modifying
> or update the mapping.
NIT: s/update/updating/

> 
> This check was already present in pt.c but since it will
> be used also for MPU system, it's wrapped into a function
> now.
> 
> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
Hari, your SOB is missing.

> ---
>  xen/arch/arm/include/asm/mm.h |  2 ++
>  xen/arch/arm/mm.c             | 15 +++++++++++++++
>  xen/arch/arm/mmu/pt.c         |  9 +--------
>  3 files changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
> index 011bc1fd30..9daaa96d93 100644
> --- a/xen/arch/arm/include/asm/mm.h
> +++ b/xen/arch/arm/include/asm/mm.h
> @@ -192,6 +192,8 @@ extern unsigned long frametable_base_pdx;
>  
>  /* Boot-time pagetable setup */
>  extern void setup_pagetables(void);
> +/* Check that the mapping flag has no W and X together */
> +extern bool flags_has_rwx(unsigned int flags);
Please, don't use extern for function prototypes. We don't use them anymore.

>  /* Map FDT in boot pagetable */
>  extern void *early_fdt_map(paddr_t fdt_paddr);
>  /* Remove early mappings */
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index 0613c19169..c2da1e3a05 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -24,6 +24,21 @@
>  
>  unsigned long frametable_base_pdx __read_mostly;
>  
> +bool flags_has_rwx(unsigned int flags)
> +{
> +    /*
> +     * The hardware was configured to forbid mapping both writeable and
NIT: you can take opportunity to correct misspelling: s/writeable/writable/

Otherwise:
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

~Michal




 


Rackspace

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