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

Re: [PATCH v3 2/2] livepatch: set -f{function,data}-sections compiler option


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 8 Mar 2022 15:09:17 +0100
  • 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=JK7dYbPoaOvY2W2fPUp4TZDuAmm380qLNAj/t/k07nE=; b=JA8PgQ7LuyRnpf3ctu2Xb/8FaIdAKAufJ8fUGc9anLMIixmMxfgpZTYwNEx/lPVYwbiGjaJcRx2t1TDC5AGP97brhE+hrXUHe2qd8oGYt+Ltgth/Z8Qx6tNUNhI2k2JvauMR4Cs11qOyMos40+M6+LwfzNIcBDpM9sRRBR8CveOoudbC8aBvsUbKobo8Cuto88FXFjop7RWzuDLH79UXyy9moXMOYZ4Z2+WnGzPuKoMQb1mjQ+RfQNzP5UsUVFvkFCucWFHXrZV9KoyNYFuYLwVBKDExfk2gLHyljkUpg5YZEw3CoxsGZYvc+xoLGHuIcO1ZwWXRoceGZVFSMyBZGQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RH5VwSsqtXpEGZSHRhaE0zxf07333Ue6SPgpmyuWT/PwxhgCX3LJUSSE84Drhc5VIUPO3+NL5ySWJmt6REjE7AHrKzfF4eV9E6XnDeTtzF6kzn6MW+ckjdO1EwC5vBUqY20uiejxFVkcCmPg/DzFtQDySn5RaIs8fwvzX2DdEdPHRXB546iqoV3DUwEgDEIxO2SpnvG9Ebx2xczrBbKKEjEZxQHJ5nQE4qFvsMx7iMf6tPnPzCtlvQ4XRv+jPQGH4cl45vP1ZFGtaxOZKNoXu4l6M2VVD5YnbNe+Nz8WyfrNa8GI8luLjoVxfA6y+sX2eZXnSGIcZ6Mkl+Ysl/qEkQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 08 Mar 2022 14:09:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 08.03.2022 14:49, Roger Pau Monne wrote:
> If livepatching support is enabled build the hypervisor with
> -f{function,data}-sections compiler options, which is required by the
> livepatching tools to detect changes and create livepatches.
> 
> This shouldn't result in any functional change on the hypervisor
> binary image, but does however require some changes in the linker
> script in order to handle that each function and data item will now be
> placed into its own section in object files. As a result add catch-all
> for .text, .data and .bss in order to merge each individual item
> section into the final image.
> 
> The main difference will be that .text.startup will end up being part
> of .text rather than .init, and thus won't be freed. .text.exit will
> also be part of .text rather than dropped. Overall this could make the
> image bigger, and package some .text code in a sub-optimal way.
> 
> On Arm the .data.read_mostly needs to be moved ahead of the .data
> section like it's already done on x86, so the .data.* catch-all
> doesn't also include .data.read_mostly. The alignment of
> .data.read_mostly also needs to be set to PAGE_SIZE so it doesn't end
> up being placed at the tail of a read-only page from the previous
> section. While there move the alignment of the .data section ahead of
> the section declaration, like it's done for other sections.
> 
> The benefit of having CONFIG_LIVEPATCH enable those compiler option
> is that the livepatch build tools no longer need to fiddle with the
> build system in order to enable them. Note the current livepatch tools
> are broken after the recent build changes due to the way they
> attempt to set  -f{function,data}-sections.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

> --- a/xen/arch/x86/xen.lds.S
> +++ b/xen/arch/x86/xen.lds.S
> @@ -88,6 +88,9 @@ SECTIONS
>         *(.text.unlikely .text.*_unlikely .text.unlikely.*)
>  
>         *(.text)
> +#ifdef CONFIG_CC_SPLIT_SECTIONS
> +       *(.text.*)
> +#endif
>         *(.text.__x86_indirect_thunk_*)
>         *(.text.page_aligned)

These last two now will not have any effect anymore when
CC_SPLIT_SECTIONS=y. This may have undesirable effects on the
overall size when there is more than one object with a
.text.page_aligned contribution. In .data ...

> @@ -292,9 +295,7 @@ SECTIONS
>  
>    DECL_SECTION(.data) {
>         *(.data.page_aligned)
> -       *(.data)
> -       *(.data.rel)
> -       *(.data.rel.*)
> +       *(.data .data.*)
>    } PHDR(text)

... this continues to be named first. I wonder whether we wouldn't
want to use SORT_BY_ALIGNMENT (if available) instead in both places.

Jan




 


Rackspace

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