From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752613AbcF1WIJ (ORCPT ); Tue, 28 Jun 2016 18:08:09 -0400 Received: from smtprelay0190.hostedemail.com ([216.40.44.190]:53246 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752415AbcF1WID (ORCPT ); Tue, 28 Jun 2016 18:08:03 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:5007:6119:6261:7875:7903:10004:10400:10848:10967:11026:11232:11658:11914:12043:12295:12296:12438:12517:12519:12555:12663:12740:13439:14659:14721:21080:21324:21434,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: shelf34_589570ff06c5b X-Filterd-Recvd-Size: 3266 Date: Tue, 28 Jun 2016 18:06:47 -0400 From: Steven Rostedt To: Rasmus Villemoes Cc: Jiri Olsa , lkml , Frederic Weisbecker Subject: Re: [RFC/PATCH] lib/vsprintf: Add support to store cpumask Message-ID: <20160628180647.1e90257e@gandalf.local.home> In-Reply-To: <878txpi066.fsf@rasmusvillemoes.dk> References: <1467128075-10841-1-git-send-email-jolsa@kernel.org> <20160628122608.0ea291b2@gandalf.local.home> <878txpi066.fsf@rasmusvillemoes.dk> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 28 Jun 2016 21:27:29 +0200 Rasmus Villemoes wrote: > > I probably should make a trace_printk() that doesn't default to the > > binary print, to handle things like this. > > > > trace_printk_ptr()? > > > > Or even just see if I can find a way that detects this in the fmt > > string. Hmm, that probably can't be done at compile time :-/ > > Well, not with gcc itself, but it wouldn't be too hard to make smatch > complain loudly if trace_printk is used on a format string with any %p > extension (directing people to use trace_printk_ptr()) - the format > parsing (and type checking) is already there. Well, actually gcc can (see below). Although, the more I think about this, the more I'm thinking that the bin_printk() should be default just copy the pointer content. As the whole point of bin_printk() is to print the content at another time. And since pointers should not be dereferenced later, it should be saved at the moment the bprintk() is called and not dereferenced later. -- Steve diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 94aa10ffe156..62693900cc4b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -631,7 +631,24 @@ do { \ \ __trace_printk_check_format(fmt, ##args); \ \ - if (__builtin_constant_p(fmt)) \ + if (__builtin_constant_p(fmt) && \ + !__builtin_strstr(fmt, "%pF") && \ + !__builtin_strstr(fmt, "%pf") && \ + !__builtin_strstr(fmt, "%pR") && \ + !__builtin_strstr(fmt, "%pr") && \ + !__builtin_strstr(fmt, "%pb") && \ + !__builtin_strstr(fmt, "%pM") && \ + !__builtin_strstr(fmt, "%pI") && \ + !__builtin_strstr(fmt, "%pE") && \ + !__builtin_strstr(fmt, "%pU") && \ + !__builtin_strstr(fmt, "%pV") && \ + !__builtin_strstr(fmt, "%pN") && \ + !__builtin_strstr(fmt, "%pa") && \ + !__builtin_strstr(fmt, "%pd") && \ + !__builtin_strstr(fmt, "%pC") && \ + !__builtin_strstr(fmt, "%pD") && \ + !__builtin_strstr(fmt, "%pg") && \ + !__builtin_strstr(fmt, "%pG")) \ __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \ else \ __trace_printk(_THIS_IP_, fmt, ##args); \