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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 4B0B1C433E0 for ; Sat, 27 Feb 2021 04:05:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1EB6564E60 for ; Sat, 27 Feb 2021 04:05:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230010AbhB0EFO (ORCPT ); Fri, 26 Feb 2021 23:05:14 -0500 Received: from smtprelay0108.hostedemail.com ([216.40.44.108]:41588 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229863AbhB0EFL (ORCPT ); Fri, 26 Feb 2021 23:05:11 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id 7C9841802DE0C; Sat, 27 Feb 2021 04:04:30 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: hook24_39184a92769f X-Filterd-Recvd-Size: 2274 Received: from [192.168.1.159] (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf18.hostedemail.com (Postfix) with ESMTPA; Sat, 27 Feb 2021 04:04:29 +0000 (UTC) Message-ID: <0cb9c9b8ce069a92df8b974d520606a494614892.camel@perches.com> Subject: Re: [PATCH 0/2] tracing: Detect unsafe dereferencing of pointers from trace events From: Joe Perches To: Steven Rostedt , Linus Torvalds Cc: Linux Kernel Mailing List , Ingo Molnar , Andrew Morton , Masami Hiramatsu , Jacob Wen Date: Fri, 26 Feb 2021 20:04:28 -0800 In-Reply-To: <20210226183309.0edcc54d@gandalf.local.home> References: <20210226185909.100032746@goodmis.org> <20210226183309.0edcc54d@gandalf.local.home> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2021-02-26 at 18:33 -0500, Steven Rostedt wrote: > On Fri, 26 Feb 2021 14:21:00 -0800 > Linus Torvalds wrote: > > > > The second patch handles strings "%s" [..] > > > > Doing this at runtime really feels like the wrong thing to do. > > > > It won't even protect us from what happened - people like me and > > Andrew won't even run those tracepoints in the first place, so we > > won't notice. > > > > It really would be much better in every respect to have this done by > > checkpatch, I think. > > They are not mutually exclusive. We could have both. One thing that's nice > about this patch is that it removes the possibility of a real bug. That is, > it will catch the dereferencing of a string that is not valid, WARN about > it, but it wont try to dereference it (outside of the > strcpy_from_kernel_nofault()). And hopefully the warning and lack of data > they want, will have this get caught during development. > > Also, there's cases that %s is allowed to reference data that I don't know > if checkpatch would be able to differentiate. It's not obvious to me how to do that.