Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4065452pxu; Mon, 12 Oct 2020 08:37:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyi0eNDEfZ6jaDyfo4EDuz1nxkC8gSpo1qsTbm8Ii6ZB90+MnoPAThI6uSvNrV2qib7MDH5 X-Received: by 2002:a50:ef0e:: with SMTP id m14mr14855800eds.5.1602517062335; Mon, 12 Oct 2020 08:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602517062; cv=none; d=google.com; s=arc-20160816; b=fYt42OCsNopt5zvSt83xTxR++yRinHBYJpDze234nn7wL2MYpFA7uyMq0FiMMKascD Ay/pv0c3IEjWWhAposLq19fX6iiOPfCVk101ybXMb5Wt7BotC3BaK93hJGEIKFc6Jzko oj8E8D2DCoHztmsc+BNqB4spTzHIZq/vWJGMlyhndljoW8w+GdXxIBYB9AeMi0PdDZHR aAgzPf1UqCqa4oWV6BwLizJtTe9h1GFyHTvnU4TvqMrqf9pqECJm+np0gSh+++5zWBJk Q5lrvG2vMTuwbawSh5TJdDmWUKcuJ/yWNntKQ7tmwNanC1ze61OKuO05MrCn3KbpkNo6 4KuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lgksmDOGwr6afSR53HTSWyXq3O/b7foD0uOmXQAzfs0=; b=q60dPdri41Qz7+YcAi2aOm+kAPczGWXYcWeXWx85791O9GeT3e8ddmzLIqgCas5xCs K+LkiWnJ4w9a+g6mEtpysDHMYzZQ/cH7O07QP+bxx29AUgz75fgiSfPv4zqAIw9mTqpv 4O9W+6+x1PbPqJyNDoSxfohg76T28F82outQTw8UuC0YuKq6PNA8vK+hQlhSN711L+CK bjYMM9HeTeKK1kgyWuDkaCHs1vXFgyDjC0FfkfDTSKwJemFuzmrEgdLHhUH0awhGwL5D WYvTaq+nMLd4iiJrvXetl10LQ5S0BQ+U06i4TlIS2M09AVjNMb94rbk7tgtlX+XUliqq CCYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DBmH8riI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id y39si12475174ede.275.2020.10.12.08.37.19; Mon, 12 Oct 2020 08:37:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DBmH8riI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2390196AbgJLPfQ (ORCPT + 99 others); Mon, 12 Oct 2020 11:35:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24594 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389542AbgJLPfQ (ORCPT ); Mon, 12 Oct 2020 11:35:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602516915; 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=lgksmDOGwr6afSR53HTSWyXq3O/b7foD0uOmXQAzfs0=; b=DBmH8riI/E/0hIPkKg+6n0cZfJbxVWcVy/bq1q6gt28QVN+TWzP6Iyl46h0+wexS/XqF/O a68oTln6Toyfgwr+m6ik2U+lkS2peNziYq3ZmGdXKQBE0oEFWiMefsAE7+h1gM052zIEAj QkqEYLFkFTxsIIjEOxGRPWiO0ttWkyQ= 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-511-EM2I-47CNBWzt9j6uEtG0g-1; Mon, 12 Oct 2020 11:35:06 -0400 X-MC-Unique: EM2I-47CNBWzt9j6uEtG0g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F4638015A8; Mon, 12 Oct 2020 15:35:04 +0000 (UTC) Received: from treble (ovpn-118-167.rdu2.redhat.com [10.10.118.167]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 34E8C60C13; Mon, 12 Oct 2020 15:35:03 +0000 (UTC) Date: Mon, 12 Oct 2020 10:35:00 -0500 From: Josh Poimboeuf To: Julien Thierry Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mbenes@suse.cz, raphael.gault@arm.com, benh@kernel.crashing.org Subject: Re: [PATCH v2 1/3] objtool: check: Fully validate the stack frame Message-ID: <20201012153500.owcyvgjv4m3t3nh3@treble> References: <20200928093631.210610-1-jthierry@redhat.com> <20200928093631.210610-2-jthierry@redhat.com> <20200929191834.7daofidv6b5aef3y@treble> <5540c2a9-db13-e05e-713c-22ec00f21aa6@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5540c2a9-db13-e05e-713c-22ec00f21aa6@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 12, 2020 at 11:21:49AM +0100, Julien Thierry wrote: > On 9/29/20 8:18 PM, Josh Poimboeuf wrote: > > "Stack frame" has more than one meaning now, I suppose. i.e. it could > > also include the callee-saved registers and any other stack space > > allocated by the function. > > > > Would "call frame" be clearer? > > > > CALL_FRAME_BP_OFFSET > > CALL_FRAME_RA_OFFSET > > > > ? > > I would've thought that the call-frame could include the stackframe + other > callee saved regs. Hm, probably so. > Whereas stackframe tends to used for the caller's frame pointer + > return address (i.e. what allows unwinding). Unless I'm getting lost > with things. I've always seen "stack frame" used to indicate the function's entire stack. > And if call frame is associated with the region starting from the stack > pointer at the parent call point (since this is what CFA is), then it > shouldn't be associated with the framepointer + return address structure > since this could be anywhere on the call frame (not at a fixed offset) as > long as the new frame pointer points to the structure. I suppose "call frame" and "stack frame" probably mean the same thing, in which case neither is appropriate here... In fact, maybe we could forget the concept of a frame (or even a struct) here. If cfa.base is CFI_BP, then is regs[CFI_BP].offset always the same as -cfa.offset? i.e. could the BP checks could it just be a simple regs[CFI_BP].offset == -cfa.offset check? And then is RA at regs[CFI_BP].offset + 8? -- Josh