* [PATCH 4.14] efi: random: Properly limit the size of the random seed
@ 2022-11-30 23:47 Ben Hutchings
2022-11-30 23:53 ` Ben Hutchings
2022-12-03 13:54 ` Greg KH
0 siblings, 2 replies; 4+ messages in thread
From: Ben Hutchings @ 2022-11-30 23:47 UTC (permalink / raw)
To: stable; +Cc: Ard Biesheuvel, Jason A. Donenfeld, Ilias Apalodimas
[-- Attachment #1: Type: text/plain, Size: 1514 bytes --]
Commit be36f9e7517e ("efi: READ_ONCE rng seed size before munmap")
added a READ_ONCE() and also changed the call to
add_bootloader_randomness() to use the local size variable. Neither
of these changes was actually needed and this was not backported to
the 4.14 stable branch.
Commit 161a438d730d ("efi: random: reduce seed size to 32 bytes")
reverted the addition of READ_ONCE() and added a limit to the value of
size. This depends on the earlier commit, because size can now differ
from seed->size, but it was wrongly backported to the 4.14 stable
branch by itself.
Apply the missing change to the add_bootloader_randomness() parameter
(except that here we are still using add_device_randomness()).
Fixes: 700485f70e50 ("efi: random: reduce seed size to 32 bytes")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
drivers/firmware/efi/efi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index ed981f5e29ae..cc64869d8420 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -541,7 +541,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
seed = early_memremap(efi.rng_seed,
sizeof(*seed) + size);
if (seed != NULL) {
- add_device_randomness(seed->bits, seed->size);
+ add_device_randomness(seed->bits, size);
early_memunmap(seed, sizeof(*seed) + size);
pr_notice("seeding entropy pool\n");
} else {
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 4.14] efi: random: Properly limit the size of the random seed
2022-11-30 23:47 [PATCH 4.14] efi: random: Properly limit the size of the random seed Ben Hutchings
@ 2022-11-30 23:53 ` Ben Hutchings
2022-12-03 13:54 ` Greg KH
2022-12-03 13:54 ` Greg KH
1 sibling, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2022-11-30 23:53 UTC (permalink / raw)
To: Dominik Brodowski, Jason A. Donenfeld, Ard Biesheuvel
Cc: Ilias Apalodimas, stable
[-- Attachment #1: Type: text/plain, Size: 1135 bytes --]
On Thu, 2022-12-01 at 00:47 +0100, Ben Hutchings wrote:
> Commit be36f9e7517e ("efi: READ_ONCE rng seed size before munmap")
> added a READ_ONCE() and also changed the call to
> add_bootloader_randomness() to use the local size variable. Neither
> of these changes was actually needed and this was not backported to
> the 4.14 stable branch.
>
> Commit 161a438d730d ("efi: random: reduce seed size to 32 bytes")
> reverted the addition of READ_ONCE() and added a limit to the value of
> size. This depends on the earlier commit, because size can now differ
> from seed->size, but it was wrongly backported to the 4.14 stable
> branch by itself.
>
> Apply the missing change to the add_bootloader_randomness() parameter
> (except that here we are still using add_device_randomness()).
[...]
This made me wonder: shouldn't commit 18b915ac6b0a ("efi/random: Treat
EFI_RNG_PROTOCOL output as bootloader randomness") be applied to these
older stable branches? Without that, the EFI RNG can't be distrusted
if necessary.
Ben.
--
Ben Hutchings
compatible: Gracefully accepts erroneous data from any source
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 4.14] efi: random: Properly limit the size of the random seed
2022-11-30 23:53 ` Ben Hutchings
@ 2022-12-03 13:54 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2022-12-03 13:54 UTC (permalink / raw)
To: Ben Hutchings
Cc: Dominik Brodowski, Jason A. Donenfeld, Ard Biesheuvel,
Ilias Apalodimas, stable
On Thu, Dec 01, 2022 at 12:53:03AM +0100, Ben Hutchings wrote:
> On Thu, 2022-12-01 at 00:47 +0100, Ben Hutchings wrote:
> > Commit be36f9e7517e ("efi: READ_ONCE rng seed size before munmap")
> > added a READ_ONCE() and also changed the call to
> > add_bootloader_randomness() to use the local size variable. Neither
> > of these changes was actually needed and this was not backported to
> > the 4.14 stable branch.
> >
> > Commit 161a438d730d ("efi: random: reduce seed size to 32 bytes")
> > reverted the addition of READ_ONCE() and added a limit to the value of
> > size. This depends on the earlier commit, because size can now differ
> > from seed->size, but it was wrongly backported to the 4.14 stable
> > branch by itself.
> >
> > Apply the missing change to the add_bootloader_randomness() parameter
> > (except that here we are still using add_device_randomness()).
> [...]
>
> This made me wonder: shouldn't commit 18b915ac6b0a ("efi/random: Treat
> EFI_RNG_PROTOCOL output as bootloader randomness") be applied to these
> older stable branches? Without that, the EFI RNG can't be distrusted
> if necessary.
Makes sense, want to send a backport on top of this one as the original
will not work?
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 4.14] efi: random: Properly limit the size of the random seed
2022-11-30 23:47 [PATCH 4.14] efi: random: Properly limit the size of the random seed Ben Hutchings
2022-11-30 23:53 ` Ben Hutchings
@ 2022-12-03 13:54 ` Greg KH
1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2022-12-03 13:54 UTC (permalink / raw)
To: Ben Hutchings
Cc: stable, Ard Biesheuvel, Jason A. Donenfeld, Ilias Apalodimas
On Thu, Dec 01, 2022 at 12:47:22AM +0100, Ben Hutchings wrote:
> Commit be36f9e7517e ("efi: READ_ONCE rng seed size before munmap")
> added a READ_ONCE() and also changed the call to
> add_bootloader_randomness() to use the local size variable. Neither
> of these changes was actually needed and this was not backported to
> the 4.14 stable branch.
>
> Commit 161a438d730d ("efi: random: reduce seed size to 32 bytes")
> reverted the addition of READ_ONCE() and added a limit to the value of
> size. This depends on the earlier commit, because size can now differ
> from seed->size, but it was wrongly backported to the 4.14 stable
> branch by itself.
>
> Apply the missing change to the add_bootloader_randomness() parameter
> (except that here we are still using add_device_randomness()).
>
> Fixes: 700485f70e50 ("efi: random: reduce seed size to 32 bytes")
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
> drivers/firmware/efi/efi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Both now queued up, thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-12-03 13:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-30 23:47 [PATCH 4.14] efi: random: Properly limit the size of the random seed Ben Hutchings
2022-11-30 23:53 ` Ben Hutchings
2022-12-03 13:54 ` Greg KH
2022-12-03 13:54 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox