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-prev] [day] [month] [year] [list]
Message-ID: <8a4c285e-2b6f-44f0-b1d8-0b5a6f6b6581@arm.com>
Date: Mon, 2 Jun 2025 16:16:43 +0100
From: Suzuki K Poulose <suzuki.poulose@....com>
To: Steven Price <steven.price@....com>,
 "Emi Kisanuki (Fujitsu)" <fj0570is@...itsu.com>,
 "'kvm@...r.kernel.org'" <kvm@...r.kernel.org>,
 "'kvmarm@...ts.linux.dev'" <kvmarm@...ts.linux.dev>
Cc: 'Catalin Marinas' <catalin.marinas@....com>,
 'Marc Zyngier' <maz@...nel.org>, 'Will Deacon' <will@...nel.org>,
 'James Morse' <james.morse@....com>, 'Oliver Upton'
 <oliver.upton@...ux.dev>, 'Zenghui Yu' <yuzenghui@...wei.com>,
 "'linux-arm-kernel@...ts.infradead.org'"
 <linux-arm-kernel@...ts.infradead.org>,
 "'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>,
 'Joey Gouly' <joey.gouly@....com>,
 'Alexandru Elisei' <alexandru.elisei@....com>,
 'Christoffer Dall' <christoffer.dall@....com>,
 'Fuad Tabba' <tabba@...gle.com>,
 "'linux-coco@...ts.linux.dev'" <linux-coco@...ts.linux.dev>,
 'Ganapatrao Kulkarni' <gankulkarni@...amperecomputing.com>,
 'Gavin Shan' <gshan@...hat.com>,
 'Shanker Donthineni' <sdonthineni@...dia.com>,
 'Alper Gun' <alpergun@...gle.com>,
 "'Aneesh Kumar K . V'" <aneesh.kumar@...nel.org>
Subject: Re: [PATCH v8 16/43] arm64: RME: Handle realm enter/exit

On 02/06/2025 16:14, Steven Price wrote:
> On 29/05/2025 05:52, Emi Kisanuki (Fujitsu) wrote:
>> Hello, I comment below.
> 
> Hi Emi,
> 
>>> Subject: [PATCH v8 16/43] arm64: RME: Handle realm enter/exit
>>>
>>> Entering a realm is done using a SMC call to the RMM. On exit the exit-codes
>>> need to be handled slightly differently to the normal KVM path so define our own
>>> functions for realm enter/exit and hook them in if the guest is a realm guest.
>>>
>>> Signed-off-by: Steven Price <steven.price@....com>
>>> ---
> 
> [..]
> 
>>> +/*
>>> + * Return > 0 to return to guest, < 0 on error, 0 (and set exit_reason)
>>> +on
>>> + * proper exit to userspace.
>>> + */
>>> +int handle_rec_exit(struct kvm_vcpu *vcpu, int rec_run_ret) {
>>> +	struct realm_rec *rec = &vcpu->arch.rec;
>>> +	u8 esr_ec = ESR_ELx_EC(rec->run->exit.esr);
>>> +	unsigned long status, index;
>>> +
>>> +	status = RMI_RETURN_STATUS(rec_run_ret);
>>> +	index = RMI_RETURN_INDEX(rec_run_ret);
>>> +
>>> +	/*
>>> +	 * If a PSCI_SYSTEM_OFF request raced with a vcpu executing, we
>>> might
>>> +	 * see the following status code and index indicating an attempt to run
>>> +	 * a REC when the RD state is SYSTEM_OFF.  In this case, we just need
>>> to
>>> +	 * return to user space which can deal with the system event or will try
>>> +	 * to run the KVM VCPU again, at which point we will no longer attempt
>>> +	 * to enter the Realm because we will have a sleep request pending on
>>> +	 * the VCPU as a result of KVM's PSCI handling.
>>> +	 */
>>> +	if (status == RMI_ERROR_REALM && index == 1) {
>>> +		vcpu->run->exit_reason = KVM_EXIT_UNKNOWN;
>>> +		return 0;
>>> +	}
>> Running kvm-unit-tests-cca selftest(smp) test in quick succession may trigger these conditions, resulting in the following error logs.
>>   Error: KVM exit reason: 0 ("KVM_EXIT_UNKNOWN")
>>
>> Since KVM_EXIT_UNKNOWN is used when no specific exit reason applies, I think it would be better to make it identifiable as an error.
>> How about adding and setting a new ARM64 exit_reason value to indicate that the PSCI_SYSTEM_OFF request is conflicting with a running vcpu?
> 
> Aneesh pointed this out to me off-list. We agreed that KVM_EXIT_SHUTDOWN
> was more appropriate here. I'll make the change for v9.

Sounds good to me

Cheers
Suzuki


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ