From patchwork Fri May 25 17:21:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10428159 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 D3275601D5 for ; Fri, 25 May 2018 17:49:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8C7029751 for ; Fri, 25 May 2018 17:49:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B93FE29765; Fri, 25 May 2018 17:49:19 +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=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4947729751 for ; Fri, 25 May 2018 17:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Hqr7CmdmW/Y5/o6ccgFVhZHSuVsBjzlNzUtl8XQBL9Q=; b=tHI0TnOjcCn0yCcuxJ37kU3Ub0 kILWvwxOyU2kVSDjXh31XHknCc+vJadGgvzzBpaEhWYy1UdJPWrATSr1VYXhZ8XMFjqAqX7pa8/mn 392ihEtH913YV8hbhmNNFd4jVDYGDHj/gWl66UvKtl/fKkWUGvQuRVpQhReh/vSaNB1GO+UQefBTO mnj5fhUC5bQBNEv5Zzmbght5edrchUpcTo0y7HYbGSnlEdytancGAwBRM8ypiriEkN5y8T0JwwvpW UCB5Xi2J4rJH9H8TJi0dLuqRHue3ld8JHI2ZuOb/vruozeuS3OMUnOQyMchLk1gehVqkLC+V/ZngU QswiHIkw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fMGq0-0007Ik-Os; Fri, 25 May 2018 17:49:12 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fMGcz-0000u6-6N for linux-arm-kernel@bombadil.infradead.org; Fri, 25 May 2018 17:35:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YXxWZgVh8zaQtkU8P5mQzC6eH8eF/xYQbKyFFaBS3Nk=; b=piIA5RPmnHa7QZqlkKod1q9Dz GUP/TzSjn9SDe9P618COdZQS7lQsy1yNAC5kK97tbZ//cbobMGZ+CUkSd3QvlEK3Lispywor9SvJD mpfryRh3C4VRWmw2a5+gtSx/i9IV6UZmB/ui34cCzuP92goy0/qV/2MFIitkJ9wdFedkdon9p41of bRJQ605J47GGlV/dRG4zyrUhhWhzeOP5ANAVWtfSX+sqsclwm5CcI3ihNF3M72TS17qTzhRskZb/v xXo+KFbsjz8gE9VpDFWyqmRgQ7yZQkcymSc4PDAx70iyUvcPvob7ICiwJFWwgf8wtgrQdcHJRGAN2 eIHusMwSg==; Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fMGPI-0001HC-Tl for linux-arm-kernel@lists.infradead.org; Fri, 25 May 2018 17:21:38 +0000 Received: by mail-wr0-x244.google.com with SMTP id w18-v6so10450307wrn.6 for ; Fri, 25 May 2018 10:21:26 -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; bh=YXxWZgVh8zaQtkU8P5mQzC6eH8eF/xYQbKyFFaBS3Nk=; b=ttISb9pdEFWt6QVaHN01KygTdprcSXtM6fEb5MhVlrg/QGClaJA8u49frVlMPVjqDq fWlXaDWKIhU6V7bJTL596avDkfGLwv2mZ0oDA9RIDCbWW9ReiT++nVR9mZz7/sHFybyw 77Ik6VaNZuFOPgAVBYoSIzBkht/najkaM3DdNACeO/8ZjDGcWvmztHZUBYbRmigBGX6X EKl9X7etkis8oMYoCq9CEpu4dZ7CtsR9iTfQn5iCB5ad5AOeYD2lT3k+9rfZ9decys60 cZn76Ba1q27qjIHns4PLMfX+GWR7zdJ8YbnSk/oiSK9B+lUvDuZ/ZKPb8CTK6ZbyHBjd /GaQ== 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; bh=YXxWZgVh8zaQtkU8P5mQzC6eH8eF/xYQbKyFFaBS3Nk=; b=p0BYJnnTZ0zrvo/xuDUEqC2qqYGdcQbPWw53rdI+DdnGOSdCEzD4UJoiPnhhLWYMCq jwoy5zQ7JaTyHUjUMbNwrPzridVvn6AmZD0yrR6asSFQqng1OJDj6YBPTLSK+2rmutlj GUGYOPhOcjlRkn91FZlJXhIWu5og5adAktCNkHrNeM7gGYgIrf6JPVEHLvBLHhPz5/i9 ThX9PMqPM/hHxxE84ZfyTQkyLyJL2W1FDOpqNwtnrMDw1E8kt0KFdQHSDuTXS7pZTZsA QLqNBpyBeB7EFoi1pjeImQ7E0NJfhWbC/5tHSxp+JFKA8vTA+VXHrNpnsHdpByQTykvF Ge+g== X-Gm-Message-State: ALKqPwczKdeY80f+eEVH1wZAIwrFTAVfQk3BqLj9VldygXjcbdWXYl2j OUv2KmD1e+YgiaJjcGOXNxfsIA== X-Google-Smtp-Source: AB8JxZp72c6olAyJjMAimxTMq7cygCQpU+tH7cnQx0FDnINms6YsgY0q/YsR24HRDkjF6GQwOup/ew== X-Received: by 2002:a5d:4045:: with SMTP id w5-v6mr3135884wrp.96.1527268885384; Fri, 25 May 2018 10:21:25 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id s5-v6sm26579964wra.48.2018.05.25.10.21.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 10:21:24 -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" , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/6] mm, arm64: untag user addresses in mm/gup.c Date: Fri, 25 May 2018 19:21:14 +0200 Message-Id: <858608ce6ace4ebd71c0318d3d536e9d1918b613.1527268727.git.andreyknvl@google.com> X-Mailer: git-send-email 2.17.0.921.gf22659ad46-goog In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180525_182137_063107_690D3943 X-CRM114-Status: GOOD ( 15.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chintan Pandya , Jacob Bramley , Ruben Ayrapetyan , Lee Smith , Kostya Serebryany , Dmitry Vyukov , Ramana Radhakrishnan , Evgeniy Stepanov MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 541904a7c60f..5d0e9715bab7 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -650,6 +650,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)); /* @@ -804,6 +806,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;