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

Re: [PATCH] Drop ELF notes from non-EFI binary too


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 27 Feb 2023 11:28:28 +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=xemvVeuHKZ4/0l9nmKQQeEDDCxZXPRnuijuLdkSoXkY=; b=naeLn9uRGH8OcNAYGozOjJYi5teDUxjIIImWGhepay+9/K67JUzTEHJ7BOAiWu5mVOWWafdKFPCJI5TuunT4vbE/HmXM0UkkXGurHvTKPGhAZjpB+PNA0LfjnRAdeh/h9CB+12yxRkVJVMC0AZiUSZtsS7H0cv3nb9IkokrIwkECRm29f3AXA5TZHL2ui09za2W+hH59l/gQZdUFrb4gTHh63grZcPjG0qoiG/pEQi19bKfAvrHzzREtwuSrt4NbFtjcn0IcMHPrMG5lvOow27pIwSATMxeSSFTIAU5MVbU0J1XbyB7e7yaDzK8tyNseZfRd1G8liejfCwG8Ctlrpg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gqulIReHECLUFgreDXBVhDPwpL/bxAo3R9d38gI7Z84XKQw/ULD8ovys6ehk6jTw7gHwWm8vueoJvD3lt/RmDNv2rU+chaMwqZEmAZ25jSMWFA5/33bkBYZjkrFAJh8w7Gg5v+jSuZIwuKXkgQRrXW0P5AInLwtreP4DPMKHr6vzMi/YPp37SgYqZv5aplupTAgU05kV+xJTJ7a5KRXph1pm9GL02EqvUBHWmIO5CsNUQzFFag2/3gukPykMuaBDg9fPPU2uD8T6dK0q+QYOsPVkEjFqzDOEy6FXge+J3K3AOrrVUtYmraMaT2ZSBNetLJXqU1b9lEx1GaZXjZ7z1Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 27 Feb 2023 10:28:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.02.2023 00:56, Marek Marczykowski-Górecki wrote:
> The ELF is repacked from from 64bit to 32bit. With CET-related notes,
> which use 64bit fields, this results in 32bit binary with corrupted
> notes. Drop them all (except build-id and PVH note retained
> explicitly).
> 
> Suggested-by: Jan Beulich <jbeulich@xxxxxxxx>

Perhaps a misunderstanding: Yes, I did suggest this as a possibility,
but I didn't really mean we actually do so. At the very least not
without further clarifying what the cons of doing so are. The notes,
after all, are actually valid in xen-syms; they become bogus in the
course of mkelf32's processing.

> --- a/xen/arch/x86/xen.lds.S
> +++ b/xen/arch/x86/xen.lds.S
> @@ -192,13 +192,6 @@ SECTIONS
>  #endif
>  #endif
>  
> -#ifndef EFI
> -  /* Retain these just for the purpose of possible analysis tools. */
> -  DECL_SECTION(.note) {
> -       *(.note.*)
> -  } PHDR(note) PHDR(text)
> -#endif
> -
>    _erodata = .;
>  
>    . = ALIGN(SECTION_ALIGN);

Is this sufficient? .note.* isn't part of DISCARD_SECTIONS except for
xen.efi. I would expect it needs to move there from DISCARD_EFI_SECTIONS.
Otherwise, aiui, the linker's orphan section placement will kick in. Yet
at that point you'd also affect Arm and RISC-V (which, interestingly,
don't place .note.* anywhere at all right now, afaics).

Jan



 


Rackspace

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