[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZtVbrM4rQsGFJo_t@telecaster>
Date: Sun, 1 Sep 2024 23:31:08 -0700
From: Omar Sandoval <osandov@...ndov.com>
To: Christophe Leroy <christophe.leroy@...roup.eu>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Christoph Hellwig <hch@....de>, x86@...nel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
loongarch@...ts.linux.dev, linux-mips@...r.kernel.org,
linux-parisc@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-um@...ts.infradead.org, kernel-team@...com
Subject: Re: [PATCH 0/2] mm: make copy_to_kernel_nofault() not fault on user
addresses
On Mon, Sep 02, 2024 at 08:19:33AM +0200, Christophe Leroy wrote:
>
>
> Le 02/09/2024 à 07:31, Omar Sandoval a écrit :
> > [Vous ne recevez pas souvent de courriers de osandov@...ndov.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> >
> > From: Omar Sandoval <osandov@...com>
> >
> > Hi,
> >
> > I hit a case where copy_to_kernel_nofault() will fault (lol): if the
> > destination address is in userspace and x86 Supervisor Mode Access
> > Prevention is enabled. Patch 2 has the details and the fix. Patch 1
> > renames a helper function so that its use in patch 2 makes more sense.
> > If the rename is too intrusive, I can drop it.
>
> The name of the function is "copy_to_kernel". If the destination is a user
> address, it is not a copy to kernel but a copy to user and you already have
> the function copy_to_user() for that. copy_to_user() properly handles SMAP.
I'm not trying to copy to user. I am (well, KDB is) trying to copy to an
arbitrary address, and I want it to return an error instead of crashing
if the address is not a valid kernel address. As far as I can tell, that
is the whole point of copy_to_kernel_nofault().
Thanks,
Omar
Powered by blists - more mailing lists