Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp617309img; Mon, 18 Mar 2019 10:20:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmjCJZ5dUccW5C+9EMEP9XKcA2rv6vfQV6H2Zl6AkJEXvmbbPvHFBXHKjDtOCLy0QMCV/2 X-Received: by 2002:a63:1344:: with SMTP id 4mr18221136pgt.213.1552929635922; Mon, 18 Mar 2019 10:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552929635; cv=none; d=google.com; s=arc-20160816; b=IQHAQpucBF3aKcaMK7gy9jiHq07sK5NRvOm/CPF1kB0LfVw3os5zAx+1Dwg5n7kZSg 3kFTeM8lvs4OO236gi+18QDImnhJ1uEyq4XYyZ4Avb4fcx6JMaoF5DMYBuJZa30xdRZl nvw8O9FgOwLR7ElGXY7XVEGTbu+AYPeaiN2ScNCCCuynlRTedHcVnM0EUi/4l0mTiNzp C1PadtMSGZL9bB7k335f5UgHHxzW3uXGDvOveiM8NX7mC0pD97N55ekVf6z0qeXLfCl2 2qOvxbzrnHxABSiS8WWcvyX7WUPPqnorIsRk13Esx24YVQthDRhc2RktRKSfj/j92Uvo QeTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=/AfMcWXUpr8qOV9jNlH+KOvJdLIB2O2rWZvj+eGhaHk=; b=kft4Oxn4RWJi0BI0fkdM+NFc1BKnxTX6O9NBmHz9Sxf2zwruxLgOgN85RStH58KHBN gQoAAfwTc3WTnPjWyfJDnDkHkhsdIchiVCzsK2iCFRusyjmQpXlSnxv0Y96Jyu8Q+nP1 8XezqkeRECH+BvdZVguQDItydmI3bfqkmBMNZR7YAWoUnxUi8jkrg0F0YffNj1ijmaaQ uGikL3/NN7bRpT71hZS5LoMhjwzNlrLwyFJis3fTDUpj+TdCAiPN5+vtiS9+PyoLk7/k mJkTqrMSpQVeEiAGb7NtPJuJjEFcwAo72X5u1Nrckknft7Q72dzhkDJh0QscOcG4ggu8 TBLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZmesG1+v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g143si1024769pfb.29.2019.03.18.10.20.20; Mon, 18 Mar 2019 10:20:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZmesG1+v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727931AbfCRRSL (ORCPT + 99 others); Mon, 18 Mar 2019 13:18:11 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:43691 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727911AbfCRRSI (ORCPT ); Mon, 18 Mar 2019 13:18:08 -0400 Received: by mail-qt1-f201.google.com with SMTP id q21so5872282qtf.10 for ; Mon, 18 Mar 2019 10:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=/AfMcWXUpr8qOV9jNlH+KOvJdLIB2O2rWZvj+eGhaHk=; b=ZmesG1+vdfvVJVysloZ/DvNyAHwl1NeoVDeZqmznyOpJWfePQRGjlMOaVKfDpQrgzs J2EQbjkMYChUC5zNqacIMsL4hIDlSJ8LlP4Fmv1sBUKWq1gONhy9n6WlIdgh6miGrDT+ kxO+pObNRxAVLj1qO6umMp4FBt4KoE0pcjnUi2zV7lJYuNIAUHoun/OybTmy1PNaA5yQ p3eG+Dhv94MxYowpcID5/Yi84v5cik+7L0zhfsc+N+0vCh3BkkQf0oPyRfu2qOWqEfLW 2tCSF4/OHp/EYgkB0s7TOad99Oui2rlmLjv/5KNArBSNE7FFiFH/+uNURIDaDJj0/jzV BjkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=/AfMcWXUpr8qOV9jNlH+KOvJdLIB2O2rWZvj+eGhaHk=; b=Aaz13aXaskMhA1xtdKlriHFLxuWjTyUZRfmkT6jEuDD1FLQXEcBOTQtcuvxLinTVuj r44hc4xrarFmE5rC4HAaJyQdypVxm8wrrhG+uEGvK1/x/DAfyuErH4mGtmF/cd0AfkAY RWz9gIOBikdUlbjc1t2g44+7kWv+ZTFDzM4eEiOY3xOfr3monynpJ4c3nuzaMW85PdW1 lkc+1zmSWUpHxbm89axQo54fIByLijjqCTn0UHBdJz3KUzhrXmVQ3www1JYUvJyvZYOA nhbabkWTNP/ExRlSLyR0x8D+ziD2CS7xoIOCYP/cQaYYfcRXcAykwtf5dyBWgfjOHTM7 FCVA== X-Gm-Message-State: APjAAAX13f2V7/FlD2Qho+73roo6JwgkN8ycy8QIz+RuqWmrP5SUjSQs QgYzge1f/0vu15Aw5eeW2pVYED4kyYgx/zJW X-Received: by 2002:ac8:2733:: with SMTP id g48mr11081110qtg.0.1552929487390; Mon, 18 Mar 2019 10:18:07 -0700 (PDT) Date: Mon, 18 Mar 2019 18:17:38 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.21.0.225.g810b269d1ac-goog Subject: [PATCH v12 06/13] fs, arm64: untag user pointers in copy_mount_options From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Kees Cook , Kate Stewart , Greg Kroah-Hartman , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Shuah Khan , Vincenzo Frascino , Eric Dumazet , "David S. Miller" , Alexei Starovoitov , Daniel Borkmann , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Arnaldo Carvalho de Melo , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Chintan Pandya , Luc Van Oostenryck , Dave Martin , Kevin Brodsky , Szabolcs Nagy , Andrey Konovalov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 c9cab307fa77..c27e5713bf04 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2825,7 +2825,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.21.0.225.g810b269d1ac-goog