From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8D0DC433E1 for ; Thu, 21 May 2020 15:45:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 75E36207D8 for ; Thu, 21 May 2020 15:45:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="pqGd6S81" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75E36207D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1F6A680012; Thu, 21 May 2020 11:45:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A88580008; Thu, 21 May 2020 11:45:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F406680012; Thu, 21 May 2020 11:45:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id BF32A80008 for ; Thu, 21 May 2020 11:45:48 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 86446181AEF1D for ; Thu, 21 May 2020 15:45:48 +0000 (UTC) X-FDA: 76841151576.18.snail83_8a003ab09f963 X-HE-Tag: snail83_8a003ab09f963 X-Filterd-Recvd-Size: 5559 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Thu, 21 May 2020 15:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=1npcDTOJ/7f3HiPL67/bMBXtdt053nBQX247zae/UWo=; b=pqGd6S81tSKZa336lIookYkwk8 Iy7VC6laC7HEryoG9Y4rYXwbstInrQedaaFzCUC8OrHO/f8k7/NMQ1/Y2vZQ8MPkVh2IlZ6oLjN1x 68bFPrnotirGbFoTEDL0BnY9UKdYACt45BXZHJIRgTBJJF0mho2HZVIr6oVxAn1hUTwzXCpz/ud81 EeEwgbWaYHVFglAhosG/cx46HMBf1S/GMBUqlHsKHWAFFzQ77uoy3KwfUKdvOZxgJC87GqlLIOdIY atTBlvcODkkFq0v2WbjNtrOOLU8Q5cgMczOu+eopuxHLz+ub8YX5N4EXnmJizcSoizXjBOtM5tsmf 7D78Z82Q==; Received: from [2001:4bb8:18c:5da7:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbn2y-0004YO-Qn; Thu, 21 May 2020 15:23:49 +0000 From: Christoph Hellwig To: x86@kernel.org, Alexei Starovoitov , Daniel Borkmann , Masami Hiramatsu , Linus Torvalds , Andrew Morton Cc: linux-parisc@vger.kernel.org, linux-um@lists.infradead.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 15/23] maccess: remove strncpy_from_unsafe Date: Thu, 21 May 2020 17:22:53 +0200 Message-Id: <20200521152301.2587579-16-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200521152301.2587579-1-hch@lst.de> References: <20200521152301.2587579-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Content-Transfer-Encoding: quoted-printable 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: All users are gone now. Signed-off-by: Christoph Hellwig --- include/linux/uaccess.h | 1 - mm/maccess.c | 39 +-------------------------------------- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 65a37ae3b8871..d7d98ff345b3d 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h @@ -311,7 +311,6 @@ extern long probe_user_read(void *dst, const void __u= ser *src, size_t size); extern long notrace probe_kernel_write(void *dst, const void *src, size_= t size); extern long notrace probe_user_write(void __user *dst, const void *src, = size_t size); =20 -extern long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long= count); long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, long count); =20 diff --git a/mm/maccess.c b/mm/maccess.c index 6116742608217..df82fde34307f 100644 --- a/mm/maccess.c +++ b/mm/maccess.c @@ -8,8 +8,6 @@ =20 static long __probe_kernel_read(void *dst, const void *src, size_t size, bool strict); -static long __strncpy_from_unsafe(char *dst, const void *unsafe_addr, - long count, bool strict); =20 bool __weak probe_kernel_read_allowed(const void *unsafe_src, size_t siz= e, bool strict) @@ -156,35 +154,6 @@ long probe_user_write(void __user *dst, const void *= src, size_t size) return 0; } =20 -/** - * strncpy_from_unsafe: - Copy a NUL terminated string from unsafe addre= ss. - * @dst: Destination address, in kernel space. This buffer must be at - * least @count bytes long. - * @unsafe_addr: Unsafe address. - * @count: Maximum number of bytes to copy, including the trailing NUL. - * - * Copies a NUL-terminated string from unsafe address to kernel buffer. - * - * On success, returns the length of the string INCLUDING the trailing N= UL. - * - * If access fails, returns -EFAULT (some data may have been copied - * and the trailing NUL added). - * - * If @count is smaller than the length of the string, copies @count-1 b= ytes, - * sets the last byte of @dst buffer to NUL and returns @count. - * - * Same as strncpy_from_kernel_nofault() except that for architectures w= ith - * not fully separated user and kernel address spaces this function also= works - * for user address tanges. - * - * DO NOT USE THIS FUNCTION - it is broken on architectures with entirel= y - * separate kernel and user address spaces, and also a bad idea otherwis= e. - */ -long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count) -{ - return __strncpy_from_unsafe(dst, unsafe_addr, count, false); -} - /** * strncpy_from_kernel_nofault: - Copy a NUL terminated string from unsa= fe * address. @@ -204,12 +173,6 @@ long strncpy_from_unsafe(char *dst, const void *unsa= fe_addr, long count) * sets the last byte of @dst buffer to NUL and returns @count. */ long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, lon= g count) -{ - return __strncpy_from_unsafe(dst, unsafe_addr, count, true); -} - -static long __strncpy_from_unsafe(char *dst, const void *unsafe_addr, - long count, bool strict) { mm_segment_t old_fs =3D get_fs(); const void *src =3D unsafe_addr; @@ -217,7 +180,7 @@ static long __strncpy_from_unsafe(char *dst, const vo= id *unsafe_addr, =20 if (unlikely(count <=3D 0)) return 0; - if (!probe_kernel_read_allowed(unsafe_addr, count, strict)) + if (!probe_kernel_read_allowed(unsafe_addr, count, true)) return -EFAULT; =20 set_fs(KERNEL_DS); --=20 2.26.2