From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97781156C67; Wed, 10 Apr 2024 15:53:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712764422; cv=none; b=X7MjGwJ3nW87M/fh0Iu7JnpcCedf1kOUKN6z0W2qEOpGJqHiKIwvNS0yi5suUC3d0qAzaCoIju7RpYjhwPf3XfRNaHMj8cwPlj3YWku6zbgzhAWMU3SRs8s6wSYIn3MZDbpTB16b47yfM0ubgWHMzec5QB9eOajroCxCmJZxqws= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712764422; c=relaxed/simple; bh=Yj2mjB7xGY/t85UZ8jq4NsVg3CMycDTWl975T4rbgkU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZwmWoZmQFVDAGO02ysKpSCNcLuR3WNGqdqZ3QCAKXEIK+iFbbAtW4fUYGwJ1ejXV+jPXX6qxgWqJComEEoe0hp2a324sv9lsqxsaiAFZgk6NWBTWIRMskoAw6aI+DpRK7Ng2l/jebs/LFKffHHXV+L044vfxFo8cSlcwvx6ONis= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65E3CC433F1; Wed, 10 Apr 2024 15:53:40 +0000 (UTC) Date: Wed, 10 Apr 2024 11:56:17 -0400 From: Steven Rostedt To: Chuck Lever Cc: Justin Stitt , Andrew Lunn , Heiner Kallweit , Russell King , Masami Hiramatsu , Mathieu Desnoyers , Jeff Layton , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] trace: events: cleanup deprecated strncpy uses Message-ID: <20240410115617.14804133@gandalf.local.home> In-Reply-To: References: <20240401-strncpy-include-trace-events-mdio-h-v1-1-9cb5a4cda116@google.com> <20240410113614.39b61b0d@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 10 Apr 2024 11:41:18 -0400 Chuck Lever wrote: > > If anything, it needs to be: > > > > __string_len(acceptor, data, len) > > > > as the macro code has changed recently, and the current code will crash! > > A general question: > > Is there a test suite we should run regularly to build some > confidence in the kernel's observability apparatus? We're building > a menagerie of tests around kdevops, and one area where we know > there is a testing gap is the tracepoints in NFSD and SunRPC. I try to add self tests within the macros. As __assign_str() is going to turn into just __assign_str(field) (instead of __assign_str(field, src)), I added a test to make sure what was passed to __string() is also what __assign_str() gets. But using strcpy() in place of __assign_str() really is doing something that one should not be doing. There's checks in the tracepoint code as well for things like referencing a pointer that was not saved in the event, and other things. But a generic test on a custom trace event, I don't really have. Note, you could enable CONFIG_TRACE_EVENT_INJECT where an "inject" file is created, and you can write into it: # cd /sys/kernel/tracing # echo 1 > events/rpcgss/rpcgss_context/enable # echo 'expiry=123456 now=222' > events/rpcgss/rpcgss_context/inject # cat trace bash-843 [001] ..... 720.083189: rpcgss_context: win_size=0 expiry=123456 now=222 timeout=0 acceptor= And you could use that for testing. -- Steve