Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp906246imm; Wed, 20 Jun 2018 08:27:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK3QwfIwEP/sWmmqzFsz0HPv7C4134RzJNjkNuSKH//JDXFt9rmDyJ/AA+BSfbAFQPZN0FI X-Received: by 2002:a65:4249:: with SMTP id d9-v6mr19372494pgq.362.1529508438920; Wed, 20 Jun 2018 08:27:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529508438; cv=none; d=google.com; s=arc-20160816; b=Z7n8Tv1XfQ9BBa6nB7X28rz8SWPeaW5hZx3PzHKDvFiRY54Bb4AXKk1iJwIZx+EOrj ywxnDKh+W8Jfta70HE//QYdC/fXiWtMPQKiz5E1jj1wkbYoKpoEsv8RbMBs+t5FezY8Z 00pXxGBH6LfoBQyqyTcvJ9M7gCCK18wOF9p2jQ550FcffqSA4GhQg+zqQ2Az5FMtFR3l V94pHD7DZhWYSbyIz24Sqat0Gyn3MCa7n8rdr84hBp06jlY2aRfVQtqoiBj+Jpu60I47 KlC185nU/f3mDNa1J7aDXrOJsxr7rQle4qASXvdSTmwj5SKktIbhKdu32WbYi7Kpr53o Qj5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=0SdcYFgQOnNQJBlnlcaX0uJ4bOsKrRicmvs7y9kVSAg=; b=MSBiHALoGxstGH2QPupPkP/ImvQqQlWBrvW1nxFftKyx6FI6p8BdzMo62kbfBjGtO4 HPDbmq8ZqIXbIVhBTcS6QC9zOxeugl516rHFirnpRd5TxsppuVnInCilEV5p7juNNTx9 oWTf+MIY6mCVNyRgnnt7lMCx4VnnAOxR2LFv2kJuMwGEaiAORag0lyQl6uG2YDoQ+Gg2 PXuACFAJwUdlLYgEIB1jYy+Op6U2BZI+yULK0VAW6lQgbaQ0BMcIK5QTmUIlamDUw98k 7Wp2cGaM8PU2/FJYIHCaU0fDmWm1yD5sjEyegwBATJBTuv/7/pOitww6DMu82QVw2wuU mTqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RaNvG3rp; 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 u29-v6si2620490pfi.96.2018.06.20.08.27.04; Wed, 20 Jun 2018 08:27:18 -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=RaNvG3rp; 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 S1754201AbeFTP0B (ORCPT + 99 others); Wed, 20 Jun 2018 11:26:01 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:38954 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754166AbeFTPYh (ORCPT ); Wed, 20 Jun 2018 11:24:37 -0400 Received: by mail-wr0-f194.google.com with SMTP id w7-v6so3730485wrn.6 for ; Wed, 20 Jun 2018 08:24:36 -0700 (PDT) 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=0SdcYFgQOnNQJBlnlcaX0uJ4bOsKrRicmvs7y9kVSAg=; b=RaNvG3rpL9QFAwkfOD4I9SM046U787iU3B85YRqsuN5Yeu23YI522cJzYBjAfTBtEN lh+/9ZLiM1S0yf08/mT9u5qCYDldPMDKr8yJb2ZiZDu/Eh6oZYXAW+p8L6noF1rH5T1n Q0opphjG2XPih7UnNTJ6XTtOdspP5rVTGYw03vEoK0wHQGMPdqxq3CEdQFpvW3ODCa14 rLuflyTTE+/VuGes4koZIsMrqS2/Yl+KzPpnfH+35T1fgVBq1747fWhUpnGDNnj7sKrc Gx81x4z25O5vYT2j2Tol7tkYXN6GgNp4w6BsyB7BDMMM9Pxu/4IGnS4Lm132kM9tB+Q1 hqCA== 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; bh=0SdcYFgQOnNQJBlnlcaX0uJ4bOsKrRicmvs7y9kVSAg=; b=rPUIDgITd1hBdOmEAmmeXmD9ut3CGQfuIbJr1+MCTyn4p/cKdkkLTSp+JKn51S0ajV jJFrbtJGzqF18ClG9I52W9IQukYOmYmpdAyrD+TPyb3RilqFWmjw+uP/nJA30wQokqgS W4xpd/I6PgSdDqxkenyCpT2q9nsolCjma7GFu3aGBtrlbsAtNNRYAGhz9HdQl/KzGmSf us1Q4Rlms4RZlcQHK+CUfC0941hHH7oBw7+E0sgnpGlaauxYz9hh07N7B7u726QF2JaY koXKm8C5dTS2rGCXq6v1cn2ZpXt8H00ZfwjHZMZ/GyE7vjgMfQ7LgLIcckUnBdKoLjWv JyBA== X-Gm-Message-State: APt69E2P3cTCjX3YteGt7uhV9gdTBPskn9Q5KDHxJGlp6KH752cHUQfh ZlqPeDIQLGrvtYWBYsx/miSeFA== X-Received: by 2002:adf:aca7:: with SMTP id o36-v6mr1408574wrc.258.1529508275965; Wed, 20 Jun 2018 08:24:35 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id c11-v6sm3959244wrm.65.2018.06.20.08.24.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 08:24:34 -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" , Shuah Khan , 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 Subject: [PATCH v4 4/7] mm, arm64: untag user addresses in mm/gup.c Date: Wed, 20 Jun 2018 17:24:23 +0200 Message-Id: <1203c510e5c34e97e5940688df075d69429e94de.1529507994.git.andreyknvl@google.com> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 b70d7ba7cc13..5bb351c91989 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -666,6 +666,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)); /* @@ -820,6 +822,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; -- 2.18.0.rc1.244.gcf134e6275-goog