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

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


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 17 Apr 2023 14:31:52 +0200
  • 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=xi3+8447OF2S1p+bzTgtIFsvyuZusJ/CO/hiesmK1L8=; b=M93o35YDqldI79wUVxtsZA40qH8JTMDsVfLj/ua+A/XCSYD8UUYfOqp66dHeVvHuLNzuBcyYq/hgNrnZGsqN0XlpelhO6wuRcgO/R20TumSQwr+RCmxxjjIWxaSBEVI6knKhV747ZvDa3/p7yTWER7l6sPGreN6Caf3/XnNa7NpjscRodLgf5nnotyB33KqGcB0ccP+a6iqFY5JlJKA5RRhacIPO/t/uiIjCCGye0h4WNxsdPZpoU90YCM9u72PvMnqaw0LBrWV4F6wBzRv8ybtZY253jb/xDB43FHNT0qfaaqPZ8I2sbw2PIsVpmfelg/dmWk5Gav7Qtc1ATemPLQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MO0paTe3C6UB0Q+KwvQKitnMMutdoItB8NyzrzkFLXrSZSTzC4oSgLQMZPQlV/yT8jFWxyNXp1ATvy9ZEB6R5vK/smgmTPaUJwczWXw6XkxiIrnmLP8W02JkEP2cVCivNc4ekIXtuPvk0lmEl48pu/B1Pi0pd2fJJVvLw/7+b3Fi2ujSuoksRgXgQ614igZRYfWPoz+Iva0h4Qx9JEaKuoRJLqemundrAiHJ+XNugfSnNVKJgyqF7Lj3mgKROG0thmtehFxjUHCThqyS+GQU79XKsbY60RWN+kwmoFpfWPm4U8YBWwEZUH3CfVM7LiujgI7mZF8yei2Mb+//zMuubQ==
  • 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>, 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 12:32:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

>                      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>

Jan



 


Rackspace

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