Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1497679imp; Fri, 22 Feb 2019 04:55:20 -0800 (PST) X-Google-Smtp-Source: AHgI3IaRpHCj7rVa8+zjaa66C4arju7jVjg30jJRYm+eht8Aoal1rSWRV73WgQwpQM9vAezp45a3 X-Received: by 2002:a63:dc54:: with SMTP id f20mr3886683pgj.410.1550840120069; Fri, 22 Feb 2019 04:55:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550840120; cv=none; d=google.com; s=arc-20160816; b=YbTJKpCRvbW6Ks/xqkw4xl8ur27XtISPxLOagMogU6KgxnGHwODjC/STG4+fPBEzJI 4CS4Sps8OlY33Zu2zjqKvMQpDmYdeYaLO4PR0qcMt5x3pRIGG0XdfItgCa/IsaOhgNP7 25BdUPFwPpJyXeLiphImJ/7YHNz/kFWmO7IvZrOvC5fz3V9cHedoL4NBU/z7R4G7mnr3 3Qiu0ZNG0qZNQ7I+YP8S8PmxPg15JxhFLHxm816KzUr8oWdovZxJjBp1XG8hrcuhsmdD fBSQaFtOb3Ds/1TjGHaPQyoW4Qpvg5Vy/xdwbWjhJnBkVLtbgcFIEPkIUFLpcc3dhRsd YJ1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QRzSxiJgMYZtPmoiWjDl90NjyZgMYTYzeKBtn1CA2K4=; b=u7Q9tLUquKhee04K3lBYmweQJdYYbj1de8z9o2QgVLsZBodw/mh7XZzGN23O/MJV2L iAeISKoS0eD7eEuYkOy29eL92jikMpsv0EcHAVJAjM2KLtlPd4b5aq6Ji9MXyvUixYnL pRaVcZd4HhnvZgqKVhX1usyALprJpXwibzDajCJvEIJNC/dGT548TUt6mwa+zUbZEcCH zjDLWSQtDhbhfAOL83G2GwM8wHkTlv5VqeLhuZLKM3CjOba3uK7m6SIPEPUHZFvMZiHW f+qv3OQw06u/qsm7wdnR5nktZkEtseyHvV2G32m1fX5PdUriLommGb0dXKwFwEEmt2s5 ozfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bOHZq9Gt; 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 o3si1317196pll.162.2019.02.22.04.55.05; Fri, 22 Feb 2019 04:55:20 -0800 (PST) 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=bOHZq9Gt; 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 S1727411AbfBVMyV (ORCPT + 99 others); Fri, 22 Feb 2019 07:54:21 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40990 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727228AbfBVMxo (ORCPT ); Fri, 22 Feb 2019 07:53:44 -0500 Received: by mail-wr1-f66.google.com with SMTP id n2so2247169wrw.8 for ; Fri, 22 Feb 2019 04:53:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QRzSxiJgMYZtPmoiWjDl90NjyZgMYTYzeKBtn1CA2K4=; b=bOHZq9GtneVcqI+7dx1dPlGbKg1NqyMwC/3dQj65R9b+AaL1dEw6WnsEFnvda6QlbD lx5q7BJ+HMum/sxb5KUmNx4YqHmnliyifP16MSQibp7C2IHgTBNe1hU9pCqsXLkuat1c znpbV/DdU4KpgxO4goYtaVe+u2TyXP6kbQ1RoQds32uwFxEU5JLU4SpkXRt6LADYtjAl WI1hDIyHVRaaElIfgQVsUPN+J6MsWMExP4yrdvC2wBzICHHXVDfMEKh4sCD1RwZwqDI3 3IZIK/md1m1LDI9VJmKIDCuhLJSumlID2vVjptcouY1GMsQmr4PDIVNhj6rbpSyQdU/5 NOjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QRzSxiJgMYZtPmoiWjDl90NjyZgMYTYzeKBtn1CA2K4=; b=OL+j2FCdf3irFK1BjnXAT2p3orJai8vRINW0MEXtuCvkMQ/pUMY3wQnSdhOlCpI+xu OOEoIg40pQv/Zv36s0puniPixnOfW0AzfjqmWXY41D+kt5g4gKGQX/fKj28y/ZxhSSUk 7TDoYKSdfSPQR/40EfM0c0kOMOiOTkZg0zrhPUSER5zjBmc/6Y9qWYzMJEVbhDVd8BPa 5yZreGQ5jT9XSToqWWIMFVnyX5zq5OFMIR+Ea9ty00ml9AMN3HHu5CWlvxEISWh7NAlq XhI7ShtWdGmOiqv9S8Pm1Cb+F5GmwYcMCk0Ix8d1o5YeN/oxroqiFiEVzXFV8cly/y3g O1FA== X-Gm-Message-State: AHQUAub1ihSTABif/zhMFAIXfp6QM98swwKGME5CdohlmZrQapTlBjQM GACopuK25dqodUE4t6a8PmwAWA== X-Received: by 2002:adf:822d:: with SMTP id 42mr2852354wrb.63.1550840021805; Fri, 22 Feb 2019 04:53:41 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:13:8ce:d7fa:9f4c:492]) by smtp.gmail.com with ESMTPSA id o14sm808209wrp.34.2019.02.22.04.53.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 04:53:40 -0800 (PST) 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 , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@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 Subject: [PATCH v10 06/12] fs, arm64: untag user pointers in copy_mount_options Date: Fri, 22 Feb 2019 13:53:18 +0100 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.258.g878e2cd30e-goog In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 a677b59efd74..d4b7adef9204 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2730,7 +2730,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.rc0.258.g878e2cd30e-goog