From: Tangnianyao <tangnianyao@huawei.com>
To: Marc Zyngier <maz@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>, Will Deacon <will@kernel.org>,
<oliver.upton@linux.dev>, <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <kvmarm@lists.linux.dev>,
"guoyang (C)" <guoyang2@huawei.com>
Subject: Re: Question on get random long worse in VM than on host
Date: Fri, 6 Sep 2024 11:42:24 +0800 [thread overview]
Message-ID: <7530d60c-7419-fa86-57c1-9f52dc479598@huawei.com> (raw)
In-Reply-To: <86jzfqv7iq.wl-maz@kernel.org>
On 9/5/2024 16:17, Marc Zyngier wrote:
> [...]
>> Process is different between host and guest in arch/arm64, arch_get_random_seed_longs.
>> (1) In host , smccc_trng_available is false, it get randomness from RNDRRS.
>>
>> (2) In guest, smccc_trng_available is true, because kvm emulate it. Guest use smccc trng
>> and hvc, and trap to host kvm. Then in host call stack:
>> kvm_smccc_call_handler
>> kvm_trng_call
>> kvm_trng_do_rnd
>> get_random_long
>> ...
>> arch_get_random_seed_longs
>>
>> host get randomness as (1) and return random u64 to guest.
>> So the randomness guest finally get is from RNDRRS too.
>> Can we let guest get randomness directly from RNDRRS, not using hvc first?
>> The process for guest like (1):
>> 1) kvm not emulated smccc trng for guest
>> 2) guest check smccc trng, and get smccc_trng_available=false
>> 3) guest get randomness from RNDRRS
> I think I gave you the answer to this in my first reply [1].
>
> M.
>
> [1] https://lore.kernel.org/all/86zfotuoio.wl-maz@kernel.org/
>
Thank you Marc, I've missed this email.
Userspace should control whether expose TRNG to guest.
Thanks.
Nianyao
prev parent reply other threads:[~2024-09-06 3:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-31 3:34 Tangnianyao
2024-08-31 7:42 ` Marc Zyngier
2024-08-31 7:56 ` Ard Biesheuvel
2024-08-31 8:14 ` Marc Zyngier
2024-09-02 21:26 ` Ard Biesheuvel
2024-09-03 1:39 ` Tangnianyao
2024-09-03 15:04 ` Ard Biesheuvel
2024-09-05 3:12 ` Tangnianyao
2024-09-05 8:17 ` Marc Zyngier
2024-09-06 3:42 ` Tangnianyao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7530d60c-7419-fa86-57c1-9f52dc479598@huawei.com \
--to=tangnianyao@huawei.com \
--cc=ardb@kernel.org \
--cc=guoyang2@huawei.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®