Message ID | f67011f11f676bf7b947bf819273e22b828b9b9b.1544445454.git.andreyknvl@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <linux-kselftest-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B668D1751 for <patchwork-linux-kselftest@patchwork.kernel.org>; Mon, 10 Dec 2018 12:51:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9D7A2A1E5 for <patchwork-linux-kselftest@patchwork.kernel.org>; Mon, 10 Dec 2018 12:51:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DEC82A2C9; Mon, 10 Dec 2018 12:51:54 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=unavailable 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 59DA42A2A9 for <patchwork-linux-kselftest@patchwork.kernel.org>; Mon, 10 Dec 2018 12:51:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727301AbeLJMvx (ORCPT <rfc822;patchwork-linux-kselftest@patchwork.kernel.org>); Mon, 10 Dec 2018 07:51:53 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:39920 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727488AbeLJMvR (ORCPT <rfc822;linux-kselftest@vger.kernel.org>); Mon, 10 Dec 2018 07:51:17 -0500 Received: by mail-wm1-f66.google.com with SMTP id f81so11065272wmd.4 for <linux-kselftest@vger.kernel.org>; Mon, 10 Dec 2018 04:51:16 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=O6AqR+kzU7DWQeNGwKtE5aEN5/daSSLGL2wqVNM1I1o=; b=o94crt9sdWRW+Hm+QmVzs2SQOfXkb5I8ZA1YUWGR/rhiyXLta3D09PlbP8iJAgQz4P AaMOg13WCXc/3V43uJSupLTElnHz42/Ee7IzHa1JjP6TjqWFlUNN//X23cnby2HTY/og axjylPN+XFavkTnP0oGFHln3ZwFe2/juKQ5sJAgtxYNAFtsVDFeYuPsBQ0hII0bfcLEK XiMERt9XLjpmq8N8DJ1YK866L0D0OEONbAo9KCgz28iqGOX3iPjmbwdb16LAY28Asm+R C/Nun82fTDPABrkfsixYhSu9EPH9yIADCvsKOyVMjDxIqyFwkkJ/ZzoNiySiBB50PDA4 tGmQ== 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:mime-version:content-transfer-encoding; bh=O6AqR+kzU7DWQeNGwKtE5aEN5/daSSLGL2wqVNM1I1o=; b=XeByvj/MDL+jeXI6PZoIyjtCBWzdIcCo7ii6Bs3VZgOYEL+wQsmKsc033JDjK19go+ dQ9rRu2JSLesCGMMs13KeF9CrXod0GcWkLZ3vaSz82qsEICjybuzaqSrFepKQam8zS+D BOHaODm309+i+aLDjBYXwEse5eu6c/2fOkwvd53Zw8CGD4c3BPIVdLCqWDGtPivg1Uuc 9UleimkCkNBoIHKDqPCVCemxe6/cxBYSpK+sV7nXb682wYqXHZ4lC9mQwTSltswIsJOn Z8ohRhVUpE/DX6v3j4NSpTtTDOdfEIIn6VGfKTz4aLVzpu1AzCioIK0HxM4v6ReXAl6S 9ICg== X-Gm-Message-State: AA+aEWYVDvhxibrGR1SHzcwPqwh1MTfXHo2r2SJJ5HB+Q5EzzgRaI4Nc n4sggsJ0KgxVaIfwLx0ujBLG/A== X-Google-Smtp-Source: AFSGD/Xve6So/1Ery1o5wmvM73iVMPQ4hP1b6ACBIixN+5CPW479nD99WkZw/3+pQqT8QAsR/mEorA== X-Received: by 2002:a1c:570d:: with SMTP id l13mr11011978wmb.139.1544446275548; Mon, 10 Dec 2018 04:51:15 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:3180:41f8:3010:ff61]) by smtp.gmail.com with ESMTPSA id l197sm36893363wma.44.2018.12.10.04.51.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 04:51:14 -0800 (PST) From: Andrey Konovalov <andreyknvl@google.com> To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Mark Rutland <mark.rutland@arm.com>, Robin Murphy <robin.murphy@arm.com>, Kees Cook <keescook@chromium.org>, Kate Stewart <kstewart@linuxfoundation.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Andrew Morton <akpm@linux-foundation.org>, Ingo Molnar <mingo@kernel.org>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>, Shuah Khan <shuah@kernel.org>, 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 <dvyukov@google.com>, Kostya Serebryany <kcc@google.com>, Evgeniy Stepanov <eugenis@google.com>, Lee Smith <Lee.Smith@arm.com>, Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>, Jacob Bramley <Jacob.Bramley@arm.com>, Ruben Ayrapetyan <Ruben.Ayrapetyan@arm.com>, Chintan Pandya <cpandya@codeaurora.org>, Luc Van Oostenryck <luc.vanoostenryck@gmail.com>, Andrey Konovalov <andreyknvl@google.com> Subject: [PATCH v9 4/8] mm, arm64: untag user addresses in mm/gup.c Date: Mon, 10 Dec 2018 13:51:01 +0100 Message-Id: <f67011f11f676bf7b947bf819273e22b828b9b9b.1544445454.git.andreyknvl@google.com> X-Mailer: git-send-email 2.20.0.rc2.403.gdbc3b29805-goog In-Reply-To: <cover.1544445454.git.andreyknvl@google.com> References: <cover.1544445454.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kselftest.vger.kernel.org> X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
arm64: untag user pointers passed to the kernel
|
expand
|
diff --git a/mm/gup.c b/mm/gup.c index 8cb68a50dbdf..409aedb1e2d5 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -683,6 +683,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)); /* @@ -845,6 +847,8 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, struct vm_area_struct *vma; vm_fault_t ret, major = 0; + address = untagged_addr(address); + if (unlocked) fault_flags |= FAULT_FLAG_ALLOW_RETRY;
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). Since a user can provided tagged addresses, we need to handle such case. Add untagging to gup.c functions that use user addresses for vma lookup. Signed-off-by: Andrey Konovalov <andreyknvl@google.com> --- mm/gup.c | 4 ++++ 1 file changed, 4 insertions(+)