Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1786244ybt; Mon, 15 Jun 2020 09:20:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA0/pR5ZXKqjKN2Qic6UJBtiVVLTrUT5kJnBWqF7+8lqFN+dCREs82HpZApbGknjhs/0ad X-Received: by 2002:aa7:dc50:: with SMTP id g16mr25461788edu.318.1592238042812; Mon, 15 Jun 2020 09:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592238042; cv=none; d=google.com; s=arc-20160816; b=scFy1nRRPc8wB9IkftSDxbEAZaxXXRAPOcCCl+GdCjAf3WOQqDVWSbDD4L1CIqX5Ek 4ERflqp6NG7ZjuL3ldRL32Qd9YCAEAb2EKerOJtMDUwNMIJ4RrG6KXhr5TmlgeTIoO7Q 2LVz1k2U7/c/hMavWgGVmHbfmMSjV0hIvB5tGu2IgDqEAha7dDneSZXLfe+Hzs20SWrh 1BqwTEyGUXIa1WshXd7KNLwFpIIyAShSWRzQhjSdMaWBRJ13b9hqODBnUay+1GjcPoDl EBCChz7BMDd80gZ3WwvkVzV1lUzeX3JnH7OD4OAsJd5OXbA7N4nmFJHNhy1JzJTVeBBl XYww== 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=p6GnmDUPB8eMnYJNSFAMEf26+Raf9w/fxd1XfSZxDoY=; b=lYCZf6/JzOKz7xXe1N7pK10A1tQ69GNSyPJfXddEJubMVo9uBT8Swd3H1qQaHSbHKB PidKch0Hrsi72yYeVoWLcasqkh6XvxzFCZ2eo5+fC4N0xzBNX0jdLmdU6aUypR5gs0KO 4ZO5nu0OYJ9UaLck9yElYaaJ+yiZ21OJMBCWjwTVdEFEPDSPtn0ywdI6d8gtQjCvo8Jm edv+6WCm1YDUVsHRT76O1uI4MEYK+zTMQUzsR+YRu4U2Xbk6+KCkWVfXIijh1QNrfK8i 2nmdyxR3W2b0wrly9/ANlVTxw80uhgIIqpDAMTyZsgxOEoRIAWlj1+4kPUN/QBfKsuqz E3MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=s0E9pLYT; 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 nh4si9179948ejb.339.2020.06.15.09.20.18; Mon, 15 Jun 2020 09:20: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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=s0E9pLYT; 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 S1731010AbgFOQR5 (ORCPT + 99 others); Mon, 15 Jun 2020 12:17:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727785AbgFOQR4 (ORCPT ); Mon, 15 Jun 2020 12:17:56 -0400 Received: from merlin.infradead.org (unknown [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2181FC061A0E for ; Mon, 15 Jun 2020 09:17:56 -0700 (PDT) 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=p6GnmDUPB8eMnYJNSFAMEf26+Raf9w/fxd1XfSZxDoY=; b=s0E9pLYTDbXguSDj/n9DW5BHvf 7a++E+yu6QSGls201Iv5kblUQhKYyssCNWSYC+uTa1KIyZi22W0KkE2+tLhyZVlw1OYZ4dw1YnFe0 DAGEynY8Nv0KyLOQx0eWUacKKeO/4Q76QmbHDjCThlUfOGwa5/F89Uqae5StvhO1Fv5w3NN5DD93p Xk1o3mgg2nrS3iHSEpHJ3v0HKJR6lh3McR9kF8FrpOfmsG9f3Vjh0H5ljwsyJE6j2LLJ/p0o0/GgF 5WOlf86aX584vxSBLpwrazoEWvwL6VjkHJ6LaNjX721l6HDHD7MQ28i8xIahVnmMXRhhinHVbWjYX 7sErih+w==; 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 1jkrnQ-0000j3-Ln; Mon, 15 Jun 2020 16:17:16 +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 643CB301A32; Mon, 15 Jun 2020 18:17:13 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 1A87720BCADEE; Mon, 15 Jun 2020 18:17:13 +0200 (CEST) Date: Mon, 15 Jun 2020 18:17:13 +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: <20200615161713.GH2554@hirez.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> <20200523130836.GB2483@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200523130836.GB2483@worktop.programming.kicks-ass.net> 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 03:08:36PM +0200, Peter Zijlstra wrote: > 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. FYI, I just found one, I'll be making instrumentation_begin() a NOP too.