Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1709486ybb; Thu, 26 Mar 2020 06:02:34 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtfIwwwfAxOad0Z7F6Fk05xZ0xL8DtR2NqqTt4u/Kg0SgHFGiOIGREC/JiKlMsvROF6EfLv X-Received: by 2002:a05:6830:6:: with SMTP id c6mr5895360otp.84.1585227754306; Thu, 26 Mar 2020 06:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585227754; cv=none; d=google.com; s=arc-20160816; b=gDa8hfPDF3L9Z1IgSYZTYZZfy2eK6YI+w9V9mkp4psGwG0FOMW6l/bKSXoL4dFY1H6 Oah8JRZLrTUX/8kGzysmX9i5RZ6mFBwilZY9Yq5v70OnrT1PydNj5oLG8NqB0OSrsuKD mtq6xH79QKAiaOBaCFroXCA5pDk4iaR2TCN131SpqAHbN0O3cPLM7oiNWs/E/tyHYgX4 Vg0O1Q/WA85Bg84WblnLaG8XIaZPK8yqs9rd45n4NOxggTiOyPVROhHf380nVyPkGhSS YFVuSMQeXXWQ9EVSUpnDfyS10i8dYaK5MtJwRUXdtGJN1Jvp9bZHVzBd04fOMgNp3Wz8 eEqw== 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=zX5CImLOooaTxei3K64K8v3txt3+3BDfprveUbW7F2k=; b=QbZFSIOHWl271U0QI4BkEMVWAGzG2bvfAlTnas5X1A8jzoYtF/1lzWeaXiadH/ZArA oXAVZzRntewpl8l0R6ZkZRcLptXpvzUFPsWZMlja9qL/nE3Z38GCQGJaVylxzytoHCbh AtPJrziFKMRmyGUg+VMaagjRqmRuSgR7zqhOA+E92AGBNijUjeGsTBkxDZxWMlNi7zbW R1tRex2JpzM097YQZUKlGF7F6lZ2J6135r9dIiLzuo5yxSx0rqRZrzmjNECBLUKLFX++ LZcGInXfBYDG3DCyoP4yOUJmVVv1GNPeJ8U4Tdw9W/XR6fVnMQh62DaAEYzRhGO1uCpA DBlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (dns failure for signature) header.i=@infradead.org header.s=merlin.20170209 header.b=IfowJ9sY; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si1013423otr.16.2020.03.26.06.02.12; Thu, 26 Mar 2020 06:02:34 -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=temperror (dns failure for signature) header.i=@infradead.org header.s=merlin.20170209 header.b=IfowJ9sY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728225AbgCZNAJ (ORCPT + 99 others); Thu, 26 Mar 2020 09:00:09 -0400 Received: from merlin.infradead.org ([205.233.59.134]:39210 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbgCZNAJ (ORCPT ); Thu, 26 Mar 2020 09:00:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=zX5CImLOooaTxei3K64K8v3txt3+3BDfprveUbW7F2k=; b=IfowJ9sY6dOcIMd6zw4dRGfhH4 kTQyhH1x0iH0VHGYQW5B+PVuKchcxXl36IoKs7ysYGWe0qEmwxwMf4bciy35LlcgexeiPI15vf0sX /58j2MA4yhdT0+bH3vpVXeBbKI/ynR97lRNCm3CCluzWPb57qCiTr6p3mDRFWogupEAttYNM1cxvq liTD2tEQmLHLN9zOtZGO8blNZJFoTrLmb/iGRTMdDf3eAI2AtRjU2g3+atDI/AKjtiys7zttdEJch tVLBJVoB2En1Z+xdGOwLc/C/TYCetdd/rOkunE0OpbgBmmGNOdnlwPFOlo0YZp85gl/iKAvBAwCuG xI7VZ/Ow==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jHS7A-0001U1-32; Thu, 26 Mar 2020 13:00:04 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B8E493010C1; Thu, 26 Mar 2020 14:00:01 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A890C20413B69; Thu, 26 Mar 2020 14:00:01 +0100 (CET) Date: Thu, 26 Mar 2020 14:00:01 +0100 From: Peter Zijlstra To: tglx@linutronix.de, jpoimboe@redhat.com Cc: linux-kernel@vger.kernel.org, x86@kernel.org, mhiramat@kernel.org, mbenes@suse.cz Subject: Re: [PATCH v4 01/13] objtool: Remove CFI save/restore special case Message-ID: <20200326130001.GE20760@hirez.programming.kicks-ass.net> References: <20200325174525.772641599@infradead.org> <20200325174605.369570202@infradead.org> <20200326113049.GD20696@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200326113049.GD20696@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 26, 2020 at 12:30:50PM +0100, Peter Zijlstra wrote: > Subject: objtool: Remove CFI save/restore special case > From: Peter Zijlstra > Date: Wed Mar 25 12:58:16 CET 2020 > > There is a special case in the UNWIND_HINT_RESTORE code. When, upon > looking for the UNWIND_HINT_SAVE instruction to restore from, it finds > the instruction hasn't been visited yet, it normally issues a WARN, > except when this HINT_SAVE instruction is the first instruction of > this branch. > > The reason for this special case comes apparent when we remove it; > code like: > > if (cond) { > UNWIND_HINT_SAVE > // do stuff > UNWIND_HINT_RESTORE > } > // more stuff > > will now trigger the warning. This is because UNWIND_HINT_RESTORE is > just a label, and there is nothing keeping it inside the (extended) > basic block covered by @cond. It will attach itself to the first > instruction of 'more stuff' and we'll hit it outside of the @cond, > confusing things. > > I don't much like this special case, it confuses things and will come > apart horribly if/when the annotation needs to support nesting. > Instead extend the affected code to at least form an extended basic > block. > @@ -727,6 +727,13 @@ static inline void sync_core(void) > #else > unsigned int tmp; > > + /* > + * The trailing NOP is required to make this an extended basic block, > + * such that we can argue about it locally. Specifically this is > + * important for the UNWIND_HINTs, without this the UNWIND_HINT_RESTORE > + * can fall outside our extended basic block and objtool gets > + * (rightfully) confused. > + */ > asm volatile ( > UNWIND_HINT_SAVE > "mov %%ss, %0\n\t" > @@ -739,7 +746,7 @@ static inline void sync_core(void) > "pushq $1f\n\t" > "iretq\n\t" > UNWIND_HINT_RESTORE > - "1:" > + "1: nop\n\t" > : "=&r" (tmp), ASM_CALL_CONSTRAINT : : "cc", "memory"); Note that the special case very much relies on the HINT_SAVE being the first instruction of the (extended) basic block, which is only true in this one usage anyway.