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.7 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 8CF65C31E46 for ; Wed, 12 Jun 2019 11:37:05 +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 545C0208CA for ; Wed, 12 Jun 2019 11:37:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AonCRgH7"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="GDzbgDhO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 545C0208CA Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com 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:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zCDzM3Wch2nEgmWBcJvQeuEpaKwx6v/EPVBdhKD51QQ=; b=AonCRgH7dSG0ui Yru0mcOAsIei2quG+ib0GzESr8gNcBnXooFbelPria6StbOcyt3EpH/oidCwm5dzPj+od7QPT/shp XRIzrHgN7Ml1KSpJL0vxXr4kql1vzMBY7+eThQhN+D15tpCOk8A4v1TQ4PoqK5aHsuFmTxftXLguI lIkE44diyTktJlLHCTKibGwpkGFipOakP58W1gVKC4jFlFugo+tY2VzKE7x8revXm8sNFnhwicEFY XprMI88c+12eQMd8hzyUmtOYFirjZeR94gwbCwGAPFfi6t/RKKfW/VTSs/uKUcSm2ccDf2+aU6XMN ptwlWMx5Xt4q5vD4Ei3A==; 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 1hb1Ym-0002pl-Iw; Wed, 12 Jun 2019 11:36:56 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hb1Ye-0002lC-LJ for linux-arm-kernel@lists.infradead.org; Wed, 12 Jun 2019 11:36:50 +0000 Received: by mail-pf1-x444.google.com with SMTP id j2so9510379pfe.6 for ; Wed, 12 Jun 2019 04:36:48 -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=MhkB743oojqt0jCijE6DsOt5IqaBpxqgWof9mFxCLr0=; b=GDzbgDhOafy14R/X43UkUN/+wf8bZdqGlFyPynLyOoG20vlQgN7zE9jZaanLyn3zx5 qQhhso2gb34OxP/u3xHSg6zS8JjJRY1rM9k4rX+82IiHVqiDxz7X2a893Yf4graw7TMN nSUF/2Gtu0ZiA9FjJgluVZwCMm/sY7nIvA/8cwZyNRO0pWttZ9rn4SJm4NDG5Og1LJ7q 69ebVQ9hxBQQPUib1nigJuccodsU3NmYrSrnehuErfe4YWQQvRoySvoE3IbFgIm+u5mm oszynkP2bKoPt4/Zv/VgvQYlSIXKjNdvA3RFAgK5OHTEZyvWErx96s2gVUjdKfd7KRLc uonQ== 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=MhkB743oojqt0jCijE6DsOt5IqaBpxqgWof9mFxCLr0=; b=WMDfGQq6svyclabf0gx/OcbyBd+PS8KcVad/udsY8sQ9Jlxd8Rll7EQ+s2imC4VDqq BTU0qsOL8ZC6qxk85fKKIuDEuKEL1NWcyyJZ29VvBCofRv/ji7VyPhDNdZw+GJ2+J1BI ncO46Jy4MNvJ+U3kAITtifLFJOdWVOtixRDRmwClynVoZ5p2cn7nluCWF00mePZp0Gz1 BNzzOLcUlUA+3sVYU4Z1at17VoLW3A7CkW1IZ96pjxagpHZHx2Zw0thYlB7fnUNmgGOU a4ba9aTXyNNxRssH1Gx5Theuzg2LHb7sV0x1iGIiburWOscGzhltnJHbqLYbmtCSh3AX KPJw== X-Gm-Message-State: APjAAAVqPMfUD9O+DFcfR0LBtm4tzGDAaZGDerRbScM+0PltBhTzNdoQ 0mxqXdRu2ntH8AYGVTyemW3yo/7vT5qxS9NcCrsOpfKxQ4o= X-Google-Smtp-Source: APXvYqzGzjPmF8qGtciCMiJ8cvvmFlnWp+2d9nBudQ86r37IgxuDA/rPCLSSJ3M+cA0egqf1SPnYkN9tXts/BubXkpo= X-Received: by 2002:aa7:97bb:: with SMTP id d27mr18575219pfq.93.1560339407628; Wed, 12 Jun 2019 04:36:47 -0700 (PDT) MIME-Version: 1.0 References: <51f44a12c4e81c9edea8dcd268f820f5d1fad87c.1559580831.git.andreyknvl@google.com> <201906072101.58C919E@keescook> In-Reply-To: From: Andrey Konovalov Date: Wed, 12 Jun 2019 13:36:36 +0200 Message-ID: Subject: Re: [PATCH v16 08/16] fs, arm64: untag user pointers in copy_mount_options To: Kees Cook X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190612_043648_734156_145CED72 X-CRM114-Status: GOOD ( 25.36 ) 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" , Felix Kuehling , 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 , Mauro Carvalho Chehab , Linux ARM , Kostya Serebryany , Greg Kroah-Hartman , Yishai Hadas , LKML , Jens Wiklander , 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 On Tue, Jun 11, 2019 at 4:38 PM Andrey Konovalov wrote: > > On Sat, Jun 8, 2019 at 6:02 AM Kees Cook wrote: > > > > On Mon, Jun 03, 2019 at 06:55:10PM +0200, 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 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: Catalin Marinas > > > Signed-off-by: Andrey Konovalov > > > > One thing I just noticed in the commit titles... "arm64" is in the > > prefix, but these are arch-indep areas. Should the ", arm64" be left > > out? > > > > I would expect, instead: > > > > fs/namespace: untag user pointers in copy_mount_options > > Hm, I've added the arm64 tag in all of the patches because they are > related to changes in arm64 kernel ABI. I can remove it from all the > patches that only touch common code if you think that it makes sense. I'll keep the arm64 tags in commit titles for v17. Please reply explicitly if you think I should remove them. Thanks! :) > > Thanks! > > > > > Reviewed-by: Kees Cook > > > > -Kees > > > > > --- > > > fs/namespace.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > 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 = TASK_SIZE - (unsigned long)data; > > > + size = TASK_SIZE - (unsigned long)untagged_addr(data); > > > if (size > PAGE_SIZE) > > > size = PAGE_SIZE; > > > > > > -- > > > 2.22.0.rc1.311.g5d7573a151-goog > > > > > > > -- > > Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel