From patchwork Tue Apr 30 13:25:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10923609 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 B460B933 for ; Tue, 30 Apr 2019 13:27:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C83527EE2 for ; Tue, 30 Apr 2019 13:27:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FC6E28A63; Tue, 30 Apr 2019 13:27:47 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 476CF27EE2 for ; Tue, 30 Apr 2019 13:27:47 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cMsNolBbq6j67wQ2N705IcvZ2dKdDwth67qNQH5im+0=; b=DA9cVfUrw/bY0x 8/DPDk8XX96rgpjj/237kGCXtkVWqOn1U7xwhNu97ASomKjlwR0DsEShOdUFhHxbVWzJbthkMthW+ KfP9l6WX67UiOifvX185AEMPsntMj7mxRsHbwIpuHzg4P2jFUXhgMGwSaqPDuXLxTS2ThwDudxTpn Vmdymnqzw5xR6MduZxXgu6V6hxk8hHhU08NJz04RP3+Z50jqx6oTyraA8V/0czvc7vnHrv0o2M5OX 6x7LJ1bRCHLp3v+ktU6xauJn1gB6La8RRQcjlbBMSCRouEJEpaz9APpEdimde7a7rLWNuXTgbST6j Jn5+5pb79zGVwqWKov7A==; 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 1hLSnL-0003rd-7T; Tue, 30 Apr 2019 13:27:39 +0000 Received: from mail-vk1-xa4a.google.com ([2607:f8b0:4864:20::a4a]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLSlU-0001qO-TQ for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2019 13:25:49 +0000 Received: by mail-vk1-xa4a.google.com with SMTP id p129so6331446vkd.13 for ; Tue, 30 Apr 2019 06:25:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=4c/fu3qC3Skvw+ZZk7UHJQzalE9hfnOxHloiMgOUfYw=; b=wBxzW9uz5sqQEs2k0kS4yhvkUsLQPUol5yYuscC/EhJQq88IJKN51oJN9Ma9N+F87j 0yaXqLxOKrSBWEzg6TAlDuogkZNA4XMbprAL12kWJ8MdNH7JIvTO8ZRXCqw/W9rKaVTK 0th2TjbWtiytISvyVjLE74X1hS0zo7K7eSu+m53APk0oWFg+5hHivN//aHp583NOkYkp q/Xzdqo7lpDQuozd8M9soPmozGOH2C019sBJyK9gvXzEw1QU7pl845OD9URqwv3Lf0aM RmLDFBkc4rSunB/Q4UnHBTaxv0r2wOX1jQXVnW4MBVL+0daNYML4EK5a4hKos8NfLzsy dlFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=4c/fu3qC3Skvw+ZZk7UHJQzalE9hfnOxHloiMgOUfYw=; b=PRdybyJ23cDVq8rTFfrchl8iy/NH3kinSLnJOIsH7MEdyQwmd6pKhyhCk3yMAXq2A+ vu/iSl8pi+yDTkOBfHlS0hY0TVGHsbYYhw3YAjwgyRfIQv2EZzpmsklZ16dvP7Xpo2z6 UuKYNiCEbtfVEXK+izGOWQ9tRSHIkJiulDC2jbw6vvD5eo2V6LFZwzxaYRmH8PLcclDk VEb+coms3Kd7vvJXqxfortHjnlAEOCrZq1VM8FZRehLJ+lfqn91roWhh/YBFaaSlkIdu 0gOO4FvRuvTFmkDDzew4ZlELsVOvAKV4Fn9fuE9L4nTzF4nlaL1cBflmhzhTSAJTkt2+ U08w== X-Gm-Message-State: APjAAAVhsl38pcgmlTXaXe+xjtJeViAHtfvk28LN2Wn+CsOw6QSO1k3S 7epZTYjhoSVxlwTa0ABq4U3YI+KsP76oI/tdHeoqqCr5VrkPFTS6xngWGKWUu/C2fkv7y341Dqo ruWOXlx+vazkG7R7ECftOmy7wkoVZRv85VnNDricjzFAy6ZnFravdYvkKdYcOlwpzQuJG4xZPsl ASBXiqVR5Fk1E8khE= X-Google-Smtp-Source: APXvYqx4TL4lB6fuuHN3vQZgSBJDs10/R98gvbNQDm51wxIVMnZyNgUuaizbdtdyYw1MeWbTLc+s/luHbNJTgZgZ X-Received: by 2002:a67:8155:: with SMTP id c82mr6290812vsd.200.1556630742131; Tue, 30 Apr 2019 06:25:42 -0700 (PDT) Date: Tue, 30 Apr 2019 15:25:04 +0200 In-Reply-To: Message-Id: <8e20df035de677029b3f970744ba2d35e2df1db3.1556630205.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.21.0.593.g511ec345e18-goog Subject: [PATCH v14 08/17] mm, arm64: untag user pointers in get_vaddr_frames From: Andrey Konovalov To: linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190430_062545_464615_BC4E9BCE X-CRM114-Status: GOOD ( 10.94 ) 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: Mark Rutland , Koenig@google.com, Szabolcs Nagy , Catalin Marinas , Will Deacon , Kostya Serebryany , Chintan Pandya , Felix , Vincenzo Frascino , Jacob Bramley , Leon Romanovsky , Kuehling@google.com, Dave Martin , Evgeniy Stepanov , Kevin Brodsky , Kees Cook , Ruben Ayrapetyan , Andrey Konovalov , Ramana Radhakrishnan , Deucher@google.com, Alex Williamson , Mauro Carvalho Chehab , Dmitry Vyukov , Greg Kroah-Hartman , Yishai Hadas , Jens Wiklander , Lee Smith , Alexander , Andrew Morton , Robin Murphy , Christian , Luc Van Oostenryck 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 This patch is a part of a series that extends arm64 kernel ABI to allow to pass tagged user pointers (with the top byte set to something else other than 0x00) as syscall arguments. get_vaddr_frames uses provided user pointers for vma lookups, which can only by done with untagged pointers. Instead of locating and changing all callers of this function, perform untagging in it. Signed-off-by: Andrey Konovalov --- mm/frame_vector.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/frame_vector.c b/mm/frame_vector.c index c64dca6e27c2..c431ca81dad5 100644 --- a/mm/frame_vector.c +++ b/mm/frame_vector.c @@ -46,6 +46,8 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames, if (WARN_ON_ONCE(nr_frames > vec->nr_allocated)) nr_frames = vec->nr_allocated; + start = untagged_addr(start); + down_read(&mm->mmap_sem); locked = 1; vma = find_vma_intersection(mm, start, start + 1);