Received: by 2002:a25:d80d:0:0:0:0:0 with SMTP id p13csp13057ybg; Sat, 23 May 2020 06:13:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy08FeUm9KdZ07jLaMIR4K8fxyoXABKQ5r26OS+UYALP2BswRXlzHe/YYZ77PX6F/wsxAtI X-Received: by 2002:a50:8d07:: with SMTP id s7mr3594540eds.371.1590239636043; Sat, 23 May 2020 06:13:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590239636; cv=none; d=google.com; s=arc-20160816; b=h80LaLslhKgE+EjsuWB57ihV38QBfIVRWeHLJjJ87MVyh9JupAN1Q7XZcHzyJbEVT7 Bd5S4kg6teIG8IYtp7u1rGkE5FNbe84PuznS57ISe9TMKJr4nRKBMHdQ7hq8O9Op10r9 XiVgdrXDRjs07KaDS9ERiUW9YQ/EeN9L5BJ5xZpmDoNv2CVjzEWZ6kBuX6OPtR8Tk0vH +UCzY1JP6Ewkz+83L+9VRX2aLBSMfKCIO50XCXbsVX52P8KvBOIKqHN3OhtM5jLBYzb0 CLchU0zQ1xXnqRT83EjckM0lGCQbH+hmo/AMmpTprZWCkQhmy2gprWLAI4vFE2gDK5/K 8ZsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0oDw8wrBIYN7H/FUnJ33fdVz5scUf+AdJtVvf2cHYEY=; b=0+AEh5y/RrXpNpulU3s0ab7I8PNdvAefTOdae5M1HITCEZsOTiKzSZqbaKD4eGmv3E qskSKikN7PPEWyXHlCs1Gul82smb8MPTc6BlseNXJ5PyMOOMM/L+jwAJJc5KOXazby8l VykWgAYN9B2AxSGlmxI4foI1VnfBYASDsi01B6oMJn9EA/0GAeLcmmyZYcd8/kBnvF4i KpOBqHSTY4bLBsQ8pZZwk3lA2HPtwbpjFUSlXCAgcJ0obtlRCzXYch7SLGOwTBU1dhtq bC1Xmd/2XhiFodreQC7tHi8SOWJ+TstSgxPcnGPnEqZBNhZMfRAeL1tWqmTKQ6H1hBn8 M/6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=yCdyHpiT; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dx23si6223185ejb.474.2020.05.23.06.13.31; Sat, 23 May 2020 06:13:56 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=yCdyHpiT; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731291AbgEWNLi (ORCPT + 99 others); Sat, 23 May 2020 09:11:38 -0400 Received: from merlin.infradead.org ([205.233.59.134]:54354 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728749AbgEWNLi (ORCPT ); Sat, 23 May 2020 09:11:38 -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=0oDw8wrBIYN7H/FUnJ33fdVz5scUf+AdJtVvf2cHYEY=; b=yCdyHpiTveEgCB8EtQjz5t69+Q GPk3J/Af1OJiUkj9Kz7/JcqiJuQVjsyGjYY9reXJOxXnW8QlSV8+SHaakrr5VLhhfIznucd3J8YBA lt0Ux8i3R4uJzJ27PIa9fP2BGIT0sgmmDZOLVWvmYHbfDLZbIVB7+t6vaJxpQ3813DAEMkRL90z3w AaYnY2TdF5AMUoSUo0TWOzrlEhpPCxMQryU6nosgye/JRPUr74s3Rtr+1KRzJG6B8KbYnmyi1Vhsn t3jbfAIMPxtosrUNzQ3+UYsSb9yNKv0ExoYBsfe4heET/d99YTCq4K8RZzROcK80Zuqn20e7dPvkX 7Ry5IVWQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jcTtJ-0000EO-1t; Sat, 23 May 2020 13:08:41 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id B97DF9834A3; Sat, 23 May 2020 15:08:36 +0200 (CEST) Date: Sat, 23 May 2020 15:08:36 +0200 From: Peter Zijlstra To: Lai Jiangshan Cc: Thomas Gleixner , LKML , x86@kernel.org, "Paul E. McKenney" , Andy Lutomirski , Alexandre Chartre , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , Steven Rostedt , Joel Fernandes , Boris Ostrovsky , Juergen Gross , Brian Gerst , Mathieu Desnoyers , Josh Poimboeuf , Will Deacon , Tom Lendacky , Wei Liu , Michael Kelley , Jason Chen CJ , Zhao Yakui Subject: Re: [patch V6 00/37] x86/entry: Rework leftovers and merge plan Message-ID: <20200523130836.GB2483@worktop.programming.kicks-ass.net> References: <20200518160750.GA279861@hirez.programming.kicks-ass.net> <87367xvvmy.fsf@nanos.tec.linutronix.de> <20200519083826.GC279861@hirez.programming.kicks-ass.net> <20200519090226.GD279861@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 23, 2020 at 10:52:24AM +0800, Lai Jiangshan wrote: > Hello, > > I, who don't know how does the objtool handle it, am just curious. > _begin() and _end() are symmetrical, which means if _end() (without nop) > can escape, so can _begin() in a reverse way. For example: > > noinstr void foo() > { > instrumentation_begin(); > do { > instrumentation_begin(); > ... > instrumentation_end(); > } while (cond); > bar(); > instrumentation_end(); > } > > Here, the first _begin() can be "dragged" into the do-while block. > Expectedly, objtool validation should not complain here. > > But objtool validation's not complaining means it can handle it > magically correctly (by distinguishing how many _begin()s should > be taken around the jmp target when jmp in a specific path), or > handle it by not checking if all paths have the same count onto > a jmp target (a little nervous to me), or other possible ways. No, I tihnk you're right. It could be we never hit this particular problem. Even the one described, where end leaks out, is quite rare. For instance, the last one I debgged (that led to this patch) only showed itself with gcc-9, but not with gcc-8 for example. Anyway, if we ever find the above, I'll add the NOP to begin too.