[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <86cfa465-2485-ff24-16f5-9014e25a0e98@csgroup.eu>
Date: Tue, 20 Dec 2022 17:17:52 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: "Jason A. Donenfeld" <Jason@...c4.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"patches@...ts.linux.dev" <patches@...ts.linux.dev>,
"tglx@...utronix.de" <tglx@...utronix.de>
CC: "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"linux-api@...r.kernel.org" <linux-api@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Adhemerval Zanella Netto <adhemerval.zanella@...aro.org>,
Carlos O'Donell <carlos@...hat.com>,
Florian Weimer <fweimer@...hat.com>,
Arnd Bergmann <arnd@...db.de>, Jann Horn <jannh@...gle.com>,
Christian Brauner <brauner@...nel.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH v12 0/6] implement getrandom() in vDSO
Hi Jason,
Le 12/12/2022 à 19:53, Jason A. Donenfeld a écrit :
> Changes v11->v12:
> ----------------
> - In order to avoid mlock()ing pages, and the related rlimit and fork
> inheritance issues there, Introduce VM_DROPPABLE to prevent swapping
> while meeting the cache-like requirements of vDSO getrandom().
>
> This has some tenticles in mm/ and arch/x86/ code, so I've marked the
> two patches for that as still RFC, while the rest of the series is not
> RFC.
>
> - Mandate that opaque state blobs don't straddle page boundaries, so
> that VM_DROPPABLE can work on page-level granularity rather than
> allocation-level granularity.
>
> - Add compiler barriers to vDSO getrandom() to prevent theoretical
> reordering potential.
>
> - Initialize the trials loop counter in the chacha test.
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:
--------------------------------------------------------------------------
$ LANG= git reset --hard linus/master
HEAD is now at b6bb9676f216 Merge tag 'm68knommu-for-v6.2' of
git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
$ LANG= git am -3 ~/Téléchargements/implement-getrandom-in-vDSO.patch
Applying: mm: add VM_DROPPABLE for designating always lazily freeable
mappings
Using index info to reconstruct a base tree...
M fs/proc/task_mmu.c
M include/linux/mm.h
M include/trace/events/mmflags.h
M mm/Kconfig
M mm/memory.c
M mm/mprotect.c
M mm/rmap.c
Falling back to patching base and 3-way merge...
Auto-merging mm/rmap.c
CONFLICT (content): Merge conflict in mm/rmap.c
Auto-merging mm/mprotect.c
Auto-merging mm/memory.c
Auto-merging mm/Kconfig
Auto-merging include/trace/events/mmflags.h
Auto-merging include/linux/mm.h
Auto-merging fs/proc/task_mmu.c
error: Failed to merge in the changes.
Patch failed at 0001 mm: add VM_DROPPABLE for designating always lazily
freeable mappings
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
[chleroy@...0335 linux-powerpc]$ git diff
diff --cc mm/rmap.c
index b616870a09be,9fabd7affd3a..000000000000
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@@ -1291,16 -1256,13 +1291,22 @@@ void page_add_anon_rmap(struct page *pa
void page_add_new_anon_rmap(struct page *page,
struct vm_area_struct *vma, unsigned long address)
{
- const bool compound = PageCompound(page);
- int nr = compound ? thp_nr_pages(page) : 1;
+ int nr;
VM_BUG_ON_VMA(address < vma->vm_start || address >=
vma->vm_end, vma);
++<<<<<<< HEAD
+ __SetPageSwapBacked(page);
+
+ if (likely(!PageCompound(page))) {
+ /* increment count (starts at -1) */
+ atomic_set(&page->_mapcount, 0);
+ nr = 1;
+ } else {
++=======
+ if (!(vma->vm_flags & VM_DROPPABLE))
+ __SetPageSwapBacked(page);
+ if (compound) {
++>>>>>>> mm: add VM_DROPPABLE for designating always lazily freeable
mappings
VM_BUG_ON_PAGE(!PageTransHuge(page), page);
/* increment count (starts at -1) */
atomic_set(compound_mapcount_ptr(page), 0);
----------------------------------------------------------------------
$ LANG= git reset --hard v6.1
Updating files: 100% (12634/12634), done.
HEAD is now at 830b3c68c1fb Linux 6.1
$ LANG= git am -3 ~/Téléchargements/implement-getrandom-in-vDSO.patch
Applying: mm: add VM_DROPPABLE for designating always lazily freeable
mappings
Applying: x86: mm: Skip faulting instruction for VM_DROPPABLE faults
Applying: random: add vgetrandom_alloc() syscall
Using index info to reconstruct a base tree...
M MAINTAINERS
M drivers/char/random.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/char/random.c
Auto-merging MAINTAINERS
Applying: arch: allocate vgetrandom_alloc() syscall number
Applying: random: introduce generic vDSO getrandom() implementation
Using index info to reconstruct a base tree...
M MAINTAINERS
M drivers/char/random.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/char/random.c
CONFLICT (content): Merge conflict in drivers/char/random.c
Auto-merging MAINTAINERS
error: Failed to merge in the changes.
Patch failed at 0005 random: introduce generic vDSO getrandom()
implementation
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
-----------------------------------------------------------------------
Christophe
Powered by blists - more mailing lists