From: Christophe Leroy <christophe.leroy@c-s.fr>
To: David Hildenbrand <david@redhat.com>,
Kees Cook <keescook@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Mike Rapoport <rppt@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-mm@kvack.org
Subject: Re: [PATCH v2 2/2] powerpc: use probe_user_read()
Date: Tue, 8 Jan 2019 10:19:31 +0100 [thread overview]
Message-ID: <7317788a-c92d-661a-a405-b726d8054bad@c-s.fr> (raw)
In-Reply-To: <8a52b522-7b9d-e3d4-9c04-98292db11d85@redhat.com>
Le 08/01/2019 à 10:04, David Hildenbrand a écrit :
> On 08.01.19 08:37, Christophe Leroy wrote:
>> Instead of opencoding, use probe_user_read() to failessly
>> read a user location.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
>> ---
>> v2: Using probe_user_read() instead of probe_user_address()
>>
>> arch/powerpc/kernel/process.c | 12 +-----------
>> arch/powerpc/mm/fault.c | 6 +-----
>> arch/powerpc/perf/callchain.c | 20 +++-----------------
>> arch/powerpc/perf/core-book3s.c | 8 +-------
>> arch/powerpc/sysdev/fsl_pci.c | 10 ++++------
>> 5 files changed, 10 insertions(+), 46 deletions(-)
>>
[snip]
>> diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
>> index 918be816b097..c8a1b26489f5 100644
>> --- a/arch/powerpc/sysdev/fsl_pci.c
>> +++ b/arch/powerpc/sysdev/fsl_pci.c
>> @@ -1068,13 +1068,11 @@ int fsl_pci_mcheck_exception(struct pt_regs *regs)
>> addr += mfspr(SPRN_MCAR);
>>
>> if (is_in_pci_mem_space(addr)) {
>> - if (user_mode(regs)) {
>> - pagefault_disable();
>> - ret = get_user(inst, (__u32 __user *)regs->nip);
>> - pagefault_enable();
>> - } else {
>> + if (user_mode(regs))
>> + ret = probe_user_read(&inst, (void __user *)regs->nip,
>> + sizeof(inst));
>
> What about also adding probe_user_address ?
Michael doesn't like it, see https://patchwork.ozlabs.org/patch/1007117/
Christophe
>
>> + else
>> ret = probe_kernel_address((void *)regs->nip, inst);
>> - }
>>
>> if (!ret && mcheck_handle_load(regs, inst)) {
>> regs->nip += 4;
>>
>
>
next prev parent reply other threads:[~2019-01-08 9:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-08 7:37 [PATCH v2 1/2] mm: add probe_user_read() Christophe Leroy
2019-01-08 7:37 ` [PATCH v2 2/2] powerpc: use probe_user_read() Christophe Leroy
2019-01-08 9:04 ` David Hildenbrand
2019-01-08 9:19 ` Christophe Leroy [this message]
2019-01-08 9:37 ` Christophe Leroy
2019-01-08 9:58 ` Russell Currey
2019-01-08 9:58 ` Russell Currey
2019-01-08 7:51 ` [PATCH v2 1/2] mm: add probe_user_read() Mike Rapoport
2019-01-08 19:48 ` Andrew Morton
2019-01-08 21:11 ` Christophe Leroy
2019-01-08 21:14 ` Kees Cook
2019-01-08 21:14 ` Kees Cook
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=7317788a-c92d-661a-a405-b726d8054bad@c-s.fr \
--to=christophe.leroy@c-s.fr \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=david@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=rppt@linux.ibm.com \
/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