Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1497527imp; Fri, 22 Feb 2019 04:55:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IYptb9fUKEWDf2spRKY0w9pFxIbRlxGtwZxSD/wmxXmVqksjQTR5q5Ekj3DFG3wyaKAnNg3 X-Received: by 2002:aa7:8019:: with SMTP id j25mr4129474pfi.82.1550840106468; Fri, 22 Feb 2019 04:55:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550840106; cv=none; d=google.com; s=arc-20160816; b=wWA/Crp5ozWPS+rQbQhE4mv1S5pAd7xj8ZDwA9v87gEv45ncP2bmF8H9OVrXA3o1TI li38eCYymIIhwwxw/BhKDaDEDXOVT+B+dp1s8ix2mww2RO4TIq5n+wv8G6ooWe96lFCL XnlHtBFKvQ17vgmrUqTy5/ie70JvKmD2wwYN4RMPTRCtH8ATlFS8ooH3UsTJx7OZoNAq 8qBmfz4mul5dG+bHr3YRoQxV24Q4tQKwsnqtrDmibcrTyUzIeYaJeTEDjUcl4WCznm4M fSzfw+CxGXy5cQ9rrbhud+n/Nl1YHgATNUHM/nsO+IMJFs3yu0DQziwud03L6Vo7IYGH dWqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YCJNq7ywB4uaUqF1MkWtAuFgMYZGYk6wr0hn7fPLDX8=; b=dDsnmK3R43iK8QzMPgQF5fDbrZOq/F/XhTQ4jKg1QPhwtpqlMxJVebM6D6tpsPv0fY Flk6oAj4Smgx5CJn7L5HvfdlWM77J85G/FbjiLxposBgNh15S5JJ78F8K6rQaCDWPwys Vlztu4iAJ8InxCKpdiDzjBYLqOZ5/t8KVQmEE+G5T0hdYz/+jRE/VeN/qb+1gB5Ys9xV l4Y7omle+Zayvve0ULQzHgrX9Pb7dj2L0SX++HzMYdNQNH3PQLYCXDHCSkLLt9cIRwgK StOQAryohpQ+MofPGnAV1UMQZLNHNJd90aC06HN1FEGrZBZs9Uc5vpyK9eEJMOAMEtR2 uTQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BdeC2+jN; 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 n9si1388357pfj.178.2019.02.22.04.54.51; Fri, 22 Feb 2019 04:55:06 -0800 (PST) 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=BdeC2+jN; 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 S1727275AbfBVMxs (ORCPT + 99 others); Fri, 22 Feb 2019 07:53:48 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:34855 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727249AbfBVMxp (ORCPT ); Fri, 22 Feb 2019 07:53:45 -0500 Received: by mail-wr1-f66.google.com with SMTP id t18so2276485wrx.2 for ; Fri, 22 Feb 2019 04:53:44 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=YCJNq7ywB4uaUqF1MkWtAuFgMYZGYk6wr0hn7fPLDX8=; b=BdeC2+jNB/4V8eMU3JsQLO0s40wh5+ubv8EL/H0OL5QAdcdUFTEdOl5givygFGSytf jcZdXVsDWgmBZF47af5N9ErRJWRqDdGFbYzwStmoYfWu3LPhdR15RoinUqaGl4Qjgq0d YCeMM+dJno0mPLko6w5cnWPaCxS3AA2Rfd/ZMWou0m13PSErWQBsV6d5R8egW63k1+91 6M6Xf0kf8IIz0JxRxyv6eb8DSW3uJPeZp30Ea6z0EgQHP8RD6UikV9fQtwyB6NNbFht8 Y6QmzmWpqBZaGR9Y754fPqzonuZULmj8ckN9DYzx0pIKOjOjbgjMmJB8O+P6iH8eCk5e 9R2A== 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:mime-version:content-transfer-encoding; bh=YCJNq7ywB4uaUqF1MkWtAuFgMYZGYk6wr0hn7fPLDX8=; b=biEHzdzoPPHNzn0KSlOp97jmWo/SEzgKumhe98GYdWZpjwPs1MtM9Y2+HA3Ge0s2sE 9Zv8IJEWy8zUd7yRSyqx8n1jbZYN2sG1ydFN4l6rmeZg5TO47ZN1m5b9Kc3cIzJYXJL8 IVAjWr4OhqqAUJxqXffBPEvD+/eAq7ZbuGKmHjzFcOlbfw7OHYa5XcmPsEMCcSOBnHJl kl2PeQneI/5iuO34rAxlymRwGewCOJq0waeZ0LPXrWqRC/YOE+M2ZpuTWwMhAQ6j8A9s Qz4XEtZCoQQVCmat9LqYq8g8wvuEvXDZPUQCrtysfkZQRdqWxrF6pAqfmKkqNDbS4G+p iV3w== X-Gm-Message-State: AHQUAuYKR3fVMJwSXih+qCkZgrryYHwY/0WVYwK0APne9NGHGU/caZ57 xtP/OThkLyYjF22GTk2lEp+wMw== X-Received: by 2002:adf:efc4:: with SMTP id i4mr3192098wrp.42.1550840023746; Fri, 22 Feb 2019 04:53:43 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:13:8ce:d7fa:9f4c:492]) by smtp.gmail.com with ESMTPSA id o14sm808209wrp.34.2019.02.22.04.53.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 04:53:42 -0800 (PST) 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 , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@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 Subject: [PATCH v10 07/12] fs, arm64: untag user pointers in fs/userfaultfd.c Date: Fri, 22 Feb 2019 13:53:19 +0100 Message-Id: <8343cd77ca301df15839796f3b446b75ce5ffbbf.1550839937.git.andreyknvl@google.com> X-Mailer: git-send-email 2.21.0.rc0.258.g878e2cd30e-goog In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.rc0.258.g878e2cd30e-goog