Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp734046ima; Fri, 15 Mar 2019 12:55:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqx70kussICh4OY0K8NgxNXdlLKQs/EtgMq5uXwLHk75dKHuqA9Zy8QPDV75GYukcgQLA2UZ X-Received: by 2002:a62:342:: with SMTP id 63mr5840883pfd.80.1552679717530; Fri, 15 Mar 2019 12:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552679717; cv=none; d=google.com; s=arc-20160816; b=OMp8TQd8WtP9AlGQ30SB7B+T3fgr8itA2y5V8DaAaY/8ibQVHDiTElgjufZjphJ1df srCvOo0UqoFWo07Rlwfu1QkkBjdx7IcacpljlxnFKbLhqNu9XUptK6s5+aZ7nloVMddK u1oUvPxhkBHpFt7qbAkZKfI6/4OBQCDGKH/apRjnvufI6HTsvGibgip/y8ikfTPBIyjS AQ1G3vd7xGynJvRh7ahxD/2brjzAo75QmpDor3u+wjawR+ZCqYB9yGkR7BLmNBACaqhl LP/MBrrGPQ3UkcWXjriOdVYnl5+TGrVLq+bPgMddXXIJIcO2dRlx3+82ckak/CH+yqpR 6iIg== 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=z6K/c9VtqxQi5aBAmUht43d+X7x4sfj8BAD1AB++2bA=; b=CzSg/E1ORX2jefsZnlkpQ4hiRvQkX9fjdpq2CcKxrxDXIoe6PsCZHxbDZKfWG64LAF mmpJVaGP3tppfaI25qLqLhd+XbpLn/0g7IIgX64K4vko48eMl+v3/lGBG/+6gouDYXm8 tMJy1mY6zKFSCEhkNiw0JbTeAyrVdfvjYpRTS6S4mq1sagJiXuzh3VxMA/3NndGkdtuT wLUUDkE4vBc59vvv/XfcLKFdCdQFmPFvB7I1EMkFL26vKmE4XfQa6d5XlDVs+0aZ4++a r9/neQU/21lO9wb53qPTNfyhSAnxJyPl4ranJu5trpUDJtCB9W/8DqyLwariwuBFKw1t P9Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BOrKvCBJ; 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 l1si2760819pld.210.2019.03.15.12.55.02; Fri, 15 Mar 2019 12:55:17 -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=BOrKvCBJ; 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 S1726435AbfCOTxx (ORCPT + 99 others); Fri, 15 Mar 2019 15:53:53 -0400 Received: from mail-qt1-f202.google.com ([209.85.160.202]:56502 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727417AbfCOTwG (ORCPT ); Fri, 15 Mar 2019 15:52:06 -0400 Received: by mail-qt1-f202.google.com with SMTP id e1so9624851qth.23 for ; Fri, 15 Mar 2019 12:52:06 -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=z6K/c9VtqxQi5aBAmUht43d+X7x4sfj8BAD1AB++2bA=; b=BOrKvCBJgVmoeAFlZRf59PYgkXTKjrRMRrX63X976vqS2WZ9qHZEKHeBVwJtTWhSuu lUvSWiTVC/sbszWaQppDDR/3GWTkX31v65WrFbh4cWKv7GdWuy0PXeDkNLjKRPen898X V9cymVDbaCKNbzgoG3JjfivP1S/Za/rbL9bJ2fcItc9gQOVwpi9wJOepWPz1VdAZPUT1 cjQr07t64SwJCV+OZh/j0pkNHMF9Z/MNDj5cHLhFPLalavSnR7OPvVyx0xN4qyU3goh4 CsFQJ7ZthwFgkdSG7A7Q7uo8+32OwkFTx9gfh1M9rs57t4EWTuZWy/0ZLkAzrIEKwWdx tB7w== 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=z6K/c9VtqxQi5aBAmUht43d+X7x4sfj8BAD1AB++2bA=; b=kapupAoHoHP0nNnFq+JHY2MGwpcAlghIFajfqGUMzEeVGLGvBO/Lyy/+3RD1nIWTzg MwDioKSV8LBaxftxebxjTGVotTwxD2GLfi9VlEhUCBs+PCD+RbnFBRJQhU3+beFNrpNx mYqTwZf2hk6M8kE7vvq6JoZz0z/3gYPd1/ncR/7ta3bAyvCg/Yl5ih3vCceycHBE+yom I5RiV0aGKz1+taPaVGRYXhjfAi/92suAKVCaY7KmKqmCbl8JIa8z9ls51tNb6LD/X4Gj IBZJwhTXfCcgTX52R7zrR0c8pvjjuY/r+lQWJJafD3ZFJhQLLgUB2MMpcuSZ1Kk3wDCZ v6JA== X-Gm-Message-State: APjAAAXmVS8mpMptFY/6HB7vdhshGYNGFQkgY2JnzocYG/uNegDalING R4mbiMkZk0opP7W9JuC1RB0OYdZMEgbdMt1l X-Received: by 2002:ac8:3798:: with SMTP id d24mr3191740qtc.40.1552679526081; Fri, 15 Mar 2019 12:52:06 -0700 (PDT) Date: Fri, 15 Mar 2019 20:51:31 +0100 In-Reply-To: Message-Id: <4368bfa2a799442392ee9582dd1cccb8c96e524d.1552679409.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.21.0.360.g471c308f928-goog Subject: [PATCH v11 07/14] 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.360.g471c308f928-goog