From patchwork Fri May 25 17:21:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10428097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 36638602D8 for ; Fri, 25 May 2018 17:21:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D2FF29321 for ; Fri, 25 May 2018 17:21:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 118AD2972F; Fri, 25 May 2018 17:21:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAC2329321 for ; Fri, 25 May 2018 17:21:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83EC36B0010; Fri, 25 May 2018 13:21:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7A0F26B0269; Fri, 25 May 2018 13:21:27 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 640F56B026A; Fri, 25 May 2018 13:21:27 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id 028336B0010 for ; Fri, 25 May 2018 13:21:27 -0400 (EDT) Received: by mail-wm0-f71.google.com with SMTP id a16-v6so3947011wmg.9 for ; Fri, 25 May 2018 10:21:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=YXxWZgVh8zaQtkU8P5mQzC6eH8eF/xYQbKyFFaBS3Nk=; b=JS/vZNTsy5hrGtrdBizEfiPCTHPxKuR0dfW8c9CMKpuVUUlNwuM/N/AvruzXWlLa03 Hk48UdTmFHLsz8Kync78Lzmj39vg6s3l0ZIOiMjwH+p8/Z3X/8HR4vPIFbWUGsSG2xWD mK8TSJ66Wquppg/1NwkF9i3dfzWDesfQG/jG65lUeicdMRzk7VUfheB9+9TekgIC9UjB yykdACKM2nekHOmCK+ENBfRE2fCDGJJyBatqyTd6AD8S0L4sD2dwUpmuErdkJYFrMjmf P4K4DJQ+JXU5zyAzigWZ4lW1dMoZNcUxpuCtXY9Op6Rgab5tsY6YQnD4vP5Tv9J78iSj d1jA== X-Gm-Message-State: ALKqPwdiQCXaLrvZg54X3uQ5muaMglSpvUQlNnMRBmZls43aipm3dbHz AWMWXwn7eyS/jB19FP+1BgV9OOFgnwbSxRrXw1C4Z1/rsMqmTjV2CDNYCUvb/lnMqc04r0/HkXX EeBYr+p4pEgWUqk/xm+UhvYiI5QgpzypmrZ+67wi8NAjYfpAbmM1NPOoWBTzdNtv2fW9WLhdfEv 4mw8jqkZwO9G4pBxla8V/AfxvLf1hzd1tM2i2cX5J3rq4E3BsQQoOnoUHhWI4hLKzor/c+DGH5J OzrHDTUxKTV6IfheRJP88yVLLNxD+LISkuydGn5FgzlvKUH8tq/6gAH2szvevCqM4xl/zDO9irl SOq2fFVYZJqFTdIx7ndsAOoFETCrXtEAl0bZFMD0iLIvHBV8GHNKlJ3Kz0G8UFLPC9SmrSXSOfA z X-Received: by 2002:a1c:512:: with SMTP id 18-v6mr2319944wmf.47.1527268886586; Fri, 25 May 2018 10:21:26 -0700 (PDT) X-Received: by 2002:a1c:512:: with SMTP id 18-v6mr2319919wmf.47.1527268885899; Fri, 25 May 2018 10:21:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527268885; cv=none; d=google.com; s=arc-20160816; b=aQj7m6OSAE9XqwgPwS+ubTs9oNH7sjeZuuX/IbJ2IdX7raBSFdtE3RFf88H6z4arDj sZG1EwcAOV4NyLzbDVQaE+/A4XGeYQYZ+Y5ym4mZ96Ug0sQSmbckohHxB0OUACKQ9eP9 uTxVKK+Ma9ESd8DISbgVOxvznm98mS8c1LNi42aw9BZGBE7HFI/ryeGLtr0949Hcv3Dv XEqphr1Y4R6fl7dcSZZ4UvSmnMJBJ5A7qxL4NdbdAgkbOjTH6sybwJOFpcmORnmHNM4e eUOFqrrN3BRyMVLPbY9dIJT77X8hROPqrrdQrG00la9gbUK9e6m/IYjqi3AsDtTHoUWI 1oFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=YXxWZgVh8zaQtkU8P5mQzC6eH8eF/xYQbKyFFaBS3Nk=; b=YNDGpgiqLY9fyLBqO9RV51EGn6/lFufReFtB5mTgaYS1yTuHLqTP7JT/NsR7mSTrfe MmZTRuAk2lkM0iHB+MF0IFWXX9lQoDJlohFCe3mAk/f6lT+l5xA2AUEyOmmR0T2fvErm RhHbwKNWgcqavI2wP0vItwE/TkmqU6R76sco8Gw6CN8an+We4o1LvoLKubYbTUpiJhti qOnNNY9Ls8YBu32YlRBmVvd84wOftxK1hB3GiaNvf+QnKvts7Gf17PIPsI9eg31q6b9j rF9eKeokIM46wbmBdHVZ0zu6XVoGfqDGBooAxVbIH1X61V7UXuVZ+XjDfpQn+REKN1/X jEBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ttISb9pd; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id b9-v6sor12353822wra.72.2018.05.25.10.21.25 for (Google Transport Security); Fri, 25 May 2018 10:21:25 -0700 (PDT) Received-SPF: pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ttISb9pd; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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; bh=YXxWZgVh8zaQtkU8P5mQzC6eH8eF/xYQbKyFFaBS3Nk=; b=ttISb9pdEFWt6QVaHN01KygTdprcSXtM6fEb5MhVlrg/QGClaJA8u49frVlMPVjqDq fWlXaDWKIhU6V7bJTL596avDkfGLwv2mZ0oDA9RIDCbWW9ReiT++nVR9mZz7/sHFybyw 77Ik6VaNZuFOPgAVBYoSIzBkht/najkaM3DdNACeO/8ZjDGcWvmztHZUBYbRmigBGX6X EKl9X7etkis8oMYoCq9CEpu4dZ7CtsR9iTfQn5iCB5ad5AOeYD2lT3k+9rfZ9decys60 cZn76Ba1q27qjIHns4PLMfX+GWR7zdJ8YbnSk/oiSK9B+lUvDuZ/ZKPb8CTK6ZbyHBjd /GaQ== X-Google-Smtp-Source: AB8JxZp72c6olAyJjMAimxTMq7cygCQpU+tH7cnQx0FDnINms6YsgY0q/YsR24HRDkjF6GQwOup/ew== X-Received: by 2002:a5d:4045:: with SMTP id w5-v6mr3135884wrp.96.1527268885384; Fri, 25 May 2018 10:21:25 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id s5-v6sm26579964wra.48.2018.05.25.10.21.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 10:21:24 -0700 (PDT) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Al Viro , Andrey Konovalov , Kees Cook , Kate Stewart , Greg Kroah-Hartman , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@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 Subject: [PATCH v3 4/6] mm, arm64: untag user addresses in mm/gup.c Date: Fri, 25 May 2018 19:21:14 +0200 Message-Id: <858608ce6ace4ebd71c0318d3d536e9d1918b613.1527268727.git.andreyknvl@google.com> X-Mailer: git-send-email 2.17.0.921.gf22659ad46-goog In-Reply-To: References: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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). Here we also need to handle the case of tagged user pointers. Add untagging to gup.c functions that use user pointers for vma lookup. 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 541904a7c60f..5d0e9715bab7 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -650,6 +650,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)); /* @@ -804,6 +806,8 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, struct vm_area_struct *vma; int ret, major = 0; + address = untagged_addr(address); + if (unlocked) fault_flags |= FAULT_FLAG_ALLOW_RETRY;