Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp5143854pjo; Tue, 11 Feb 2020 04:49:55 -0800 (PST) X-Google-Smtp-Source: APXvYqxZwu2ogbYvLra7fOh5HcViwOKbcg5HbPWfcLZ+KulX9rMU+wLeG4gQawRJDgpeGmH7s97L X-Received: by 2002:aca:5486:: with SMTP id i128mr2658628oib.12.1581425395382; Tue, 11 Feb 2020 04:49:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581425395; cv=none; d=google.com; s=arc-20160816; b=ddij2kxUiH+6rZ0x5GvjfRX3d6xtR2Fle/sgOSQm5S+D8rLNLkI7XEVw86Jz1FXgNC 7GpxFz8P72zjRgVMDLOc5TORTaJPQwAiFzV3bVFD353TXp/1NBRsaY2Oj94x9DKPX0g/ UTs/+9N7+KmrOLbxSUtN21TzVxY0R2VpxDxM/zhtroaXoD2wFlW+TuYB1McXrgn47Vhh PcrW5m0pVnyfNPC1synrX7FskQZk50zORVZyNH4YeIAuCFqpSCbZsx9XJTh683AZUk1r Zc4+3qJcqnjE2LSGWmzXTmJDbN23bgEG3YZeAqYwlDjyv04JKSXQpstwhbv1pt5G70oM Ne8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=0E9E17bj0gXW9iM4J7Jt0C8O4TnYzw5UEr6NzhC/M98=; b=GiG4SE1Aaq30q2aHz57vqNYnJvmBII51Ic4VHAG3vzyxze7WS7ydJkqtjDDqY+YDCz ICeu5gB97DAiczlVtspiqER3d+kihvqvB9RTyMyMwgb+ine4RC8+iaD5rmzbel6erEJU gQ9ByC94dVPB1+qN4I1Go4LnkdbD+8qIMWt+IIjij7PA3XMCH6fTpatXrZFoUx++6z6s A0UAlO0Mvgcw+dyrkZJJomwXOP4cWO/Or2VOBUOsgoViji9lXD1gw/BGcOKAwq8ulxP7 3HJuzjjy/Bi+F/LSz0SOoLWTJBAhcDe3s0vK3ntBETmwoOUb2QuoduB7wssBg0+Easq+ WO2g== ARC-Authentication-Results: i=1; mx.google.com; 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 t3si1792610oig.25.2020.02.11.04.49.43; Tue, 11 Feb 2020 04:49:55 -0800 (PST) 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; 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 S1728349AbgBKMrp (ORCPT + 99 others); Tue, 11 Feb 2020 07:47:45 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:45918 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728171AbgBKMro (ORCPT ); Tue, 11 Feb 2020 07:47:44 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1j1Ux0-0007X0-Es; Tue, 11 Feb 2020 13:47:38 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 240C31C2018; Tue, 11 Feb 2020 13:47:38 +0100 (CET) Date: Tue, 11 Feb 2020 12:47:37 -0000 From: "tip-bot2 for Josh Poimboeuf" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/objtool] objtool: Add is_static_jump() helper Cc: Josh Poimboeuf , Borislav Petkov , Julien Thierry , x86 , LKML In-Reply-To: <9b8b438df918276315e4765c60d2587f3c7ad698.1581359535.git.jpoimboe@redhat.com> References: <9b8b438df918276315e4765c60d2587f3c7ad698.1581359535.git.jpoimboe@redhat.com> MIME-Version: 1.0 Message-ID: <158142525791.411.14762185239829142608.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the core/objtool branch of tip: Commit-ID: a22961409c02b93ffa7ed78f67fb57a1ba6c787d Gitweb: https://git.kernel.org/tip/a22961409c02b93ffa7ed78f67fb57a1ba6c787d Author: Josh Poimboeuf AuthorDate: Mon, 10 Feb 2020 12:32:39 -06:00 Committer: Borislav Petkov CommitterDate: Tue, 11 Feb 2020 13:36:01 +01:00 objtool: Add is_static_jump() helper There are several places where objtool tests for a non-dynamic (aka direct) jump. Move the check to a helper function. Signed-off-by: Josh Poimboeuf Signed-off-by: Borislav Petkov Reviewed-by: Julien Thierry Link: https://lkml.kernel.org/r/9b8b438df918276315e4765c60d2587f3c7ad698.1581359535.git.jpoimboe@redhat.com --- tools/objtool/check.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 796f6a1..9016ae1 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -97,14 +97,19 @@ static struct instruction *next_insn_same_func(struct objtool_file *file, for (insn = next_insn_same_sec(file, insn); insn; \ insn = next_insn_same_sec(file, insn)) +static bool is_static_jump(struct instruction *insn) +{ + return insn->type == INSN_JUMP_CONDITIONAL || + insn->type == INSN_JUMP_UNCONDITIONAL; +} + static bool is_sibling_call(struct instruction *insn) { /* An indirect jump is either a sibling call or a jump to a table. */ if (insn->type == INSN_JUMP_DYNAMIC) return list_empty(&insn->alts); - if (insn->type != INSN_JUMP_CONDITIONAL && - insn->type != INSN_JUMP_UNCONDITIONAL) + if (!is_static_jump(insn)) return false; /* add_jump_destinations() sets insn->call_dest for sibling calls. */ @@ -553,8 +558,7 @@ static int add_jump_destinations(struct objtool_file *file) unsigned long dest_off; for_each_insn(file, insn) { - if (insn->type != INSN_JUMP_CONDITIONAL && - insn->type != INSN_JUMP_UNCONDITIONAL) + if (!is_static_jump(insn)) continue; if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET) @@ -764,8 +768,7 @@ static int handle_group_alt(struct objtool_file *file, insn->ignore = orig_insn->ignore_alts; insn->func = orig_insn->func; - if (insn->type != INSN_JUMP_CONDITIONAL && - insn->type != INSN_JUMP_UNCONDITIONAL) + if (!is_static_jump(insn)) continue; if (!insn->immediate)