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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06C75C433F5 for ; Tue, 22 Mar 2022 14:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233991AbiCVO1y (ORCPT ); Tue, 22 Mar 2022 10:27:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241238AbiCVO0v (ORCPT ); Tue, 22 Mar 2022 10:26:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C662D13F48; Tue, 22 Mar 2022 07:25:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0A411615BE; Tue, 22 Mar 2022 14:25:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 781C1C340EC; Tue, 22 Mar 2022 14:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647959121; bh=ZJy4jdo44xK7N2rkd/X1voMeDEE0lojYlDBJmgmcmhU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MPq7XyYuZOLpWAJVUwMdRZF7wvfqt9CnUvtuCNcd2EOsQR8wjlPn5L4wm70eaJTdv vkzjJCsXqKJRIfx3XxKJit/vwbEzEbdq9BeTJkdXy3os6LpfO254lsfS9Jk2YyFeab 0foNkCXdYPv45Wi0TF9u/KImGJNoBq+WovUGkxJERZBvh2OhX47pJtUJOIkVXICiYs lqkp5A/NqVfp2Zjzul9P5+zkGMJNR6ZnzLItF6WzdG2BQ6yiUNU147qlqeXuEkknXz qVCy43qgJNPbH6x+fl1YL+MfS87lnvE9cWDnsQkit56gHkYwSNJa2Qe3KU37/mFn+a FQvJKCHe2gzJw== Date: Tue, 22 Mar 2022 23:25:15 +0900 From: Masami Hiramatsu To: Steven Rostedt Cc: Peter Zijlstra , Stephen Rothwell , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Linux Kernel Mailing List , Linux Next Mailing List , mhiramat@kernel.org, ast@kernel.org, hjl.tools@gmail.com, rick.p.edgecombe@intel.com, rppt@kernel.org, linux-toolchains@vger.kernel.org, Andrew.Cooper3@citrix.com, ndesaulniers@google.com Subject: Re: linux-next: build warnings after merge of the tip tree Message-Id: <20220322232515.97d8e2d66d051881bcfe3ce0@kernel.org> In-Reply-To: <20220321121209.3b95e406@gandalf.local.home> References: <20220321140327.777f9554@canb.auug.org.au> <20220321112805.1393f9b9@gandalf.local.home> <20220321121209.3b95e406@gandalf.local.home> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; 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-next@vger.kernel.org On Mon, 21 Mar 2022 12:12:09 -0400 Steven Rostedt wrote: > On Mon, 21 Mar 2022 17:04:28 +0100 > Peter Zijlstra wrote: > > > On Mon, Mar 21, 2022 at 11:28:05AM -0400, Steven Rostedt wrote: > > > On Mon, 21 Mar 2022 14:04:05 +0100 > > > Peter Zijlstra wrote: > > > > > > Also, folks, I'm thinking we should start to move to __fexit__, if CET > > > > SHSTK ever wants to come to kernel land return trampolines will > > > > insta-stop working. > > > > > > > > Hjl, do you think we could get -mfexit to go along with -mfentry ? > > > > > int funcA () { > > > [..] > > > return funcB(); > > > } > > > > > This currently works with function graph and kretprobe tracing because of > > > the shadow stack. Let's say we traced both funcA and funcB > > > > > > funcA: > > > call __fentry__ > > push funcA on trace-stack > > > > > > [..] > > > jmp funcB > > > > > > funcB: > > > call __fentry__ > > push funcB on trace-stack > > > > > > [..] > > call __fexit__ > > pop trace-stack until empty This seems wrong. We don't pop the trace-stack until empty, but we will record the real stack pointer at funcA. > > 'exit funcB' > > 'exit funcA' > > And what happens if funcC called funcA and it too was on the stack. We pop > that too? But it's not done yet, because calling of funcA was not a tail > call. Thus when the funcC is called, the trace-stack will be poped until funcA, because we can see the real stack pointer at the 'ret'. So the funcC is still on the trace-stack after that. Thank you, > > -- Steve > > > > > > > ret > > > > > > > > That is, the current algorithm traces the end of both funcA and funcB > > > without issue, because of how the shadow stack works. > > > > And it all works, no? Or what am I missing? > > > -- Masami Hiramatsu