Message ID | 2c573564b456327708d175f3124256bc71081bd8.1544445454.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 DBBE417FE for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 10 Dec 2018 12:51:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEA252A297 for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 10 Dec 2018 12:51:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC9742A2A9; Mon, 10 Dec 2018 12:51: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=-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=ham 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 69D5B2A2A8 for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 10 Dec 2018 12:51:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 65AE28E000E; Mon, 10 Dec 2018 07:51:19 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5DEC68E0001; Mon, 10 Dec 2018 07:51:19 -0500 (EST) 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 4A8098E000E; Mon, 10 Dec 2018 07:51:19 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id DFBFB8E0001 for <linux-mm@kvack.org>; Mon, 10 Dec 2018 07:51:18 -0500 (EST) Received: by mail-wr1-f70.google.com with SMTP id w12so3458308wru.20 for <linux-mm@kvack.org>; Mon, 10 Dec 2018 04:51:18 -0800 (PST) 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=THrF65uyQ43y9XI4Oao8ZCD7W0hiODFoiBK2GnkK+6k=; b=Gd1oN/M7Vf8vSJGJH07WOgO/S9YSWGkuaRLKWdia9jHn2ZJ8Q0Va5viys04E2UFfXb 3rYAQ6pgENDxlEd/x2HOJlV+BkkX+LvgxwUofHxHGas37tQ5tfgp90qUhZkPjmbK7nAU 4FuL4xbbeLDYMQHOy4JH8I+wIkuxXvbmmK06d1EPOlGqra0xf0aREjnygxyjZOxl6qlv msKd3XNpbQCDSmqDBbr1WGpQDpfaOTcwG28R9cn3ahIR6te6Q7Q6wHE4b5o4+/utoYV2 +k2Q0yTxuWeGkfLrnGg226S1cjpBS5WShrAgXuoHf2aV1ZN+bD2mxhKK9pEkEL0fMKEL JR7g== X-Gm-Message-State: AA+aEWbBeyjoOr2GWY3vInBaFFw1KhCqc0gGu9MQHx35XnasUqO94LCm ZbGINpXq7GwutQBs5lw50u5/3BE5c29dePnED0W3GTE8qD/tTnSsf3SSHu/85AQLp/PEpgQX72T m3+WlfU+3G2fHmac23mh8JoFrucWj8Vq4IAnIKmoPTa8e8K3wO3MaaDk7oZV8Qz38iowwSZNaGF PT1y8131IXxm41TiJi9soQAehiyMKVkCCw+63UG/mDnDY0BNY3poRmqZ2CW4LlKAJCDwueq8yTO O2NO7xI55P3jlHVy2IEtAgCsw3LWg4jHgAiSxC6LV8VJxczeXebEvQyCcyLzHL++haRj3XerRDt R7ERhZenzrzSXDozWdBH0/wk8pfXk9M57flK3251qreFQ2KSH+17jaFAqYJETN5Kng7A6sBa4dA 7 X-Received: by 2002:a1c:2457:: with SMTP id k84mr10443272wmk.139.1544446278435; Mon, 10 Dec 2018 04:51:18 -0800 (PST) X-Received: by 2002:a1c:2457:: with SMTP id k84mr10443231wmk.139.1544446277515; Mon, 10 Dec 2018 04:51:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544446277; cv=none; d=google.com; s=arc-20160816; b=kVTgjyjriIHxZIxv6PM4WIHWSbdruzBB+WsN99Zc0aXF45F1TcdRrCsnxV3r1MDd/4 qpJjwUcHIYxABKVT+kcLExukWnfnSu96OacV1IpQn8LaD5hn8+hOlTL+YfFStBu2WT1g HUpXvoCw/wE7WjuQmkmTUgrsiTGCU9KHPOX96oFKRiwMEy2n342wWBCQDLpr9J0ODahX +LMb2hOb1ybrUdr3bDhOCVAq1trhVR5D4e+eeM1ETI1Q5eIOwcOHQaIJHgH1+nnL3XNo /DFC3MiWxSL6CgqZsBbOrYg4CeHkPsq0MjnhXzztFc5JboJVjMIWZ2e5+oAV5dCXPsDa 9mrw== 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; bh=THrF65uyQ43y9XI4Oao8ZCD7W0hiODFoiBK2GnkK+6k=; b=tPyzIrtmvsQ8eV0exifpVfQR8F5kTB8yHTVq3gfRe/umwSIu8nc5gcdHNo67xoh91N J4x9pn9mNw9yPurJFAykJ9ZkKqN1mYiTRk9ZRsnkZbCMQbOfMeSGSlJtKL7wFRFhoApI 9TjO7X9XIJr6Yfve/hIsakeCJtDmGuRUHm2Kn7V6uiY67Nb5IXmtdSwtd96NnPtFkGX1 UcQhcsItsCBlOX1v81i8HCf2HmugArBu6SPOtLvUmW7ATu12fR8FHyzX9xqOlzoqjQeq bwV1nSwiZmSrqej+qUtTONZomdmcXQuwJPrcOsIQKtnIAj6a/Qm1SPZMr9ATd8HYB1/G 09uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="PdfHiKV/"; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id k1sor6958567wrx.19.2018.12.10.04.51.17 for <linux-mm@kvack.org> (Google Transport Security); Mon, 10 Dec 2018 04:51:17 -0800 (PST) Received-SPF: pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="PdfHiKV/"; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 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=THrF65uyQ43y9XI4Oao8ZCD7W0hiODFoiBK2GnkK+6k=; b=PdfHiKV/nw+CfvDzzUmvpjA/YhVLjcLEJGbE4xRNKckctV4ggJLQ09SaEpJOCkc/Wd TsbWeQ7VqNxHNADvOwoiDxubfQDEDS0+PHacVgOSQwfEz02dQXLOTxmV5IykKVkn0f9a qcdjj+pRCBHgfvFs4fxlSCiaYPFMMXTkQUdwp3B9666yUCdbDg9xBDMR3zDN5H2HdY1U EAZ/zAia4HQUr1OpEIgycWmDLiok+qqigVLOzimiWXbPovc2JNH66nE7jrGjj0/pP7Xm u31n4umKu6azySOlPyk4zWiDSNjuQbTXYYgyyZeCL1TW0iqGcwgkW/T/pb9E8YfCUAZ2 045Q== X-Google-Smtp-Source: AFSGD/VI/5BMsRXqnw18fB6Gll7b+Eig1k8PMWahNn8bGC0uXwXuMAwRBnIM/ZnTZkzB47NBiSqZdQ== X-Received: by 2002:a5d:538a:: with SMTP id d10mr9405307wrv.202.1544446277017; Mon, 10 Dec 2018 04:51:17 -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.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 04:51:16 -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 5/8] lib, arm64: untag addrs passed to strncpy_from_user and strnlen_user Date: Mon, 10 Dec 2018 13:51:02 +0100 Message-Id: <2c573564b456327708d175f3124256bc71081bd8.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 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(+)