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

Re: [PATCH] create-diff-object: handle missing padding at end of special section


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 17 Apr 2023 09:31:03 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=NZn4kzEE6aP9fyCf+9qanmJfpDIZMAhoGwQkQL7qdVc=; b=hQUTW0Gv9BifnN4mBMGCkxlQgcKH96nJ5MgHnnV/NybieHuubXbAwkw5Z1Xe77kMbr9NdKz9uLf6mUZ1r7/oN5ewNNii7FmxznsYyWPrtr8P3Ktvi1NJ27Qf51QGNSPzey4BX9Fnks/jog26Db3m+ZmTFk+tyX7oCr7GhFFKA1q8g3nueFxdta0n2fohYtoJfgw5abQ4Vqfocc46hNB8S23MENDcAEPzSPZJyQYSuEX00460gR2AZNL5wrK5tbkzizHykYF6Kfdj0Gvt9nXKfAzMyO6clku6mPVpRH7xfO7j4ZQTy7w3I0B4iKe42ADOusmGUcAGq1j8XeuJRxOxtA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MetBibDaQqTTTQRQ9IwmomuVDXwbtMBH6hKFhNP/R8QEdQNstMLHBnhhOZJm/uL3pbPYM1nI3OU6qJZniI9fYVFekeMGzbOnxvavx2eHqBr6/IaLkEP0WRmwHcXN7ZPXGcC4FRr9d/ItCV2XEB5RHIk5a22vlqsATtllQ5VOuGC0ZotMFrhNdcc9vYvVxsOe9lfuBSiDScf3F4aB0A3ugIWWc97yBSUr5hEURsSmFsVS8n/70eshFbWVJG50egDRp1fbonwhOwtrGQ2VL74FB2MN1xahWTsaSNlbJsvh2OudcWN95Xao5+EfMxdjY9XGe0NAQT7oSqaU7VDmzI06TQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Josh Poimboeuf <jpoimboe@xxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • Delivery-date: Mon, 17 Apr 2023 07:31:28 +0000
  • Ironport-data: A9a23:b8Kn9amnU2Vi7mdwx5uNsO3o5gy1J0RdPkR7XQ2eYbSJt1+Wr1Gzt xJOXmvQMvjfZ2XxL4onad6/90tVvJPQm9dmHgs+qSA3ECMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+a6U6icfHgqH2eIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE4p7aWaVA8w5ARkPqgX5QGGzRH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 dshAy83bR6Ivuan/bikYNRpmssTPeC+aevzulk4pd3YJdAPZMmbBo/suppf1jp2gd1SF/HDY cZfcSBocBnLfxxIPBEQFY46m+CrwHL4dlW0qnrM/fZxvzeVk1Q3ieC1WDbWUoXiqcF9hEGXq 3iA523kKhobKMae2XyO9XfEaurnxHumBtxDSubinhJsqFPO6jQJITcIbgLlh6O1lku/ZdV7b FNBr0LCqoB3riRHVOLVTxC+5XKJoBMYc95RCPEhrhGAzLLO5ASUDXRCSSROAPQkrMg3QDYt2 3eTkt/pDCApu7qQIVqe8bGOpD/0JikRLkcFfyYPSQZD6N7myLzflTrKR9dnVaSz0dv8HGiox yjQ9XBmwbIOkcQMyqO3u0jdhC6hrYTISQhz4RjLWmWi7UVyY4vNi5GU1GU3JM1odO6xJmRtd lBa8yRCxIji1a2wqRE=
  • Ironport-hdrordr: A9a23:tyykqq0sJ6bd+6HB1EOkyAqjBfdyeYIsimQD101hICG9E/bo4v xG+c5xuyMc5wxwZJheo6H9BEDtexLhHP1OkPos1MmZLWvbUQKTRekJ0WKI+UyCJ8SRzJ856U 9qG5IOd+EZZTJB4foTi2ODfOrJD7O8nZyAtKPm6zNIcCkvUqdn6m5Ce3Sm+o8dfng5OXL8fq DslvauYlCbCAUqh7+Adx04dtmGncTPiJXlJTYeHnccmXCzpALt0qf+Dx+bmjwDUzZDqI1SjF TtokjC/6C+tPP+7RfZ2wbonvNrseqk8MJHGMuPzu4KLTn24zzYArhJavm5pTUop+Pq0nYG+e O82ysIDoBI8nbMeWPwmxf3xAX69z4r5xbZuCSlqEqmm9X9WDU5T/VMnphYdByx0TtbgO1B
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Apr 14, 2023 at 05:17:42PM +0100, Andrew Cooper wrote:
> On 14/04/2023 4:19 pm, Roger Pau Monne wrote:
> > From: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> >
> > The paravirt_patch_site struct has 12 bytes of data and 4 bytes of
> > padding, for a total of 16 bytes.  However, when laying out the structs
> > in the .parainstructions section, the vmlinux script only aligns before
> > each struct's data, not after.  So the last entry doesn't have the
> > 4-byte padding, which breaks kpatch_regenerate_special_section()'s
> > assumption of a 16-byte struct, resulting in a memcpy past the end of
> > the section.
> >
> > Fixes #747.
> >
> > Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> >
> > This is commit:
> >
> > c2dc3836e862 create-diff-object: handle missing padding at end of special 
> > section
> >
> > In kpatch repository.
> >
> > I've seen the .fixup section get an alignment of 16 but a size of 81,
> > which makes the error removed in this patch trigger.  Overall I'm not
> > sure why the original alignment check was done against the size of the
> > section, the alignment applies to the address of the section, not its
> > size.
> >
> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> Seems like a clean backport, so FWIW
> 
> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> 
> However, surely we want a correction to Xen's linker file too, to stop
> putting out a badly aligned section?

AFAICT that alignment comes from the per-function-section object files,
so that's before the linker has assembled the xen image.  And the
address of the section is indeed alignment to the value, so it's all
correct.

Even then, it's my understanding the alignment in sh_addralign applies
to the address of the section, not the size, so I'm confused as to why
create-diff-object was expecting section sizes to the aligned.  IMO
it would make sense to pad the start address so it's aligned to the
section requirements, but not the section size.

Regardless, it's indeed a clean backport from the change upstream so
we should take it.

Thanks, Roger.



 


Rackspace

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