Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2368795pxa; Mon, 3 Aug 2020 14:36:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPwA8YRS2AivJSnwaPJ3VFOc5l6TaY4XiEoFUj0qLYlfzT/kEaPrRkplcbsFb3FlyJkKHN X-Received: by 2002:aa7:dc44:: with SMTP id g4mr17812631edu.273.1596490605108; Mon, 03 Aug 2020 14:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596490605; cv=none; d=google.com; s=arc-20160816; b=f5nyU20pDEOWIg0Xlddmc0ogBY+LB6f5I8kWxDOunxfkJ03YiB5N2Hlns+VnxY8e/R 4n7WlDN8BI2wvcLHVVu/cAEz0b0Iozc4BnJ4XaZMfnWxhd+fwGlyPnVsucJZkNDgFc7/ 4Ro7A+a7+VKzTlHHs31QfVNaKkhHsZGVZ+fk5YkU30kRPWU1u39Wb/ckAD77NpypJy3J GtLwzy9NYqlapv/ZwTysFmNN0fyCQlipSvfduCPIf4qa/NW2nc26hPAZnaeGmpOpk7v2 bB1tMwnYX5dmADt3Z512zi7Jv0GRnVG7jKpaBdpHuGCiPIH6ZACBUZJzDTQio78svzhM SqZg== 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=h9SfcHvrVL171F/TlYWZMH1j+qEEwI65V+nQH+ZI8OI=; b=oNBpzsotXlOAqDaGG15nRGg8A/LiGzldYTsjnQB8ecwvzIhetkFenDeklX8da/KITu WcZpZ4rcplprrMdtEOX5Z2QS3GjCqg3SNPddF/edecLo0RjYnM3OpRYIFeSQFeHI15YL azG28LefjJCNAWdLnup04x1IYSC520V54FaM3F+m43qNE5ptds/a6QufjxMAlxGffpEo boQMjXvcb1pRAnuZXaNQ2LJp7Ze+mFP1p6bsZOGYMS+fstGaC7yQGXY1/TJSA+dZPqj+ jOXQjBM8wzd6HEYiU59Oqru7f1fQN0lViSPJxXpXLU2hTtLMZUD8zpEuzygBvw0Qph67 LAbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fd80tP7v; 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 i2si10975798ejg.240.2020.08.03.14.36.22; Mon, 03 Aug 2020 14:36:45 -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=fd80tP7v; 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 S1728419AbgHCVfl (ORCPT + 99 others); Mon, 3 Aug 2020 17:35:41 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:43727 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726130AbgHCVfl (ORCPT ); Mon, 3 Aug 2020 17:35:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596490539; 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=h9SfcHvrVL171F/TlYWZMH1j+qEEwI65V+nQH+ZI8OI=; b=fd80tP7v3GkjZcCFPypC3GF9cb0hcUpx/k0L4MBEYhx6AW9yCR1HLYo7URaMvJndXXmFLt FST9f/duYdzv0VqYq/40eaZb5IFhIU1kMJSS6q/pZHTl7ziKe4Wbv70MvQw2NI3cMhjuUY jyT+7ZrhK0mFBI+5LeuKT6/ANWt3oDg= 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-393-oS980i_sNsq8l8S3ZEG_Zw-1; Mon, 03 Aug 2020 17:35:38 -0400 X-MC-Unique: oS980i_sNsq8l8S3ZEG_Zw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 95425102C7ED; Mon, 3 Aug 2020 21:35:36 +0000 (UTC) Received: from treble (ovpn-113-147.rdu2.redhat.com [10.10.113.147]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BE6AB5C6D9; Mon, 3 Aug 2020 21:35:32 +0000 (UTC) Date: Mon, 3 Aug 2020 16:35:29 -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 9/9] objtool: Abstract unwind hint reading Message-ID: <20200803213506.hlbpdlitom7sjtqo@treble> References: <20200730094652.28297-1-jthierry@redhat.com> <20200730094652.28297-10-jthierry@redhat.com> <20200730150341.udqnykbw7yfsjvin@treble> <1a078563-001d-c666-d2f5-9291f0efd35a@redhat.com> <20200731140441.cpzr4lrlkcrmoz2c@treble> <6a314dba-4086-717b-d226-6c292240a3e9@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <6a314dba-4086-717b-d226-6c292240a3e9@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 03, 2020 at 01:13:14PM +0100, Julien Thierry wrote: > > > On 7/31/20 3:04 PM, Josh Poimboeuf wrote: > > On Fri, Jul 31, 2020 at 08:00:58AM +0100, Julien Thierry wrote: > > > > > + cfa->offset = hint->sp_offset; > > > > > + insn->cfi.hint_type = hint->type; > > > > > + insn->cfi.end = hint->end; > > > > > + > > > > > + insn->cfi.sp_only = hint->type == ORC_TYPE_REGS || hint->type == ORC_TYPE_REGS_IRET; > > > > > > > > What does "sp" mean here in sp_only? > > > > > > > > > > Stack pointer, like in CFI_SP. When objtool encounters one of these hints, > > > it starts to only track the stack frame with the stack pointer (no BP, no > > > drap register, no move to temporary registers). Just trying to make some > > > sense of this corner case. > > > > I think that's not quite right, because ORC_TYPE_CALL could also be > > "sp_only" in some cases, by that definition. > > > > But in that case the code will still track when/if the CFI becomes pointed > to by BP. > > > The call to update_cfi_state_regs() is really regs-specific, not > > sp-specific. > > > > I must admit I don't really understand what "regs" is and why exactly such > an exception in stack state tracking is made where only operations to SP are > taken into account. "regs" is a special type of stack frame, usually for asm entry code, where the frame is actually an instance of 'struct pt_regs'. So if there's a variable associated it with it, maybe it should have "regs" in the name. Though I think non-x86 arches will also have regs frames, so would it make sense to just make the unwind hint types a global multiarch thing? They could be renamed to UNWIND_HINT_TYPE_REGS{_PARTIAL}. Then there wouldn't really be a need for the "sp_only" thing. -- Josh