From patchwork Mon May 22 20:33:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Olsa X-Patchwork-Id: 97605 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1707503vqo; Mon, 22 May 2023 13:41:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7KFoB3stl6P7z2bKyJIkuTiIm4H+eay+7vjNcJ/ncFEwpXj58PXUXS52sk9tBAYm8RbSKi X-Received: by 2002:a05:6a00:2445:b0:63b:7fc0:a4af with SMTP id d5-20020a056a00244500b0063b7fc0a4afmr13583512pfj.26.1684788110889; Mon, 22 May 2023 13:41:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684788110; cv=none; d=google.com; s=arc-20160816; b=Lr27wSovQWdD9id6IVE+zojseSXMbKPBxKfn0Ry5Aoz6uMUbrKDEj4zIAkC95HMd8g 7gRMKAl6/kMfovATZVxZwzpsgJsfGH2p3McrHZmebQI3EQkVjkhuwjet2h6bu8u5Ml7A Pewwt+4laPUmD9hl/FYwvFF9StP+tthPhiQwqOZfPcrw1Ycx2gQHf4PQq8I75Mu9egrx D+ERE0j9MPOL4c5W7ppwZlrS3u8UZXK0rRy7TyzZ0mCDDC3/plntN3HDyxZifGTMxS+j Z4ie8KL6cXMAltdmpsT9INIr5/OZNCbZpbTrbgVVZ23/jnqpkyaCBJZ2bVytaBEefnoH zqhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=k7IDJOFoy5IHA93tYNGmeE7Bw/UW8sNq2IFcXo5S3z4=; b=0S6SJlT1Xs1qSm8N5NYnJsOCsUhlLmkkt64nw7aE5xuurdovR89fSDmI+FrnKKq09V N+5/fG0Ix5wGoH7RnG8nI2kXxSMa+Ha94BixkpB8EChGFMiIadSdFi+N4vihG5wGquW6 GC7Kn7Xtf7CNym17TEZttyQt60otOJp8d/lVSQfG4sIqQmpUbuBTYONMjKwm9VFzQatr 4KuEiGkj892XInu4Q0iHj+J6SS+NDh8Ah7m5i7rtZdKSWppceMt++NUkMnwlvuz6Ng7Y c/Aj3UkLYPRWWkuhx4QNTsMK7ZZ/2892Pdrrk14ziYmOeqC0dLdW6DilJnOA3yM/V8WT 10Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZIotzxhO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a624e06000000b0064d56eccffdsi1306193pfb.401.2023.05.22.13.41.37; Mon, 22 May 2023 13:41:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZIotzxhO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234868AbjEVUff (ORCPT + 99 others); Mon, 22 May 2023 16:35:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234361AbjEVUf3 (ORCPT ); Mon, 22 May 2023 16:35:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 848C5C4; Mon, 22 May 2023 13:35:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1BD8562BBA; Mon, 22 May 2023 20:35:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A771C4339B; Mon, 22 May 2023 20:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684787713; bh=eHFLwkwnqJLV1skqiSQb1kO36BXLt5pZkTr7pZXoGQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZIotzxhO3HwG38hcM6aijGpyjjnPs6cQsHkoiUDuxBLolfFQK75I5fpMs/cB2wf6V mR28ahuPQ/KT51PcT/869TcBM4E13dtkg3oN4VqdX5vLB1tTSzCswlUWwoW0mG/Nk9 unbDxoFcjbze+24r3T8thJEGfCNznl3ceEouvKiqvESC0RkGfcvdzjJdkqd17+YN8+ ewzuQBUBiMKT3knw5DWvLs+LUTtQ4INx5qw1R5jX86s12NeJgwmfyzJT7vPao72NWZ 9cyMZflIK3W6SdeIKtGaRSmhUVl67wYenrT+LW5Mw1ZSktfTIWARdzWVH3DENzNnMG TkYl06+GRoHFw== From: Jiri Olsa To: stable@vger.kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , "H. Peter Anvin" , Ingo Molnar , Masami Hiramatsu , Thomas Gleixner , linux-mm@kvack.org, bpf@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Tsahee Zidenberg , Andrii Nakryiko , Christoph Hellwig , =?utf-8?q?Mah=C3=A9_Tardy?= , linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH stable 5.4 5/8] maccess: rename strncpy_from_unsafe_user to strncpy_from_user_nofault Date: Mon, 22 May 2023 22:33:49 +0200 Message-Id: <20230522203352.738576-6-jolsa@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230522203352.738576-1-jolsa@kernel.org> References: <20230522203352.738576-1-jolsa@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766628378457223035?= X-GMAIL-MSGID: =?utf-8?q?1766628378457223035?= From: Christoph Hellwig commit bd88bb5d4007949be7154deae7cef7173c751a95 upstream. [Missing bpf_trace.c hunk due to not backported changes] This matches the naming of strncpy_from_user, and also makes it more clear what the function is supposed to do. Signed-off-by: Christoph Hellwig Signed-off-by: Andrew Morton Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Masami Hiramatsu Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20200521152301.2587579-7-hch@lst.de Signed-off-by: Linus Torvalds --- include/linux/uaccess.h | 4 ++-- kernel/trace/trace_kprobe.c | 2 +- mm/maccess.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 25ae650dcb1a..23bda5df4c08 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h @@ -358,8 +358,8 @@ extern long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count); extern long strncpy_from_unsafe_strict(char *dst, const void *unsafe_addr, long count); extern long __strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count); -extern long strncpy_from_unsafe_user(char *dst, const void __user *unsafe_addr, - long count); +long strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr, + long count); extern long strnlen_unsafe_user(const void __user *unsafe_addr, long count); /** diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index a422cf6a0358..d6ba4f6bed73 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1111,7 +1111,7 @@ fetch_store_string_user(unsigned long addr, void *dest, void *base) __dest = get_loc_data(dest, base); - ret = strncpy_from_unsafe_user(__dest, uaddr, maxlen); + ret = strncpy_from_user_nofault(__dest, uaddr, maxlen); if (ret >= 0) *(u32 *)dest = make_data_loc(ret, __dest - base); diff --git a/mm/maccess.c b/mm/maccess.c index d263c7b5e4eb..8e4d564b6c25 100644 --- a/mm/maccess.c +++ b/mm/maccess.c @@ -231,7 +231,7 @@ long __strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count) } /** - * strncpy_from_unsafe_user: - Copy a NUL terminated string from unsafe user + * strncpy_from_user_nofault: - Copy a NUL terminated string from unsafe user * address. * @dst: Destination address, in kernel space. This buffer must be at * least @count bytes long. @@ -248,7 +248,7 @@ long __strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count) * If @count is smaller than the length of the string, copies @count-1 bytes, * sets the last byte of @dst buffer to NUL and returns @count. */ -long strncpy_from_unsafe_user(char *dst, const void __user *unsafe_addr, +long strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr, long count) { mm_segment_t old_fs = get_fs();