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

Re: [PATCH for-4.17] xen/arm: Support properly __ro_after_init on Arm


  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 17 Aug 2022 10:37:15 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7w5dscsKH1+XS6ikeKzQ3eRGM2tBkUkycjyueMpk854=; b=QTMoO2Fn1OjvviSZPlG+kXX1h6+lAndwV4pNrNniohD7L6RegT1hJjv3mQwTmJTN9ca8/T9Q4vpAhMJMd1kEm1TIH0a2tJNAq125YNLuu7U50KND2uxporR5/kyfz/tgMAFHmnOHwsn6TdADcyFkM5zcy/Joj7E1Hkm60hz5rnUE5sni7E2cjnWlYwNRTpA3S5/3wS8be98Q4hZ9cwhp9BWfUzpoOeP09xmRu3c/tWiAJ4SVHzPUZx1LalpzafMZ27pjx4MLqp8G1HHaA+sRrpnjt5ECWeAi8ETHU8beFlJIUcH8A+yMbCwkD+pcQ2O0kK0ceNrr2auDjoYSzV160w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WXLdS5zEp20g/J544ha8fT2Rjddj/sVbHdyIwAvmV9tGdB1uZMeHeXzD2ltIyYxp+juuV68o48ajIrtlYI2hjjS5OzsmIaf5vT20ptVnb7O9kx2DzVBaeU10dHUJHN7uYtX487QdoBSSIfjYEFB3BR/NyWX7zihbIKh23KzgUj14ajdPn/7YHifN5EXU6+d1yJKs36IIRsyF36NQpxrUhUgyTZWFaDyxH6IjJzKtRGoGC1ILCrIltJUpJPBtNcOcCVcZoiwJMeK5vPxzu7RQCaMKNeI9YaSXeQooZd+ow5IqeN+sGkfonKu+70dg7/+neU9/NqUO/KQ/lUC8AbLFXQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Julien Grall <jgrall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 17 Aug 2022 08:37:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 16.08.2022 20:59, Julien Grall wrote:
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -75,10 +75,24 @@ domid_t __read_mostly max_init_domid;
>  
>  static __used void init_done(void)
>  {
> +    int rc;
> +
>      /* Must be done past setting system_state. */
>      unregister_init_virtual_region();
>  
>      free_init_memory();
> +
> +    /*
> +     * We have finished to boot. Mark the section .data.ro_after_init
> +     * read-only.
> +     */
> +    rc = modify_xen_mappings((unsigned long)&__ro_after_init_start,
> +                             (unsigned long)&__ro_after_init_end,
> +                             PAGE_HYPERVISOR_RO);
> +    if ( rc )
> +        panic("Unable to mark the .data.ro_after_init section read-only (rc 
> = %d)\n",
> +              rc);

Just wondering - is this really worth panic()ing?

> --- a/xen/arch/arm/xen.lds.S
> +++ b/xen/arch/arm/xen.lds.S
> @@ -83,6 +83,13 @@ SECTIONS
>    _erodata = .;                /* End of read-only data */
>  
>    . = ALIGN(PAGE_SIZE);
> +  .data.ro_after_init : {
> +      __ro_after_init_start = .;
> +      *(.data.ro_after_init)
> +      . = ALIGN(PAGE_SIZE);
> +      __ro_after_init_end = .;
> +  } : text

Again just wondering: Wouldn't it be an option to avoid the initial
page size alignment (and the resulting padding) here, simply making
.data.ro_after_init part of .rodata and do the earlier write-protection
only up to (but excluding) the page containing __ro_after_init_start?

Jan



 


Rackspace

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