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

Re: [PATCH 4/5] x86/xen: Avoid relocatable quantities in Xen ELF notes


  • To: Ard Biesheuvel <ardb+git@xxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Thu, 26 Sep 2024 21:46:53 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=re69GDicJsTVYB8i/wCJt4K1EhDG8JMiCWJegOKlVFw=; b=e0I7xmXpkCvtXlSgmCZRuhWczbLgbGxYA57K8ZT5AGmki41awPLwcS96BbdcRd0aWtnUExpsG8/ycRtsDo5rKeFimLqu1iQguhX2nRwgR1woKeHAcaoYzLjOi1+1aYo4kTYK68oMbSMaHTFO9P+E5MZH9GMt75m53W+tDRWIB0oknCNBwvDKZEmosuyfkD59fw9T5a3lszRlsYn1sjoniblHvcC216eAZHNOKqGC7JeXCIAH+fPi6veNIAK64gC6VYTPaEWLm59Aqfcut+3ZnjGk1VRW+NLnrvS/lw2HFkCOAM83tEOdmdVDbGqiQm2TJ7dg2GSI4L3NXbyN034WtA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iU/Q8VKD1br1d7wdQqO7Q1oiqZkLjyHWU1L/1zEuuTlRZdTp0KugtnoPArp4hsn/0+aRAeQDSDpxKVVt9BFLbFdTUGe71QJLgYxQLNOrlo1+6R7QnnUeVM6HFoFhtYmLZE9s5UMKeunNb0xCulilXc4TVB2k27VwwGqN1fdGRpSVdjZi70d+M1IEDnm3CgBvthc2ImerUKgK8gfTXDBHCGMxgklTAzTj4w7XLyZiZLUC6OMm5Qpj5Yu58050kv7jCjA2T9Tgw3OXYmohBw2EDlVbWceuuSc4Fm3eaQ535DVc7z7dBAzaRh0TUQZzUvrlew+W5C7MunHu6yvJ9KkJ2Q==
  • Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, "Boris Ostrovsky" <boris.ostrovsky@xxxxxxxxxx>, <x86@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 27 Sep 2024 01:47:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-09-26 06:41, Ard Biesheuvel wrote:
From: Ard Biesheuvel <ardb@xxxxxxxxxx>

Xen puts virtual and physical addresses into ELF notes that are treated
by the linker as relocatable by default. Doing so is not only pointless,
given that the ELF notes are only intended for consumption by Xen before
the kernel boots. It is also a KASLR leak, given that the kernel's ELF
notes are exposed via the world readable /sys/kernel/notes.

So emit these constants in a way that prevents the linker from marking
them as relocatable. This involves place-relative relocations (which
subtract their own virtual address from the symbol value) and linker
provided absolute symbols that add the address of the place to the
desired value.

While at it, switch to a 32-bit field for XEN_ELFNOTE_PHYS32_ENTRY,
which better matches the intent as well as the Xen documentation and
source code.

QEMU parses this according to the ELF bitness. It looks like this reads 8 bytes on 64bit, and 4 on 32. So I think this change would break its parsing.

(I don't use QEMU PVH and I'm not that familiar with its implementation.)

Regards,
Jason



 


Rackspace

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