From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754598AbcEPTOE (ORCPT ); Mon, 16 May 2016 15:14:04 -0400 Received: from smtprelay0036.hostedemail.com ([216.40.44.36]:52471 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754554AbcEPTOC (ORCPT ); Mon, 16 May 2016 15:14:02 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::,RULES_HIT:41:355:379:541:599:800:960:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3167:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:4250:4321:5007:6119:6261:7875:7903:8660:10004:10226:10400:10848:10967:11026:11232:11473:11658:11914:12296:12438:12517:12519:12555:12740:13069:13148:13161:13229:13230:13311:13357:13439:14096:14097:14181:14659:14721:21080:21434:30025:30054:30056:30070:30090:30091,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:3,LUA_SUMMARY:none X-HE-Tag: loaf21_5b305100c00c X-Filterd-Recvd-Size: 2514 Date: Mon, 16 May 2016 15:13:57 -0400 From: Steven Rostedt To: Borislav Petkov Cc: Namhyung Kim , Masami Hiramatsu , LKML , Ingo Molnar , x86@kernel.org, "H.J. Lu" Subject: Re: [PATCH] ftrace/x86: Fix function graph tracer reset path Message-ID: <20160516151357.73fca76a@gandalf.local.home> In-Reply-To: <20160516190359.GB16265@pd.tnic> References: <1463147623-2575-1-git-send-email-namhyung@kernel.org> <20160515094141.0cff3ee44f1f0fa101b98b02@kernel.org> <20160515130652.GA7745@danjae.aot.lge.com> <20160516175614.53e0ceed3ec0880526fa1799@kernel.org> <20160516123250.GA16239@danjae.aot.lge.com> <20160516095833.08478147@gandalf.local.home> <20160516142453.GB16239@danjae.aot.lge.com> <20160516190359.GB16265@pd.tnic> 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 Mon, 16 May 2016 21:03:59 +0200 Borislav Petkov wrote: > On Mon, May 16, 2016 at 11:24:53PM +0900, Namhyung Kim wrote: > > > -GLOBAL(ftrace_stub) > > > +/* This is weak to keep gas from relaxing the jumps */ > > > +WEAK(ftrace_stub) > > > retq > > > END(ftrace_caller) > > You could also force the 5-byte jump. I guess you could also write > simply ".long 0" in there but this way it is more robust if someone > decides to add other stuff between the JMP and the ftrace_stub label. > > --- > diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S > index ed48a9f465f8..b1db8a584c06 100644 > --- a/arch/x86/kernel/mcount_64.S > +++ b/arch/x86/kernel/mcount_64.S > @@ -179,7 +179,9 @@ GLOBAL(ftrace_epilogue) > > #ifdef CONFIG_FUNCTION_GRAPH_TRACER > GLOBAL(ftrace_graph_call) > - jmp ftrace_stub > + .byte 0xe9 > + .long ftrace_stub - 1f > +1: > #endif > I actually thought about this first, but I thought it rather a hack (although one could argue all of function tracing is a hack ;-) But as the "weak" call was used to fix one location, why not use it here too. Being consistent, and also making sure all calls to ftrace_stub do the same. -- Steve