Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp732521ima; Fri, 15 Mar 2019 12:52:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJYU/CtIj/PI6GvKMaVPyFWcbmmilxSaXzIFvfP5ovWmFJVK8XJ8LZE31vFUrpCXWHl/mg X-Received: by 2002:a62:560f:: with SMTP id k15mr5717721pfb.231.1552679576249; Fri, 15 Mar 2019 12:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552679576; cv=none; d=google.com; s=arc-20160816; b=y5Ohtg0Rnm2xc/NHRNqn7E/do0cbWGbCBowySfDNZMQxtjmgeULkcDKsfIxRcKNuxS 0JUlXfdu/cpmS0jOz57VeqzBHj97b1/DinEyuZYihh9qZq+In85gj8wq+GTfK8RjickB 0IvSMU68/fsIKrgsl4eXdqQKiAyy3heWT655dH7PRZ9fwOKm+HR459cJ1VCWlAFtTzSA s5wz8BwLZ3ZYqwsBUjhzAsNPJejDbNeOuQp/kYvjaCgCkdiN41I06k0yezJf9MnwHpvZ HLCKynDqUfK3jYdv7E+n9IiBduZRwIcVMiNRz1Kg/UyLh28EjRzlKAjVk3qJDJUQGfNh YbGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=5MhKE+xTLHyfvL7IaHp0v3M/t60vex2+i9OGVnQRymk=; b=B9IdbigrRzY87RYwCJcIPI/I7nWCu9xtYWwFvL5tFLTG7xNxZRjcsY/kBrxgO4EOs3 Wt1emLtnzME0xK5J+ZamEEnV3RLWkf+39s9XTIGgYM2DFMQmWTh0cJ+BV6tb9NxHXNO1 dU3dzR94u4gsmrRYSfEFIrx4b2olgzr9FuytIF+na1s/TJVd2fT6CKuXvvQwfIETWjeB cTMnBWEWNrEgDxbfH5htalGZ0Ez4Ojt6Rh7xH3qUKXo6bayYnKqvGSr3JPPJqRUM6WYd FvNgVdsSPco4pI2f/AELe1XWuuy2dx9twgpbcK14twnERFm9zWQVnCVjh0MK95XMB1ev zqyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="b/k7mB6t"; 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 n5si2492093plk.301.2019.03.15.12.52.41; Fri, 15 Mar 2019 12:52:56 -0700 (PDT) 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="b/k7mB6t"; 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 S1727407AbfCOTwB (ORCPT + 99 others); Fri, 15 Mar 2019 15:52:01 -0400 Received: from mail-io1-f73.google.com ([209.85.166.73]:34866 "EHLO mail-io1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727371AbfCOTwA (ORCPT ); Fri, 15 Mar 2019 15:52:00 -0400 Received: by mail-io1-f73.google.com with SMTP id k2so7892346ioj.2 for ; Fri, 15 Mar 2019 12:52:00 -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=5MhKE+xTLHyfvL7IaHp0v3M/t60vex2+i9OGVnQRymk=; b=b/k7mB6t8bkl6WhPUgGfnIbuQpfATsU20Yd9KlI8YbMaGUFttdQxCzkvduKa8IOy8C +aL+zDQpxDKN5neB5pmosuIHBI0Zw/VkKPjT+OCI05YKof+0rexjDomInULUZSZZwZe4 sKO4ip/dnicDW0EiUs3RF19JdO3smNNUCHBqnEYyMQcB4Zi3SAnphW12wObXWLr30yaC Cg1FmVpaxC5JzsE7dKMZHXXd8+AOb4omgJILGhPI4h92LrbGtWJe5eIqPcfmyYH0djku js0qEZrW0JA+T0+gbA+Ly5yXzixdwcg0y/4Mb6pAB6p7EjV2RE2SUw8xVQAbEf7JiHti SGaw== 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=5MhKE+xTLHyfvL7IaHp0v3M/t60vex2+i9OGVnQRymk=; b=W43REZcDHh3vTea6aTiEGyOnPxbSPUb9KZaCGCvHRM49UHvfNTsNy4yRKo3CK8qhBj c2FetPWAMc/Hnt8m/flp//HKwugoD40at31CBnIMBRRSMsv2H/0tkHVOeKnw1x0SikaN AH4PM0wuprOf6IkJOiOYaYd0oaimZqG5gro/4G9zqp8BzKVkLZCmPOR9PtvRiTOaba+b SZa+aXFgWt7nOz8E2/fJ4TNSEGNVctKHyN0YVYSAmjKhpJL2v7SXh3LdPAmVgvwwWJx6 n4e/pat6zMigFiPLHw1GPlea/RXcLewATgu6cL3LYpPqZZWTPyNWqrZxRsnm4XLLd1Ic dgPg== X-Gm-Message-State: APjAAAW8++Y//L34m8/h7ueJ7etKuauRBkxk6P6uSZFFo5SGuNpHtQi9 70YPcuQVscFn9QCxGHBFx6qauLIMQ1pxTyHk X-Received: by 2002:a24:4503:: with SMTP id y3mr2805802ita.32.1552679519819; Fri, 15 Mar 2019 12:51:59 -0700 (PDT) Date: Fri, 15 Mar 2019 20:51:29 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.21.0.360.g471c308f928-goog Subject: [PATCH v11 05/14] mm, arm64: untag user pointers in mm/gup.c 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 , Eric Dumazet , "David S. Miller" , Alexei Starovoitov , Daniel Borkmann , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Arnaldo Carvalho de Melo , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, bpf@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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 this case. Add untagging to gup.c functions that use user addresses for vma lookups. 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 f84e22685aaa..3192741e0b3a 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -686,6 +686,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)); /* @@ -848,6 +850,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.360.g471c308f928-goog