Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp511441imm; Thu, 30 Aug 2018 04:43:55 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbrFB/8LRwHjvrYbUv6FDx0WuGzVE4I33TgSZQh1nV0g3Dwt0i6dnq6lxl6Po7CXtuoJvQ8 X-Received: by 2002:a17:902:b189:: with SMTP id s9-v6mr9856320plr.188.1535629435738; Thu, 30 Aug 2018 04:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535629435; cv=none; d=google.com; s=arc-20160816; b=YpXGQtac5yHlUtmp/6ZCN6Iui3QKKI9B44xFL39nhfbpv1ZUnDGir16PhFREY4W8X4 0VcMUa21GCYUr1wVNPVcfIKaZXNs8qoqb4eGHkjotyxqqLiVyZ9T/etO8+v/1fYUO4FF IsFr79oet+3kn7wUAKc+K3inW187WRJnSs4LlFFQRIurOYHdeG06/ThJGthGJmWlyaEZ WYwjDfXvEHPn3LhyvI5GXdJUK8eIGF45kgce2E2uvMA38e5BXKFSlqgfDjU7iaorZAo0 iHh7m85LWOJ5V/51jUPckDmlPui4KGJD2FFi912iWNmE7nm3pIxbyJKqZ+4bKsN+4hQ2 7uLA== 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:arc-authentication-results; bh=peFGwkj0AlthOK6WcLkPIvSBY/FDPlGLSABrTryAHcY=; b=IinP+UisfxVXrpSrR2VdSMgzpkSuDP88dDB0p1JFxAYAsPiFlbDEpd86nmtp6Vlg0v pZEqQZUkAYdhV+FNCh6Ax1Yd/pIAmvqj+pgMMtkRd+V5+cQwet76Uq2/Ggxcu46K91Qx M+0xXa2IlLkegdDdRfeqCBAsIAC4TNJnLm7G/rW6kYGc8XIbe9PamwAwbwCsghiArxKE 2bkYacuIhVFZHZGTHBS1s0Hs0mJn62aJdniBryKLfHmuub+3MD/IvmyXdBaf7I1zQ2S0 9AVIWyPXcagA/TzqpTuFdG5D4ldFxWJsgXfbYg+GWlqSeK9qezHRH8jEjOIeyelBBVbx jaPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qutDpDCE; 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 h11-v6si6580050pfk.81.2018.08.30.04.43.40; Thu, 30 Aug 2018 04:43:55 -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=qutDpDCE; 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 S1728436AbeH3PnL (ORCPT + 99 others); Thu, 30 Aug 2018 11:43:11 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36487 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728334AbeH3PnK (ORCPT ); Thu, 30 Aug 2018 11:43:10 -0400 Received: by mail-wr1-f65.google.com with SMTP id m27-v6so7769525wrf.3 for ; Thu, 30 Aug 2018 04:41:27 -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=peFGwkj0AlthOK6WcLkPIvSBY/FDPlGLSABrTryAHcY=; b=qutDpDCEJxZdQJGRz9onfIyHIbFL8b17YWKAy3SacXtKLfSDNYNiVlv1hK56myHKVG TpyquPNOuTBxR6l698HxJDFXuGfJTfgvMYNFFkc9/TXqGxKm8UfZZF8EYjbSu9sRM6Sv MeNf7eh1j8Y9rENXz6JmOCnaZ5acljWvTf1sWUnXx/3QzkRf3sWTGcV0uHPXYOL47Jwf fQ+ZkBLNcijn0SXu94/W9cZckIe0NxQsbfFYrLBOM2UywIlnvrmBr/qpaYtLINQomi0w NTY9nCRgU5N/y2QOVTs7v+xMJkt10JdgERM5cVwoecykkVi8kZaSlsRfS3mO1P/oW9A+ Kbbg== 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=peFGwkj0AlthOK6WcLkPIvSBY/FDPlGLSABrTryAHcY=; b=grZ6iv37yArS+2itf0ZeOngN+dtHeAgF769I7PeT8PoWZ9otuGLvLiYR/PianbRDF1 bDAwN39IpJ0sMFkPGKe6NJvkxEfBfzBehnP3EiNZy3CMKrbzqUPEd+ZcPwrve/dlnKvL pkc5gR7rWXYA+0yNqwLzLop9UsayTKq1BeFM3m/Pm8xgh4X+LpvZC0/PBvJ2F66pM1Td dqgRaJk2KBanUQBOR54X/U4yQv7vr3wR8bLKqnGkW4shFfZOKy22I7kgzS5cNwg223Hs 3PBlZCZStVk8Okul/nIX2QGVKsfDyp5fYclIv9BSBNe68YVbOj7sucnUEOqWHRBs0qPg 06qA== X-Gm-Message-State: APzg51CtDIpVSsLZLM1KOJLWjF8Fh1DTo+EeprONiv0NFyN41RlNdj0p Mmh6HhTcLwSITFZ9/EuXJ0fNtw== X-Received: by 2002:a5d:5009:: with SMTP id e9-v6mr7782028wrt.18.1535629286664; Thu, 30 Aug 2018 04:41:26 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id z184-v6sm2175218wmz.0.2018.08.30.04.41.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 04:41:26 -0700 (PDT) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Al Viro , Andrey Konovalov , 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 Subject: [PATCH v6 04/11] mm, arm64: untag user addresses in mm/gup.c Date: Thu, 30 Aug 2018 13:41:09 +0200 Message-Id: <163681302d7380fde6717daa26739965295f636a.1535629099.git.andreyknvl@google.com> X-Mailer: git-send-email 2.19.0.rc0.228.g281dcd1b4d0-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 mm/gup.c provides a kernel interface that accepts user addresses and manipulates user pages directly (for example get_user_pages, that is used by the futex syscall). Since a user can provided tagged addresses, we need to handle such case. Add untagging to gup.c functions that use user addresses for vma lookup. Signed-off-by: Andrey Konovalov --- mm/gup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/gup.c b/mm/gup.c index 1abc8b4afff6..6f09132c654e 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -666,6 +666,8 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, if (!nr_pages) return 0; + start = untagged_addr(start); + VM_BUG_ON(!!pages != !!(gup_flags & FOLL_GET)); /* @@ -820,6 +822,8 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, struct vm_area_struct *vma; vm_fault_t ret, major = 0; + address = untagged_addr(address); + if (unlocked) fault_flags |= FAULT_FLAG_ALLOW_RETRY; -- 2.19.0.rc0.228.g281dcd1b4d0-goog