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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 20 Jun 2024 12:27:57 +0530
From: Anshuman Khandual <anshuman.khandual@....com>
To: linux-arm-kernel@...ts.infradead.org,
	maz@...nel.org
Cc: Anshuman Khandual <anshuman.khandual@....com>,
	Oliver Upton <oliver.upton@...ux.dev>,
	James Morse <james.morse@....com>,
	Suzuki K Poulose <suzuki.poulose@....com>,
	Catalin Marinas <catalin.marinas@....com>,
	Will Deacon <will@...nel.org>,
	Mark Brown <broonie@...nel.org>,
	kvmarm@...ts.linux.dev,
	linux-kernel@...r.kernel.org
Subject: [RFC 00/10] KVM: arm64: Enable fine grained undefined for MDSELR_EL1

MDSELR_EL1 register access is essential while enabling latest HW breakpoint
via the arch feature FEAT_DebugV8P9. During our previous discussion on this
[1], it was also observed that MDSELR_EL1 access needs to be managed across
various KVM host-guest code paths via the new fine grained trap based UNDEF
mechanism. Besides MDSELR_EL1 access is managed via FEAT_FGT2 based fine
grained registers.

This series has been carved out from the original breakpoint series just to
enable MSELR_EL1 access via fine grained trap control.

All the initial sysreg updates or additions are required while configuring
HDFGRTR2_EL2 and HDFGWTR2_EL2 registers in the last two patches.

This series has been very lightly tested - boots with KVM without warnings
or errors. I am not entirely sure how these fine grained bits would behave
in various paths. The idea is to get the series into discussion, learn and
change as required. All reviews, feedbacks and pointers really appreciated.

Questions and Challenges:

- TRBIDR_EL1.MPAM needs to be probed for setting HDFGRTR2_EL2_nTRBMPAM_EL1
  but kvm_has_feat() does not operate a non-ID register which causes build
  warnings. The same problem exists for probing PMSIDR_EL1.FDS which is
  needed for setting HDFGRTR2_EL2_nPMSDSFR_EL1 as well. Currently both the
  bits mentioned earlier are set, assuming the features are not present in
  nested virtualization. Do we need some new helpers to probe these non-ID
  registers as well ?

- At present both HDFGRTR2_EL2 and HDFGWTR2_EL2 based accesses are enabled
  (MDSELR_E1 was dependent on them) but then there are some more FEAT_FGT2
  registers such HFGRTR2_EL2, HFGWTR2_EL2 and HFGITR2_EL2. Should those be
  handled in this series as well ?

- Probably an entry is needed for SYS_MDSELR_EL1 in encoding_to_fgt[] table
  inside the file arch/arm64/kvm/emulate-nested.c, but while trying to test
  features for all individual bits in HDFGRTR2_EL2, it seemed a lot of new
  register definitions from various features need to be added as well, thus
  expanding the scope further. Should all required new system registers be
  added for completeness ?

[1] https://lore.kernel.org/all/20240405080008.1225223-1-anshuman.khandual@arm.com/

Cc: Marc Zyngier <maz@...nel.org>
Cc: Oliver Upton <oliver.upton@...ux.dev>
Cc: James Morse <james.morse@....com>
Cc: Suzuki K Poulose <suzuki.poulose@....com>
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: Will Deacon <will@...nel.org>
Cc: Mark Brown <broonie@...nel.org>
Cc: linux-arm-kernel@...ts.infradead.org
Cc: kvmarm@...ts.linux.dev
Cc: linux-kernel@...r.kernel.org

Anshuman Khandual (10):
  arm64/sysreg: Update ID_AA64MMFR0_EL1 register
  arm64/sysreg: Update ID_AA64DFR0_EL1 register
  arm64/sysreg: Add register fields for ID_AA64DFR2_EL1
  arm64/sysreg: Add register fields for HDFGRTR2_EL2
  arm64/sysreg: Add register fields for HDFGWTR2_EL2
  arm64/sysreg: Add register fields for MDSELR_EL1
  arm64/sysreg: Add register fields for PMSID_EL1
  arm64/sysreg: Add register fields for TRBIDR_EL1
  KVM: arm64: nv: Enable HDFGRTR2_EL2 & HDFGWTR2_EL2 access from virtual EL2
  KVM: arm64: nv: Add new HDFGRTR2_GROUP & HDFGRTR2_GROUP based FGU handling

 arch/arm64/include/asm/kvm_arm.h        |   8 ++
 arch/arm64/include/asm/kvm_host.h       |   5 ++
 arch/arm64/include/asm/vncr_mapping.h   |   2 +
 arch/arm64/kvm/emulate-nested.c         |  14 +++
 arch/arm64/kvm/hyp/include/hyp/switch.h |  10 +++
 arch/arm64/kvm/nested.c                 |  36 ++++++++
 arch/arm64/kvm/sys_regs.c               |  47 ++++++++++
 arch/arm64/tools/sysreg                 | 115 ++++++++++++++++++++++--
 8 files changed, 232 insertions(+), 5 deletions(-)

-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ