From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26802C76191 for ; Mon, 15 Jul 2019 16:00:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA032205ED for ; Mon, 15 Jul 2019 16:00:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CUwZ43K9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731131AbfGOQAR (ORCPT ); Mon, 15 Jul 2019 12:00:17 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:40521 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730931AbfGOQAR (ORCPT ); Mon, 15 Jul 2019 12:00:17 -0400 Received: by mail-pf1-f195.google.com with SMTP id p184so7618513pfp.7 for ; Mon, 15 Jul 2019 09:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1pf3WGwA9D7m+i0fi13et95NxKX1fwC73+4IJDRPguM=; b=CUwZ43K9ybSDvf08eErRqtarzGQdiyDymnpU0KIK2JQh0T9Sup32mLmqjhs/VSqLrM MYwEWnD1tZLcOi15wredI/8U9xLO31vPqZvI1nsgvE8QGayvfGS4zJ8DFpd8xTqTB2Uu X0XI38pv45yv7xUlijhdFuvP2joPIHdZCt3wPU6yGKh7zI1+RsRJeph15u1MMAsHXsmU N/CNSsdTxOBDr+vJzIQZq74ITN4H5tRoqeyXjfz14O98vHdJyS9nZdunI9ZY16WRAzUr aDjqrcEfrIeCTuDiF5a0mq44jqMLnJJxVYJo2ivJup10466XLsZAPQUB28/H/OHw+0N1 yN/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1pf3WGwA9D7m+i0fi13et95NxKX1fwC73+4IJDRPguM=; b=CtpUuNwJMaafCfXiTvrh4fVoukSxXGTmRKpTkAs2Z9OjbOQLOMAjab2xA4H3ewYdoB dfFywLTnE6qzTizXIYf3XL21agvOr2bgT8no6Zi9Nd6CgxxV8YVB9yS0vc9QPbDoH9ny nsnXiS21PiOhrFssVLI6Ju9cOyuN+dOQuQqxCi8IVfhYfsr69+qXwyVttdqsgXpoxjr+ bEbPhszBmm5iWtdBRBUYK0XoSGVb1TxYs1wUTTVxEdmKuPDNSWJ6xFrSj+je/8jas3SZ 0uNZKNPJU++Xvg8lnRV2WVHJMT0ZTSUOqT9Aa30+0xL4Pf7Ap5D1KkKTvrgWpFeRcljG 8XSA== X-Gm-Message-State: APjAAAUkx4G13UYbB9C8FbK8Q1Vgtn7P3lHNVeYcV1aWnMasda2U28FE Dbv0OHzpcWgUE+Gk89koaUimqekVefEzqOtrtvGeTg== X-Google-Smtp-Source: APXvYqxUxnVJIFmSjF/fduDJIdHHtTu2E7rs0M1v5DQsmsjwZzuX9klo19X53kLCG4pNPCe3wIEdLnHCwqNb7FnoP6U= X-Received: by 2002:a17:90a:a116:: with SMTP id s22mr29852919pjp.47.1563206415768; Mon, 15 Jul 2019 09:00:15 -0700 (PDT) MIME-Version: 1.0 References: <41e0a911e4e4d533486a1468114e6878e21f9f84.1561386715.git.andreyknvl@google.com> <20190624175009.GM29120@arrakis.emea.arm.com> In-Reply-To: <20190624175009.GM29120@arrakis.emea.arm.com> From: Andrey Konovalov Date: Mon, 15 Jul 2019 18:00:04 +0200 Message-ID: Subject: Re: [PATCH v18 07/15] fs/namespace: untag user pointers in copy_mount_options To: Al Viro Cc: Linux ARM , Linux Memory Management List , LKML , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, kvm@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , 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 , Khalid Aziz , enh , Jason Gunthorpe , Christoph Hellwig , Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Robin Murphy , Kevin Brodsky , Szabolcs Nagy , Catalin Marinas Content-Type: text/plain; charset="UTF-8" Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, Jun 24, 2019 at 7:50 PM Catalin Marinas wrote: > > On Mon, Jun 24, 2019 at 04:32:52PM +0200, Andrey Konovalov wrote: > > This patch is a part of a series that extends kernel ABI to allow to pass > > tagged user pointers (with the top byte set to something else other than > > 0x00) as syscall arguments. > > > > In copy_mount_options a user address is being subtracted from TASK_SIZE. > > 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. > > > > Untag the address before subtracting. > > > > Reviewed-by: Khalid Aziz > > Reviewed-by: Vincenzo Frascino > > Reviewed-by: Kees Cook > > Reviewed-by: Catalin Marinas > > Signed-off-by: Andrey Konovalov > > --- > > fs/namespace.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/fs/namespace.c b/fs/namespace.c > > index 7660c2749c96..ec78f7223917 100644 > > --- a/fs/namespace.c > > +++ b/fs/namespace.c > > @@ -2994,7 +2994,7 @@ void *copy_mount_options(const void __user * data) > > * the remainder of the page. > > */ > > /* copy_from_user cannot cross TASK_SIZE ! */ > > - size = TASK_SIZE - (unsigned long)data; > > + size = TASK_SIZE - (unsigned long)untagged_addr(data); > > if (size > PAGE_SIZE) > > size = PAGE_SIZE; > > I think this patch needs an ack from Al Viro (cc'ed). > > -- > Catalin Hi Al, Could you take a look and give your acked-by? Thanks!