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

Re: [PATCH livepatch-build-tools] Treat constant sections as string sections


  • To: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>
  • Date: Tue, 7 Oct 2025 10:48:34 +0000
  • Accept-language: en-GB, en-US
  • 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=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=XnKuMuS/DmbJZIpHQ4FbALKwQfdmb9XbkUo1fMOaMZY=; b=WXBSJh6ve+RnnMzQc1KyxUa6+7R5+ZpZP9OFTmv+4rtzVz7qrczF1IUnH/kfkBSOroYc1O/+2LUWjH7qtuqSucwcbpViHpju4TfClBROqqiXiTJdNWB+XBombDSgvAraVaKI9rPmiEcVPerJcKU7ppRdFVgdILXpcoK7Ef7vqWzTSZe2xXtmvf7lMZFr7s2j3zSw5//Hz+7JIswGFq9xlqLV7aRUwussAC3utgKsBSUGW1a1JuNQGM5VZe5t3hkdwlKwB5g+0oL/J+7RC7oyxYP1udefvq3U69xS0kNHmowAKfem6GZkr8KKHxuSV029jgmP3iHroeQpOuZlwtG7uQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jIGg9JnySpVSNHYabNN+8t9sVQ5WRy8RNXSUl3hYYeKB5c76OvpDtttdAjG48fL38BdhKk4FBqIsGJJejiO1UnmpPtzs6tL/jEu3cGDwWnUvx1X4PI61iojm58x6+jJu1i2KniqVzO76PuATkmSOzzu0tmaaDniGmeYTUPS+9urxg78D7K7T7bGdIp8QbUe8GDmOCLD1A4yLUdpWfd0hLBVFrZ9e1mWBvaWM7ceiRredXLZIhwNhGaBrRw6SstzX6ovdMHNSqq2sl1xaEb/83IFaCNeP4lpquVsWtPYvnWqo254fdKk4ty3TYKEQcReufpqroalaGMA8SGxOF+zS2w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Andrew Cooper <andrew.cooper@xxxxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 07 Oct 2025 10:48:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Msip_labels:
  • Thread-index: AQHcKIHoyLH9KprocEqbpj5ziY/4lbS1cVKAgAEs5ek=
  • Thread-topic: [PATCH livepatch-build-tools] Treat constant sections as string sections

> > From: Frediano Ziglio 
> > Sent: Thursday, September 18, 2025 10:51 AM
> > To: xen-devel@xxxxxxxxxxxxxxxxxxxx 
> > Cc: Frediano Ziglio ; Ross Lagerwall ; Konrad Rzeszutek Wilk ; Andrew 
> > Cooper ; Roger Pau Monne 
> > Subject: [PATCH livepatch-build-tools] Treat constant sections as string 
> > sections
> >  
> > Newer compiler can put some constant strings inside constant
> > sections (.rodata.cstXX) instead of string sections (.rodata.str1.XX).
> > This causes the produced live patch to not apply when such
> > strings are produced.
> > So treat the constant sections as string ones.
> 
> 
> Are you sure it was a string and not something else? As far as I can
> tell GCC chooses the section in categorize_decl_for_section() which
> doesn't appear to ever put constant strings in .rodata.cst.
>


In the specific case it was a "h" string (used for continuation).
 
> 
> In any case if we have a reference to a constant in .rodata.cst then the
> section _does_ need to be included in its entirety, though it makes me
> wonder if is_rodata_str_section is the best place for this check.
> 
> 
> > 
> > Signed-off-by: Frediano Ziglio 
> > ---
> >  create-diff-object.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/create-diff-object.c b/create-diff-object.c
> > index 7e6138b..7acaf88 100644
> > --- a/create-diff-object.c
> > +++ b/create-diff-object.c
> > @@ -1446,11 +1446,16 @@ static bool is_rodata_str_section(const char *name)
> 
> 
> Can you update the comment at the top of this function?
> 

I'll do it.

> 
> >  {
> >  #define GCC_5_SECTION_NAME ".rodata.str1."
> >  #define GCC_6_SECTION_NAME ".str1."
> > +#define GCC_CSTR ".rodata.cst"
> 
> 
> What does CSTR stand for? May call it GCC_CONSTANT_SECTION_NAME instead?
> 

It makes sense, I'll change it.

> 
> Ross

Frediano



 


Rackspace

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