From mboxrd@z Thu Jan 1 00:00:00 1970 From: Khalid Aziz Subject: Re: [PATCH v17 07/15] fs, arm64: untag user pointers in copy_mount_options Date: Wed, 19 Jun 2019 14:01:22 -0600 Message-ID: <14e49054-01dc-dab5-40cc-71434ea3852a@oracle.com> References: <4ed871e14cc265a519c6ba8660a1827844371791.1560339705.git.andreyknvl@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <4ed871e14cc265a519c6ba8660a1827844371791.1560339705.git.andreyknvl@google.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Andrey Konovalov , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: Catalin Marinas , Vincenzo Frascino , Will Deacon , Mark Rutland , Andrew Morton , Greg Kroah-Hartman , Kees Cook , Yishai Hadas , Felix Kuehling , Alexander Deucher , Christian Koenig , Mauro Carvalho Chehab , Jens Wiklander , Alex Williamson , Leon Romanovsky , Luc Van Oostenryck , Dave Martin , enh , Jason Gunthorpe List-Id: linux-rdma@vger.kernel.org On 6/12/19 5:43 AM, Andrey Konovalov wrote: > This patch is a part of a series that extends arm64 kernel ABI to allow= to > pass tagged user pointers (with the top byte set to something else othe= r > than 0x00) as syscall arguments. >=20 > In copy_mount_options a user address is being subtracted from TASK_SIZE= =2E > If the address is lower than TASK_SIZE, the size is calculated to not > allow the exact_copy_from_user() call to cross TASK_SIZE boundary. > However if the address is tagged, then the size will be calculated > incorrectly. >=20 > Untag the address before subtracting. >=20 > Reviewed-by: Kees Cook > Reviewed-by: Catalin Marinas > Signed-off-by: Andrey Konovalov > --- Please update commit log to make it not arm64 specific since this change affects other architectures as well. Other than that, Reviewed-by: Khalid Aziz > fs/namespace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/fs/namespace.c b/fs/namespace.c > index b26778bdc236..2e85712a19ed 100644 > --- a/fs/namespace.c > +++ b/fs/namespace.c > @@ -2993,7 +2993,7 @@ void *copy_mount_options(const void __user * data= ) > * the remainder of the page. > */ > /* copy_from_user cannot cross TASK_SIZE ! */ > - size =3D TASK_SIZE - (unsigned long)data; > + size =3D TASK_SIZE - (unsigned long)untagged_addr(data); > if (size > PAGE_SIZE) > size =3D PAGE_SIZE; > =20 >=20