|
Message-ID: <CA+55aFzuNg5pfv_S_55u1tGhfUEux16wwiUSeCStKfha2MrxBQ@mail.gmail.com> Date: Thu, 23 Jun 2016 12:34:24 -0700 From: Linus Torvalds <torvalds@...ux-foundation.org> To: Peter Zijlstra <peterz@...radead.org> Cc: Oleg Nesterov <oleg@...hat.com>, Andy Lutomirski <luto@...capital.net>, Andy Lutomirski <luto@...nel.org>, "the arch/x86 maintainers" <x86@...nel.org>, Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>, Borislav Petkov <bp@...en8.de>, Nadav Amit <nadav.amit@...il.com>, Kees Cook <keescook@...omium.org>, Brian Gerst <brgerst@...il.com>, "kernel-hardening@...ts.openwall.com" <kernel-hardening@...ts.openwall.com>, Josh Poimboeuf <jpoimboe@...hat.com>, Jann Horn <jann@...jh.net>, Heiko Carstens <heiko.carstens@...ibm.com> Subject: Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) On Thu, Jun 23, 2016 at 12:11 PM, Peter Zijlstra <peterz@...radead.org> wrote: > > Didn't we talk about using SLAB_DESTROY_BY_RCU for task_struct before? > If that is possible, a reuse in per-cpu cache is equally possible. > > All we really want to guarantee is that the memory remains a > task_struct, it need not remain the same task, right? No, we can't do SLAB_DESTROY_BY_RCU for the task_struct itself, because the RCU list traversal does expect that the thread and task lists are stable even if it walks into a "stale" struct task_struct. If we re-use the task-struct before the RCU grace period is over, then the list walker might end up walking into the wrong thread group (bad!) or seeing tasks twice on the task list (also bad, although perhaps not _as_ bad). The _other_ fields might be ok, but updaing the very list fields that we walk with RCU is a no-no. Basically, SLAB_DESTROY_BY_RCU is fine only for things where the RCU field use is idempotent. So for things where the RCU walker only looks at entries that don't matter semantically, or where it does things like "lock/unlock" on a lock that is still valid. It's actually fairly rare that we can use SLAB_DESTROY_BY_RCU. We have that sighand thing, and there's a couple of networking uses for the request_sock and socket slabs. And I sincerely hope the socket slab RCU lists are safe, because it's dangerous. Linus
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.