Re: [PATCH 2/2] powerpc/vdso: Implement __arch_get_vdso_rng_data()

2024-10-07 Thread Jason A. Donenfeld
On Fri, Oct 04, 2024 at 04:03:34PM +0200, Jason A. Donenfeld wrote: > On Fri, Oct 04, 2024 at 08:52:40PM +1000, Michael Ellerman wrote: > > > > > > On October 4, 2024 2:33:54 AM GMT+10:00, "Jason A. Donenfeld" > > wrote: > > >Hey Christophe,

Re: [PATCH 2/2] powerpc/vdso: Implement __arch_get_vdso_rng_data()

2024-10-04 Thread Jason A. Donenfeld
On Fri, Oct 04, 2024 at 08:52:40PM +1000, Michael Ellerman wrote: > > > On October 4, 2024 2:33:54 AM GMT+10:00, "Jason A. Donenfeld" > wrote: > >Hey Christophe, Michael, > > > >This series actually looks pretty okay to me. I realize ThomasW is > &

Re: [PATCH 2/2] powerpc/vdso: Implement __arch_get_vdso_rng_data()

2024-10-03 Thread Jason A. Donenfeld
Hey Christophe, Michael, This series actually looks pretty okay to me. I realize ThomasW is working on more generic cleanups that might obliterate the need for this, and that may or may not wind up in 6.13. But, I was thinking, this seems like a good correct thing to do, and to do it now for 6.12,

Re: [PATCH] powerpc/vdso: allow r30 in vDSO code generation of getrandom

2024-09-25 Thread Jason A. Donenfeld
On Wed, Sep 25, 2024 at 08:48:31PM +0200, Christophe Leroy wrote: > > > Le 25/09/2024 à 20:38, Jason A. Donenfeld a écrit : > > On Wed, Sep 25, 2024 at 07:50:22PM +0200, Jason A. Donenfeld wrote: > >> For gettimeofday, -ffixed-r30 was passed to work around a bug in Go &

Re: [PATCH] powerpc/vdso: allow r30 in vDSO code generation of getrandom

2024-09-25 Thread Jason A. Donenfeld
On Wed, Sep 25, 2024 at 07:50:22PM +0200, Jason A. Donenfeld wrote: > For gettimeofday, -ffixed-r30 was passed to work around a bug in Go > code, where the vDSO trampoline forgot to save and restore this register > across function calls. But Go requires a different trampoline for every &g

[PATCH] powerpc/vdso: allow r30 in vDSO code generation of getrandom

2024-09-25 Thread Jason A. Donenfeld
bugs. So remove -ffixed-r30 for getrandom. Fixes: 8072b39c3a75 ("powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO64") Signed-off-by: Jason A. Donenfeld --- Michael - can you take this through your tree as a ppc fix? arch/powerpc/kernel/vdso/Makefile | 2 +- 1 file chang

Re: [PATCH 2/2] Fixup for 3279be36b671 ("powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32")

2024-09-07 Thread Jason A. Donenfeld
On Fri, Sep 06, 2024 at 08:54:49PM +0200, Jason A. Donenfeld wrote: > On Fri, Sep 06, 2024 at 05:14:43PM +0200, Christophe Leroy wrote: > > > > > > Le 06/09/2024 à 16:46, Jason A. Donenfeld a écrit : > > > On Fri, Sep 06, 2024 at 04:26:32PM +0200, Christophe Ler

Re: [PATCH 2/2] Fixup for 3279be36b671 ("powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32")

2024-09-06 Thread Jason A. Donenfeld
On Fri, Sep 06, 2024 at 05:14:43PM +0200, Christophe Leroy wrote: > > > Le 06/09/2024 à 16:46, Jason A. Donenfeld a écrit : > > On Fri, Sep 06, 2024 at 04:26:32PM +0200, Christophe Leroy wrote: > > > >> On the long run I wonder if we should try to find a more gener

Re: [PATCH 2/2] Fixup for 3279be36b671 ("powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32")

2024-09-06 Thread Jason A. Donenfeld
On Fri, Sep 06, 2024 at 04:26:32PM +0200, Christophe Leroy wrote: > And thanks for playing up with it while I was sleeping and getting ideas > too. > > Did you learn powerpc assembly during the night or did you know it already ? I don't really know ppc assembly. I had perused the tree over the l

Re: [PATCH 2/2] Fixup for 3279be36b671 ("powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32")

2024-09-06 Thread Jason A. Donenfeld
On Fri, Sep 06, 2024 at 10:33:44AM +0200, Christophe Leroy wrote: > Use the new get_realdatapage macro instead of get_datapage > > Signed-off-by: Christophe Leroy > --- > arch/powerpc/kernel/vdso/getrandom.S | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/k

Re: [PATCH 1/2] powerpc/vdso: Fix VDSO data access when running in a non-root time namespace

2024-09-06 Thread Jason A. Donenfeld
On Fri, Sep 06, 2024 at 03:43:17PM +0200, Jason A. Donenfeld wrote: > On Fri, Sep 06, 2024 at 10:23:08PM +1000, Michael Ellerman wrote: > > Christophe Leroy writes: > > > When running in a non-root time namespace, the global VDSO data page > > > is replaced by a dedica

Re: [PATCH 1/2] powerpc/vdso: Fix VDSO data access when running in a non-root time namespace

2024-09-06 Thread Jason A. Donenfeld
t; > > Fixes: 74205b3fc2ef ("powerpc/vdso: Add support for time namespaces") > > Signed-off-by: Christophe Leroy > > Oops. > > I guess it should also have: > > Cc: sta...@vger.kernel.org # v5.13+ > Reported-by: Jason A. Donenfeld > Closes: ht

Re: [PATCH v5 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32

2024-09-05 Thread Jason A. Donenfeld
On Fri, Sep 06, 2024 at 04:48:28AM +0200, Jason A. Donenfeld wrote: > On Thu, Sep 05, 2024 at 10:41:40PM +0200, Jason A. Donenfeld wrote: > > On Thu, Sep 05, 2024 at 06:13:29PM +0200, Jason A. Donenfeld wrote: > > > > +/* > > > > + * The macro sets two stack frame

Re: [PATCH v5 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32

2024-09-05 Thread Jason A. Donenfeld
On Thu, Sep 05, 2024 at 10:41:40PM +0200, Jason A. Donenfeld wrote: > On Thu, Sep 05, 2024 at 06:13:29PM +0200, Jason A. Donenfeld wrote: > > > +/* > > > + * The macro sets two stack frames, one for the caller and one for the > > > callee > > > + * because

Re: [PATCH v5 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32

2024-09-05 Thread Jason A. Donenfeld
On Thu, Sep 05, 2024 at 06:13:29PM +0200, Jason A. Donenfeld wrote: > > +/* > > + * The macro sets two stack frames, one for the caller and one for the > > callee > > + * because there are no requirement for the caller to set a stack frame > > when > > + * ca

Re: [PATCH v5 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32

2024-09-05 Thread Jason A. Donenfeld
On Thu, Sep 05, 2024 at 07:03:34PM +0200, Jason A. Donenfeld wrote: > On Thu, Sep 05, 2024 at 06:55:27PM +0200, Christophe Leroy wrote: > > > > > > Le 05/09/2024 à 18:13, Jason A. Donenfeld a écrit : > > >> +/* > > >> + * The macro sets two sta

Re: [PATCH v5 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32

2024-09-05 Thread Jason A. Donenfeld
On Thu, Sep 05, 2024 at 06:55:27PM +0200, Christophe Leroy wrote: > > > Le 05/09/2024 à 18:13, Jason A. Donenfeld a écrit : > >> +/* > >> + * The macro sets two stack frames, one for the caller and one for the > >> callee > >> + * because there are

Re: [PATCH v5 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32

2024-09-05 Thread Jason A. Donenfeld
On Thu, Sep 05, 2024 at 06:13:29PM +0200, Jason A. Donenfeld wrote: > > +/* > > + * The macro sets two stack frames, one for the caller and one for the > > callee > > + * because there are no requirement for the caller to set a stack frame > > when > > + * ca

Re: [PATCH v5 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32

2024-09-05 Thread Jason A. Donenfeld
> +/* > + * The macro sets two stack frames, one for the caller and one for the callee > + * because there are no requirement for the caller to set a stack frame when > + * calling VDSO so it may have omitted to set one, especially on PPC64 > + */ > + > +.macro cvdso_call funct > + .cfi_startproc

Re: [PATCH v5 0/5] Wire up getrandom() vDSO implementation on powerpc

2024-09-05 Thread Jason A. Donenfeld
On Thu, Sep 05, 2024 at 10:18:40PM +1000, Michael Ellerman wrote: > There is an existing comment in the a/p/vdso/Makefile about the > fixed-r30 thing, tldr is it's a workaround to avoid breaking old > versions of Go. Thanks. Indeed, following Christophe's links yesterday, I tumbled down that rabbi

Re: Profiling of vdso_test_random

2024-09-04 Thread Jason A. Donenfeld
On Wed, Sep 4, 2024 at 1:41 PM Christophe Leroy wrote: > > Hi, > > I'm done a 'perf record' on vdso_test_random reduced to vdso test only, > and I get the following function usage profile. > > Do you see the same type of percentage on your platforms ? > > I would have expected most of the time to

Re: [PATCH v5 0/5] Wire up getrandom() vDSO implementation on powerpc

2024-09-04 Thread Jason A. Donenfeld
Hi Christophe, Michael, On Mon, Sep 02, 2024 at 09:17:17PM +0200, Christophe Leroy wrote: > This series wires up getrandom() vDSO implementation on powerpc. > > Tested on PPC32 on real hardware. > Tested on PPC64 (both BE and LE) on QEMU: > > Performance on powerpc 885: > ~# ./vdso_test_ge

Re: [PATCH v4 5/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC64

2024-09-02 Thread Jason A. Donenfeld
On Mon, Sep 02, 2024 at 04:27:12PM +0200, Christophe Leroy wrote: > Hi Jason, hi Michael, > > Le 02/09/2024 à 16:19, Jason A. Donenfeld a écrit : > > On Mon, Sep 02, 2024 at 04:16:48PM +0200, Christophe Leroy wrote: > >> Can do that, but there will still be a problem

Re: [PATCH v4 5/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC64

2024-09-02 Thread Jason A. Donenfeld
On Mon, Sep 02, 2024 at 04:16:48PM +0200, Christophe Leroy wrote: > Can do that, but there will still be a problem with chacha selftests if > I don't opt-out the entire function content when it is ppc64. It will > build properly but if someone runs it on a ppc64 it will likely crash > because on

Re: [PATCH v4 5/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC64

2024-09-02 Thread Jason A. Donenfeld
On Mon, Sep 02, 2024 at 03:12:47PM +0200, Christophe Leroy wrote: > > > Le 02/09/2024 à 14:41, Jason A. Donenfeld a écrit : > > On Mon, Sep 02, 2024 at 02:04:42PM +0200, Christophe Leroy wrote: > >> SYM_FUNC_START(__arch_chacha20_blocks_nostack) > >>

Re: [PATCH v4 5/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC64

2024-09-02 Thread Jason A. Donenfeld
On Mon, Sep 02, 2024 at 02:04:42PM +0200, Christophe Leroy wrote: > SYM_FUNC_START(__arch_chacha20_blocks_nostack) > #ifdef __powerpc64__ > - blr > + std r5, -216(r1) > + > + std r14, -144(r1) > + std r15, -136(r1) > + std r16, -128(r1) > + std r17, -12

Re: [PATCH v4 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC32

2024-09-02 Thread Jason A. Donenfeld
On Mon, Sep 02, 2024 at 02:04:41PM +0200, Christophe Leroy wrote: > This first patch adds support for PPC32. As selftests cannot easily > be generated only for PPC32, and because the following patch brings > support for PPC64 anyway, this patch opts out all code in > __arch_chacha20_blocks_nostack(

Re: [PATCH] selftests: vDSO: Also test counter in vdso_test_chacha

2024-09-01 Thread Jason A. Donenfeld
On Sun, Sep 01, 2024 at 08:08:13PM +0200, Jason A. Donenfeld wrote: > While you're doing this, also add the remaining, `0, 0` elements. > > counter2 will always be counter2. You meant for the first argument to be > counter1. > > Also, same issue with counter2 used twice

Re: [PATCH] selftests: vDSO: Also test counter in vdso_test_chacha

2024-09-01 Thread Jason A. Donenfeld
On Sun, Sep 01, 2024 at 08:08:13PM +0200, Jason A. Donenfeld wrote: > > + reference_chacha20_blocks(output1, key, counter1, BLOCKS); > > + __arch_chacha20_blocks_nostack(output2, key, counter2, BLOCKS); > > + if (memcmp(output1, output2, sizeof(output1)) || > >

Re: [PATCH] selftests: vDSO: Build vDSO tests with O2 optimisation

2024-09-01 Thread Jason A. Donenfeld
On Sun, Sep 01, 2024 at 07:24:03PM +0200, Christophe Leroy wrote: > Without -O2, the generated code for testing chacha function is awful. > GCC even implements rol32() as a function instead of just using the > rotlwi instruction, that function is 20 instructions long. > > ~# time ./vdso_test

Re: [PATCH] selftests: vDSO: Also test counter in vdso_test_chacha

2024-09-01 Thread Jason A. Donenfeld
On Sun, Sep 01, 2024 at 07:40:33PM +0200, Christophe Leroy wrote: > -static void reference_chacha20_blocks(uint8_t *dst_bytes, const uint32_t > *key, size_t nblocks) > +static void reference_chacha20_blocks(uint8_t *dst_bytes, const uint32_t > *key, uint32_t *counter, size_t nblocks) > { >

Re: [PATCH v3 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC32

2024-08-30 Thread Jason A. Donenfeld
On Fri, Aug 30, 2024 at 05:57:08PM +0200, Christophe Leroy wrote: > @@ -14,6 +14,10 @@ ifeq ($(uname_M),x86_64) > TEST_GEN_PROGS += vdso_test_getrandom > TEST_GEN_PROGS += vdso_test_chacha > endif > +ifeq ($(ARCH),powerpc) > +TEST_GEN_PROGS += vdso_test_getrandom > +TEST_GEN_PROGS += vdso_test_c

Re: [PATCH v3 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on PPC32

2024-08-30 Thread Jason A. Donenfeld
On Fri, Aug 30, 2024 at 05:57:08PM +0200, Christophe Leroy wrote: > + * r5: 8-byte counter input/output (saved on stack) > + * > + * r14-r15: counter > + */ > +SYM_FUNC_START(__arch_chacha20_blocks_nostack) > + stwur1, -96(r1) > + stw r5, 20(r1) > + stmwr14, 24(r1) > +

Re: [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc

2024-08-30 Thread Jason A. Donenfeld
Hi Shuah, No 0/5 patch, so replying to the first one. These are fixes to the vDSO selftests that Christophe is ostensibly providing as a preamble to his work porting vgetrandom to PPC. Do you mind if I take these via my random tree so his PPC vgetrandom code can go on top of it? Jason

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Jason A. Donenfeld
On Wed, Aug 28, 2024 at 07:33:13AM -0500, Segher Boessenkool wrote: > On Wed, Aug 28, 2024 at 01:18:34PM +0200, Jason A. Donenfeld wrote: > > On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: > > > On Tue, Aug 27, 2024 at 11:08:19AM -0700,

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Jason A. Donenfeld
On Wed, Aug 28, 2024 at 2:24 PM Arnd Bergmann wrote: > > On Wed, Aug 28, 2024, at 11:18, Jason A. Donenfeld wrote: > > On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: > >> On Tue, Aug 27, 2024 at 11:08:19AM -0700, Eric Biggers wrote: > >> > >

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Jason A. Donenfeld
On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: > On Tue, Aug 27, 2024 at 11:08:19AM -0700, Eric Biggers wrote: > > On Thu, Aug 22, 2024 at 09:13:13AM +0200, Christophe Leroy wrote: > > > With the current implementation, __cvdso_getrandom_data() calls > > > memset(), which is un

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-27 Thread Jason A. Donenfeld
On Tue, Aug 27, 2024 at 11:08:19AM -0700, Eric Biggers wrote: > On Thu, Aug 22, 2024 at 09:13:13AM +0200, Christophe Leroy wrote: > > With the current implementation, __cvdso_getrandom_data() calls > > memset(), which is unexpected in the VDSO. > > > > Rewrite opaque data initialisation to avoid m

getrandom() vDSO archs (arm64, ppc, loongarch) for 6.12 [Was: Re: [PATCH v2 00/17] Wire up getrandom() vDSO implementation on powerpc]

2024-08-27 Thread Jason A. Donenfeld
Hey again, On Mon, Aug 26, 2024 at 09:19:22AM +0200, Jason A. Donenfeld wrote: > Thanks for this series. There are quite a few preliminary patches in it, > before you get to the PPC part, which fix up general build system or test > harness correctness issues. Since some of those a

Re: [PATCH] random: vDSO: Redefine PAGE_SIZE and PAGE_MASK

2024-08-27 Thread Jason A. Donenfeld
in vdso/datapage.h"). Removing linux/time64.h leads to missing 'struct timespec64' in x86's asm/pvclock.h. Add a forward declaration of that struct in that file. Signed-off-by: Christophe Leroy Signed-off-by: Jason A. Donenfeld --- arch/x86/include/asm/pvclock.h | 1 +

Re: [PATCH 2/4] random: vDSO: Don't use PAGE_SIZE and PAGE_MASK

2024-08-27 Thread Jason A. Donenfeld
On Tue, Aug 27, 2024 at 10:16:18AM +0200, Christophe Leroy wrote: > tglx or yourself suggested to put in a one of the vdso headers instead > of directly in getrandom.c. This is too fragile because PAGE_SIZE might > be absent in that header but arrive in getrandom.c through another header. Oh jee

Re: [PATCH 4/4] random: vDSO: don't use 64 bits atomics on 32 bits architectures

2024-08-27 Thread Jason A. Donenfeld
On Tue, Aug 27, 2024 at 09:31:50AM +0200, Christophe Leroy wrote: > Performing SMP atomic operations on u64 fails on powerpc32: Thanks for this, and nice catch on the vDSO side checking on big endian. I've applied this, fixing up the commit message and the comment, maintaining the reverse christma

Re: [PATCH 2/4] random: vDSO: Don't use PAGE_SIZE and PAGE_MASK

2024-08-27 Thread Jason A. Donenfeld
On Tue, Aug 27, 2024 at 09:31:48AM +0200, Christophe Leroy wrote: > - ssize_t ret = min_t(size_t, INT_MAX & PAGE_MASK /* = MAX_RW_COUNT */, > len); > + const unsigned long page_size = 1UL << CONFIG_PAGE_SHIFT; > + const unsigned long page_mask = ~(page_size - 1); > + ssize_t ret =

Re: [PATCH v2 02/17] vdso: Clean header inclusion in getrandom

2024-08-26 Thread Jason A. Donenfeld
On Mon, Aug 26, 2024 at 12:45:40PM +0200, Christophe Leroy wrote: > > > Le 26/08/2024 à 10:58, Jason A. Donenfeld a écrit : > > On Mon, Aug 26, 2024 at 10:37:49AM +0200, Christophe Leroy wrote: > >> > >> > >> Le 26/08/2024 à 10:07, Jason A. Donenfeld a é

Re: [PATCH v2 06/17] vdso: Change getrandom's generation to unsigned long

2024-08-26 Thread Jason A. Donenfeld
On Mon, Aug 26, 2024 at 11:43:39AM +0200, Thomas Gleixner wrote: > As explained before, there is no problem with store or load tearing on > 32bit systems because the generation counter is only 32bit wide. So the > obvious solution is to only update 32 bits on a 32bit kernel: > > --- a/drivers/char

Re: [PATCH v2 02/17] vdso: Clean header inclusion in getrandom

2024-08-26 Thread Jason A. Donenfeld
On Mon, Aug 26, 2024 at 10:37:49AM +0200, Christophe Leroy wrote: > > > Le 26/08/2024 à 10:07, Jason A. Donenfeld a écrit : > > On Thu, Aug 22, 2024 at 09:13:10AM +0200, Christophe Leroy wrote: > >> > >> +#define _PAGE_SIZE (1UL << CONFIG_PAGE_SHIFT) >

Re: [PATCH v2 06/17] vdso: Change getrandom's generation to unsigned long

2024-08-26 Thread Jason A. Donenfeld
On Mon, Aug 26, 2024 at 10:01:17AM +0200, Christophe Leroy wrote: > > > Le 26/08/2024 à 09:50, Jason A. Donenfeld a écrit : > > On Thu, Aug 22, 2024 at 09:13:14AM +0200, Christophe Leroy wrote: > >> Performing SMP atomic operations on u64 fails on powerpc32. > >>

Re: [PATCH v2 00/17] Wire up getrandom() vDSO implementation on powerpc

2024-08-26 Thread Jason A. Donenfeld
On Mon, Aug 26, 2024 at 09:19:22AM +0200, Jason A. Donenfeld wrote: > Hi Christophe, > > Thanks for this series. There are quite a few preliminary patches in it, > before you get to the PPC part, which fix up general build system or test > harness correctness issues. Since some

Re: [PATCH v2 02/17] vdso: Clean header inclusion in getrandom

2024-08-26 Thread Jason A. Donenfeld
x27;t mentioned in the commit message and could probably benefit from doing so. > diff --git a/lib/vdso/getrandom.c b/lib/vdso/getrandom.c > index b230f0b10832..cab153c5f9be 100644 > --- a/lib/vdso/getrandom.c > +++ b/lib/vdso/getrandom.c > @@ -3,15 +3,13 @@ > * Copyrigh

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-26 Thread Jason A. Donenfeld
On Thu, Aug 22, 2024 at 09:13:13AM +0200, Christophe Leroy wrote: > With the current implementation, __cvdso_getrandom_data() calls > memset(), which is unexpected in the VDSO. > > Rewrite opaque data initialisation to avoid memset(). I think of the various ways I've seen of fixing this -- e.g. a

Re: [PATCH v2 06/17] vdso: Change getrandom's generation to unsigned long

2024-08-26 Thread Jason A. Donenfeld
On Thu, Aug 22, 2024 at 09:13:14AM +0200, Christophe Leroy wrote: > Performing SMP atomic operations on u64 fails on powerpc32. > > Random driver generation is handled as unsigned long not u64, > see for instance base_cnrg or struct crng. > > Use the same type for vDSO's getrandom as it gets copi

Re: [PATCH v2 04/17] vdso: Add missing c-getrandom-y in Makefile

2024-08-26 Thread Jason A. Donenfeld
On Thu, Aug 22, 2024 at 09:13:12AM +0200, Christophe Leroy wrote: > Same as for gettimeofday CVDSO implementation, add c-getrandom-y > to ease the inclusion of lib/vdso/getrandom.c in architectures > VDSO builds. Thanks, seems straight forward. I'll apply this now as a fix.

Re: [PATCH v2 16/17] selftests: vdso: Make VDSO function call more generic

2024-08-26 Thread Jason A. Donenfeld
On Thu, Aug 22, 2024 at 09:13:24AM +0200, Christophe Leroy wrote: > On powerpc, a call to a VDSO function is not a standard C function > call. Unlike x86 that returns a negated error code in case of an > error, powerpc sets CR[SO] and returns the error code as a > positive value. > > So use a macr

Re: [PATCH v2 15/17] selftests: vdso: Fix build of test_vdso_chacha

2024-08-26 Thread Jason A. Donenfeld
On Thu, Aug 22, 2024 at 09:13:23AM +0200, Christophe Leroy wrote: > Replace -isystem by -idirafter > > But this implies that now tools/include/linux/linkage.h is > included instead of include/linux/linkage.h, so define a stub > for SYM_FUNC_START() and SYM_FUNC_END(). Thanks! I got step 1, but di

Re: [PATCH v2 14/17] selftests: vdso: Make test_vdso_getrandom look for the right vDSO function

2024-08-26 Thread Jason A. Donenfeld
On Thu, Aug 22, 2024 at 09:13:22AM +0200, Christophe Leroy wrote: > Don't hard-code x86 specific names, use vdso_config definitions > to find the correct function matching the architecture. > > Add random VDSO function names in names[][]. Remove the #ifdef > CONFIG_VDSO32, having the name there al

Re: [PATCH v2 01/17] asm-generic/unaligned.h: Extract common header for vDSO

2024-08-26 Thread Jason A. Donenfeld
On Thu, Aug 22, 2024 at 09:13:09AM +0200, Christophe Leroy wrote: > include/asm-generic/unaligned.h | 11 +-- > include/vdso/unaligned.h| 15 +++ > 2 files changed, 16 insertions(+), 10 deletions(-) > create mode 100644 include/vdso/unaligned.h Do you need to also adj

Re: [PATCH v2 00/17] Wire up getrandom() vDSO implementation on powerpc

2024-08-26 Thread Jason A. Donenfeld
Hi Christophe, Thanks for this series. There are quite a few preliminary patches in it, before you get to the PPC part, which fix up general build system or test harness correctness issues. Since some of those affect all architectures that are adding vDSO getrandom() support for 6.12, I'm going to

Re: [PATCH v2 13/17] selftests: vdso: Don't hard-code location of vDSO sources

2024-08-26 Thread Jason A. Donenfeld
On Thu, Aug 22, 2024 at 09:13:21AM +0200, Christophe Leroy wrote: > Architectures use different location for vDSO sources: > arch/mips/vdso > arch/sparc/vdso > arch/arm64/kernel/vdso > arch/riscv/kernel/vdso > arch/csky/kernel/vdso > arch/x86/um/vdso > arch

Re: [PATCH v2 03/17] vdso: Add __arch_get_k_vdso_rng_data()

2024-08-26 Thread Jason A. Donenfeld
On Thu, Aug 22, 2024 at 09:13:11AM +0200, Christophe Leroy wrote: > _vdso_data is specific to x86 and __arch_get_k_vdso_data() is provided > so that all architectures can provide the requested pointer. > > Do the same with _vdso_rng_data, provide __arch_get_k_vdso_rng_data() > and don't use x86 _v

Re: [PATCH 0/9] Wire up getrandom() vDSO implementation on powerpc

2024-08-16 Thread Jason A. Donenfeld
On Fri, Aug 16, 2024 at 09:57:37PM +, Jason A. Donenfeld wrote: > On first glance, patch number 7 isn't okay. If you want this to work on Sorry, I meant 6.

Re: [PATCH 0/9] Wire up getrandom() vDSO implementation on powerpc

2024-08-16 Thread Jason A. Donenfeld
Hi Christophe, Thanks for this series. I'm looking forward to taking a close look at it. I'm currently traveling until the 26th without a laptop and no email except for lore+lei+mutt on my phone. So I'll review this in about 1 week. But I'm very happy to see it here. On first glance, patch number

Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-17 Thread Jason A. Donenfeld
On Mon, Jun 17, 2024 at 06:38:52PM +0200, Vlastimil Babka wrote: > On 6/17/24 6:33 PM, Jason A. Donenfeld wrote: > > On Mon, Jun 17, 2024 at 6:30 PM Uladzislau Rezki wrote: > >> Here if an "err" is less then "0" means there are still objects > >> w

Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-17 Thread Jason A. Donenfeld
On Mon, Jun 17, 2024 at 06:42:23PM +0200, Uladzislau Rezki wrote: > On Mon, Jun 17, 2024 at 06:33:23PM +0200, Jason A. Donenfeld wrote: > > On Mon, Jun 17, 2024 at 6:30 PM Uladzislau Rezki wrote: > > > Here if an "err" is less then "0" means there are still o

Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-17 Thread Jason A. Donenfeld
On Mon, Jun 17, 2024 at 6:30 PM Uladzislau Rezki wrote: > Here if an "err" is less then "0" means there are still objects > whereas "is_destroyed" is set to "true" which is not correlated > with a comment: > > "Destruction happens when no objects" The comment is just poorly written. But the logic

Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-17 Thread Jason A. Donenfeld
On Mon, Jun 17, 2024 at 03:50:56PM +0200, Uladzislau Rezki wrote: > On Fri, Jun 14, 2024 at 09:33:45PM +0200, Jason A. Donenfeld wrote: > > On Fri, Jun 14, 2024 at 02:35:33PM +0200, Uladzislau Rezki wrote: > > > + /* Should a destroy process be deferred? */ &g

Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-14 Thread Jason A. Donenfeld
On Fri, Jun 14, 2024 at 02:35:33PM +0200, Uladzislau Rezki wrote: > + /* Should a destroy process be deferred? */ > + if (s->flags & SLAB_DEFER_DESTROY) { > + list_move_tail(&s->list, &slab_caches_defer_destroy); > + schedule_delayed_work(&slab_caches_defer_destroy_w

Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-13 Thread Jason A. Donenfeld
On Thu, Jun 13, 2024 at 05:46:11AM -0700, Paul E. McKenney wrote: > How about a kmem_cache_destroy_rcu() that marks that specified cache > for destruction, and then a kmem_cache_destroy_barrier() that waits? > > I took the liberty of adding your name to the Google document [1] and > adding this se

Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-13 Thread Jason A. Donenfeld
On Wed, Jun 12, 2024 at 08:38:02PM -0700, Paul E. McKenney wrote: > o Make the current kmem_cache_destroy() asynchronously wait for > all memory to be returned, then complete the destruction. > (This gets rid of a valuable debugging technique because > in normal use, it is a b

Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-13 Thread Jason A. Donenfeld
On Wed, Jun 12, 2024 at 03:37:55PM -0700, Paul E. McKenney wrote: > On Wed, Jun 12, 2024 at 02:33:05PM -0700, Jakub Kicinski wrote: > > On Sun, 9 Jun 2024 10:27:12 +0200 Julia Lawall wrote: > > > Since SLOB was removed, it is not necessary to use call_rcu > > > when the callback only performs kmem

Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-12 Thread Jason A. Donenfeld
On Thu, Jun 13, 2024 at 01:31:57AM +0200, Jason A. Donenfeld wrote: > On Wed, Jun 12, 2024 at 03:37:55PM -0700, Paul E. McKenney wrote: > > On Wed, Jun 12, 2024 at 02:33:05PM -0700, Jakub Kicinski wrote: > > > On Sun, 9 Jun 2024 10:27:12 +0200 Julia Lawall wrote: > > &g

Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback

2024-06-12 Thread Jason A. Donenfeld
On Wed, Jun 12, 2024 at 03:37:55PM -0700, Paul E. McKenney wrote: > On Wed, Jun 12, 2024 at 02:33:05PM -0700, Jakub Kicinski wrote: > > On Sun, 9 Jun 2024 10:27:12 +0200 Julia Lawall wrote: > > > Since SLOB was removed, it is not necessary to use call_rcu > > > when the callback only performs kmem

Re: [PATCH] treewide: drop CONFIG_EMBEDDED

2023-08-16 Thread Jason A. Donenfeld
@lists.infradead.org > Cc: Arnd Bergmann > Cc: Jason A. Donenfeld > Cc: wiregu...@lists.zx2c4.com > Cc: linux-a...@vger.kernel.org > Cc: linux-snps-...@lists.infradead.org > Cc: Vineet Gupta > Cc: Brian Cain > Cc: linux-hexa...@vger.kernel.org > Cc: Greg Ungerer >

Re: [PATCH v12 0/6] implement getrandom() in vDSO

2022-12-21 Thread Jason A. Donenfeld
On Tue, Dec 20, 2022 at 08:13:14PM +, Eric Biggers wrote: > On Tue, Dec 20, 2022 at 05:17:52PM +, Christophe Leroy wrote: > > Hi Jason, > > > > Le 12/12/2022 à 19:53, Jason A. Donenfeld a écrit : > > > Changes v11->v12: > > >

Re: [PATCH v12 0/6] implement getrandom() in vDSO

2022-12-21 Thread Jason A. Donenfeld
On Tue, Dec 20, 2022 at 05:17:52PM +, Christophe Leroy wrote: > I would have liked to give it a try on powerpc, but the series > conflicts. I tried both on v6.1 and on linus/master from now: I'll send a rebased v+1 shortly. Jason

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

2022-11-17 Thread Jason A. Donenfeld
On Thu, Nov 17, 2022 at 01:57:13PM -0800, Kees Cook wrote: > The only comment I have is that maybe these cases can just be left as-is > with _below()? > > > - size_t len = get_random_u32_below(rs) + gs; > > + size_t len = get_random_u32_inclusive(gs, rs + gs - 1); > > It s

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

2022-11-17 Thread Jason A. Donenfeld
subsequently cleaned up by hand, with several automatic cases rejected if it didn't make sense contextually. Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jason Gunthorpe # for infiniband Signed-off-by: Jason A. Donenfeld --- arch/x86/kernel/module.c | 2 +- crypt

[PATCH v3 2/3] treewide: use get_random_u32_{above,below}() instead of manual loop

2022-11-17 Thread Jason A. Donenfeld
I; @@ - do { ... when != I - I = get_random_u32(); ... when != I - } while (I == 0); + I = get_random_u32_above(0); @@ expression E; @@ - E + 1 + get_random_u32_below(U32_MAX - E) + get_random_u32_above(E) Reviewed-by: Greg Kroah-Hartman Signed-off-by: Jason A. Donenfeld --- f

[PATCH v3 1/3] treewide: use get_random_u32_below() instead of deprecated function

2022-11-17 Thread Jason A. Donenfeld
King (Oracle) # for arm Acked-by: Ulf Hansson # for mmc Signed-off-by: Jason A. Donenfeld --- arch/arm/kernel/process.c | 2 +- arch/arm64/kernel/process.c | 2 +- arch/loongarch/kernel/process.c | 2 +- arch/loongarch/kernel/vdso.c

[PATCH v3 0/3] convert tree to get_random_u32_{below,above,inclusive}()

2022-11-17 Thread Jason A. Donenfeld
kernel.org Cc: linux-arm-ker...@lists.infradead.org Cc: loonga...@lists.linux.dev Cc: linux-m...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-...@vger.kernel.org Cc: linux-par...@vger.kernel.org Jason A. Donenfeld (3): treewide: use get_random_u32_below() instead of deprecated function t

Re: [PATCH v2 3/3] treewide: use get_random_u32_between() when possible

2022-11-17 Thread Jason A. Donenfeld
On Thu, Nov 17, 2022 at 10:42:37AM -0500, Theodore Ts'o wrote: > On Wed, Nov 16, 2022 at 04:47:27PM -0800, Kees Cook wrote: > > >> > - between > > >> > - ranged > > >> > - spanning > > >> > > > >> > https://www.thefreedictionary.com/List-of-prepositions.htm > > >> > - amid > > >> > > > >> > Sigh,

Re: [PATCH v2 3/3] treewide: use get_random_u32_between() when possible

2022-11-16 Thread Jason A. Donenfeld
On Thu, Nov 17, 2022 at 12:55:47AM +0100, Jason A. Donenfeld wrote: > 1) How/whether to make f(0, UR2_MAX) safe, >- without additional 64-bit arithmetic, >- minimizing the number of branches. >I have a few ideas I'll code golf for a bit. > I think I can make progre

Re: [PATCH v2 3/3] treewide: use get_random_u32_between() when possible

2022-11-16 Thread Jason A. Donenfeld
On Wed, Nov 16, 2022 at 04:31:18PM -0800, Kees Cook wrote: > On Thu, Nov 17, 2022 at 01:03:14AM +0100, Jason A. Donenfeld wrote: > > On Thu, Nov 17, 2022 at 12:55:47AM +0100, Jason A. Donenfeld wrote: > > > 2) What to call it: > > >- between I still like, because it

Re: [PATCH v2 3/3] treewide: use get_random_u32_between() when possible

2022-11-16 Thread Jason A. Donenfeld
On Thu, Nov 17, 2022 at 12:55:47AM +0100, Jason A. Donenfeld wrote: > 2) What to call it: >- between I still like, because it mirrors "I'm thinking of a number > between 1 and 10 and..." that everybody knows, >- inclusive I guess works, but it's no

Re: [PATCH v2 3/3] treewide: use get_random_u32_between() when possible

2022-11-16 Thread Jason A. Donenfeld
On Wed, Nov 16, 2022 at 02:43:13PM -0800, Kees Cook wrote: > On Mon, Nov 14, 2022 at 05:45:58PM +0100, Jason A. Donenfeld wrote: > > - (get_random_u32_below(1024) + 1) * PAGE_SIZE; > > + get_random_u32_between(1, 1024 + 1) * PA

[PATCH v2 3/3] treewide: use get_random_u32_between() when possible

2022-11-14 Thread Jason A. Donenfeld
cleaned up by hand, with several automatic cases rejected if it didn't make sense contextually. Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jason Gunthorpe # for infiniband Signed-off-by: Jason A. Donenfeld --- arch/x86/kernel/module.c | 2 +- crypto/rsa-pkcs1

[PATCH v2 2/3] treewide: use get_random_u32_{above,below}() instead of manual loop

2022-11-14 Thread Jason A. Donenfeld
I; @@ - do { ... when != I - I = get_random_u32(); ... when != I - } while (I == 0); + I = get_random_u32_above(0); @@ expression E; @@ - E + 1 + get_random_u32_below(U32_MAX - E) + get_random_u32_above(E) Reviewed-by: Greg Kroah-Hartman Signed-off-by: Jason A. Donenfeld --- f

[PATCH v2 1/3] treewide: use get_random_u32_below() instead of deprecated function

2022-11-14 Thread Jason A. Donenfeld
A. Donenfeld --- arch/arm/kernel/process.c | 2 +- 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

[PATCH v2 0/3] convert tree to get_random_u32_{below,above,between}()

2022-11-14 Thread Jason A. Donenfeld
@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-...@vger.kernel.org Cc: linux-par...@vger.kernel.org Jason A. Donenfeld (3): treewide: use get_random_u32_below() instead of deprecated function treewide: use get_random_u32_{above,below}() instead of manual loop treewide: use get_random_u32_b

Re: [6.1.0-rc4-next-20221108] Boot failure on powerpc

2022-11-09 Thread Jason A. Donenfeld
Should be fixed already in today's next.

[PATCH v2] random: do not include from random.h

2022-10-28 Thread Jason A. Donenfeld
The header is a random.c private detail, not something to be called by other code. As such, don't make it automatically available by way of random.h. Cc: Michael Ellerman Cc: Heiko Carstens Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-s...@vger.kernel.org Signed-off-by: Jason A. Done

Re: [PATCH v1 0/5] convert tree to get_random_u32_{below,above,between}()

2022-10-24 Thread Jason A. Donenfeld
On Sun, Oct 23, 2022 at 05:07:13PM -0400, Theodore Ts'o wrote: > On Fri, Oct 21, 2022 at 11:03:22PM -0700, Jakub Kicinski wrote: > > On Sat, 22 Oct 2022 07:47:06 +0200 Jason A. Donenfeld wrote: > > > On Fri, Oct 21, 2022 at 10:32:42PM -0700, Jakub Kicinski wrote: >

[PATCH v1 2/2] stackprotector: actually use get_random_canary()

2022-10-23 Thread Jason A. Donenfeld
stackprotector.h files is superfluous and over-complicated. Instead, we can get exactly the same thing, but better, by just calling `get_random_canary()`. Signed-off-by: Jason A. Donenfeld --- arch/arm/include/asm/stackprotector.h | 9 + arch/arm64/include/asm/stackprotector.h | 9

[PATCH v1 1/2] stackprotector: move CANARY_MASK and get_random_canary() into stackprotector.h

2022-10-23 Thread Jason A. Donenfeld
stackprotector.h file where it belongs. Signed-off-by: Jason A. Donenfeld --- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/setup_percpu.c | 2 +- arch/x86/kernel/smpboot.c | 2 +- arch/x86/xen/enlighten_pv.c| 2 +- include/linux/random.h | 19 --- include/linux

[PATCH v1 0/2] cleanup stackprotector canary generation

2022-10-23 Thread Jason A. Donenfeld
nsa.org Cc: linuxppc-dev@lists.ozlabs.org Cc: x...@kernel.org Jason A. Donenfeld (2): stackprotector: move CANARY_MASK and get_random_canary() into stackprotector.h stackprotector: actually use get_random_canary() arch/arm/include/asm/stackprotector.h | 9 + arch/arm64/i

Re: [PATCH v1 0/5] convert tree to get_random_u32_{below,above,between}()

2022-10-21 Thread Jason A. Donenfeld
On Fri, Oct 21, 2022 at 10:32:42PM -0700, Jakub Kicinski wrote: > But whatever. I mean - hopefully there aren't any conflicts in the ~50 > networking files you touch. I just wish that people didn't pipe up with > the tree wide changes right after the merge window. Feels like the > worst possible ti

Re: [PATCH v1 0/5] convert tree to get_random_u32_{below,above,between}()

2022-10-21 Thread Jason A. Donenfeld
On Fri, Oct 21, 2022 at 08:55:22PM -0700, Jakub Kicinski wrote: > On Fri, 21 Oct 2022 21:43:58 -0400 Jason A. Donenfeld wrote: > > Since get_random_u32_below() sits in my random.git tree, these patches > > too will flow through that same tree. > > How big is it? Can you pr

[PATCH v1 3/5] random: add helpers for random numbers with given floor or range

2022-10-21 Thread Jason A. Donenfeld
Now that we have get_random_u32_below(), it's trivial to make inline helpers to compute get_random_u32_above() and get_random_u32_between(), which will help clean up open coded loops and manual computations throughout the tree. Signed-off-by: Jason A. Donenfeld --- include/linux/random.h

[PATCH v1 5/5] treewide: use get_random_u32_between() when possible

2022-10-21 Thread Jason A. Donenfeld
These cases were done with this Coccinelle: @@ expression H; expression L; @@ - (get_random_u32_below(H) + L) + get_random_u32_between(L, H + L) And then subsequently cleaned up by hand, with several automatic cases rejected if it didn't make sense contextually. Signed-off-by: Ja

[PATCH v1 4/5] treewide: use get_random_u32_{above,below}() instead of manual loop

2022-10-21 Thread Jason A. Donenfeld
_u32_above(0); @@ expression E; identifier I; @@ - E + 1 + get_random_u32_below(U32_MAX - E) + get_random_u32_above(E) Signed-off-by: Jason A. Donenfeld --- fs/ext4/mmp.c| 8 +--- lib/test_fprobe.c| 5 + lib/test_kprobes.c | 5 + net/ipv6/output_

[PATCH v1 1/5] treewide: use get_random_u32_below() instead of deprecated function

2022-10-21 Thread Jason A. Donenfeld
This is a simple mechanical transformation done by: @@ expression E; @@ - prandom_u32_max(E) + get_random_u32_below(E) Signed-off-by: Jason A. Donenfeld --- arch/arm/kernel/process.c | 2 +- arch/arm64/kernel/process.c | 2 +- arch/loongarch/kernel

  1   2   3   >