[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiSFvb7djwa7D=-rVtnq3C5msh3u=CF7CVoU6hTJ=VdLw@mail.gmail.com>
Date: Fri, 30 Aug 2019 08:41:03 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Russell King - ARM Linux admin <linux@...linux.org.uk>
Cc: Oleg Nesterov <oleg@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Chris Metcalf <cmetcalf@...hip.com>,
Christoph Lameter <cl@...ux.com>,
Kirill Tkhai <tkhai@...dex.ru>, Mike Galbraith <efault@....de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>
Subject: Re: [BUG] Use of probe_kernel_address() in task_rcu_dereference()
without checking return value
On Fri, Aug 30, 2019 at 8:30 AM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> Do you actually see that behavior?
>
> Because the foillowing lines:
>
> smp_rmb();
> if (unlikely(task != READ_ONCE(*ptask)))
> goto retry;
Side note: that code had better not be performance-critical, because
"probe_kernel_address()" is actually really really slow.
We really should do a real set of "read kernel with fault handling" functions.
We have *one* right now: load_unaligned_zeropad(), but that one
assumes that at least the first byte is valid and that the fault can
only be because of unaligned page crossers.
The problem with "probe_kernel_address()" is that it really just
re-uses the user access functions, and then plays games to make them
work for kernel addresses. Games we shouldn't play, and it's all very
expensive when it really shouldn't need to be. Including changing
limits, but also doing all the system instructions to allow user
accesses (PAN on ARM, clac/stac on x86).
Doing a set of "access kernel with error handling" should be trivial,
it's just that every architecture needs to do it. So we'd probably
need to do something where architectures can say "I have it", and fall
back on the silly legacy implementation otherwise..
Linus
Powered by blists - more mailing lists