Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3051imw; Tue, 12 Jul 2022 13:19:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vAdGV4rbxwahro9eROICGsOie2jbprjWdeEv/rSalQhBdll0rUzJ15CuYVOPCyH6Yti1Lh X-Received: by 2002:a63:9b0a:0:b0:406:8c31:47e6 with SMTP id r10-20020a639b0a000000b004068c3147e6mr21811301pgd.329.1657657185038; Tue, 12 Jul 2022 13:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657657185; cv=none; d=google.com; s=arc-20160816; b=osYibVxRt8WBWKjoDGDP3Dcsg30znkrdCel1wgzxIYBZ7hVj0b5o0FmxDXD4sl3sAo Q7/YQRjc1TLVsC06D4AiUc6eMYrLNtkAr8vOT6mcgcmis4iCA9BOkcusMYC1ArzP0gQx dig24MTQVvUWhxeKS6YYMJGSxNbEHVXKZZ1wuVuJrRuGqbpoWOYmKREfbdSr9VaxTIHr iuw/yFi6LQZRCL0NilfwXH9XgWOaXBPS2CwwUb/pkyZQMJ61u0mPkt2deq7pwex7atcW HJU2/TOp7GEyapQ7sX9/6jXpKPLo2QnAc7qX4xisq4OIu/4d/IwsmVLPh+yBC/2WGi/V NJdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gR7+vHsEVWHIQQnWa0m61uAP1dr92aSlWiKeSIm54RM=; b=BFZzbn1/z8bwbIHX3jKWB8ik9E7etC4FOP6LpJtDMEUwCyRGInQLKJziJ1ppDkO+Hw o2i3Vvzl1cT+OcP1ViN/VqEj0HpRTm+IOlESKeupRUJpflMi5UVZ+Mw/yS3Apbbt2dZC 84bbXdgSMQ5z9icaRxwI74AIapoSWAQ9BQEviImT9SjCAABswiVNeTHYPHcEMUGkF6V1 x9+/rsHgy9vIXFCtBRh26W2Xl1M958wVWMY4lCTBXZmMM0ms0zbIIveuj8fZGuc92LJE kxLhATsvK2nsXgVj1W9K2Q5+V8rnIPwr3QCCohPfid8l0IAqv+zVPXpijtTt5Vnz6QDQ VMWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DRihz+ph; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a17090311c400b0016a2bfe5c7csi19158457plh.172.2022.07.12.13.19.28; Tue, 12 Jul 2022 13:19:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DRihz+ph; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234596AbiGLSuC (ORCPT + 99 others); Tue, 12 Jul 2022 14:50:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234643AbiGLStZ (ORCPT ); Tue, 12 Jul 2022 14:49:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D2B3C3AEB; Tue, 12 Jul 2022 11:43:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DE33F61B10; Tue, 12 Jul 2022 18:43:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC013C3411C; Tue, 12 Jul 2022 18:43:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657651417; bh=a3uaGNTJRCN1AZgQunj5sehXg5YFviJZKOEKcHUEBxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DRihz+phm4Pfw3W1/roWFuuchHDUkWDmQZCM1W4rXX4N0/CPlr8pQKs71ErHgusAu AP/JDpl3qXWDPWQTsn4y8QIMaWqhi7zIBJT/YTs9Uh7L3T2DV/HEhbl6P7SakBB0pv fStefQrFI1vAud+NYG7RIDJx9nEhzzBBTwnNhYVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Josh Poimboeuf , Thadeu Lima de Souza Cascardo , Ben Hutchings Subject: [PATCH 5.10 069/130] objtool: Default ignore INT3 for unreachable Date: Tue, 12 Jul 2022 20:38:35 +0200 Message-Id: <20220712183249.644325479@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220712183246.394947160@linuxfoundation.org> References: <20220712183246.394947160@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra commit 1ffbe4e935f9b7308615c75be990aec07464d1e7 upstream. Ignore all INT3 instructions for unreachable code warnings, similar to NOP. This allows using INT3 for various paddings instead of NOPs. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Josh Poimboeuf Link: https://lore.kernel.org/r/20220308154317.343312938@infradead.org Signed-off-by: Thadeu Lima de Souza Cascardo Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- tools/objtool/check.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2775,9 +2775,8 @@ static int validate_branch(struct objtoo switch (insn->type) { case INSN_RETURN: - if (next_insn && next_insn->type == INSN_TRAP) { - next_insn->ignore = true; - } else if (sls && !insn->retpoline_safe) { + if (sls && !insn->retpoline_safe && + next_insn && next_insn->type != INSN_TRAP) { WARN_FUNC("missing int3 after ret", insn->sec, insn->offset); } @@ -2824,9 +2823,8 @@ static int validate_branch(struct objtoo break; case INSN_JUMP_DYNAMIC: - if (next_insn && next_insn->type == INSN_TRAP) { - next_insn->ignore = true; - } else if (sls && !insn->retpoline_safe) { + if (sls && !insn->retpoline_safe && + next_insn && next_insn->type != INSN_TRAP) { WARN_FUNC("missing int3 after indirect jump", insn->sec, insn->offset); } @@ -2997,7 +2995,7 @@ static bool ignore_unreachable_insn(stru int i; struct instruction *prev_insn; - if (insn->ignore || insn->type == INSN_NOP) + if (insn->ignore || insn->type == INSN_NOP || insn->type == INSN_TRAP) return true; /*