Re: [PATCH 0/2] mm: make copy_to_kernel_nofault() not fault on user addresses

2024-09-01 Thread Omar Sandoval
On Mon, Sep 02, 2024 at 08:19:33AM +0200, Christophe Leroy wrote: > > > Le 02/09/2024 à 07:31, Omar Sandoval a écrit : > > [Vous ne recevez pas souvent de courriers de osan...@osandov.com. Découvrez > > pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification > > ] > > > > F

Re: [PATCH 0/2] mm: make copy_to_kernel_nofault() not fault on user addresses

2024-09-01 Thread Christophe Leroy
Le 02/09/2024 à 07:31, Omar Sandoval a écrit : [Vous ne recevez pas souvent de courriers de osan...@osandov.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] From: Omar Sandoval Hi, I hit a case where copy_to_kernel_nofault() will fault (lol): if

[PATCH 2/2] mm: make copy_to_kernel_nofault() not fault on user addresses

2024-09-01 Thread Omar Sandoval
From: Omar Sandoval I found that on x86, copy_to_kernel_nofault() still faults on addresses outside of the kernel address range (including NULL): # echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc # echo g > /proc/sysrq-trigger ... [15]kdb> mm 0 1234 [ 94.652476] BUG: kernel NULL po

[PATCH 0/2] mm: make copy_to_kernel_nofault() not fault on user addresses

2024-09-01 Thread Omar Sandoval
From: Omar Sandoval Hi, I hit a case where copy_to_kernel_nofault() will fault (lol): if the destination address is in userspace and x86 Supervisor Mode Access Prevention is enabled. Patch 2 has the details and the fix. Patch 1 renames a helper function so that its use in patch 2 makes more sens

[PATCH 1/2] mm: rename copy_from_kernel_nofault_allowed() to copy_kernel_nofault_allowed()

2024-09-01 Thread Omar Sandoval
From: Omar Sandoval All of the existing checks are applicable to both the "from" and "to" directions, and the next patch needs it for copy_to_kernel_nofault(). Signed-off-by: Omar Sandoval --- arch/arm/mm/fault.c | 2 +- arch/loongarch/mm/maccess.c | 2 +- arch/mips/mm/maccess.c |

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 in that memcmp. Fixed these

[powerpc:next] BUILD SUCCESS 65948b0e716a47382731889ee6bbb18642b8b003

2024-09-01 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next branch HEAD: 65948b0e716a47382731889ee6bbb18642b8b003 powerpc/vdso: Inconditionally use CFUNC macro elapsed time: 785m configs tested: 126 configs skipped: 3 The following configs have been built successfully.

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)) || > > + memcmp(counter2, counte

[powerpc:next-test] BUILD SUCCESS 087c25f837f4fc43a78b08b3b2be9f41b17adb5d

2024-09-01 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next-test branch HEAD: 087c25f837f4fc43a78b08b3b2be9f41b17adb5d powerpc: Replace kretprobe code with rethook on powerpc elapsed time: 767m configs tested: 106 configs skipped: 3 The following configs have been buil

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) > { >

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

2024-09-01 Thread Christophe Leroy
The chacha vDSO selftest doesn't check the way the counter is handled by __arch_chacha20_blocks_nostack(). It indirectly checks that the counter is writen on exit and read back on new entry, but it doesn't check that the format is correct. It has led to an invisible erroneous implementation on powe

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

2024-09-01 Thread Christophe Leroy
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_chacha TAP version 13 1..1 ok 1 chacha: PASS

Re: [PATCH v3 1/5] mm: Define VM_DROPPABLE for powerpc/32

2024-09-01 Thread Michael Ellerman
Christophe Leroy writes: > Commit 9651fcedf7b9 ("mm: add MAP_DROPPABLE for designating always > lazily freeable mappings") only adds VM_DROPPABLE for 64 bits > architectures. > > In order to also use the getrandom vDSO implementation on powerpc/32, > use VM_ARCH_1 for VM_DROPPABLE on powerpc/32. T