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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 6B60DC7618F for ; Mon, 22 Jul 2019 16:46:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C69421901 for ; Mon, 22 Jul 2019 16:46:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CWL1yvW7"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="VX6SSuVo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C69421901 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EsiTQZrOtxmDRNcFFNnrabc2Vyfa8WUe7SvHS4gOX2A=; b=CWL1yvW7OV8srL UJvpMjjrm8Qy1dCwXX19RF9rI2dUof1JZoMkH643i79EkDh1Nl/Z5SfK1wf5Z1y8LlTx/eCMICAZy b6RJjE46sdNflyrfNnjZl32/qfUscVsTeROgaUz0zNdVfJIOL7T49Coiwz5ug8g2UHsYxO84zjAbY CnG8WcmXUdFvwNACeKutAug1wxcBAt8x8/OeLUT89ZVNCa6iZ1MvXJzVZRTIh+MDffLVo2BcKCxd+ d5TbaAnUtuqPmDNoAYQiKBzRl6mapkCWah4oupf4EyfvhNCTwGVWgP4DaJtq75PqoQs6irMQkq9/L zxp8Q/2kUST5V95+i5Ng==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hpbS0-00032c-R0; Mon, 22 Jul 2019 16:46:12 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hpbRx-00031l-Hg for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 16:46:10 +0000 Received: by mail-pg1-x543.google.com with SMTP id u17so17927330pgi.6 for ; Mon, 22 Jul 2019 09:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=F8BugWPvgcU2u1kFFZKMyP/IOkg4/qodeykECt+PCWA=; b=VX6SSuVoSHuo5NAioif+DJtSSs1RJl179j5hlo4DTfAYF66Jgcx0vpiJB8eR+9HEL8 +f/45Mc4lQN3jKnZezfzKg+yOPAVpcviTazcgmREFQYvaP41eWd/rYtiTmOP5jut4IGW UsbCxeU7Nx57xcR3YkKPrTzMk7AWS/2VcXYuY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=F8BugWPvgcU2u1kFFZKMyP/IOkg4/qodeykECt+PCWA=; b=sLNODjIWpLl5EIEaSQc6inVJ+rE8FOx57zGCOok+txtsxuog268g2Mi2SKQD8vklVi HDEAs+JP7guIWhZ0ewC6owraF+6YG9kCUtopfGs41k/2c4iFyhenR47fQ6+A5JEupo0T BYO/h2m7gNF4Zc1GeE3C2W5TeAahbKGmTBespiU3BROAHtHe1wsnfKlgIB1B/qqxoUR5 ipzTcMb9FaUM+v85ULr+hYFMLjARcSJNTrWKqWKbun+XUkfwWlsXGJnwXomCbQ3nnMEs UxLMPzTK4Gcft0JeClF+eQK//5/J6GxN/AN771o9N+JNATJbhKzUTXV5VwlqMcVOIu4V FXnw== X-Gm-Message-State: APjAAAWjkHyshwjdV0eoz9e7A5hgQXpze0DRzFo2S1VbSLJsQ94y1aru f9EomVc0VwTbKjZNZeRhvwMj2Q== X-Google-Smtp-Source: APXvYqzl1okfrN5zPZDspTEQta/i5+YABh20qrSg3GL1AN5406TswuRoR6v+V+I5B+11TbFoYh/o0Q== X-Received: by 2002:a17:90a:ff17:: with SMTP id ce23mr77676431pjb.47.1563813968675; Mon, 22 Jul 2019 09:46:08 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 4sm48411440pfc.92.2019.07.22.09.46.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2019 09:46:07 -0700 (PDT) Date: Mon, 22 Jul 2019 09:46:06 -0700 From: Kees Cook To: Andrey Konovalov Subject: Re: [PATCH v18 07/15] fs/namespace: untag user pointers in copy_mount_options Message-ID: <201907220944.5821C92518@keescook> References: <41e0a911e4e4d533486a1468114e6878e21f9f84.1561386715.git.andreyknvl@google.com> <20190624175009.GM29120@arrakis.emea.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_094609_589063_442EABF7 X-CRM114-Status: GOOD ( 26.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kvm@vger.kernel.org, Szabolcs Nagy , Catalin Marinas , Will Deacon , dri-devel@lists.freedesktop.org, Linux Memory Management List , Khalid Aziz , "open list:KERNEL SELFTEST FRAMEWORK" , Vincenzo Frascino , Jacob Bramley , Leon Romanovsky , linux-rdma@vger.kernel.org, amd-gfx@lists.freedesktop.org, Christoph Hellwig , Jason Gunthorpe , Dmitry Vyukov , Dave Martin , Evgeniy Stepanov , linux-media@vger.kernel.org, Kevin Brodsky , Ruben Ayrapetyan , Ramana Radhakrishnan , Alex Williamson , Al Viro , Yishai Hadas , Mauro Carvalho Chehab , Linux ARM , Kostya Serebryany , Greg Kroah-Hartman , Felix Kuehling , LKML , Jens Wiklander , Eric Biederman , Lee Smith , Alexander Deucher , Andrew Morton , enh , Robin Murphy , Christian Koenig , Luc Van Oostenryck Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org +Eric Biederman too, who might be able to Ack this... On Mon, Jul 15, 2019 at 06:00:04PM +0200, Andrey Konovalov wrote: > 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! -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel