kernel: Add support for to trust the CPU's hwrng#482
kernel: Add support for to trust the CPU's hwrng#482mcastelino wants to merge 1 commit intokata-containers:masterfrom
Conversation
To accelerate firecracker bootup enable support for hwrng https://lwn.net/Articles/760121/ User will still be able to override via kata configration.toml if desired random.trust_cpu=on|off Fixes: kata-containers#481 Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
|
/test |
grahamwhaley
left a comment
There was a problem hiding this comment.
lgtm
I'll add this to the fragment PR as well.
@Pennyzct @alicefr @tuan-hoang1 @nitkon - just fyi in for consideration on other arch's
|
Interestingly, looks like the entropy test failed for 18.04 CI - which feels like it could be related @mcastelino @GabyCT |
jodh-intel
left a comment
There was a problem hiding this comment.
Hi @mcastelino - the patch itself looks fine, but this feature is also available for ppc64le and s390x so shouldn't we also update those configs?
|
@jodh-intel: I can see |
|
I'd forgotten that ;) |
@GabyCT @grahamwhaley this is a nice CI test. Also I need to test this as scale. If launching a large number of kata containers actually get impacted by this, as this will get entropy from h/w. It may actually end up causing slowdown at scale. @grahamwhaley do we test entropy at scale as part of scale testing. I meant launch say 100 containers in parallel to detect any entropy related lockup delaying container launch. /cc @egernst |
|
@mcastelino We don't explicitly do any at-scale entropy tests that I am aware of, not. Notes:
|
|
I've had a look at the test, the kernel code for I have one idea that may be a 'fix', and I'll see if I can re-create and test that locally. I can't help feeling our test is a bit 'fast' at checking the entropy inside the VM, and maybe it just needs to be given a few seconds for Any extra thoughts welcome here :-) |
|
@mcastelino I did a bit more testing, and thinking... I also have a feeling the fact that in the container we were getting ~1000 units of entropy, and on the host I'm not convinced checking for available entropy immediately after boot inside the container is a useful test. the entropy may not have gathered by then. We may have to write a smarter test that does something like drains all the entropy and then measures how long it takes to come back. That might be a more realistic test for 'how good is our entropy pool source in the container'? I measure the entropy on my host and what the test was seeing on my local system, both with and without this wdyt? |
@grahamwhaley so the faster boot has the side effect of reducing available entropy. I agree we need to have a test that drains and checks how long it takes for entropy to build up to an acceptable level on an otherwise container. @ganeshmaharaj also noticed drops in entropy even with QEMU with come of the kernel config changes. |
|
I think @ganeshmaharaj noticed over on my fragments pr, where I added your |
We need to wait a couple of seconds in order to get the entropy level kata-containers/packaging#482. Fixes kata-containers#1546 Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
|
@mcastelino @GabyCT @jcvenegas - I thought I'd have a look-see at how fast random numbers can be supplied by either command: $ time dd if=/dev/[u]random of=/dev/null bs=4b count=100000
Notes then:
@GabyCT - I suspect we can thus write our 'entropy' (or rather, probably better named something like 'random source') test by doing a time test on getting random numbers from the (potentially blocking) |
|
Branch is conflicted (version file). |
|
Eric-stale-bot: This hasn't had much activity. AFAICT, this should be marked do-no-merge until we have appropriate test results in place for running on a single node with a scaled number of kata pods in order to measure the impact. I don't think @mcastelino will have cycles to do this -- I'll also add the help-wanted label. |
|
Ping @kata-containers/packaging - anyone have cycles to look at this? |
|
From reading the history and browsing the code, I think the correct way (for x86 at least) is to add the RANDOM_TRUST_CPU option to the kernel fragments. We may want to decide if we default to using the hwrng to on/off on the kernel command line though - that config option was added to the kernel for a reason ... |
|
As this PR is marked as do-not-merge, we're assuming it won't make for the final 1.13.0 release, thus we're closing it. |
To accelerate firecracker bootup enable support for hwrng
https://lwn.net/Articles/760121/
User will still be able to override via kata configration.toml if
desired random.trust_cpu=on|off
Fixes: #481
Signed-off-by: Manohar Castelino manohar.r.castelino@intel.com