[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrXHaAFARQ4Gq2ku1DMbD+78cx1JjWDpTenbNns4OWT+FA@mail.gmail.com>
Date: Mon, 27 Aug 2018 16:25:43 -0700
From: Andy Lutomirski <luto@...nel.org>
To: Jann Horn <jannh@...gle.com>
Cc: Andy Lutomirski <luto@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
"the arch/x86 maintainers" <x86@...nel.org>,
Borislav Petkov <bp@...en8.de>,
Rik van Riel <riel@...riel.com>,
kernel list <linux-kernel@...r.kernel.org>,
stable <stable@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Nadav Amit <nadav.amit@...il.com>
Subject: Re: [PATCH] x86/nmi: Fix some races in NMI uaccess
On Mon, Aug 27, 2018 at 4:12 PM, Jann Horn <jannh@...gle.com> wrote:
> On Tue, Aug 28, 2018 at 1:04 AM Andy Lutomirski <luto@...nel.org> wrote:
>>
>> In NMI context, we might be in the middle of context switching or in
>> the middle of switch_mm_irqs_off(). In either case, CR3 might not
>> match current->mm, which could cause copy_from_user_nmi() and
>> friends to read the wrong memory.
>>
>> Fix it by adding a new nmi_uaccess_okay() helper and checking it in
>> copy_from_user_nmi() and in __copy_from_user_nmi()'s callers.
>
> What about eBPF probes (which I think can be attached to kprobe points
> / tracepoints / perf events) that perform userspace reads / userspace
> writes / kernel reads? Can those run in NMI context, and if so, do
> they also need special handling?
I assume they can run in NMI context, which might be problematic in
and of themselves. For example, does BPF adequately protect against a
BPF program accessing a map while bpf(2) is modifying it? It seems
like bpf_prog_active is intended to serve this purpose.
But I don't see any obvious mechanism for eBPF programs to read user memory.
Powered by blists - more mailing lists