Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3593435imu; Mon, 10 Dec 2018 04:56:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/VHZ3yxcwiTofgya91kJ6l86j3NWLdvTLcELGfi/89B7ZqS1kZzInV9YC3fH3tTWuSfB/UO X-Received: by 2002:a17:902:9691:: with SMTP id n17mr12384942plp.9.1544446577370; Mon, 10 Dec 2018 04:56:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544446577; cv=none; d=google.com; s=arc-20160816; b=TeGOU8G+m20IF0nTfxBsTXl+Tb30642K5P9iOjr7OrDK9nAvb5uQMTRN+jSWtNRd0p t+4SYw7mOEyvvEBs3I84aGnLp8Z/1EVLX+oSRjedHflrcn+eOlqkQ9LU7ZSILaZXwyv+ cq181o6Jl0BcPWwrCot5V8qqMcxtZ38t/iFsg3aYZAYhSEMk5WkMQiSs+UOJMrHnq/bB F9xj0yJ2+rwmu53k6g/8sD6cxeZimKboSkRdWL2ly5SQPOAIUB0pNQW5YJwzp3LAxzBY XBlvL8yUO/7o23slCEFCviITNcjabAyTElLcN3AlH+d+r4KCaQuHucPtVfrGd5qWzKSG f2aA== 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=pdp/ryV9bt4+HrjeOWrdnZnBI6aj8YPFqzbeaIQ9j68=; b=Sem2wQXo0OI81g/DR8AdtxRsj6RXPAO5XZs4+EdIhLPyaPwJlXBnsPCg7yOLxQbRgQ 9bGKAwRJKQUqiDD/+Wuhok/oNUroIRerhz0pgPbgdJZJkA/8QODsnwxFRlTp58bDewBp QmFIgx/CP7PavgerLv6r3ulsj27pjk+qqoBDhuWsoY2mQad9dCM3Y6Kaup1XYIAdjPeb SlJtGu+AnwGfMG5TFPgQCjgyOKKndXZyPQjGSujN2cQdhaj2IAL2xUeasq6nzUE0028u sMEJ239rZ2vb5wFtOAfHTgF1ost+4xbIkOpeonDPplxh5V9HHTDrAHNgRGjvk+s4Clmt +sgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=VEgcxLaX; 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 f81si11071765pfh.33.2018.12.10.04.56.02; Mon, 10 Dec 2018 04:56:17 -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=VEgcxLaX; 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 S1727893AbeLJMvl (ORCPT + 99 others); Mon, 10 Dec 2018 07:51:41 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36350 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727792AbeLJMvU (ORCPT ); Mon, 10 Dec 2018 07:51:20 -0500 Received: by mail-wr1-f65.google.com with SMTP id u3so10375158wrs.3 for ; Mon, 10 Dec 2018 04:51:19 -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=pdp/ryV9bt4+HrjeOWrdnZnBI6aj8YPFqzbeaIQ9j68=; b=VEgcxLaXoi0dOKDXk3mvZgG3orCXpa3lyeE6CP4OJMDCNte/zoFeg72gBtyYRUM/+z dkdH0FX3oaVuoZ2TdAnAWlMAq2acZqiJrldMEieGTNK+3b5PjuVvTUt13jkyridlEMir ldYCNgQs6aUD15xGtoBy02lnJF80uPmFB1DrhlhknCsVZxjWvFv1RdkV5JJ5GSpCW5Fm 4CiX7I8udlN21IjNRASuq0xeFFDULrKpoEaM9D2i67zp9cQXXr2TQKyBW/cdB/XiSE0/ JddgPffO2wfeBRJJGAVFDqBC6nXfN7M9u/3FUN6B+81x1rMeN5f1CRtoSZFGlT6PrwZW bQNw== 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=pdp/ryV9bt4+HrjeOWrdnZnBI6aj8YPFqzbeaIQ9j68=; b=jtl2dpcPRc4E8IDxNkGLI4Xr/cECfvl2D7FoYC/bI49PG0cOxKNH/xpt38l3vPGGSL R0gHbKn6X1MYbdbge0E4O7bRtOwuVOp7prExvQd4u1rB+NznlufUuqzlCQGgqAdb5ePX X1uTr3YLAnAX51tqHmGoJ010/Jmcmf8DRud9xU1bYho9B+qzsObvGtIkA0fWO2fJ/di1 4A3iEnYKFTbx6uf8QrdIBSY/0r1HDwX/N/mNjgo4T8WgLh8DYaRYZ7eOw7Ov1B4YglVM GHfJQ2Me9lYqVWIkOdo21Bd2hdN3rZqEgiwvH0NlQ4tOPjMvf9Z0pPiIkkkqyHbok8Fp Rrug== X-Gm-Message-State: AA+aEWYaVxtidEaewQ38zqIOJ+NqHmmUwJG4Gm1PiwL81P7/QB6ONSeA d9JQR5dbegpPoksISMoJOY9kng== X-Received: by 2002:a5d:61c4:: with SMTP id q4mr9258512wrv.308.1544446278383; Mon, 10 Dec 2018 04:51:18 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:3180:41f8:3010:ff61]) by smtp.gmail.com with ESMTPSA id l197sm36893363wma.44.2018.12.10.04.51.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 04:51:17 -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 , 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 , Andrey Konovalov Subject: [PATCH v9 6/8] fs, arm64: untag user address in copy_mount_options Date: Mon, 10 Dec 2018 13:51:03 +0100 Message-Id: <07a4efa5983abec2355b2754812509a73f648332.1544445454.git.andreyknvl@google.com> X-Mailer: git-send-email 2.20.0.rc2.403.gdbc3b29805-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 a7f91265ea67..694dcedb7e7d 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2686,7 +2686,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.20.0.rc2.403.gdbc3b29805-goog