From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751287AbeAPPUx (ORCPT + 1 other); Tue, 16 Jan 2018 10:20:53 -0500 Received: from merlin.infradead.org ([205.233.59.134]:52640 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbeAPPUw (ORCPT ); Tue, 16 Jan 2018 10:20:52 -0500 Date: Tue, 16 Jan 2018 16:20:41 +0100 From: Peter Zijlstra To: David Woodhouse , Josh Poimboeuf Cc: linux-kernel@vger.kernel.org, Dave Hansen , Ashok Raj , Thomas Gleixner , Tim Chen , Andy Lutomirski , Linus Torvalds , Greg KH , Andrea Arcangeli , Andi Kleen , Arjan Van De Ven , Dan Williams , Paolo Bonzini , Jun Nakajima , Asit Mallick Subject: Re: [PATCH v2 10/10] objtool: More complex static jump implementation Message-ID: <20180116152041.GE2228@hirez.programming.kicks-ass.net> References: <20180116142825.376986833@infradead.org> <20180116143241.478561014@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180116143241.478561014@infradead.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tue, Jan 16, 2018 at 03:28:35PM +0100, Peter Zijlstra wrote: > +static int grow_static_blocks(struct objtool_file *file) > +{ > + struct instruction *insn; > + bool static_block = false; > + > + for_each_insn(file, insn) { > + if (!static_block && !insn->static_jump_dest) > + continue; > + > + if (insn->static_jump_dest) { > + static_block = true; > + continue; > + } > + > + if (insn->branch_target) { > + static_block = false; > + continue; > + } else switch (insn->type) { > + case INSN_JUMP_CONDITIONAL: > + case INSN_JUMP_DYNAMIC: Hmm, I think I also should have added INSN_JUMP_UNCONDITIONAL here, because the for_each_insn() iteration simply iterates through the entire file in linear order, it doesn't actually _follow_ the jumps. So this would result in code after the unconditional jump also being marked static (although very likely it ends up being a branch target and thus stops it through that). /me updates. > + case INSN_CALL: > + case INSN_CALL_DYNAMIC: > + case INSN_RETURN: > + case INSN_BUG: > + static_block = false; > + continue; > + } > + > + insn->static_jump_dest = static_block; > + } > + > + return 0; > +}