Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1304131imm; Tue, 2 Oct 2018 06:15:20 -0700 (PDT) X-Google-Smtp-Source: ACcGV629KX1VSJMtyhs5Gcy2BlkmhpD1QD8lrqgxvdw/t7UBXfHMizlTCN7HlcOks8+oxDrpNo8D X-Received: by 2002:a63:ad44:: with SMTP id y4-v6mr14275506pgo.138.1538486120063; Tue, 02 Oct 2018 06:15:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538486120; cv=none; d=google.com; s=arc-20160816; b=uHFFLovqIchLwuOKx5VsQlOE8dpLEXG2OwVT8WQ8t5yASIneSjpmLx66bfDVUAjdey FSMalwkSdSjXRMudhJzSnbXxDXoO3MoK/JSlNtROME0NRww3Drzp/vl1dDEBtalzv5Bb MgeCtn0XC4+RTHFb/Zw4ApZRq5/MnOC0Oo8tpfMZPkWxmqysfZYo13hDin7JGD0qQvbK wmAdqwqn4uymF3LUySaLGZZjA/8Qo8u95jh0z21WosghptL8KqbU5fMeV0rO2Vl7IQ5Y wPeBdwPCd9w/lErhW2lNpWiP4KcQJg7c/p+mUOjkwwA3XsG1uEuFBLD8K0cDTMyupELc ikMg== 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=xOEYtA/I6Fm+wYElUl5x45bwyq3Cixn9jAS0SVOnGHY=; b=vEVsgJo9c7qT1H0SgMfeagVct4B/lc+Vm4wcCTExGX4MIaOGFxZCW7mthVa1DuP+Sa rqjXOec8VwcETEeJNe+H/yOpaj8LJFHOvaSHw5U9Bc194RAX8X8tk6VIFjKfxrIPt9WC //5saWbY4vc96tED7kFHENZ50P/y4CFewrgwvgJ2nEM4u+/eCkHEivlJb2yQOIn6mK7h 2aVL3tRrkE/TM2ScSo69a1kilHYeRCG8fjJHqWKyekt9QjbkVLhxXj1GohBc3P4a/ZtJ Z1WboeCgJ8H1DBfTwDoYuMgJPMVsKC619ASUQLwpr9+J3OQ7rHvF59suZ5Z+MVZW+7Jt pMVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hapSsxwd; 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 22-v6si15713254pfl.220.2018.10.02.06.15.04; Tue, 02 Oct 2018 06:15:20 -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=hapSsxwd; 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 S1728220AbeJBT41 (ORCPT + 99 others); Tue, 2 Oct 2018 15:56:27 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44128 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728074AbeJBT4N (ORCPT ); Tue, 2 Oct 2018 15:56:13 -0400 Received: by mail-wr1-f68.google.com with SMTP id 63-v6so2155748wra.11 for ; Tue, 02 Oct 2018 06:12:55 -0700 (PDT) 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=xOEYtA/I6Fm+wYElUl5x45bwyq3Cixn9jAS0SVOnGHY=; b=hapSsxwdWXwCXhX3cx/PcxUUNiBlkLbDk5Ol0GIiM68H9rsaDKFOhEppykmnJbSMIG hP4HvsnoWoqCLF1XH0klHSE3kJRDP7PzPV+P6sfrd5jZTa5O9wY0NHxHbg+ssowNWDAK jMZK0Qtbun2y4bsuxkmMQDRH3ZXywQU73104mMawS21UPnCx0hs79aj2FTAWAvr0G5Zk bxZmeY1y8kNyiwgFzrMFxb0Kd5/hqdAgiK5/yWb9dAnFsWl2bEa6+ntzVC/LqyX7KdsE qebdV3d2DvQAFlQK5j16Cw1+qqvmSmApY2GvOiRAmqs6XOLDd7R47nErQEM1ADlvsb3k CIGg== 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=xOEYtA/I6Fm+wYElUl5x45bwyq3Cixn9jAS0SVOnGHY=; b=RE3HtCMiHrieuLFlbJQ4QGN6Zmua7f9jGfXa0XeFa77cMmn9AJHDZj3kTKTgJZ8n2Y sAPWHDs43Zdh9lBK9XyTDXFvIv6bMn0RnXn3Q9YxUzXcZ+lrfL3VWq4SEzZVRkkW3meK PD0CfOfB4gGHHZmXULyw0kPGgAd8MZ9LFl1+Ah+jJ/s8hbXnLBT7ru7lWrpYp0qtFQOO hr1BjwRWPn3Sy3CT9f5FaLeojyrPJNt5E+/RBhDA1MFv0zUiyD/wnHX9L71JOcw7W+QJ wPPTYHx86bMH9P7VVY6cTeMb+7VMvTDyAIm82sNDt88O42ky7ELzd5mlUg1WEY/77eAj pvXw== X-Gm-Message-State: ABuFfoiXPT4y1MhnSX0ax9SndJItue/+ex62JbyQ4el1TsYB78qa4yTb cFZXGlKkdOD0E/gnd+mslPeLIQ== X-Received: by 2002:a5d:6707:: with SMTP id o7-v6mr10890380wru.326.1538485974696; Tue, 02 Oct 2018 06:12:54 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id v10-v6sm17458681wrp.0.2018.10.02.06.12.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Oct 2018 06:12:53 -0700 (PDT) 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 v7 6/8] fs, arm64: untag user address in copy_mount_options Date: Tue, 2 Oct 2018 15:12:41 +0200 Message-Id: X-Mailer: git-send-email 2.19.0.605.g01d371f741-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 99186556f8d3..51f763fb9430 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2672,7 +2672,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.19.0.605.g01d371f741-goog