Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1497821imp; Fri, 22 Feb 2019 04:55:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IaYhw84m4cWgoUMv3bZa6FzkQA0Knxd/usnuG1nRNhVQiPzh/HC8i1uFupMEouCYbonzCYO X-Received: by 2002:aa7:9255:: with SMTP id 21mr4168243pfp.8.1550840134237; Fri, 22 Feb 2019 04:55:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550840134; cv=none; d=google.com; s=arc-20160816; b=gI0RxqFGJHk567KE08vRXsGPlpVpaPbrVRC9jiPr9v9HlMAEPPcEJpxMmsG9BX/EgS mPgsuhxrBXBlaF5am0Or4KsfiQTuflxAIy+ks5LEtViaMABoKxU0ZKl8SL/uMmCnwRBv dPHrxzsSX9fF5ZIl4umdRHI2yNEh95U9PBl0vLAEsHHlWMoBSoPPOV+iN8ApWn5cr6XU Y3OeGdUtGW3vxV+V7g+xnFIAkS8H2CqzG/9TQB6LsoT2Z1mtviFbTwkzaLqN6mp9yl5W V0+9ZAMPDy9KN/l+BUcQg5zpbOtdq6I3GWl3F0M55U3sYrRIF7g6pXcTuG1rR806KQQ8 DqIg== 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=uDDn0ivyVadTQonBIumHfFBd6mG/pAa/u+KuaaJi/B4=; b=mFW5ZROiJGWDwfnQbkYhafcfhDJkcHkMH62udS/IX4RyTiGUsiIohjLZpwgu4kvzQ+ xqbZaf5/j+6FP791T4kX4f3R1SeW4oizoiFvFxzfF1lVBK+dv/iMgBWQcU2P3JV9UaVZ HaDoAyl6dQi7DkuqE6i7tcjuSWM8rCxmidxl8QF3g+FVXR5YeWpy2A3Gk5FoBaB2pRtF Ohpnhgm+NTVB9HEVAq3gr9NY6D48bZZ0JGu/bO0uLeweWzkvZo6s978JGpHJbxSc6pG5 fpJ/hmQatZDOb/+E5wk0lWuxqv0/uCP3fkPDOWcoZGZa9Nz/RRxVIU2GvvC1aV0LSjo0 1ZVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fnTgPPWF; 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 n3si1300043plk.108.2019.02.22.04.55.19; Fri, 22 Feb 2019 04:55:34 -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=fnTgPPWF; 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 S1727422AbfBVMy3 (ORCPT + 99 others); Fri, 22 Feb 2019 07:54:29 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40975 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727205AbfBVMxl (ORCPT ); Fri, 22 Feb 2019 07:53:41 -0500 Received: by mail-wr1-f67.google.com with SMTP id n2so2246961wrw.8 for ; Fri, 22 Feb 2019 04:53:40 -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=uDDn0ivyVadTQonBIumHfFBd6mG/pAa/u+KuaaJi/B4=; b=fnTgPPWFbhryzIzggFc58E4JRsSfK1IU6Sw4LOT9BmgUYGkt3wEcfANoHsXQNUfzc9 iq9GnYboQsHAKfaKEMrayX1hTXWMMzN/I+6xp02HRbDpZSbRDDjWtj8CtbTOO+dIfC18 ltrqDIgvui1Exhs0Vsi5guo+6E3eT4Wtp8hwz3ZjUu7OWeuvZHwtR/+mz7N5pObt7Jyg o9MWPu/ZGZA22IZSghjyRMXWOy54fhII2IqGEsHjXbEZzuq4hcuupqXge221UVGDnEs4 VFRnbwlpME12B1w6MdCak9Bm0Q10KMMEgKTJkafiFF5n0MsmyUqd2OoKz/ClD7ZF5Nsp o7qQ== 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=uDDn0ivyVadTQonBIumHfFBd6mG/pAa/u+KuaaJi/B4=; b=k7GXyfwpT7gXwoF+uoECo794TUDKPoyRqW3upcsRbRj2gIRzU8NS5sgk7O+8DqEV+4 nI0s3ZHAa+owsGGMJ3VzytN9tGb8esnzrvpByTPdUp6Or4r83k0MWN3CGIJghEmSzaIw CJ2qUbaEx23QoUNpCuLvx9qFD0XBcworK7RzMw16TtBE5frS1jwsyqjG2hgszHKaO3in ekpxqUOBNS/PrndUnzpznzXWGEwmbtqxfsG6pXoL1/Za6Iwtoj1yBB4aziv9KesztqGZ xrCIApTcT+qF2R5S2zZ7RvGaUiALD7OpzxCdU8gN8IoOHC8sifsDPcyQd6tgkP0/hHCk zd8g== X-Gm-Message-State: AHQUAuZdWiiRhRFeYRTQeUl/N3jaQ9XfYY/WEZbpZHBbH9WVTnJRpfsb 2xhq4oJlKnBCFmXoBaQGF4q5CQ== X-Received: by 2002:adf:e548:: with SMTP id z8mr2994894wrm.52.1550840019712; Fri, 22 Feb 2019 04:53:39 -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.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 04:53:38 -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 05/12] mm, arm64: untag user pointers in mm/gup.c Date: Fri, 22 Feb 2019 13:53:17 +0100 Message-Id: <12759ef1c30887dd9fc7a04498f5a434a67f98d5.1550839937.git.andreyknvl@google.com> 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 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 75029649baca..b6eda1608bea 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -683,6 +683,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)); /* @@ -845,6 +847,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.21.0.rc0.258.g878e2cd30e-goog