Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp617377img; Mon, 18 Mar 2019 10:20:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzDZwR2GfzVDypclIrms9WBX5st8D/3Du3UO2GQiZWACHSuK0T19N7cLgGyXEHGRhDaBsL X-Received: by 2002:a63:6e4c:: with SMTP id j73mr11822725pgc.276.1552929641870; Mon, 18 Mar 2019 10:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552929641; cv=none; d=google.com; s=arc-20160816; b=ZLsnEv32OV891PC3+mNneatQMnYpabCoB6Z6xEXGdC6rQ7f7s8r+OI4S6FEIA0pmeY 1rS8+rZMJ5CSn6YnZD5IGHelwm3YBiL5ZZD1x4ZuK2drlSmazQ0Dcpsq6llEilaYIvor zDRHE/EJNmpZT/FO/qpBRhl1HbPp0j/vM82mgRTIz/b6iJhC7paBPp+kIxwkzK+sdccs 1oJrANMbgFPn+STvVnaPFTSVc6Gi87bE/D3Hw1o6g7V7sjx5cYYFR9HrTxF8mPZq2W4m x5nvQAL7p6+gzVow6JhvdisbU3CylbSrI8em7RYVhnkdpvrsmdxdR0ri8INBb0EXJm9M g3YQ== 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=LfpjTjIWpAUqgBuBr+ROlRDq3TWjVWHbA3wqyLv7Gqg=; b=hD5vKZQU9DWlfjRIgLwkENMKN/Ir7Ew236bbsSwQXhdeD1QLO0Ku/6PI5z1jiCznU8 T2G4grzNx6ykE/wVKSMO7+Y3xEbSH9QBklwoNthUgstLA/zY6g04kWTW9OkGABPx0FJ/ I7IdBy6IRsmOpxI6DtP4bn4ePCHRV5WMAD9V2vbYMdjTouBv4kQhGvcWHYocdJQVNSh0 8ONlc6y4YjiUEDpG2yUbMafee4YywODUiSkNNodGAQUePVhR4l7TPt2GHZm4cUuMix03 ax1Q8IUzAwJkSeyUU3xHCeaZ2c4/YYS0sNPYmjlUtnc/zOiuUs+ECmjNgbvPueVA7quo nCnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YkzThGw7; 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 102si10230459plb.247.2019.03.18.10.20.26; Mon, 18 Mar 2019 10:20:41 -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=YkzThGw7; 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 S1727896AbfCRRSH (ORCPT + 99 others); Mon, 18 Mar 2019 13:18:07 -0400 Received: from mail-qk1-f202.google.com ([209.85.222.202]:34326 "EHLO mail-qk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727870AbfCRRSF (ORCPT ); Mon, 18 Mar 2019 13:18:05 -0400 Received: by mail-qk1-f202.google.com with SMTP id y6so15362263qke.1 for ; Mon, 18 Mar 2019 10:18:04 -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=LfpjTjIWpAUqgBuBr+ROlRDq3TWjVWHbA3wqyLv7Gqg=; b=YkzThGw7U5bxwuGivZfG7gXjy3sbFeGI9LQQNwpjKesMWYXA6dWvmlyTVIDVds3jdT 99Hv46CfyNGepDjQmBrGdjnE8DmIFRJxBJqNXjHLIWC7+99xjXgyacIB4V4zSxrfGRS1 gCdVGS/MQBILBUagjA0XfHFo8FDflJm4SJEr94PsmlNdR79rNuZTcqAgPDOmgM2h8uU1 X27jM72pTPp4w4jfVrzQIbmq9wd3O59csXywpy8yafGddFfq57LOwhbAfJSUMg2BvGCJ ay4PGD3jH0Ph4L+WAj6gW2ezv9U1Ktw+Hx+TJhzvpdvgFTaZaxSZHrZdwWAc4E0uG5zJ mTGw== 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=LfpjTjIWpAUqgBuBr+ROlRDq3TWjVWHbA3wqyLv7Gqg=; b=TxB/RdIOnw+96AOLpywPdaQCDSVKcRqBvA5aLDBSov0VgxMFIstoTWa1vHZ8mc217e 9cxnNkcsJISWo/7/Dpj1zqw35h06Z3+Sr4AFw1aWRHoT4t3SN+Q/z4j2evs8069yUXG7 2JoDRroMbNLoH+da0e9QKEKU09YjjNcLfp/g5iwM6mHfrUB4IvB+PuxE82k8ZwUh5E7I +NHQK3mhP9SAQ7LjtWSPOJGyo2TN5GUev/+GuLQuxKxcHxwMmTH96MnPWQqYIrxTbHVg Gy8KNnMQPnxVaEL2GMwICebBFoJVm1s8n9Y/KEgQ22rDBu5W05IvpMDbbY5Boq6+rr/l n7cA== X-Gm-Message-State: APjAAAWw8DghspwmRCmiTzZcprTcUNzCb6G2YeEkarLtC7yes/V+h3A/ ziEM2OOjHwknWONgt7YqOPQButYmp99rlvIj X-Received: by 2002:aed:3a42:: with SMTP id n60mr10517091qte.62.1552929484433; Mon, 18 Mar 2019 10:18:04 -0700 (PDT) Date: Mon, 18 Mar 2019 18:17:37 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.21.0.225.g810b269d1ac-goog Subject: [PATCH v12 05/13] 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.225.g810b269d1ac-goog