Message ID | 1a761b77620457f3bb57d327343765068cd652eb.1522169685.git.andreyknvl@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org> 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 49A64605B4 for <patchwork-linux-arm@patchwork.kernel.org>; Tue, 27 Mar 2018 16:59:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3851129762 for <patchwork-linux-arm@patchwork.kernel.org>; Tue, 27 Mar 2018 16:59:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 234D629D4D; Tue, 27 Mar 2018 16:59:06 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID 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 88B3A29762 for <patchwork-linux-arm@patchwork.kernel.org>; Tue, 27 Mar 2018 16:59:05 +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=v9fELQJ83kBG/DMN9nrPNzjW6GWw93JFWK7P7/HzdmI=; b=Qq+LQKPgUPLnqkdVoWzKCY/xBg SiOw+kqnatoQeI5p/f7xx+6X1gGaLlw3rkh1LXUc+ThMB9F9qCQd1pO/Qku+eSOMx1zsF1qBxlYTE b+zzBZY7ZBLGOvGQVMIZAADDX12yT6Dn9R7CDqylKzHeP+P2+mI+3BMnPgsrRKK8AW5p65eZQIGO3 or6yW1lvISzgFMpFLw4TI7km0A2OK9GU4M8cjhEPyUGE4t2XkW5kHbpbw//uJuAxwwARmwTPlsZXf ggypGpWM3wYqiuhVbVklbM41gJ7tS6PhWQf0T3cgtHdq3XmiNgN+Wb+r1n9lvxi1Qg8uf7947jMV8 T4Cqob7A==; 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 1f0rw5-0000GQ-B1; Tue, 27 Mar 2018 16:59:01 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f0rv4-00080Y-Ix for linux-arm-kernel@lists.infradead.org; Tue, 27 Mar 2018 16:58:01 +0000 Received: by mail-wr0-x243.google.com with SMTP id l49so13971420wrl.4 for <linux-arm-kernel@lists.infradead.org>; Tue, 27 Mar 2018 09:57:56 -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 :in-reply-to:references; bh=zLiSxNYCnbZDGOudEgmHw5G2g+Qsz+FQUgsgraVMNdU=; b=dCo2qWPklBfMRyZnIkK9tXaJjSF8B6r1Aivq6hpI1SeUrHy+/gCVqYqRdIFK/bTpZK +SqF7iWci+OenSDS5EKNUZEMz0A2rivQrzyJgb1zW2Dmnj7VYmNrqb1O2dE5GhDKUBMY Fq+YXUE/fcKFejypRxAbkWfnphhe6NRHU429QjKTrJo8lqStvoes6Kd3F0BwAA4spq9J 4qQkh66OjsJu6XD4BXuUmEbV3yaBW9lDyBBnbaQluS2oiX8tmCKAbZS1oiNVgYw/Gjt5 GhG1Qobn+1ta44btCuOC2jtxyoLjRtFqkA9IQOdPtixLk3cT3jJBYo4HJa93kQvNo5Lg btWA== 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:in-reply-to:references; bh=zLiSxNYCnbZDGOudEgmHw5G2g+Qsz+FQUgsgraVMNdU=; b=FqCFat7wHi5Skq8CATU5i0kJMsfYyRg04yf5kp9SpNL7qCQnV64RhUcLvYnbqBWOy0 WLg6VLLbf+BF/tRpCTcyAaS/m7avNGL7T9ztBiVfm3QekagsSmdH43Wl1g11S9dYMb4m pmBQ2AJ9h8NrYQixIZADdjxhaCp5E1iJfvK81DfRR9WIQLA4NNAMQN0WaUfkTq2KATW3 ZZlsAr/g2QnSlyXc05KqI70VJ+5LypD9ENEv5M/acLjBILHD/PIDBD0o4W46flPQGFVb j2bl6mRPQDgqCQhEtLPqCLj9TgZ5/puYX5SwsP5GAfS0N4dsL0WghrFU08WkQDISQ1CO LHiQ== X-Gm-Message-State: AElRT7HcVfXXJJUoyTnbDdMm18uS3EI8Mw3SkFGV17b3n5ZdSJfb+6Bo 7Uv/o1uEEOoViuD7Fjx7MKTR2g== X-Google-Smtp-Source: AIpwx48QI24nLLjNvxbcD2UT2yQZ6pWgReRkH9he5h6cS3juE62VyMrI+6oe5NRpvpUIOW/Duw1EiA== X-Received: by 10.223.225.76 with SMTP id f12mr124682wri.128.1522169874753; Tue, 27 Mar 2018 09:57:54 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id 93sm1622992wrh.46.2018.03.27.09.57.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Mar 2018 09:57:53 -0700 (PDT) From: Andrey Konovalov <andreyknvl@google.com> To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Jonathan Corbet <corbet@lwn.net>, Mark Rutland <mark.rutland@arm.com>, Robin Murphy <robin.murphy@arm.com>, Al Viro <viro@zeniv.linux.org.uk>, Andrey Konovalov <andreyknvl@google.com>, James Morse <james.morse@arm.com>, Kees Cook <keescook@chromium.org>, Bart Van Assche <bart.vanassche@wdc.com>, Kate Stewart <kstewart@linuxfoundation.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Thomas Gleixner <tglx@linutronix.de>, Philippe Ombredanne <pombredanne@nexb.com>, Andrew Morton <akpm@linux-foundation.org>, Ingo Molnar <mingo@kernel.org>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>, Dan Williams <dan.j.williams@intel.com>, "Aneesh Kumar K . V" <aneesh.kumar@linux.vnet.ibm.com>, Zi Yan <zi.yan@cs.rutgers.edu>, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 5/6] lib, arm64: untag addrs passed to strncpy_from_user and strnlen_user Date: Tue, 27 Mar 2018 18:57:41 +0200 Message-Id: <1a761b77620457f3bb57d327343765068cd652eb.1522169685.git.andreyknvl@google.com> X-Mailer: git-send-email 2.17.0.rc0.231.g781580f067-goog In-Reply-To: <cover.1522169685.git.andreyknvl@google.com> References: <cover.1522169685.git.andreyknvl@google.com> In-Reply-To: <cover.1522169685.git.andreyknvl@google.com> References: <cover.1522169685.git.andreyknvl@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180327_095758_665577_932EB54B X-CRM114-Status: GOOD ( 13.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: Jacob Bramley <Jacob.Bramley@arm.com>, Ruben Ayrapetyan <Ruben.Ayrapetyan@arm.com>, Lee Smith <Lee.Smith@arm.com>, Kostya Serebryany <kcc@google.com>, Dmitry Vyukov <dvyukov@google.com>, Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>, Evgeniy Stepanov <eugenis@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP |
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 separately handle the case of tagged user addresses as well. 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(+)