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

Re: [PATCH 3/3] livepatch: correctly handle altinstruction sections


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 11 Mar 2022 08:35:18 +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=XYS4+Swr/XxYiIs+qZs2wMjAfnDUFisBVZmUV9uOFpQ=; b=GgNFy6zjit+NvX53X+zj3kCZHvwr/XhgGT9bX57ebN8bnxGg9aGqA7aX9yKfJxA4W1lJwNodYhsjiMg1xwslS322Fwe1HbItmUqkzrKH3VxiNfOFGVLE0PATgib4nhttMduYLBryriHIgd22YdAgvB09mI48h9mPkqCG7Qc0jTjdLlBlJFk5roZpsCfMs4kOPMajsvW7kG+VQXbTJlfQ6MrgD7ezYXroV/S2B6ugsaGp4wHDeGDuVJfDzk7Mo1vxC+9Onq+nnEcFDneZ6I5vUc8EjT3CjfGk3tUz322pnM6rGndQIGOlFrGfgj3zJ1sBpuMS4T0vtTuZeJZrGBzF6w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d8D1N1LL/i5hL9Lv3Ie1s9jNXB59whwtzUsOYopU6kdUzKKHaJDCMsGEmwN5vFMbLu0n5AAJsj7d9Salcj6Bj7G+sCy38y9cKXi4FZ7T7w4cn8oteHuDxlMpVXxj2jrAMSyvGvOiSq6d7Lv+znE2dAbrKUWbvxeVRJb3YCq44XPG/+zNrxRHUYsFsyocFFFB/HPtGd71aF0yO3ogw7TPHGWSBxaTfcB5LC6QKK3Dd3zqBegWrKJxtsbW54k3Ze/cGCRRa56GEtliQejBNNt+95ss/0b51T4wCKfqpikYVRqfm50q8ygwRmFUn+4H08GTN+2+Wz1SG2IWf4dLAhKn7w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, doebel@xxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 11 Mar 2022 07:35:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 10.03.2022 16:08, Roger Pau Monne wrote:
> --- a/common.c
> +++ b/common.c
> @@ -249,19 +249,22 @@ int is_text_section(struct section *sec)
>               (sec->sh.sh_flags & SHF_EXECINSTR));
>  }
>  
> +#define SEC_MATCH(n) !strncmp(sec->name, n, strlen(n) - 1)
>  int is_rodata_section(struct section *sec)
>  {
>       return sec->sh.sh_type == SHT_PROGBITS &&
>              !(sec->sh.sh_flags & (SHF_EXECINSTR | SHF_WRITE)) &&
> -            !strncmp(sec->name, ".rodata", 7);
> +            (SEC_MATCH(".rodata") || SEC_MATCH(".data.ro_after_init"));
>  }
>  
>  int is_init_section(struct section *sec)
>  {
>       return sec->sh.sh_type == SHT_PROGBITS &&
>              (sec->sh.sh_flags & SHF_ALLOC) &&
> -            !strncmp(sec->name, ".init", 5);
> +            (SEC_MATCH(".init") || SEC_MATCH(".text.startup") ||
> +             SEC_MATCH(".altinstr") || SEC_MATCH(".ctors"));

Having dealt with this recently - what about .init_array? Modern gcc
prefers that over .ctors. Of course the question is whether either
really needs dealing with here - these sections, to my knowledge,
appear only with gcov support enabled. Not sure that's a case where
livepatching is actually expected to be used.

Jan




 


Rackspace

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