Message ID | a31c2ab78925e0df0a9164e7ee402141ca1b0d6b.1535629099.git.andreyknvl@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.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 D6283139B for <patchwork-linux-mm@patchwork.kernel.org>; Thu, 30 Aug 2018 11:41:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7ECF2BA60 for <patchwork-linux-mm@patchwork.kernel.org>; Thu, 30 Aug 2018 11:41:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBA5E2BA68; Thu, 30 Aug 2018 11:41:39 +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=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FAB92BA60 for <patchwork-linux-mm@patchwork.kernel.org>; Thu, 30 Aug 2018 11:41:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE89D6B5138; Thu, 30 Aug 2018 07:41:30 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AD3336B513C; Thu, 30 Aug 2018 07:41:30 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 91CCF6B513D; Thu, 30 Aug 2018 07:41:30 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by kanga.kvack.org (Postfix) with ESMTP id 2D02F6B5138 for <linux-mm@kvack.org>; Thu, 30 Aug 2018 07:41:30 -0400 (EDT) Received: by mail-wr1-f71.google.com with SMTP id p105-v6so5613107wrc.11 for <linux-mm@kvack.org>; Thu, 30 Aug 2018 04:41:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=5dvluYXXhbs3bkFHe7bYXbDtGM4AV4lqI04lFKRyGa0=; b=JEDdMSb5WF/DdZfHaLdlCo981MUERcBLELfFfE1r5aC2568oYNxjlFoD5Fmg4WSLoJ ZwiV63y76J9hZYWAsD7IiobWQBpYKE02ReYFV7An1Ux3pOhdnfj5ckA5MBuR5cvTlofQ IadciNAUHtv9ReWwyFRVOkgNuPZU5xLULE+lwtRGapZYMO7AEgXaWAmpNKvvuMBr1K6B sSGUgwswoyvVOCkUFmwF3rqFMH+podlnNdIPi295XFGdfm+O2Nyfo/zDeFCDibYpomx4 zel6DSuNz73LnKw3+Fu2sRs4pE5TQXNNvjR+xsypn+fVtlYXOK9t58m3Mi9B0uir8zxm royw== X-Gm-Message-State: APzg51A91pI8H6DuAWOpYBBB/qQSXWgD4rcQa5se/IugJi2jgu496gOY o5nddVlYF2FCTZiptg5qqhTqu3Tm4MKSygMgk4G9aUmvTgdKjHxOuDs3/+azQmbtvuHsG4EVEg3 RkXeQ0nWHQuTw8jsNFe6MGfMX5BJdIgW0TIM2LIhvYIcxhWSe0jX9kf4QwbadSiPpRIS5T11UDP VHgBT2vK4t860itQ5LrdOWQ4fHzw1tXAXXvoozOllVAQ0o7NQXd+W6tOHHovnwwyaFjUkDTUTyS ucjwhSfKzuJCuDNSF/PZvmI83dI6wqw2s86vQComAzFnjRin1d5cZ28mMq+b1Y4gFU57hN4RzXI w7Cy4AgSescS5rA7qs0WcawqmPrmNHofUcfARFPyGxaPRHZ5g9/GX7tA19iRFejSU9kZG0umLYs P X-Received: by 2002:a5d:4401:: with SMTP id z1-v6mr7762042wrq.227.1535629289712; Thu, 30 Aug 2018 04:41:29 -0700 (PDT) X-Received: by 2002:a5d:4401:: with SMTP id z1-v6mr7762015wrq.227.1535629289010; Thu, 30 Aug 2018 04:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535629288; cv=none; d=google.com; s=arc-20160816; b=rAblaMdJPnKyKZ9DQG7K65S8MpAwQ3xdWsjSuB9GH3HjV2HiB8Xgt1gyv9FZIeAb0D MJAMggRr3FklBXOkmetA1MnBWZbyLipYEFKz0eMTjP0H/j25kt4OTJoUXb692NnXcqvz 2TA9SFBKpQ6qdTEMMRhMs4CCsrfSoClVA9u9ydBUGrdNYgS+gF7P3hD1ioVMbWBeiOYM L/f0pYfiMHDA3LGZgOe9ABeXOPT7DbIVpwP/FoC/EMfw6scView9Edv6nDic8MibIFwC WlZmdRsSf2pBAg9K+ENCY3d0W0KIgMvJ8HMjEJg1ZA0vRBGqLeXSqy6XJTkFOJsH0JyI rkGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=5dvluYXXhbs3bkFHe7bYXbDtGM4AV4lqI04lFKRyGa0=; b=Yu+LmPZWYmcxenl9EZxfLJ3RsBahg4zrzjDT8rDnoMtqiyGSdlRsvQBoDGBOcoVD85 1J8QQI5K9m2y/W4j4mhs0f+Vu44TQ8vZu4DPhmFO0WfHd/MhJADO3zObasx+QKim9UZK u39qzJNhv0O+sWuj43GGxdi/fb4SjDgTfIFWEJQWl5Cy0MdTqwADQG5o9tT/PgScGeUe 41chIuP8AIEeOU2GrRPmmqEP47kvXkDFf6eJOx6PLaRswoxL7eecSdrryE1DROiaDGa2 1u3R5jaGaDo20IxFYydxenqoxEbTDudQNpa/+hDsNqw9RsY+jC9oT6AAREPSyDQcymjY nL0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FrgdPh5T; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id o139-v6sor62279wmd.23.2018.08.30.04.41.28 for <linux-mm@kvack.org> (Google Transport Security); Thu, 30 Aug 2018 04:41:28 -0700 (PDT) Received-SPF: pass (google.com: domain of andreyknvl@google.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FrgdPh5T; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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=5dvluYXXhbs3bkFHe7bYXbDtGM4AV4lqI04lFKRyGa0=; b=FrgdPh5TBPIr4rtMd7tklQtyRgar4ZAsFHKz1PwEj3+VC5jau9Dry3d3VxRWxcx9DN aM7aeZudTWm7p/kNyIHKV/3zc+Y5VxHMcMOGT00Raehj8yCHK4qQRjbgPVV2KLJMxAqa 3Rgdu4UCrXM9AqoS+dFhMRoW3rJ0nq+cpf74SiEB/jzedt9fBg4Hfm/m/pENAIQSu++0 oMrCJovZb3IkPM50eWmd/9DzfAZugaZLcIZhmav9Cf0kn8UP4YxUMn9mjnercwABxtdG oWWF4BHN5MPrFvo1HQRM1riSm10AId1VXqNCaVpDU0IN56koQpJ+E8OSG+nLyWo4zchm X6TQ== X-Google-Smtp-Source: ANB0VdaAurM5wWvTbuaKJB5Eic+D12Dz24+pkaychw8uSDgku8eMYRWKoLaud5DLPVltKXfKUxcYpw== X-Received: by 2002:a1c:b143:: with SMTP id a64-v6mr1645342wmf.114.1535629288159; Thu, 30 Aug 2018 04:41:28 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id z184-v6sm2175218wmz.0.2018.08.30.04.41.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 04:41:27 -0700 (PDT) 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>, Al Viro <viro@zeniv.linux.org.uk>, Andrey Konovalov <andreyknvl@google.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> Subject: [PATCH v6 05/11] lib, arm64: untag addrs passed to strncpy_from_user and strnlen_user Date: Thu, 30 Aug 2018 13:41:10 +0200 Message-Id: <a31c2ab78925e0df0a9164e7ee402141ca1b0d6b.1535629099.git.andreyknvl@google.com> X-Mailer: git-send-email 2.19.0.rc0.228.g281dcd1b4d0-goog In-Reply-To: <cover.1535629099.git.andreyknvl@google.com> References: <cover.1535629099.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
arm64: untag user pointers passed to the kernel
|
expand
|
diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index b53e1b5d80f4..97467cd2bc59 100644 --- a/lib/strncpy_from_user.c +++ b/lib/strncpy_from_user.c @@ -106,6 +106,8 @@ long strncpy_from_user(char *dst, const char __user *src, long count) if (unlikely(count <= 0)) return 0; + src = untagged_addr(src); + max_addr = user_addr_max(); src_addr = (unsigned long)src; if (likely(src_addr < max_addr)) { diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c index 60d0bbda8f5e..8b5f56466e00 100644 --- a/lib/strnlen_user.c +++ b/lib/strnlen_user.c @@ -108,6 +108,8 @@ long strnlen_user(const char __user *str, long count) if (unlikely(count <= 0)) return 0; + str = untagged_addr(str); + max_addr = user_addr_max(); src_addr = (unsigned long)str; if (likely(src_addr < max_addr)) {
strncpy_from_user and strnlen_user accept user addresses as arguments, and do not go through the same path as copy_from_user and others, so here we need to handle the case of tagged user addresses separately. Untag user pointers passed to these functions. Signed-off-by: Andrey Konovalov <andreyknvl@google.com> --- lib/strncpy_from_user.c | 2 ++ lib/strnlen_user.c | 2 ++ 2 files changed, 4 insertions(+)