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: 10477749 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 61BE9600F6 for ; Wed, 20 Jun 2018 15:26:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5091D28F40 for ; Wed, 20 Jun 2018 15:26:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4159C28F3B; Wed, 20 Jun 2018 15:26:22 +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=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B698028F3B for ; Wed, 20 Jun 2018 15:26:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=HVK8cb7RyW9tJA85+V7hGdJZafsONVqsjiEdfaAr5lM=; b=R4p/ciQIfVndufj6metHGgrOIm EGsmm6hsIv6EYdT9H4RCzfrmW0L2OPLDLGn1PAW/rxCKJhAFDMPBVlTnIbRe7YQV8cIIcZXK+77He lT9nx7ZBMKEMFOISTkVvKmi4KuRUtcY1uTjzq6yEP3ogF+ICtTCMGZdRYr4DOXKTYyN3n+1DTFTw9 aQEm6aRMTk51X9Lg8sydsufNTc57VbQYIu0ifZWyOpB+mTOdQ639SbeIZu0DnfGr9e1Z0RgVMcX8U U0M7ZcopkIm5BEL44swdXy+qT189fJ7COfA0aS5etYnSH2Ovs1U3X7rpwaGRN6Z7AnyrHHLQ2HRRL ocynri3w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVezr-0007Dv-Kf; Wed, 20 Jun 2018 15:26:11 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVeyV-00059G-UV for linux-arm-kernel@lists.infradead.org; Wed, 20 Jun 2018 15:24:50 +0000 Received: by mail-wr0-x241.google.com with SMTP id l8-v6so2173563wrr.2 for ; Wed, 20 Jun 2018 08:24:37 -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=Av+bbMCtLaJFBsc0MqrH6E2pZEYAr9FJGryEPM+B/6S6hJWQX/XGWsQlEl8f3kMFFl 5ADewlC6yeo24VKJZsuMsKo3ytnU4mrD7y9QEf6ZOopP1sTdQHpgzh+wMA7Vm3GKFbzT jiGAzjPuUn34ItA3DSxqQsrw9khdaktHkXZ7jtQROC/CCjua04I41WWKJCO5Su+Nh9l/ vxa/D9UEDDWU0xS4QGguBptQgGvlOwKNAuexeB9HrA6k4vWtcazVkjfHsfDvGZeUF7sE FKG7/DGRJoo/LhkBAW3xP5XsH5C81/LmTEguFFiADw51DhlKtG6blF/QiRAOWZUOVI4C vlng== X-Gm-Message-State: APt69E1nTePTHiALmp63pqtyej8hjG93sZ6s8QS08uU/PwUWDDS8doC2 w4x8jhQ1vfgHf2DXyuGnmOcrZg== 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 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180620_082447_998186_1D460EE5 X-CRM114-Status: GOOD ( 12.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chintan Pandya , Jacob Bramley , Ruben Ayrapetyan , Lee Smith , Kostya Serebryany , Dmitry Vyukov , Ramana Radhakrishnan , Evgeniy Stepanov MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;