From patchwork Thu May 3 14:15:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10378447 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D4A1B603B4 for ; Thu, 3 May 2018 14:16:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C13B629032 for ; Thu, 3 May 2018 14:16:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4D0B29171; Thu, 3 May 2018 14:16:04 +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 4B84129032 for ; Thu, 3 May 2018 14:16:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A8A06B0011; Thu, 3 May 2018 10:15:59 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 30D5C6B0012; Thu, 3 May 2018 10:15:59 -0400 (EDT) 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 182186B0022; Thu, 3 May 2018 10:15:59 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr0-f200.google.com (mail-wr0-f200.google.com [209.85.128.200]) by kanga.kvack.org (Postfix) with ESMTP id ACD826B0011 for ; Thu, 3 May 2018 10:15:58 -0400 (EDT) Received: by mail-wr0-f200.google.com with SMTP id o8-v6so11974494wra.12 for ; Thu, 03 May 2018 07:15:58 -0700 (PDT) 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:in-reply-to:references; bh=o+ak8aT7T3uE1kdwTWR13dwi0UfLy2jLaOVdoh2IUAY=; b=mQqBNHBx3LKpo3PZT7U8HGdxix9ABfAuT6iVxYdKLDbxWMLLIUr3J4Qg6P4otLrsng Ot+X0a4+zMQYS/2b8Ai6AFjvwoHIHbbezi/3zKKd8zpiVnEFbFs5QQ6Lsmo82Hyb/vLW v/ffA7OEAz0In1utQQ/SLh+9W5JhWbSK75AVKuY5vT7QKuEXQwxYN6NasQwJL8zmrSRQ nDnkAEdsK3VRd3Q6nRHtIgBg3pNqmdx+dV6wJtaOoTfE2B/tuLhn/3tfvTt7vZ7mu7pY HJj+ykDyHDKRd062WLp4IEuUfivrjvFF4MHLr/B9GVE15ti7nUFfTrP0xbiNYtfyHxUc FyRA== X-Gm-Message-State: ALQs6tBcIhRV/7ek6SmGclQnm2z8YcpUj5dUDT520pkP2P704SveZ39M t/y+uDgI49Xf+Hu1k9/+5Bu3Vhh2IOOtIYlmHO6E1VOqKJpoXo8ERU+p3GFrD1DqAJ8hpLUu32D Cbxce83YtrAwJusTVkxBGKUBM4K8VkLmCsVejM/+9FOaeWju6Y0WYOMjL7t8Axd8LP1YL67Yccd /Q3ibPozMCcZkZoUFoLf+oCHP1s6DMRYWc6YuWcUkfJ6r9ocpfU3uv2XutUX3MkLEIIXmnvDpz5 uepIhQBmHbzQbOMzfXcybimqY23dWGtMYc0SieanQ1tudUM05j16lRGk4AUyuaYvVH5R2Rb2JaX tZmysmA4DankL4dDyCTrwDKGgj1WV5Gw/j2xSqAutSPfi67kO0IYObK7VenNpxNjKLBl9MJa5xy u X-Received: by 2002:adf:c301:: with SMTP id n1-v6mr18482960wrf.26.1525356958251; Thu, 03 May 2018 07:15:58 -0700 (PDT) X-Received: by 2002:adf:c301:: with SMTP id n1-v6mr18482921wrf.26.1525356957570; Thu, 03 May 2018 07:15:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525356957; cv=none; d=google.com; s=arc-20160816; b=PoIUbigTiQ7N5qjbLuYKe3P4QVS33JD1ck+NazzUDudItMYn3CI/lCspw2sailEnoq uBBjBz8FXz4IL+1rl41nyCjZNIkbJgXBo87LX6ruawr6nQ1nrEY+TxU7Hj3UqHQhmpw9 QEzNMM1hg3CgVGcIKIK63+P0C/tFMCxThvbIVqg77CHas4Y9guuhIHWoQ96lnPNS6zvP ctHKtnlEbL698xcPtqTJLPMNOFxIvVYCCRsOQ3myKjnGHab8qBuOlG7UYhscf1ZvSs67 CCGvT3SjxDya3qMq3CqqrP6Et1v7kJDrqh9HIqzl6R1bu/qJYeH/eEE4joSRNkPHxvH+ JpzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=o+ak8aT7T3uE1kdwTWR13dwi0UfLy2jLaOVdoh2IUAY=; b=sjfzXAfJpl68+YJxhzh5UG1VU9pYqCoF2vwCsNW1GaML83GJy/60w+IRGqPUDKAelS 0V3M94TS5AoZGN4U642p2djZ3eaFdgMz8C22ykL1neB0wQKJgxplkOowkbboR/yw9aoS IjphXTfGS4RI1jty9ex0nR8n9XVWjUOs7Zt7Oya2sU52i3RLrscukvw5d2MkhZPOnAFH RI8cIFIfQJYzObxoa10T3a3mmb8SaSKaawLlmiTxPBVTQ4sD9Ql/k8pv7eb5jVbZgshB E8Ie45lAfTuWP/FfT97PQFjP9JAKznQMHSCnBmqZLpIq3c5tAZ2gyfwr0w0nc4Zqu3qL OssQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20120113 header.b=LsqUKggN; 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 e134sor1491224wma.79.2018.05.03.07.15.57 for (Google Transport Security); Thu, 03 May 2018 07:15:57 -0700 (PDT) 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=20120113 header.b=LsqUKggN; 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=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=o+ak8aT7T3uE1kdwTWR13dwi0UfLy2jLaOVdoh2IUAY=; b=LsqUKggNktg8eN6z+vIy2COAcmK3axAFA6UCN/2gDZ8Np1ZlsLG/UyDlsQmt0m/qOk XK/LQug75xAbYijiJswdDtt9Uw7jEbVwty3AvcqkXJzH5OiCJRC7CBfdQs94dw5wfCpp UAkE/GYr4pKqCxDen8QLbx+dXplaro6soXvhdRg53rRA6LlO1U5osCK3oNjr1x7omveM jo6RDTdo173a9Eqkn9GTLFHUfU68lqntf/TpgZn2izDoYkw9mmdcMdDJ8unLYTHeeYGw +yoDuWkwvcb6pPwznLqvpeJrQ7s8V6c122RUJHIam2/QR04Lj5Du8PXmzBHSShErqZD5 cXxA== X-Google-Smtp-Source: AB8JxZptJtXiKJBDGbwE89q0SZRWIhadPxCAvvpndroOWisTrqqDu2K9+Rg0HJfCfSaZ0FKxnM9UiA== X-Received: by 2002:a1c:6a0a:: with SMTP id f10-v6mr244958wmc.1.1525356955378; Thu, 03 May 2018 07:15:55 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id u20-v6sm22090298wru.33.2018.05.03.07.15.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 07:15:54 -0700 (PDT) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Jonathan Corbet , Mark Rutland , Robin Murphy , Al Viro , Andrey Konovalov , James Morse , Kees Cook , Bart Van Assche , Kate Stewart , Greg Kroah-Hartman , Thomas Gleixner , Philippe Ombredanne , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Dan Williams , "Aneesh Kumar K . V" , Zi Yan , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Chintan Pandya Subject: [PATCH v2 4/6] mm, arm64: untag user addresses in mm/gup.c Date: Thu, 3 May 2018 16:15:42 +0200 Message-Id: <24ab244adc196fda8536cf2efb59cc654e1c234b.1525356769.git.andreyknvl@google.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: References: In-Reply-To: References: 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). Here we also need to handle the case of tagged user pointers. Add untagging to gup.c functions that use user pointers 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 76af4cfeaf68..65a9566c96d3 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -647,6 +647,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)); /* @@ -801,6 +803,8 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, struct vm_area_struct *vma; int ret, major = 0; + address = untagged_addr(address); + if (unlocked) fault_flags |= FAULT_FLAG_ALLOW_RETRY;