[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc5c94a2-5a25-0715-5240-5ba3cbe0f2b2@c-s.fr>
Date: Thu, 23 Jan 2020 20:47:06 +0100
From: christophe leroy <christophe.leroy@....fr>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
Alexander Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
the arch/x86 maintainers <x86@...nel.org>
Subject: Re: [PATCH v3 2/7] uaccess: Tell user_access_begin() if it's for a
write or not
Le 23/01/2020 à 19:02, Linus Torvalds a écrit :
> On Thu, Jan 23, 2020 at 4:59 AM Christophe Leroy
> <christophe.leroy@....fr> wrote:
>>
>> On 32 bits powerPC (book3s/32), only write accesses to user are
>> protected and there is no point spending time on unlocking for reads.
>
> Honestly, I'm starting to think that 32-bit ppc just needs to look
> more like everybody else, than make these changes.
Well, beside ppc32, I was also seen it as an opportunity for the modern
ppc64. On it, you can unlock either read or write or both. And this is
what is done for get_user() / put_user() and friends: unlock only reads
for get_user() and only writes for put_user().
Could also be a compromise between performance and security: keeping
reads allowed at all time and only protect against writes on modern
architectures which support it like ppc64.
>
> We used to have a read/write argument to the old "verify_area()" and
> "access_ok()" model, and it was a mistake. It was due to odd i386 user
> access issues. We got rid of it. I'm not convinced this is any better
> - it looks very similar and for odd ppc access issues.
I'm going to leave it aside, at least for the time being, and do it as a
second step later after evaluating the real performance impact. I'll
respin tomorrow in that way.
>
> But if we really do want to do this, then:
Indeed I took the idea from a discussion in last Octobre (Subject:
"book3s/32 KUAP (was Re: [PATCH] Convert filldir[64]() from __put_user()
to unsafe_put_user())" )
https://lore.kernel.org/lkml/87h84avffi.fsf@mpe.ellerman.id.au/
>
>> Add an argument to user_access_begin() to tell when it's for write and
>> return an opaque key that will be used by user_access_end() to know
>> what was done by user_access_begin().
>
> You should make it more opaque than "unsigned long".
>
> Also, it shouldn't be a "is this a write". What if it's a read _and_ a
> write? Only a write? Only a read?
Indeed that was more: does it includes a write. It's either RO or RW
Christophe
Powered by blists - more mailing lists