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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_2 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 2699EC433E0 for ; Fri, 26 Feb 2021 23:34:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E511D64E83 for ; Fri, 26 Feb 2021 23:34:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbhBZXd4 (ORCPT ); Fri, 26 Feb 2021 18:33:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:51076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbhBZXdw (ORCPT ); Fri, 26 Feb 2021 18:33:52 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B907764E83; Fri, 26 Feb 2021 23:33:11 +0000 (UTC) Date: Fri, 26 Feb 2021 18:33:09 -0500 From: Steven Rostedt To: Linus Torvalds Cc: Linux Kernel Mailing List , Ingo Molnar , Andrew Morton , Masami Hiramatsu , Jacob Wen Subject: Re: [PATCH 0/2] tracing: Detect unsafe dereferencing of pointers from trace events Message-ID: <20210226183309.0edcc54d@gandalf.local.home> In-Reply-To: References: <20210226185909.100032746@goodmis.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. As for the other pointer dereferences (the first patch), those get caught at boot up if they are compiled in. That is, you don't need to have the events enabled. The boot up code will do the verification on all events that are loaded (allyesconfig will catch all of them, which I need to try to boot with this code). -- Steve