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

Re: [PATCH v2 1/3] xen/ELF: Fix ELF32 PRI formatters


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 17 Apr 2023 14:47:33 +0100
  • 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=TQp5LWwPfngv0IeLask3X6cTOeI2qHYy5LfM7Q0wmsI=; b=CDlXF/a1AgGoybUfyjbDKzKSduqFEDsFTx7kXZT+0AYuOVMPoDdktMmlGllgUv5VX9sxUS/TbhPykmPiopXx3t5ja4j/QojzsqPNVFGcjAM+HSeQcX6CRlvYmWY57QpCv0S9sWXjyWVtTJhCE1TtGi3L/2rFR1dNQUAh263PkU0XsZqufoHvIjN0nQi27WuXEbsM0dT+eMWRAPP86qJ79IN3SwnTFQN8XDpaf9fYt+n7uQsPZCzSMHQR3clMN7X8IOP3WHeYiPf3T+/cqso/TZ6HBgU4968EpVNtwTzWzKOaLWuPHlFGaN1WB96RcrQn6J5+ubtFi9Ucz0dyJ1oypw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LbQbWT7eYiEd9Z2v4EP9D5SknqhP7me/y2s1yIkGTTNKkuG9oJ8Xg5hEccq6KHVykKdGSGzBW9ZIcKWLhnSBtDAUuLJbsuK+rkNHdy3bdg6vmRN7QpHM1/Hi8jMSMOIA3M6krNMdtnEZH6wCtyFmVh3DCkIMurZNJcqpNIbFG+Z1qtBQ2IDdp1Bz38rdjINdfi3X7CcBd+wW5AfjUf6R5Vabpwpmvhca337lc7OVqwIzINH4RgRVFi9CoWhnF8UMwFtHopiKkE683FxKkJtauFCeI7lcJbgkaC4LQDafZIVrTStwmWztdbfFzISW0LpHZU0UAUi1S9lk6cyXo/xwvg==
  • 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>, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 17 Apr 2023 13:48:13 +0000
  • Ironport-data: A9a23:e62lTa1jaODdtxOxjPbD5Utwkn2cJEfYwER7XKvMYLTBsI5bp2AOm 2pKWj+DP/2CZTSjco9wPISypkkOuJ/QzYUyHgdvpC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliefTAOK6ULWeUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8tuTS+XuDgNyo4GlD5gBnOqgS1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRrukoPD9IOaF8/ttm8t4sZJ OOhF3CHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqFvnrSFL/hGVSkL0YMkFulfGWhj/ 8xEEDwxSB2HlsPs24O/E9thmZF2RCXrFNt3VnBI6xj8Vapja7aTBqLA6JlfwSs6gd1IEbDGf c0FZDFzbRPGJRpSJlMQD5F4l+Ct7pX9W2QA9BTJ+uxovy6PkWSd05C0WDbRUvWMSd9YgQCzo WXe8n6iKhobKMae2XyO9XfEaurnxHunBdNLSePinhJsqEWI/HUKUB8Sb3ym/+bkunTlUYIBO UNBr0LCqoB3riRHVOLVXRe1vXqFtR40QMdLHqsx7wTl4rrZ5UOVC3YJShZFacc6r4kmSDoyz FiLktj1Qzt1v9W9SnWb7L6Y6yyzPSs9KnULbisJCwAC5rHLu5ovhxjCStJiFq+djdDvHzz0h TeQo0AWhagXjMMN/7W2+xbAmT3EjqbOSgk59wDGRFWP5wlyZJOmT4Gw4F2d5vFFRK6TQ0Odp nECl46b5foXEJCWvCWXRaMGG7TBz+mBGC3RhxhoBZZJyti203uqfIQV6jcuIk5sapoAYWWxP BKVvh5N7phOOnfsdbVwf4+6F8Uty+7nCMjhUffXKNFJZ/CdaTO6wc2nXmbIt0iFraTmufxX1 UuzGSp0MUsnNA==
  • Ironport-hdrordr: A9a23:0K075aEJ+MzeE86DpLqEI8eALOsnbusQ8zAXPiFKOHlom6mj/P xG88526faZslkssQgb6KG90cq7MBHhHPxOgbX5Zo3SODUO0VHAROsO0WKF+VPd8kbFh41gPM lbEpSWAueAa2STqq7BkXHIaKdbsaS62ZHtpsPXz3JgVmhRGt5dBn9Ce3qm+pMffng+OXIAfK DsmPavDADQCUj/Kv7LYUU4Yw==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17/04/2023 1:31 pm, Jan Beulich wrote:
> On 17.04.2023 14:13, Andrew Cooper wrote:
>> --- a/xen/common/livepatch_elf.c
>> +++ b/xen/common/livepatch_elf.c
>> @@ -310,12 +310,12 @@ int livepatch_elf_resolve_symbols(struct livepatch_elf 
>> *elf)
>>                      break;
>>                  }
>>              }
>> -            dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Undefined symbol resolved: 
>> %s => %#"PRIxElfAddr"\n",
>> +            dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Undefined symbol resolved: 
>> %s => 0x%08"PRIxElfAddr"\n",
> I don't see what's wrong with using %# here (and below); I also don't see
> what value it has to zero-pad to 8 digits when the printed value either
> is far below 4G (when representing just a section offset) or likely far
> above (when representing a real address on 64-bit). But once again I'll
> leave judging to the maintainers.

Hmm - I could be persuaded to drop everything in livepatch_elf.c.  I
guess that makes it more consistent with the 64bit side too.

Ross?

>
>>                      elf->name, elf->sym[i].name, st_value);
>>              break;
>>  
>>          case SHN_ABS:
>> -            dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Absolute symbol: %s => 
>> %#"PRIxElfAddr"\n",
>> +            dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Absolute symbol: %s => 
>> 0x%08"PRIxElfAddr"\n",
>>                      elf->name, elf->sym[i].name, sym->st_value);
>>              break;
>>  
>> @@ -344,7 +344,7 @@ int livepatch_elf_resolve_symbols(struct livepatch_elf 
>> *elf)
>>  
>>              st_value += (unsigned long)elf->sec[idx].load_addr;
>>              if ( elf->sym[i].name )
>> -                dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Symbol resolved: %s => 
>> %#"PRIxElfAddr" (%s)\n",
>> +                dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Symbol resolved: %s => 
>> 0x%08"PRIxElfAddr" (%s)\n",
>>                         elf->name, elf->sym[i].name,
>>                         st_value, elf->sec[idx].name);
>>          }
>> diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
>> index 06e6f87c3d80..3124469faeb4 100644
>> --- a/xen/include/xen/elfstructs.h
>> +++ b/xen/include/xen/elfstructs.h
>> @@ -561,8 +561,8 @@ typedef struct {
>>  #endif
>>  
>>  #if defined(ELFSIZE) && (ELFSIZE == 32)
>> -#define PRIxElfAddr "08x"
>> -#define PRIuElfWord "8u"
>> +#define PRIxElfAddr         PRIx32
>> +#define PRIuElfWord         PRIu32
>>  
>>  #define Elf_Ehdr    Elf32_Ehdr
>>  #define Elf_Phdr    Elf32_Phdr
> This part certainly
> Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

Thanks.

~Andrew



 


Rackspace

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