Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp616551img; Mon, 18 Mar 2019 10:19:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPqAIWvZ3BEHGPYq4171kY9+ja1zVU56UndiEiyoOc5FvaB/LdDJew/E8RJTcqocDo9f51 X-Received: by 2002:a62:d2ca:: with SMTP id c193mr3983038pfg.247.1552929571408; Mon, 18 Mar 2019 10:19:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552929571; cv=none; d=google.com; s=arc-20160816; b=hOrDeELPnTVz2hH819D2eLVR/Yft/Jv4JyyaC9pVh2bTb+Lwxy87cU5jfvBEf+D0hQ 2DiDbWeUShB1FNv7RCumAh18Pub/tEfoaRYCD3rl4+d7rBMJTh7F4W0TAisPfq1QMSCD 0SYbhy22tQ1x34Jj7MVYWAAicz7QL+4lmnCf6bYIkxwTpHl39K5udkPWesfaaYLp1Xdk VjT/jSeAVlvJOsOoUqMezHxP9+Ihtw67Rl1yoonOkaJY4yvU3/qhIX4dxuaKJGjKbGAU pVTCOnhqvmmy9xIYM6lNwid6Jjc/oRuOLwabmdqIdUzK8vTXNIoOYxat8nJxl8KI5l+l StGQ== 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=MRHHZYm6qbbddi64ikktRuAjn8BoXK8Gf7bv/2tC2r0=; b=A3naq8RTkzismLYN0Q2dHB873N1SURAQrkBQB/kqOiegvLLCAbEIf7YZZUgr/F2hlT jy5EPYrEw+b3Y8WU/ZBkdu0pkjifSB7XKzcs13lTIi8mnePoT3j4GQ8mFai4O6IIeyvv i+fFn76FjRSil9dtpK3jcCOtYdUDci284wFqIm1erPgxOi5nwSJDWe8dyafDWl1GCzXu ynBuEkPTmey79t9jV1hq46kyE5k1WSUolVhPsKCWZWUTRJsmy125/v0WTcWHbMoOt9qn pPNHDCwDH2CrW2Z1Rj2K3JqXcFM2UzameVm3b1l2c9VtZfV34DSdzWdn5zRwRJpzZ2v1 c8rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YFFN0pzA; 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 n25si9212725pgv.283.2019.03.18.10.19.15; Mon, 18 Mar 2019 10:19:31 -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=YFFN0pzA; 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 S1727958AbfCRRSP (ORCPT + 99 others); Mon, 18 Mar 2019 13:18:15 -0400 Received: from mail-pg1-f201.google.com ([209.85.215.201]:39160 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727933AbfCRRSL (ORCPT ); Mon, 18 Mar 2019 13:18:11 -0400 Received: by mail-pg1-f201.google.com with SMTP id o4so19304193pgl.6 for ; Mon, 18 Mar 2019 10:18:11 -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=MRHHZYm6qbbddi64ikktRuAjn8BoXK8Gf7bv/2tC2r0=; b=YFFN0pzAH8aZKTAjwEnRibFpDgHMBLVgE+Y/H6BldyMJfISdxeV4TieTiwWBUf4++h 5qPE8agzsmBOu94H7aWR8TKMxJHOgpBxp+05T//MmjQV6X0IOo3LoMT6g453xDS32JNL uEO1aHTq8Rnk2u7skv3uFK7PlcfyAPVOgEppwAZwtzGwNkP4ro6UBD/uLtdfnq9xy7XW XO0COxSTv1Jmnv80OnZ2/0dsLvQrl7sHFJMan50DHp20r8EaWagDzYNNog4tZOIZ3oMY w/ooiTzJSI12lW99h0KIupXV6luZppWPt/ReHe66F1061arfZzk+YHF0fBmf1FEO1sRB IxuA== 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=MRHHZYm6qbbddi64ikktRuAjn8BoXK8Gf7bv/2tC2r0=; b=NNqSk3ZYuBhZIblTBnktDtMjevc0LWK34NskHiHzIJmGSHdHoIk7L/hWlVK6/N4Ln+ 3MNVDaHnan8WiHzzyHYn7bf0iUOJF6JfNbJu16gz4n6ub43/ooIxQH7i+9g6HOjwB3OE CVxsQ4qi4umB8XgwkulgImYTc+cenHrqh5r9dvc9BPDNdgZDjZcCBhdXdbh0Uk15auvr V2E+6CdSJdoh5aQ4uiTYfMfLJ+uS6dG9Q3RfyzFH72cI7uJgYSavjy1GZSxwxGLA0e+K vJyZDQAja7iCbXgj209C+9O19OHI7AvagHvHjD4YICWRs5T9c1meY/SXDHI58skA/g1a /Qwg== X-Gm-Message-State: APjAAAW2r8t/zRPD+SInRwEfsh92PSk8LwUVToUD+PE9OOEfnfe+MVRX 0RBhs1dO0BTES81UKboj51PFe6DIoEvjREYh X-Received: by 2002:a63:4964:: with SMTP id y36mr7052420pgk.60.1552929490581; Mon, 18 Mar 2019 10:18:10 -0700 (PDT) Date: Mon, 18 Mar 2019 18:17:39 +0100 In-Reply-To: Message-Id: <4368bfa2a799442392ee9582dd1cccb8c96e524d.1552929301.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.21.0.225.g810b269d1ac-goog Subject: [PATCH v12 07/13] fs, arm64: untag user pointers in fs/userfaultfd.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. userfaultfd_register() and userfaultfd_unregister() use provided user pointers for vma lookups, which can only by done with untagged pointers. Untag user pointers in these functions. Signed-off-by: Andrey Konovalov --- fs/userfaultfd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 89800fc7dc9d..a3b70e0d9756 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -1320,6 +1320,9 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx, goto out; } + uffdio_register.range.start = + untagged_addr(uffdio_register.range.start); + ret = validate_range(mm, uffdio_register.range.start, uffdio_register.range.len); if (ret) @@ -1507,6 +1510,8 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, if (copy_from_user(&uffdio_unregister, buf, sizeof(uffdio_unregister))) goto out; + uffdio_unregister.start = untagged_addr(uffdio_unregister.start); + ret = validate_range(mm, uffdio_unregister.start, uffdio_unregister.len); if (ret) -- 2.21.0.225.g810b269d1ac-goog