From patchwork Wed Jun 20 15:24:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10477753 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 CDDAC600F6 for ; Wed, 20 Jun 2018 15:26:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF06B28F3C for ; Wed, 20 Jun 2018 15:26:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B190428F3E; Wed, 20 Jun 2018 15:26:29 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3488828F38 for ; Wed, 20 Jun 2018 15:26:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753972AbeFTP01 (ORCPT ); Wed, 20 Jun 2018 11:26:27 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:42775 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754014AbeFTPYh (ORCPT ); Wed, 20 Jun 2018 11:24:37 -0400 Received: by mail-wr0-f196.google.com with SMTP id w10-v6so3725505wrk.9 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=AgqCGjxN2S8tmADiaZyzSSRYuHhlQBQRJlzkwuX+h6J0YfD9exSb3EE8PvHqj5xy5y XdBpaJ083SyIpMDB1l4JaB5uFy2+qGpkX5eaLTqzKLCcm8Ss7a5acSAONLveLpNIjfgK f/NQTBcaNrBDWF9EDSL0tkVK2KlAD9SXRHUBRfu7BqEzrGqb59RtEZq2ByU1uTUxl+Pf FqGM9OWK0/dOXOndL22bSjYu7t8XP1qKs6QAAn1iBac/TpfVTmHwC+VLF3KDvjHDDuRw gXy9OFlry4XfYjPEVYNSSTAhzsYmeLiAfKtkjFL8c8Tn3tr83r7zLXN1YqADYOZo0gWg shxA== X-Gm-Message-State: APt69E0wYjJ3wArD9WvRjWWbbz5BnUdqx5zxUyL2JRuzK0Olw05nS1JY jC75GP6ajV+QTcQmw1msB1VOqw== X-Google-Smtp-Source: ADUXVKLXT94yC0cFozFu3kmSJDBexRMscv440Gy63zDsomyYjwP//+06z4JAxvYtKPL1B+wvy3NnwQ== 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-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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 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;