From patchwork Mon Dec 10 12:51:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10721221 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E2E217FE for ; Mon, 10 Dec 2018 12:51:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E4DD2A278 for ; Mon, 10 Dec 2018 12:51:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B57F2A2A6; Mon, 10 Dec 2018 12:51:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCD012A278 for ; Mon, 10 Dec 2018 12:51:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF8CF8E000D; Mon, 10 Dec 2018 07:51:17 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C257F8E0001; Mon, 10 Dec 2018 07:51:17 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A98B88E000D; Mon, 10 Dec 2018 07:51:17 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by kanga.kvack.org (Postfix) with ESMTP id 5610B8E0001 for ; Mon, 10 Dec 2018 07:51:17 -0500 (EST) Received: by mail-wr1-f69.google.com with SMTP id w16so3438654wrk.10 for ; Mon, 10 Dec 2018 04:51:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=O6AqR+kzU7DWQeNGwKtE5aEN5/daSSLGL2wqVNM1I1o=; b=kVY8/pu5NdbVb0+Ig00PGhR3mHOsl9SCcftpnpYHBV/8Cuwfv7UjqYPDomiEetKlne CKJtZWPpkInxE18Si72sPwSFG7f5CE259AmlQw9GhFPjrKi9k7iDcl7HVScoQr1pZzdr 6HU3INjkHAPacLk4mu4XyNFX8YauEgnMJ50lacS0B7JPnR3QHxRAMZt7i1j5tTA0fuXh LXu1YfY/58QazHXlW5offVtxhqWFFroCITEe7Mb0saUNGyUzEqTjwgkEAetFxrHbuLk+ vkFWWteGXmgVs78qaSch5PULoxv4/PEUnrcvixJnkTl6kYW58Nt0CVoH1VSxM8iyzzI+ BDZw== X-Gm-Message-State: AA+aEWYfT+uS4pKXWdQu4lMgPWqeS1/Ln1b3v1lZr8pj7N+zLai3FUYL XvOUTFdmP/ukqYJKEumVsZO7jH6tN3LHcjT3OPqMef73OfTLHwxdIltTcKVyumMQlPn1F/V24EA p5YyaO6+svT183tWPKHsZQXPRFuLs5/wF/wHIJ82cy9DrjMvQWuQe3wydkgNCyDEmn7aAxH6SnX QESQ/j8NFC9OFKG5T+4G5xzxM7t+SQcb7Loxoa+kkCZyFna4SnYKPQCLlHD2C9oP5LpCcOYKRbt s0WD0hcTYbcXK+QUczTFXNuRX7auMWPCCi2hDzgeg3FNnpNBQWXxKz4XwBmUsUTjdVIBdGTTg7P ca+US7az7mranWZE1lOCArAHLtAZnAE/ylDN5TauqLYt5RShAgjwhHUQkdZ8vGfUKZN55XJGVIn v X-Received: by 2002:a7b:c7c1:: with SMTP id z1mr11038780wmk.31.1544446276885; Mon, 10 Dec 2018 04:51:16 -0800 (PST) X-Received: by 2002:a7b:c7c1:: with SMTP id z1mr11038738wmk.31.1544446276027; Mon, 10 Dec 2018 04:51:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544446276; cv=none; d=google.com; s=arc-20160816; b=nDwjdfwcqSMuEqhX/rR5M9uaZ1Z08W51Z3wbewuK5qzuwN8Ne4XQNvk9WCX3LmKfxv /JqyoP+RDgOQQHlgIIoI2pZExg2UJnSnHK99XHHM+TAmGdRuwam+2W275Y+r6B1ACV8l apiu7kw7Mbv33VneUqwMXmeZ9HZ4kcTEgOmkmd0K8U89NgYCtrkN6dHp1aIvNXARw4sA LvXDUYE18xd7P4fLLEp2mS1N91oiek1pGIENyZccjIpnGrQoYB0LQWwSXmYrL7L8m1h3 vthyYK84bVtzAm7dgFhuDbTOdYr6Wb0j8Jq7RZKe8M1EGyRB7eVs29P/ZSoS/kL5bplr jwBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=O6AqR+kzU7DWQeNGwKtE5aEN5/daSSLGL2wqVNM1I1o=; b=p1dPFFw0wgLnodrrLMbZFG8fZd5pmoYbtrQOpm3MCeU4L//eXS4lZilBpY+ki9uplK 9DhlQfSEfuoumQ5BpW5uk+PCYgaBCTTaz63PMf3FtLLd6DNBx4YRSl77QvfRIj7K6Fws ogsER8VLkGrRT0uyQthYkYVXahA8/nX6bM2GcxB9rx+YGmdvqn7Y31cxRlAmqecYdKyY BE2S/4xGwE5ShxhUQwF6LSVIjUxpE8x70GUaCvBzk1hrUTA+mHAq/MGYEAhHoiU9xEQt IYTkR7p/5sEr/FCHXSnRHJsMPO31gUyx5dSH5b4ieFsELIu9Ar7LSuFdG8vc+Z3ZOdE4 OyGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=o94crt9s; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id s15sor7612116wmh.13.2018.12.10.04.51.15 for (Google Transport Security); Mon, 10 Dec 2018 04:51:15 -0800 (PST) Received-SPF: pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=o94crt9s; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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=O6AqR+kzU7DWQeNGwKtE5aEN5/daSSLGL2wqVNM1I1o=; b=o94crt9sdWRW+Hm+QmVzs2SQOfXkb5I8ZA1YUWGR/rhiyXLta3D09PlbP8iJAgQz4P AaMOg13WCXc/3V43uJSupLTElnHz42/Ee7IzHa1JjP6TjqWFlUNN//X23cnby2HTY/og axjylPN+XFavkTnP0oGFHln3ZwFe2/juKQ5sJAgtxYNAFtsVDFeYuPsBQ0hII0bfcLEK XiMERt9XLjpmq8N8DJ1YK866L0D0OEONbAo9KCgz28iqGOX3iPjmbwdb16LAY28Asm+R C/Nun82fTDPABrkfsixYhSu9EPH9yIADCvsKOyVMjDxIqyFwkkJ/ZzoNiySiBB50PDA4 tGmQ== X-Google-Smtp-Source: AFSGD/Xve6So/1Ery1o5wmvM73iVMPQ4hP1b6ACBIixN+5CPW479nD99WkZw/3+pQqT8QAsR/mEorA== X-Received: by 2002:a1c:570d:: with SMTP id l13mr11011978wmb.139.1544446275548; Mon, 10 Dec 2018 04:51:15 -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.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 04:51:14 -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 4/8] mm, arm64: untag user addresses in mm/gup.c Date: Mon, 10 Dec 2018 13:51:01 +0100 Message-Id: X-Mailer: git-send-email 2.20.0.rc2.403.gdbc3b29805-goog In-Reply-To: References: MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 8cb68a50dbdf..409aedb1e2d5 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;