Re: [PATCH v6 5/7] treewide: use get_random_u32() when possible

2022-10-13 Thread Jason A. Donenfeld
On Thu, Oct 13, 2022 at 01:40:40PM +0200, Rolf Eike Beer wrote: > Am Donnerstag, 13. Oktober 2022, 12:16:35 CEST schrieb Florian Westphal: > > Rolf Eike Beer wrote: > > > Florian, can you comment and maybe fix it? > > > > Can't comment, do not remember -- this was 5 years ago. > > > > > Or you w

Re: [PATCH v6 3/7] treewide: use get_random_{u8,u16}() when possible, part 1

2022-10-10 Thread Jason A. Donenfeld
On Tue, Oct 11, 2022 at 01:18:40AM +, Elliott, Robert (Servers) wrote: > > > diff --git a/crypto/testmgr.c b/crypto/testmgr.c > ... > > @@ -944,7 +944,7 @@ static void generate_random_bytes(u8 *buf, size_t count) > > default: > > /* Fully random bytes */ > > for (i

[PATCH v6 7/7] prandom: remove unused functions

2022-10-10 Thread Jason A. Donenfeld
With no callers left of prandom_u32() and prandom_bytes(), as well as get_random_int(), remove these deprecated wrappers, in favor of get_random_u32() and get_random_bytes(). Reviewed-by: Greg Kroah-Hartman Reviewed-by: Kees Cook Reviewed-by: Yury Norov Signed-off-by: Jason A. Donenfeld

[PATCH v6 6/7] treewide: use get_random_bytes() when possible

2022-10-10 Thread Jason A. Donenfeld
Kroah-Hartman Reviewed-by: Kees Cook Reviewed-by: Yury Norov Reviewed-by: Christophe Leroy # powerpc Signed-off-by: Jason A. Donenfeld --- arch/powerpc/crypto/crc-vpmsum_test.c | 2 +- block/blk-crypto-fallback.c | 2 +- crypto/async_tx/raid6test.c | 2

[PATCH v6 5/7] treewide: use get_random_u32() when possible

2022-10-10 Thread Jason A. Donenfeld
thunderbolt Acked-by: Darrick J. Wong # for xfs Signed-off-by: Jason A. Donenfeld --- Documentation/networking/filter.rst| 2 +- arch/parisc/kernel/process.c | 2 +- arch/parisc/kernel/sys_parisc.c| 4 ++-- arch/s390/mm/mmap.c

[PATCH v6 4/7] treewide: use get_random_{u8,u16}() when possible, part 2

2022-10-10 Thread Jason A. Donenfeld
in a non-32-bit context. Reviewed-by: Greg Kroah-Hartman Reviewed-by: Kees Cook Reviewed-by: Yury Norov Signed-off-by: Jason A. Donenfeld --- arch/s390/kernel/process.c | 2 +- drivers/mtd/nand/raw/nandsim.c | 2 +- lib/test_vmalloc.c | 2 +- net/rds/bind.c | 2

[PATCH v6 3/7] treewide: use get_random_{u8,u16}() when possible, part 1

2022-10-10 Thread Jason A. Donenfeld
lt. @plus_one@ expression literal_mask.LITERAL; position literal_mask.p; identifier add_one.RESULT; identifier FUNC; @@ - (FUNC()@p & (LITERAL)) + (RESULT() & LITERAL) Reviewed-by: Greg Kroah-Hartman Reviewed-by: Kees Cook Reviewed-by: Yury Norov Acked-b

[PATCH v6 2/7] treewide: use prandom_u32_max() when possible, part 2

2022-10-10 Thread Jason A. Donenfeld
: Greg Kroah-Hartman Reviewed-by: Kees Cook Reviewed-by: Yury Norov Reviewed-by: Jan Kara # for ext2, ext4, and sbitmap Signed-off-by: Jason A. Donenfeld --- fs/ext2/ialloc.c | 3 +-- fs/ext4/ialloc.c | 5 ++--- lib/sbitmap.c | 2 +- lib/test_vmalloc.c | 17 - 4

[PATCH v6 1/7] treewide: use prandom_u32_max() when possible, part 1

2022-10-10 Thread Jason A. Donenfeld
by: Jan Kara # for ext4 and sbitmap Reviewed-by: Christoph Böhmwalder # for drbd Acked-by: Ulf Hansson # for mmc Acked-by: Darrick J. Wong # for xfs Signed-off-by: Jason A. Donenfeld --- arch/arm/kernel/process.c | 2 +- arch/arm64/kernel/process.c

[PATCH v6 0/7] treewide cleanup of random integer usage

2022-10-10 Thread Jason A. Donenfeld
s.org Cc: loonga...@lists.linux.dev Cc: net...@vger.kernel.org Cc: sparcli...@vger.kernel.org Cc: x...@kernel.org Jason A. Donenfeld (7): treewide: use prandom_u32_max() when possible, part 1 treewide: use prandom_u32_max() when possible, part 2 treewide: use get_random_{u8,u16}() when possible

Re: [PATCH v5 0/7] treewide cleanup of random integer usage

2022-10-09 Thread Jason A. Donenfeld
On Sat, Oct 08, 2022 at 08:41:14PM -0700, Kees Cook wrote: > On Fri, Oct 07, 2022 at 11:53:52PM -0600, Jason A. Donenfeld wrote: > > This is a five part treewide cleanup of random integer handling. The > > rules for random integers are: > > Reviewing the delta between of my

Re: [PATCH v3 3/5] treewide: use get_random_u32() when possible

2022-10-08 Thread Jason A. Donenfeld
On Sat, Oct 08, 2022 at 09:53:33PM +, David Laight wrote: > From: Jason A. Donenfeld > > Sent: 07 October 2022 18:56 > ... > > > Given these kinds of less mechanical changes, it may make sense to split > > > these from the "trivial" conversions in a tre

Re: [PATCH v4 4/6] treewide: use get_random_u32() when possible

2022-10-08 Thread Jason A. Donenfeld
On Sat, Oct 8, 2022 at 4:37 PM Jason A. Donenfeld wrote: > > On Sat, Oct 08, 2022 at 10:18:45PM +, David Laight wrote: > > From: Jason A. Donenfeld > > > Sent: 07 October 2022 19:01 > > > > > > The prandom_u32() function has been a deprecated inline wr

Re: [PATCH v4 4/6] treewide: use get_random_u32() when possible

2022-10-08 Thread Jason A. Donenfeld
On Sat, Oct 08, 2022 at 10:18:45PM +, David Laight wrote: > From: Jason A. Donenfeld > > Sent: 07 October 2022 19:01 > > > > The prandom_u32() function has been a deprecated inline wrapper around > > get_random_u32() for several releases now, and compiles down

Re: [PATCH v4 2/6] treewide: use prandom_u32_max() when possible

2022-10-08 Thread Jason A. Donenfeld
On Sat, Oct 08, 2022 at 10:08:03PM +, David Laight wrote: > From: Jason A. Donenfeld > > Sent: 07 October 2022 19:01 > > > > Rather than incurring a division or requesting too many random bytes for > > the given range, use the prandom_u32_max() function, which

[PATCH v5 6/7] treewide: use get_random_bytes when possible

2022-10-08 Thread Jason A. Donenfeld
Reviewed-by: Christophe Leroy # powerpc Signed-off-by: Jason A. Donenfeld --- arch/powerpc/crypto/crc-vpmsum_test.c | 2 +- block/blk-crypto-fallback.c | 2 +- crypto/async_tx/raid6test.c | 2 +- drivers/dma/dmatest.c | 2

[PATCH v5 7/7] prandom: remove unused functions

2022-10-08 Thread Jason A. Donenfeld
With no callers left of prandom_u32() and prandom_bytes(), as well as get_random_int(), remove these deprecated wrappers, in favor of get_random_u32() and get_random_bytes(). Reviewed-by: Kees Cook Signed-off-by: Jason A. Donenfeld --- drivers/char/random.c | 11 +-- include/linux

[PATCH v5 5/7] treewide: use get_random_u32() when possible

2022-10-07 Thread Jason A. Donenfeld
-by: Jason A. Donenfeld --- Documentation/networking/filter.rst| 2 +- arch/parisc/kernel/process.c | 2 +- arch/parisc/kernel/sys_parisc.c| 4 ++-- arch/s390/mm/mmap.c| 2 +- arch/x86/kernel/cpu/amd.c

[PATCH v5 4/7] treewide: use get_random_{u8,u16}() when possible, part 2

2022-10-07 Thread Jason A. Donenfeld
in a non-32-bit context. Reviewed-by: Kees Cook Signed-off-by: Jason A. Donenfeld --- arch/s390/kernel/process.c | 2 +- lib/test_vmalloc.c | 2 +- net/ipv4/ip_output.c| 2 +- net/netfilter/nf_nat_core.c | 4 ++-- net/rds/bind.c | 2 +- net/sched/sch_sfb.c

[PATCH v5 3/7] treewide: use get_random_{u8,u16}() when possible, part 1

2022-10-07 Thread Jason A. Donenfeld
print("Skipping large mask of %s" % (literal)) cocci.include_match(False) // Replace the literal mask with the calculated result. @plus_one@ expression literal_mask.LITERAL; position literal_mask.p; identifier add_one.RESULT; identifier FUNC; @@ - (FUNC()@p & (LITERAL)) +

[PATCH v5 1/7] treewide: use prandom_u32_max() when possible, part 1

2022-10-07 Thread Jason A. Donenfeld
+ return E; } @drop_var@ type T; identifier VAR; @@ { - T VAR; ... when != VAR } Reviewed-by: Kees Cook Reviewed-by: KP Singh Reviewed-by: Jan Kara # for ext4 and sbitmap Reviewed-by: Christoph Böhmwalder # for drbd Acked-by: Ulf Hansson # for mmc Acked-by: Dar

[PATCH v5 2/7] treewide: use prandom_u32_max() when possible, part 2

2022-10-07 Thread Jason A. Donenfeld
: Kees Cook Reviewed-by: Jan Kara # for ext2, ext4, and sbitmap Signed-off-by: Jason A. Donenfeld --- fs/ext2/ialloc.c | 3 +-- fs/ext4/ialloc.c | 5 ++--- lib/sbitmap.c | 2 +- lib/test_vmalloc.c | 17 - 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a

[PATCH v5 0/7] treewide cleanup of random integer usage

2022-10-07 Thread Jason A. Donenfeld
a...@lists.linux.dev Cc: net...@vger.kernel.org Cc: sparcli...@vger.kernel.org Cc: x...@kernel.org Jason A. Donenfeld (7): treewide: use prandom_u32_max() when possible, part 1 treewide: use prandom_u32_max() when possible, part 2 treewide: use get_random_{u8,u16}() when possible, part 1

Re: [PATCH v4 2/6] treewide: use prandom_u32_max() when possible

2022-10-07 Thread Jason A. Donenfeld
On Fri, Oct 07, 2022 at 03:47:44PM -0700, Kees Cook wrote: > > diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c > > index 4f2f2d1bac56..56ffaa8dd3f6 100644 > > --- a/lib/test_vmalloc.c > > +++ b/lib/test_vmalloc.c > > @@ -151,9 +151,7 @@ static int random_size_alloc_test(void) > > int i; >

Re: [PATCH v4 2/6] treewide: use prandom_u32_max() when possible

2022-10-07 Thread Jason A. Donenfeld
On Fri, Oct 07, 2022 at 03:47:44PM -0700, Kees Cook wrote: > On Fri, Oct 07, 2022 at 12:01:03PM -0600, Jason A. Donenfeld wrote: > > Rather than incurring a division or requesting too many random bytes for > > the given range, use the prandom_u32_max() function, which only takes

Re: [PATCH v4 4/6] treewide: use get_random_u32() when possible

2022-10-07 Thread Jason A. Donenfeld
On Fri, Oct 07, 2022 at 10:34:47PM +0200, Rolf Eike Beer wrote: > > diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c > > index 7c37e09c92da..18c4f0e3e906 100644 > > --- a/arch/parisc/kernel/process.c > > +++ b/arch/parisc/kernel/process.c > > @@ -288,7 +288,7 @@ __get_wchan(

Re: [PATCH v4 2/6] treewide: use prandom_u32_max() when possible

2022-10-07 Thread Jason A. Donenfeld
On Fri, Oct 07, 2022 at 02:17:22PM -0700, Darrick J. Wong wrote: > On Fri, Oct 07, 2022 at 12:01:03PM -0600, Jason A. Donenfeld wrote: > > Rather than incurring a division or requesting too many random bytes for > > the given range, use the prandom_u32_max() function, which onl

[PATCH v4 4/6] treewide: use get_random_u32() when possible

2022-10-07 Thread Jason A. Donenfeld
around get_random_u32(). Reviewed-by: Kees Cook Acked-by: Toke Høiland-Jørgensen # for sch_cake Acked-by: Chuck Lever # for nfsd Reviewed-by: Jan Kara # for ext4 Acked-by: Mika Westerberg # for thunderbolt Signed-off-by: Jason A. Donenfeld --- Documentation/networking/filter.rst| 2

[PATCH v4 3/6] treewide: use get_random_{u8,u16}() when possible

2022-10-07 Thread Jason A. Donenfeld
Rather than truncate a 32-bit value to a 16-bit value or an 8-bit value, simply use the get_random_{u8,u16}() functions, which are faster than wasting the additional bytes from a 32-bit value. Reviewed-by: Kees Cook Acked-by: Toke Høiland-Jørgensen # for sch_cake Signed-off-by: Jason A

[PATCH v4 6/6] prandom: remove unused functions

2022-10-07 Thread Jason A. Donenfeld
With no callers left of prandom_u32() and prandom_bytes(), as well as get_random_int(), remove these deprecated wrappers, in favor of get_random_u32() and get_random_bytes(). Reviewed-by: Kees Cook Signed-off-by: Jason A. Donenfeld --- drivers/char/random.c | 11 +-- include/linux

[PATCH v4 5/6] treewide: use get_random_bytes when possible

2022-10-07 Thread Jason A. Donenfeld
Signed-off-by: Jason A. Donenfeld --- arch/powerpc/crypto/crc-vpmsum_test.c | 2 +- block/blk-crypto-fallback.c | 2 +- crypto/async_tx/raid6test.c | 2 +- drivers/dma/dmatest.c | 2 +- drivers/mtd/nand/raw/nandsim.c | 2

[PATCH v4 2/6] treewide: use prandom_u32_max() when possible

2022-10-07 Thread Jason A. Donenfeld
Reviewed-by: Jan Kara # for ext2, ext4, and sbitmap Signed-off-by: Jason A. Donenfeld --- arch/arm64/kernel/process.c | 2 +- arch/loongarch/kernel/process.c | 2 +- arch/loongarch/kernel/vdso.c | 2 +- arch/mips/kernel/process.c | 2 +- arch/mips/kernel

[PATCH v4 1/6] treewide: use prandom_u32_max() when possible, mechanically

2022-10-07 Thread Jason A. Donenfeld
-by: Kees Cook Reviewed-by: KP Singh Reviewed-by: Jan Kara # for ext4 and sbitmap Acked-by: Ulf Hansson # for mmc Signed-off-by: Jason A. Donenfeld --- arch/arm/kernel/process.c | 2 +- arch/s390/kernel/vdso.c | 2 +- arch/um/kernel/process.c

[PATCH v4 0/6] treewide cleanup of random integer usage

2022-10-07 Thread Jason A. Donenfeld
xppc-...@lists.ozlabs.org Cc: loonga...@lists.linux.dev Cc: net...@vger.kernel.org Cc: sparcli...@vger.kernel.org Cc: x...@kernel.org Jason A. Donenfeld (6): treewide: use prandom_u32_max() when possible, mechanically treewide: use prandom_u32_max() when possible treewide: use get_random_

Re: [PATCH v3 3/5] treewide: use get_random_u32() when possible

2022-10-07 Thread Jason A. Donenfeld
On Fri, Oct 07, 2022 at 10:12:42AM -0700, Kees Cook wrote: > On Fri, Oct 07, 2022 at 08:07:58AM -0600, Jason A. Donenfeld wrote: > > On Fri, Oct 07, 2022 at 04:57:24AM +, Christophe Leroy wrote: > > > > > > > > > Le 07/10/2022 à 01:36, Jason A. Do

Re: [PATCH v3 3/5] treewide: use get_random_u32() when possible

2022-10-07 Thread Jason A. Donenfeld
On Fri, Oct 07, 2022 at 04:57:24AM +, Christophe Leroy wrote: > > > Le 07/10/2022 à 01:36, Jason A. Donenfeld a écrit : > > On 10/6/22, Christophe Leroy wrote: > >> > >> > >> Le 06/10/2022 à 19:31, Christophe Leroy a écrit : > >>> &

Re: [PATCH v3 4/5] treewide: use get_random_bytes when possible

2022-10-06 Thread Jason A. Donenfeld
On 10/6/22, Bagas Sanjaya wrote: > On 10/6/22 23:53, Jason A. Donenfeld wrote: >> The prandom_bytes() function has been a deprecated inline wrapper around >> get_random_bytes() for several releases now, and compiles down to the >> exact same code. Replace the deprecated wrapp

Re: [PATCH v3 3/5] treewide: use get_random_u32() when possible

2022-10-06 Thread Jason A. Donenfeld
On 10/6/22, Christophe Leroy wrote: > > > Le 06/10/2022 à 19:31, Christophe Leroy a écrit : >> >> >> Le 06/10/2022 à 19:24, Jason A. Donenfeld a écrit : >>> Hi Christophe, >>> >>> On Thu, Oct 6, 2022 at 11:21 AM Christophe Leroy >>>

[PATCH v3 2/5] treewide: use get_random_{u8,u16}() when possible

2022-10-06 Thread Jason A. Donenfeld
Rather than truncate a 32-bit value to a 16-bit value or an 8-bit value, simply use the get_random_{u8,u16}() functions, which are faster than wasting the additional bytes from a 32-bit value. Reviewed-by: Kees Cook Acked-by: Toke Høiland-Jørgensen # for sch_cake Signed-off-by: Jason A

Re: [PATCH v3 3/5] treewide: use get_random_u32() when possible

2022-10-06 Thread Jason A. Donenfeld
Hi Christophe, On Thu, Oct 6, 2022 at 11:21 AM Christophe Leroy wrote: > Le 06/10/2022 à 18:53, Jason A. Donenfeld a écrit : > > The prandom_u32() function has been a deprecated inline wrapper around > > get_random_u32() for several releases now, and compiles down to the >

[PATCH v3 4/5] treewide: use get_random_bytes when possible

2022-10-06 Thread Jason A. Donenfeld
The prandom_bytes() function has been a deprecated inline wrapper around get_random_bytes() for several releases now, and compiles down to the exact same code. Replace the deprecated wrapper with a direct call to the real function. Reviewed-by: Kees Cook Signed-off-by: Jason A. Donenfeld

[PATCH v3 5/5] prandom: remove unused functions

2022-10-06 Thread Jason A. Donenfeld
With no callers left of prandom_u32() and prandom_bytes(), as well as get_random_int(), remove these deprecated wrappers, in favor of get_random_u32() and get_random_bytes(). Reviewed-by: Kees Cook Signed-off-by: Jason A. Donenfeld --- drivers/char/random.c | 11 +-- include/linux

[PATCH v3 3/5] treewide: use get_random_u32() when possible

2022-10-06 Thread Jason A. Donenfeld
around get_random_u32(). Reviewed-by: Kees Cook Acked-by: Toke Høiland-Jørgensen # for sch_cake Acked-by: Chuck Lever # for nfsd Reviewed-by: Jan Kara # for ext4 Signed-off-by: Jason A. Donenfeld --- Documentation/networking/filter.rst| 2 +- arch/arm64/kernel/process.c

[PATCH v3 1/5] treewide: use prandom_u32_max() when possible

2022-10-06 Thread Jason A. Donenfeld
Reviewed-by: Jan Kara # for ext2, ext4, and sbitmap Signed-off-by: Jason A. Donenfeld --- arch/arm/kernel/process.c | 2 +- arch/loongarch/kernel/vdso.c | 2 +- arch/mips/kernel/vdso.c | 2 +- arch/parisc/kernel/vdso.c

[PATCH v3 0/5] treewide cleanup of random integer usage

2022-10-06 Thread Jason A. Donenfeld
nel.org Cc: linux-r...@vger.kernel.org Cc: linux-s...@vger.kernel.org Cc: linux-um@lists.infradead.org Cc: linux-...@vger.kernel.org Cc: linux-wirel...@vger.kernel.org Cc: linuxppc-...@lists.ozlabs.org Cc: loonga...@lists.linux.dev Cc: net...@vger.kernel.org Cc: sparcli...@vger.kernel.org Cc: x..

Re: [PATCH v4 04/11] mips: use fallback for random_get_entropy() instead of zero

2022-04-24 Thread Jason A. Donenfeld
On Sun, Apr 24, 2022 at 12:33:44AM +0100, Maciej W. Rozycki wrote: > unconditionally. I think this discovery asks for code optimisation, which > I'll try to cook up sometime. At some point too, by the way, we might also consider putting that into a .c file rather than a static inline in the .h,

[PATCH v6 00/17] archs/random: fallback to best raw ktime when no cycle counter

2022-04-23 Thread Jason A. Donenfeld
s.infradead.org Cc: x...@kernel.org Cc: linux-xte...@linux-xtensa.org Cc: openr...@lists.librecores.org Cc: linux-i...@vger.kernel.org Cc: linux-s...@vger.kernel.org Cc: linux-par...@vger.kernel.org Cc: linuxppc-...@lists.ozlabs.org Jason A. Donenfeld (17): ia64: define get_cycles macro for arch-ove

Re: [PATCH v5 11/11] random: insist on random_get_entropy() existing in order to simplify

2022-04-23 Thread Jason A. Donenfeld
Hi Sandy, On Sat, Apr 23, 2022 at 10:24:07AM +0800, Sandy Harris wrote: > On Sat, Apr 23, 2022 at 6:37 AM Jason A. Donenfeld wrote: > > > > All platforms are now guaranteed to provide some value for > > random_get_entropy(). In case some bug leads to this not being so, w

Re: [PATCH v5 04/11] mips: use fallback for random_get_entropy() instead of just c0 random

2022-04-21 Thread Jason A. Donenfeld
Hi Maciej, On Thu, Apr 21, 2022 at 9:25 PM Maciej W. Rozycki wrote: > > On Tue, 19 Apr 2022, Jason A. Donenfeld wrote: > > > For situations in which we don't have a c0 counter register available, > > we've been falling back to reading the c0 "random" regi

Re: [PATCH v5 07/11] x86: use fallback for random_get_entropy() instead of zero

2022-04-19 Thread Jason A. Donenfeld
Hi Borislav, On Tue, Apr 19, 2022 at 8:59 PM Borislav Petkov wrote: > > On Tue, Apr 19, 2022 at 08:38:41PM +0200, Jason A. Donenfeld wrote: > > I think I prefer doing (a), and leaving (b) for another time when you > > or another x86 maintainer can do so. But I'll do which

Re: [PATCH v5 07/11] x86: use fallback for random_get_entropy() instead of zero

2022-04-19 Thread Jason A. Donenfeld
Hi Borislav, On Tue, Apr 19, 2022 at 8:16 PM Borislav Petkov wrote: > > +static inline unsigned long random_get_entropy(void) > > +{ > > +#ifndef CONFIG_X86_TSC > > + if (!boot_cpu_has(X86_FEATURE_TSC)) > > cpu_feature_enabled() pls. This function began as a carbon copy of get_cycles(), whic

Re: [PATCH v5 08/11] um: use fallback for random_get_entropy() instead of zero

2022-04-19 Thread Jason A. Donenfeld
Hi Johannes, On Tue, Apr 19, 2022 at 01:33:21PM +0200, Johannes Berg wrote: > On Tue, 2022-04-19 at 13:16 +0200, Jason A. Donenfeld wrote: > > In the event that random_get_entropy() can't access a cycle counter or > > similar, falling back to returning 0 is really no

[PATCH v5 11/11] random: insist on random_get_entropy() existing in order to simplify

2022-04-19 Thread Jason A. Donenfeld
time. And more importantly, it lets us do the same sponge-like construction everywhere. Cc: Theodore Ts'o Signed-off-by: Jason A. Donenfeld --- drivers/char/random.c | 89 ++- 1 file changed, 29 insertions(+), 60 deletions(-) diff --git a/dri

[PATCH v5 10/11] xtensa: use fallback for random_get_entropy() instead of zero

2022-04-19 Thread Jason A. Donenfeld
r architectures, which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Max Filippov Signed-off-by: Jason A. Donenfeld --- arch/xtensa/include/asm/timex.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/xtensa/includ

[PATCH v5 09/11] sparc: use fallback for random_get_entropy() instead of zero

2022-04-19 Thread Jason A. Donenfeld
r architectures, which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: David S. Miller Signed-off-by: Jason A. Donenfeld --- arch/sparc/include/asm/timex_32.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/sparc/include

[PATCH v5 08/11] um: use fallback for random_get_entropy() instead of zero

2022-04-19 Thread Jason A. Donenfeld
r architectures, which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Signed-off-by: Jason A. Donenfeld --- arch/um/include/asm/timex.h | 9 ++--- 1 file changed, 2 insertions(+), 7 del

[PATCH v5 07/11] x86: use fallback for random_get_entropy() instead of zero

2022-04-19 Thread Jason A. Donenfeld
486 with no RDTSC, so we only need the fallback code for that case. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: x...@kernel.org Signed-off-by: Jason A. Donenfeld --- arch/x86/include/asm/timex.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/include/asm/timex.h b/arc

[PATCH v5 06/11] nios2: use fallback for random_get_entropy() instead of zero

2022-04-19 Thread Jason A. Donenfeld
ffies eventually. It's not as though random_get_entropy_fallback() is super high precision or guaranteed to be entropic, but basically anything that's not zero all the time is better than returning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Dinh Nguyen Signed-

[PATCH v5 05/11] arm: use fallback for random_get_entropy() instead of zero

2022-04-19 Thread Jason A. Donenfeld
ffies eventually. It's not as though random_get_entropy_fallback() is super high precision or guaranteed to be entropic, but basically anything that's not zero all the time is better than returning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Russell King Signed-

[PATCH v5 04/11] mips: use fallback for random_get_entropy() instead of just c0 random

2022-04-19 Thread Jason A. Donenfeld
viously were falling back to 0 for ancient CPUs that Linux does not support anyway; remove that dead path entirely. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Thomas Bogendoerfer Cc: Maciej W. Rozycki Signed-off-by: Jason A. Donenfeld --- ThomasB - I dropped your Ack from v4, because this is p

[PATCH v5 03/11] riscv: use fallback for random_get_entropy() instead of zero

2022-04-19 Thread Jason A. Donenfeld
elt Signed-off-by: Jason A. Donenfeld --- arch/riscv/include/asm/timex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/timex.h b/arch/riscv/include/asm/timex.h index 507cae273bc6..d6a7428f6248 100644 --- a/arch/riscv/include/asm/timex.h +++ b/arch/ri

[PATCH v5 02/11] m68k: use fallback for random_get_entropy() instead of zero

2022-04-19 Thread Jason A. Donenfeld
Signed-off-by: Jason A. Donenfeld --- arch/m68k/include/asm/timex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/m68k/include/asm/timex.h b/arch/m68k/include/asm/timex.h index 6a21d9358280..f4a7a340f4ca 100644 --- a/arch/m68k/include/asm/timex.h +++ b/arch/m68k/incl

[PATCH v5 01/11] timekeeping: add raw clock fallback for random_get_entropy()

2022-04-19 Thread Jason A. Donenfeld
turning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Theodore Ts'o Signed-off-by: Jason A. Donenfeld --- include/linux/timex.h | 8 kernel/time/timekeeping.c | 10 ++ 2 files changed, 18 insertions(+) diff --git a/include/linux/timex.h b/include/linux/t

[PATCH v5 00/11] archs/random: fallback to best raw ktime when no cycle counter

2022-04-19 Thread Jason A. Donenfeld
c: H. Peter Anvin Cc: Chris Zankel Cc: Max Filippov Cc: Stephen Boyd Cc: Dinh Nguyen Cc: linux-arm-ker...@lists.infradead.org Cc: linux-m...@lists.linux-m68k.org Cc: linux-m...@vger.kernel.org Cc: linux-ri...@lists.infradead.org Cc: sparcli...@vger.kernel.org Cc: linux-um@lists.infradead.org C

Re: [PATCH v4 04/11] mips: use fallback for random_get_entropy() instead of zero

2022-04-16 Thread Jason A. Donenfeld
Hi Maciej, On Sat, Apr 16, 2022 at 03:44:53PM +0100, Maciej W. Rozycki wrote: > > Okay, I can give this a shot, but this certainly isn't my forté. It > > may ultimately wind up being simpler for you to just send some code of > > what you envision for this, but if I understand your idea correctly,

Re: [PATCH v4 04/11] mips: use fallback for random_get_entropy() instead of zero

2022-04-16 Thread Jason A. Donenfeld
Hi Maciej, On Fri, Apr 15, 2022 at 2:26 PM Maciej W. Rozycki wrote: > return (random_get_entropy_fallback() << 14) | ((1<<14) - > read_c0_random()); > > of course, as bit 13 is still one of the active ones in the R3k CP0 Random > register. Ah, thanks, will do that. > There are two variant

Re: [PATCH v4 01/11] timekeeping: add raw clock fallback for random_get_entropy()

2022-04-14 Thread Jason A. Donenfeld
Hi Russell, On Thu, Apr 14, 2022 at 12:12 PM Russell King (Oracle) wrote: > I'm surprised this didn't trigger checkpatch to warn. From > coding-style: > > 6.1) Function prototypes > Do not use the ``extern`` keyword with function declarations as this makes > lines longer and isn't strictly necess

Re: [PATCH v4 04/11] mips: use fallback for random_get_entropy() instead of zero

2022-04-14 Thread Jason A. Donenfeld
Hi Maciej, On Thu, Apr 14, 2022 at 02:16:18AM +0100, Maciej W. Rozycki wrote: > Yes, for the relevant CPUs the range is 63-8 << 8 for R3k machines and > 47-0 (the lower bound can be higher if wired entries are used, which I > think we occasionally do) for R4k machines with a buggy CP0 counter.

Re: [PATCH v4 03/11] riscv: use fallback for random_get_entropy() instead of zero

2022-04-13 Thread Jason A. Donenfeld
Hi Rob, On Wed, Apr 13, 2022 at 4:40 PM Rob Herring wrote: > Moving this check to get_cycles() implementation would eliminate the > RiscV implementation of random_get_entropy() if you follow my other > suggestion. Not an option. random_get_entropy() != get_cycles(). Sometimes these are different

Re: [PATCH v4 01/11] timekeeping: add raw clock fallback for random_get_entropy()

2022-04-13 Thread Jason A. Donenfeld
Hi Rob, On Wed, Apr 13, 2022 at 4:32 PM Rob Herring wrote: > 'does not have a usable get_cycles(), ...' as clearly some arches have > get_cycles() and yet still need a fallback. > > Why not handle the 'if get_cycles() returns 0 do the fallback' within > a weak random_get_entropy() function? Then

Re: [PATCH v4 04/11] mips: use fallback for random_get_entropy() instead of zero

2022-04-13 Thread Jason A. Donenfeld
Hi Maciej, On Wed, Apr 13, 2022 at 2:46 PM Maciej W. Rozycki wrote: > > On Wed, 13 Apr 2022, Thomas Bogendoerfer wrote: > > > > diff --git a/arch/mips/include/asm/timex.h b/arch/mips/include/asm/timex.h > > > index b05bb70a2e46..abc60a6395e3 100644 > > > --- a/arch/mips/include/asm/timex.h > > >

[PATCH v4 11/11] random: insist on random_get_entropy() existing in order to simplify

2022-04-13 Thread Jason A. Donenfeld
time. And more importantly, it lets us do the same sponge-like construction everywhere. Cc: Theodore Ts'o Signed-off-by: Jason A. Donenfeld --- drivers/char/random.c | 87 ++- 1 file changed, 28 insertions(+), 59 deletions(-) diff --git a/dri

[PATCH v4 10/11] xtensa: use fallback for random_get_entropy() instead of zero

2022-04-13 Thread Jason A. Donenfeld
r architectures, which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Max Filippov Signed-off-by: Jason A. Donenfeld --- arch/xtensa/include/asm/timex.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/xtensa/includ

[PATCH v4 09/11] sparc: use fallback for random_get_entropy() instead of zero

2022-04-13 Thread Jason A. Donenfeld
r architectures, which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: David S. Miller Signed-off-by: Jason A. Donenfeld --- arch/sparc/include/asm/timex_32.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/sparc/include

[PATCH v4 08/11] um: use fallback for random_get_entropy() instead of zero

2022-04-13 Thread Jason A. Donenfeld
r architectures, which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Signed-off-by: Jason A. Donenfeld --- arch/um/include/asm/timex.h | 9 ++--- 1 file changed, 2 insertions(+), 7 del

[PATCH v4 07/11] x86: use fallback for random_get_entropy() instead of zero

2022-04-13 Thread Jason A. Donenfeld
486 with no RDTSC, so we only need the fallback code for that case. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: x...@kernel.org Signed-off-by: Jason A. Donenfeld --- arch/x86/include/asm/tsc.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/include/asm/tsc.h b/arch/x8

[PATCH v4 06/11] nios2: use fallback for random_get_entropy() instead of zero

2022-04-13 Thread Jason A. Donenfeld
ffies eventually. It's not as though random_get_entropy_fallback() is super high precision or guaranteed to be entropic, but basically anything that's not zero all the time is better than returning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Dinh Nguyen Signed-

[PATCH v4 05/11] arm: use fallback for random_get_entropy() instead of zero

2022-04-13 Thread Jason A. Donenfeld
ffies eventually. It's not as though random_get_entropy_fallback() is super high precision or guaranteed to be entropic, but basically anything that's not zero all the time is better than returning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Russell King Signed-

[PATCH v4 04/11] mips: use fallback for random_get_entropy() instead of zero

2022-04-13 Thread Jason A. Donenfeld
ffies eventually. It's not as though random_get_entropy_fallback() is super high precision or guaranteed to be entropic, but basically anything that's not zero all the time is better than returning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Thomas Bogendoerfer Signed-

[PATCH v4 03/11] riscv: use fallback for random_get_entropy() instead of zero

2022-04-13 Thread Jason A. Donenfeld
elt Signed-off-by: Jason A. Donenfeld --- arch/riscv/include/asm/timex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/timex.h b/arch/riscv/include/asm/timex.h index 507cae273bc6..d6a7428f6248 100644 --- a/arch/riscv/include/asm/timex.h +++ b/arch/ri

[PATCH v4 02/11] m68k: use fallback for random_get_entropy() instead of zero

2022-04-13 Thread Jason A. Donenfeld
Signed-off-by: Jason A. Donenfeld --- arch/m68k/include/asm/timex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/m68k/include/asm/timex.h b/arch/m68k/include/asm/timex.h index 6a21d9358280..f4a7a340f4ca 100644 --- a/arch/m68k/include/asm/timex.h +++ b/arch/m68k/incl

[PATCH v4 01/11] timekeeping: add raw clock fallback for random_get_entropy()

2022-04-13 Thread Jason A. Donenfeld
turning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Theodore Ts'o Signed-off-by: Jason A. Donenfeld --- include/linux/timex.h | 8 kernel/time/timekeeping.c | 10 ++ 2 files changed, 18 insertions(+) diff --git a/include/linux/timex.h b/include/linux/t

[PATCH v4 00/11] archs/random: fallback to best raw ktime when no cycle counter

2022-04-13 Thread Jason A. Donenfeld
ists.linux-m68k.org Cc: linux-m...@vger.kernel.org Cc: linux-ri...@lists.infradead.org Cc: sparcli...@vger.kernel.org Cc: linux-um@lists.infradead.org Cc: x...@kernel.org Cc: linux-xte...@linux-xtensa.org Jason A. Donenfeld (11): timekeeping: add raw clock fallback for random_get_entropy(

Re: [PATCH v3 01/10] timekeeping: add raw clock fallback for random_get_entropy()

2022-04-12 Thread Jason A. Donenfeld
Hi Thomas, On Tue, Apr 12, 2022 at 10:57 PM Thomas Gleixner wrote: > > On Tue, Apr 12 2022 at 19:27, Jason A. Donenfeld wrote: > > +/** > > + * random_get_entropy_fallback - Returns the raw clock source value, > > + * used by random.c for platforms with no

[PATCH v3 10/10] xtensa: use fallback for random_get_entropy() instead of zero

2022-04-12 Thread Jason A. Donenfeld
r architectures, which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Max Filippov Signed-off-by: Jason A. Donenfeld --- arch/xtensa/include/asm/timex.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/xtensa/includ

[PATCH v3 09/10] sparc: use fallback for random_get_entropy() instead of zero

2022-04-12 Thread Jason A. Donenfeld
r architectures, which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: David S. Miller Signed-off-by: Jason A. Donenfeld --- arch/sparc/include/asm/timex_32.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/sparc/include

[PATCH v3 08/10] um: use fallback for random_get_entropy() instead of zero

2022-04-12 Thread Jason A. Donenfeld
r architectures, which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Signed-off-by: Jason A. Donenfeld --- arch/um/include/asm/timex.h | 9 ++--- 1 file changed, 2 insertions(+), 7 del

[PATCH v3 07/10] x86: use fallback for random_get_entropy() instead of zero

2022-04-12 Thread Jason A. Donenfeld
486 with no RDTSC, so we only need the fallback code for that case. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: x...@kernel.org Signed-off-by: Jason A. Donenfeld --- arch/x86/include/asm/tsc.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/include/asm/tsc.h b/arch/x8

[PATCH v3 06/10] nios2: use fallback for random_get_entropy() instead of zero

2022-04-12 Thread Jason A. Donenfeld
ffies eventually. It's not as though random_get_entropy_fallback() is super high precision or guaranteed to be entropic, but basically anything that's not zero all the time is better than returning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Dinh Nguyen Signed-

[PATCH v3 05/10] arm: use fallback for random_get_entropy() instead of zero

2022-04-12 Thread Jason A. Donenfeld
ffies eventually. It's not as though random_get_entropy_fallback() is super high precision or guaranteed to be entropic, but basically anything that's not zero all the time is better than returning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Russell King Signed-

[PATCH v3 04/10] mips: use fallback for random_get_entropy() instead of zero

2022-04-12 Thread Jason A. Donenfeld
ffies eventually. It's not as though random_get_entropy_fallback() is super high precision or guaranteed to be entropic, but basically anything that's not zero all the time is better than returning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Thomas Bogendoerfer Signed-

[PATCH v3 03/10] riscv: use fallback for random_get_entropy() instead of zero

2022-04-12 Thread Jason A. Donenfeld
elt Signed-off-by: Jason A. Donenfeld --- arch/riscv/include/asm/timex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/timex.h b/arch/riscv/include/asm/timex.h index 507cae273bc6..d6a7428f6248 100644 --- a/arch/riscv/include/asm/timex.h +++ b/arch/ri

[PATCH v3 02/10] m68k: use fallback for random_get_entropy() instead of zero

2022-04-12 Thread Jason A. Donenfeld
ffies eventually. It's not as though random_get_entropy_fallback() is super high precision or guaranteed to be entropic, but basically anything that's not zero all the time is better than returning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Geert Uytterhoeven Signed-

[PATCH v3 01/10] timekeeping: add raw clock fallback for random_get_entropy()

2022-04-12 Thread Jason A. Donenfeld
turning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Theodore Ts'o Signed-off-by: Jason A. Donenfeld --- include/linux/timex.h | 8 kernel/time/timekeeping.c | 10 ++ 2 files changed, 18 insertions(+) diff --git a/include/linux/timex.h b/include/linux/t

[PATCH v3 00/10] archs/random: fallback to best raw ktime when no cycle counter

2022-04-12 Thread Jason A. Donenfeld
Cc: Dinh Nguyen Cc: linux-arm-ker...@lists.infradead.org Cc: linux-m...@lists.linux-m68k.org Cc: linux-m...@vger.kernel.org Cc: linux-ri...@lists.infradead.org Cc: sparcli...@vger.kernel.org Cc: linux-um@lists.infradead.org Cc: x...@kernel.org Cc: linux-xte...@linux-xtensa.org Jason A. Done

Re: [PATCH v2 03/11] m68k: use ktime_read_raw_clock() for random_get_entropy() instead of zero

2022-04-11 Thread Jason A. Donenfeld
Hi Thomas, On Mon, Apr 11, 2022 at 10:18 AM Thomas Gleixner wrote: > > diff --git a/arch/m68k/include/asm/timex.h b/arch/m68k/include/asm/timex.h > > index 6a21d9358280..5351b10e1b18 100644 > > --- a/arch/m68k/include/asm/timex.h > > +++ b/arch/m68k/include/asm/timex.h > > @@ -35,7 +35,7 @@ stati

Re: [PATCH RFC v1 00/10] archs/random: fallback to using sched_clock() if no cycle counter

2022-04-10 Thread Jason A. Donenfeld
Hi Eric, On 4/11/22, Eric Biggers wrote: > On Fri, Apr 08, 2022 at 08:21:35PM +0200, Jason A. Donenfeld wrote: >> By my first guess, we have ktime_get_boottime_ns(), jiffies, and >> sched_clock(). It seems like sched_clock() has already done a lot of >> work in being alway

[PATCH v2 11/11] xtensa: use ktime_read_raw_clock() for random_get_entropy() instead of zero

2022-04-10 Thread Jason A. Donenfeld
which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Max Filippov Signed-off-by: Jason A. Donenfeld --- arch/xtensa/include/asm/timex.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/xtensa/include/asm/timex.

[PATCH v2 10/11] sparc: use ktime_read_raw_clock() for random_get_entropy() instead of zero

2022-04-10 Thread Jason A. Donenfeld
which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: David S. Miller Signed-off-by: Jason A. Donenfeld --- arch/sparc/include/asm/timex_32.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/sparc/include/asm/timex_32.

[PATCH v2 09/11] um: use ktime_read_raw_clock() for random_get_entropy() instead of zero

2022-04-10 Thread Jason A. Donenfeld
which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Signed-off-by: Jason A. Donenfeld --- arch/um/include/asm/timex.h | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff

  1   2   >