From patchwork Thu May 3 14:15:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10378471 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 325A760353 for ; Thu, 3 May 2018 14:19:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CB4028CC5 for ; Thu, 3 May 2018 14:19:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1027828E66; Thu, 3 May 2018 14:19:25 +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 9D15728CC5 for ; Thu, 3 May 2018 14:19:24 +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=mh5AUQTUGH1tMEQl2Po8nI4eNkRvqJjle5RXuLjeDAg=; b=m5irqO6meDd8GoOoHSABRWkMhR o6xKi3DrF7gnTTNhrT24haw4pDxWJWsMGUgsTddusV8Hz9DtA4yoY7vpYmIEf+gD0YVTQWP4FHNxX /HgigXTApfxN1+yx/DdRHJVooyG8iCmCZG73qGutjJjBNAYQkJHF7A8a8jx8VpTjvaXOlwhC+n1bh P8CbUS7omVP2Dbney6O1VrKY5/QyxK2KXpOssvfQVTJYGRrC7tGJNYDprJY6aBABYOgUK1MIt3pRh Ls531CE0S+HTrFY2Y41Kzp3DM66ls8hJMJip4RuxE9GrZXCzLDVSNZEofB+iWzPmGkyfOK4/kZZRr Xi57ypYw==; 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 1fEF4j-00055P-CD; Thu, 03 May 2018 14:19:13 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fEF1l-0003VA-4c for linux-arm-kernel@lists.infradead.org; Thu, 03 May 2018 14:16:10 +0000 Received: by mail-wm0-x242.google.com with SMTP id a67so20974645wmf.3 for ; Thu, 03 May 2018 07:15:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=o+ak8aT7T3uE1kdwTWR13dwi0UfLy2jLaOVdoh2IUAY=; b=LsqUKggNktg8eN6z+vIy2COAcmK3axAFA6UCN/2gDZ8Np1ZlsLG/UyDlsQmt0m/qOk XK/LQug75xAbYijiJswdDtt9Uw7jEbVwty3AvcqkXJzH5OiCJRC7CBfdQs94dw5wfCpp UAkE/GYr4pKqCxDen8QLbx+dXplaro6soXvhdRg53rRA6LlO1U5osCK3oNjr1x7omveM jo6RDTdo173a9Eqkn9GTLFHUfU68lqntf/TpgZn2izDoYkw9mmdcMdDJ8unLYTHeeYGw +yoDuWkwvcb6pPwznLqvpeJrQ7s8V6c122RUJHIam2/QR04Lj5Du8PXmzBHSShErqZD5 cXxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=o+ak8aT7T3uE1kdwTWR13dwi0UfLy2jLaOVdoh2IUAY=; b=NDE69JcXQjR4+3VvPcxw27PEl0X7YJz83NKpd5BBLVqRfBuY6LTiDeeT8Cl1MzRY/T cGkIaKeBh9//0uLUmg49QCzUnrFCVXMBu2/K9/U55fmX092f2jtvgJGp141NYg06q4uB CNYgScQYHtMRtKqH3vbJrQqp2ltFhTLKqZOaU8ZC3oFfRZuUQ+wll0Ve+M21nkHtEGck NMQqG5nW4dUOjg5d9DBeVJFUrhZgKLBqvZthEuU+7NV19+u+cUIGb4bVPQUM/LTwZc3p geFfAeSxkj7VvT6bP7+mtXIYfVH3f3seFTc5b24+r6Gi6MuHxjexX/vinhgjNuulBIJL 8vFQ== X-Gm-Message-State: ALQs6tCVfa1Lbd9uXPqypV1tCZ88enwnhM67i03WGR2C6eu+tFQBX0wN huNi0VYUWsV7ujjL2FPSEslb4Q== X-Google-Smtp-Source: AB8JxZptJtXiKJBDGbwE89q0SZRWIhadPxCAvvpndroOWisTrqqDu2K9+Rg0HJfCfSaZ0FKxnM9UiA== X-Received: by 2002:a1c:6a0a:: with SMTP id f10-v6mr244958wmc.1.1525356955378; Thu, 03 May 2018 07:15:55 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id u20-v6sm22090298wru.33.2018.05.03.07.15.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 07:15:54 -0700 (PDT) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Jonathan Corbet , Mark Rutland , Robin Murphy , Al Viro , Andrey Konovalov , James Morse , Kees Cook , Bart Van Assche , Kate Stewart , Greg Kroah-Hartman , Thomas Gleixner , Philippe Ombredanne , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Dan Williams , "Aneesh Kumar K . V" , Zi Yan , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 4/6] mm, arm64: untag user addresses in mm/gup.c Date: Thu, 3 May 2018 16:15:42 +0200 Message-Id: <24ab244adc196fda8536cf2efb59cc654e1c234b.1525356769.git.andreyknvl@google.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180503_071609_231390_3681FBFF X-CRM114-Status: GOOD ( 14.88 ) 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 76af4cfeaf68..65a9566c96d3 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -647,6 +647,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)); /* @@ -801,6 +803,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;