From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"patches@lists.linux.dev" <patches@lists.linux.dev>,
"tglx@linutronix.de" <tglx@linutronix.de>
Cc: "linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
"linux-api@vger.kernel.org" <linux-api@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
Carlos O'Donell <carlos@redhat.com>,
Florian Weimer <fweimer@redhat.com>,
Arnd Bergmann <arnd@arndb.de>, Jann Horn <jannh@google.com>,
Christian Brauner <brauner@kernel.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v12 0/6] implement getrandom() in vDSO
Date: Tue, 20 Dec 2022 17:17:52 +0000 [thread overview]
Message-ID: <86cfa465-2485-ff24-16f5-9014e25a0e98@csgroup.eu> (raw)
In-Reply-To: <20221212185347.1286824-1-Jason@zx2c4.com>
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@PO20335 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
next prev parent reply other threads:[~2022-12-20 17:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-12 18:53 [PATCH v12 0/6] implement getrandom() in vDSO Jason A. Donenfeld
2022-12-12 18:53 ` [PATCH RFC v12 1/6] mm: add VM_DROPPABLE for designating always lazily freeable mappings Jason A. Donenfeld
2022-12-12 18:53 ` [PATCH RFC v12 2/6] x86: mm: Skip faulting instruction for VM_DROPPABLE faults Jason A. Donenfeld
2022-12-12 21:01 ` Jason A. Donenfeld
2022-12-12 18:53 ` [PATCH v12 3/6] random: add vgetrandom_alloc() syscall Jason A. Donenfeld
2022-12-12 18:53 ` [PATCH v12 4/6] arch: allocate vgetrandom_alloc() syscall number Jason A. Donenfeld
2022-12-12 18:53 ` [PATCH v12 5/6] random: introduce generic vDSO getrandom() implementation Jason A. Donenfeld
2022-12-12 18:53 ` [PATCH v12 6/6] x86: vdso: Wire up getrandom() vDSO implementation Jason A. Donenfeld
2022-12-20 17:17 ` Christophe Leroy [this message]
2022-12-20 20:13 ` [PATCH v12 0/6] implement getrandom() in vDSO Eric Biggers
2022-12-21 14:25 ` Jason A. Donenfeld
2022-12-21 20:48 ` Eric Biggers
2022-12-21 14:04 ` Jason A. Donenfeld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86cfa465-2485-ff24-16f5-9014e25a0e98@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=Jason@zx2c4.com \
--cc=adhemerval.zanella@linaro.org \
--cc=arnd@arndb.de \
--cc=brauner@kernel.org \
--cc=carlos@redhat.com \
--cc=fweimer@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jannh@google.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=patches@lists.linux.dev \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).