From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754595AbcEPTEP (ORCPT ); Mon, 16 May 2016 15:04:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:38869 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754551AbcEPTEM (ORCPT ); Mon, 16 May 2016 15:04:12 -0400 Date: Mon, 16 May 2016 21:03:59 +0200 From: Borislav Petkov To: Namhyung Kim , Steven Rostedt Cc: Masami Hiramatsu , LKML , Ingo Molnar , x86@kernel.org, "H.J. Lu" Subject: Re: [PATCH] ftrace/x86: Fix function graph tracer reset path Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160516142453.GB16239@danjae.aot.lge.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 GLOBAL(ftrace_stub) -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --