lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1714090302.git.ashish.kalra@amd.com>
Date: Fri, 26 Apr 2024 00:41:38 +0000
From: Ashish Kalra <Ashish.Kalra@....com>
To: <tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
	<dave.hansen@...ux.intel.com>, <x86@...nel.org>, <hpa@...or.com>,
	<jbohac@...e.cz>, <dyoung@...hat.com>, <luto@...nel.org>
CC: <rafael@...nel.org>, <peterz@...radead.org>, <adrian.hunter@...el.com>,
	<sathyanarayanan.kuppuswamy@...ux.intel.com>, <jun.nakajima@...el.com>,
	<rick.p.edgecombe@...el.com>, <thomas.lendacky@....com>,
	<michael.roth@....com>, <seanjc@...gle.com>, <kai.huang@...el.com>,
	<bhe@...hat.com>, <kirill.shutemov@...ux.intel.com>, <jroedel@...e.de>,
	<ardb@...nel.org>, <kevinloughlin@...gle.com>, <kexec@...ts.infradead.org>,
	<linux-coco@...ts.linux.dev>, <linux-kernel@...r.kernel.org>
Subject: [PATCH v3 0/2] Apply RMP table fixups for kexec.

From: Ashish Kalra <ashish.kalra@....com>

Handle cases where the RMP table placement in the BIOS is
not 2M aligned and then the kexec kernel could try to allocate
from within that chunk and that causes a fatal RMP fault.

Check if RMP table start & end physical range in e820 tables
are not aligned to 2MB and in that case map this range to reserved
in all the three e820 tables.

The callback to apply these RMP table fixups needs to be called
after the e820 tables are setup/populated and before the e820 map
has been converted to the standard Linux memory resources and e820 map
is no longer used and modifying it has no effect.

v3:
- Added new e820__range_update_table() helper and updated all
  internal and external modifiers of e820_table_kexec and 
  e820_table_firmware to call this new helper function.
- Updated and restructured the commit message for patch 2/2 to
  explain the issue in detail.
- Added, merged and cleaned up inline comments in patch 2/2.
- Added new __snp_e820_tables_fixup() function to be avoid
  duplication of code for fixing both RMP table start and end
  physical ranges.

v2:
- Remove overriding e820__memory_setup_default() to invoke
  snp_rmptable_e820_fixup() to apply the RMP table fixups.
- This callback snp_rmptable_e820_fixup() is now invoked
  after e820__memory_setup() and before e820__reserve_resources().
- Expose e820 API interfaces to update e820_table_kexec and
  e820_table_firmware externally.
- snp_rmptable_e820_fixup() now calls these new external API
  interfaces to update e820_table_kexec and e820_table_firmware.

Ashish Kalra (2):
  x86/e820: Expose API to update e820 kexec and firmware tables
    externally.
  x86/sev: Add callback to apply RMP table fixups for kexec

 arch/x86/include/asm/e820/api.h |  2 ++
 arch/x86/include/asm/sev.h      |  2 ++
 arch/x86/kernel/e820.c          |  6 ++---
 arch/x86/mm/mem_encrypt.c       | 13 ++++++++++
 arch/x86/virt/svm/sev.c         | 42 +++++++++++++++++++++++++++++++++
 5 files changed, 62 insertions(+), 3 deletions(-)

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ