Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp845838ybb; Wed, 1 Apr 2020 10:41:19 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvAuChmxMCOLBeBHr2G+f4jzTLTNmUvW/WOs/3Uq35O3LTm66PMjEkBW1msEKUhViuwfuuv X-Received: by 2002:a05:6830:158e:: with SMTP id i14mr18670423otr.103.1585762879408; Wed, 01 Apr 2020 10:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585762879; cv=none; d=google.com; s=arc-20160816; b=as4L1qMhmXCz2PT1NyxIY2IJP6D2+AvkXxlCswi1hv23ZiLGXP4gcrIS8IvuxKNTZG A3yDhZzXvEEKckZj+jPRDZiZ30iDuN9heBM1peX/ub4guOkR+AStsNH9ovWoPH4ROows T5hKS6TXIaj9mLKttZmxKwydYrkUZRVW6pJy6KGg7TsWtTKUUTJjhWzYeieGJgnXXeeZ qMr4Hzv8YFMhEQyMdBn1ixoaYuiha3NPXfvUthpgkzhaflLTktHz2v4k2cGl66zBHsGh z91haY6+dlH36JJSE6DEc7+5muHWMvTtmKMPr3UH7BiRlHCB0RK9a2cUonj77ZXlMfor MRdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=bN9sAxxrxI0QKUe5EmcfAyEAD1O55pPC904an2QRe7s=; b=gmONDRc6MOjs3BznSKK1ceKUVzthXwCScfRrxZWRyg3HWPDAyKnic+dOtmT48Y7NFR VsYi/L40Gu196CdGLLrPmBmp3CcoHeTjut3pFYgFsjiBCxM8pzeYbjb8pco3SQKANDHu u3l9/xwRjP7VwY1FHRijAJZtyfE4eqXwf8ggsp772qUYjiiuyCDQbAcPgcc2hCBhwhxc E7tfkSakhn6jMCwZdBHw7fmTxHWx0HP3JSh1oD6n7lHfyCPpxzGoD/QL8sGiLW5BZ+53 S5pbCCfbDz9siEMG0B21nVVIWUk6uioa3BgFAQ9TXoucufFhkIdR5dfr6pErw72zLCG1 xHeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="b/fKiL+5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 192si1156448oii.36.2020.04.01.10.41.06; Wed, 01 Apr 2020 10:41:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="b/fKiL+5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732723AbgDARh1 (ORCPT + 99 others); Wed, 1 Apr 2020 13:37:27 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:32985 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726901AbgDARh0 (ORCPT ); Wed, 1 Apr 2020 13:37:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585762645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bN9sAxxrxI0QKUe5EmcfAyEAD1O55pPC904an2QRe7s=; b=b/fKiL+5HJaCivkLTAvMjRfEEqi1w643XkH66KOf6RF2imLUmOkPt/cfCWfpgKyCjTiA5B j61klu7et+RwxIJScW2T9034mrYpFIDqhDOA4EwriuNuqmxS1yAKslrBC9uCwVVZ4g6VBW XhB/u3KHULhjh5ViPLMxFDzP3Bf3wl8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-444-5qC2-SH4MpmplGeB9sW4Bw-1; Wed, 01 Apr 2020 13:37:13 -0400 X-MC-Unique: 5qC2-SH4MpmplGeB9sW4Bw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 541381005055; Wed, 1 Apr 2020 17:37:12 +0000 (UTC) Received: from treble (ovpn-118-135.phx2.redhat.com [10.3.118.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8627C391; Wed, 1 Apr 2020 17:37:11 +0000 (UTC) Date: Wed, 1 Apr 2020 12:37:09 -0500 From: Josh Poimboeuf To: Peter Zijlstra Cc: Julien Thierry , tglx@linutronix.de, linux-kernel@vger.kernel.org, x86@kernel.org, mhiramat@kernel.org, mbenes@suse.cz, Steven Rostedt Subject: Re: [PATCH v2] objtool,ftrace: Implement UNWIND_HINT_RET_OFFSET Message-ID: <20200401173709.xzfuwmbz4b6lvsfy@treble> References: <20200330190205.k5ssixd5hpshpjjq@treble> <20200330200254.GV20713@hirez.programming.kicks-ass.net> <20200331111652.GH20760@hirez.programming.kicks-ass.net> <20200331202315.zialorhlxmml6ec7@treble> <20200331204047.GF2452@worktop.programming.kicks-ass.net> <20200331211755.pb7f3wa6oxzjnswc@treble> <20200331212040.7lrzmj7tbbx2jgrj@treble> <20200331222703.GH2452@worktop.programming.kicks-ass.net> <20200401170910.GX20730@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200401170910.GX20730@hirez.programming.kicks-ass.net> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 01, 2020 at 07:09:10PM +0200, Peter Zijlstra wrote: > On Wed, Apr 01, 2020 at 04:43:35PM +0100, Julien Thierry wrote: > > > > +static bool has_modified_stack_frame(struct instruction *insn, struct insn_state *state) > > > { > > > + u8 ret_offset = insn->ret_offset; > > > int i; > > > > > > - if (state->cfa.base != initial_func_cfi.cfa.base || > > > - state->cfa.offset != initial_func_cfi.cfa.offset || > > > - state->stack_size != initial_func_cfi.cfa.offset || > > > - state->drap) > > > + if (state->cfa.base != initial_func_cfi.cfa.base || state->drap) > > > + return true; > > > + > > > + if (state->cfa.offset != initial_func_cfi.cfa.offset && > > > + !(ret_offset && state->cfa.offset == initial_func_cfi.cfa.offset + ret_offset)) > > > > Isn't that the same thing as "state->cfa.offset != > > initial_func_cfi.cfa.offset + ret_offset" ? > > I'm confused on what cfa.offset is, sometimes it increase with > stack_size, sometimes it doesn't. > > ISTR that for the ftrace case it was indeed cfa.offset + 8, but for the > IRET case below (where it is now not used anymore) it was cfa.offset > (not cfa.offset + 40, which I was expecting). It depends on the value of cfa.base. If cfa.base is CFI_SP, then cfa.offset changes with stack_size. If cfa.base is CFI_BP (i.e. if the function uses a frame pointer), then cfa.offset is constant (the distance between RBP on the stack and the previous frame). -- Josh