-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove haveged to save space and resources #6781
Conversation
Starting from Linux kernel v5.4, the HAVEGED inspired algorithm has been included in the Linux kernel, see the [LKML article](https://lore.kernel.org/lkml/alpine.DEB.2.21.1909290010500.2636@nanos.tec.linutronix.de/T/) and the Linux Kernel [commit](torvalds/linux@50ee752). Additionally, since v5.6, as soon as the CRNG (the Linux cryptographic-strength random number generator) gets ready, /dev/random does not block on reads anymore: see this [commit](torvalds/linux@30c08ef). SOURCE: [jirka-h/haveged](https://github.com/jirka-h/haveged/blob/master/README.md)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not convinced -- prove me wrong
Hi! I'm not sure I understand specifically what I should prove wrong, but I can break down some facts:
To sum it up:
To be honest the initial material listed offered a decent overview, nevertheless I'm not expecting or demanding removal: just proposing it - no offence taken should you decide otherwise :) Grazie 🙏🏻 |
Excellent. I'm 99% convinced, except: does it all apply to armhf/arm64/riscv64? A cursory look revealed But I've my reasons: see the "default scheduler" fiasco/success from a few weeks ago. |
Now I understand the root doubt, thanks: there are some similar doubts on the lkl thread along with some testing code and some benchmark runs to prove robustness. Now, if logic serves me well (and I don't take it for granted as probabilistic/deterministic stuff is complex), if HAVEGE algorithm isn't fit for armhf/arm64/riscv64, it shouldn't matter if it's running off a library/daemon or from kernel |
The linked readme states:
I believe U-Boot can do this for us. Need to have a look at what e.g.
Users can install their fav tool for RNG if needed
Irrelevant today. The project seems to not have been updated in a while. Looks to me as dropping this package is totally fine. |
Did a few tests. All my systems run fine without haveged (and have been so for a few years, actually -- silly me) |
🙏🏻 |
Actually I'm interested too - tried to delve a bit it seems it needs some nodes in DTB - with a random seed coming from bootloader kaslr would kick in - whatever that is - possibly some randomization of kernel memory |
Ah I didn't know that this needed a special device tree node. RK35** devices do have a hardware RNG generator, so maybe this could be used somehow in U-Boot? |
@ColorfulRhino - it's implemented in some nanopi board - look at this pr #4352 |
Yeah this is a requirement, U-Boot has to be compiled to have the kaslrseed command available AND the command needs to be called in the script. The PR you linked actually is not the best implementation imo since on so many boards it currently does output an error message on boot like "error: kaslrseed not available" 😆 |
What's your On NanoPi R6C it seems stuck on 256 which is really low (without this PR applied). |
smeels like hardcoded |
Yeah this is unrelated to In theory, the hardware based RNG generator should be active on RK35xx in the edge kernel. Maybe something is not correct here. Investigation needed, I will open an issue. |
on my nanopi I'm running current 6.6 - kali patches aren't yet ported to post-6.8 |
It's probably the same on 6.10 :) Maybe this behaviour is wanted, see #6806 Also, apologies, I did not want to hold up this PR. It's still ready to merge, the discussion has not much to do with |
Not a big fan of HWRNG's as unlike SW, they cannot be audited... The current RNG in the kernel is more that sufficient |
True, but you can only do so much with software.
I'm not sure if HWRNG on Rockchip automatically replaces software RNG if enabled in the kernel config. |
IIRC it just creates the device, e.g. /dev/hwrng To actually use it, one has to also include the rng-tools package and configure rngd to use the hwrng device. https://github.com/nhorman/rng-tools Otherwise the kernel should always prefer the internal software based RNG As I mentioned, things like HWRNG's and onboard crypto accelerators/offload are always a concern... how random are they, and how can one confidently test it? If it is even slightly less than random, it's a big security risk. Anyways, the other benefit of just using the kernel's RNG is that it's just a lot less maintaining - and that's always a win. Remember that haveged was there to address issues with /dev/random (it's blocking) and things like VM's that are slow to fill the pool - the RNG in 5.19 addresses the same concerns. |
Or did you test entropy quality? |
Starting from Linux kernel v5.4, the HAVEGED inspired algorithm has been included in the Linux kernel, see the LKML article and the Linux Kernel commit.
Additionally, since v5.6, as soon as the CRNG (the Linux cryptographic-strength random number generator) gets ready, /dev/random does not block on reads anymore: see this commit.
SOURCE: jirka-h/haveged
How Has This Been Tested?
Checklist: