Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp459962imi; Fri, 22 Jul 2022 02:52:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sViQpRg2RbXPdViNKv37ktyzepafePu8Z2elHZ7sbw7/uKlzFZjt0Cb0JP6h0Y1jE4xLtj X-Received: by 2002:a05:6a00:a26:b0:528:9831:d935 with SMTP id p38-20020a056a000a2600b005289831d935mr2585866pfh.25.1658483559828; Fri, 22 Jul 2022 02:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658483559; cv=none; d=google.com; s=arc-20160816; b=WZ6v1jqKvDTALgsLATvmj8zZjh73KSw1IcIAitMPLH9q/MTWr2Iv4k1oKxsmZWmUPx QPwARohz+QyV8Hf4AsZripqJsj1nVDXbUrfPeqyBlICoeEes6TKGI+47DQivjrlNQgjG UxF2yDdczyR14ita/6TX3GUfgI8wtImvXf5Pn67aM8Zbf2qCOn+yF1asKj4wr6PiWXMK 6Cdabx2pQk1aEHjuz7pKcte7XJ2ckBkVxYjeSVJRiiL4duziXcayizA3+3+GMxA/eShs h4AFSjt8nZnaOxIQEjyhYtPNIT1A1QI75U0LUDdQZ0TrxASeVLXygK1ROUvUfkGEo/BA sv2w== 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=52HskmozrVShifAKZjgxxJjnhVQ51BvsZBPmVxops0k=; b=ZB9v1ufo1B2HTSdDJLfaXLg+QW1PFofaXWWFW0WpgqBdNT+Px82R0Beu4s1ZLBq7FG bZs/NXfbKS2og73njARcfoXNTW+oG2VSw0dZ6ElQUQV4vzVlkf1W/r784W5zHJvGTD2H t1Chl9OmYYT10bh1VOIhWKiWuAS7C5rrVgMelImAoUn4emDUkks3GmjWrQRS1h5y7SgW Zq31zSaU4qgol5K/BEXZ69iktWXcB+DsQJymntZjq98TH1GX7GappHwZFcU7Goc5hA9h vyQYeDmWptsyGDdnuR9I1bgUzlcqvu03Hdxc/I4JynYY+IMn8YzkM7in28vTxB+jUram zPKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vR4Q7Wzk; 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 v202-20020a6361d3000000b0041a0a9d7ca0si5307185pgb.646.2022.07.22.02.52.25; Fri, 22 Jul 2022 02:52:39 -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=vR4Q7Wzk; 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 S235875AbiGVJVI (ORCPT + 99 others); Fri, 22 Jul 2022 05:21:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236053AbiGVJUg (ORCPT ); Fri, 22 Jul 2022 05:20:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BA549A6A0; Fri, 22 Jul 2022 02:13: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 ams.source.kernel.org (Postfix) with ESMTPS id E51B4B827C9; Fri, 22 Jul 2022 09:13:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48E4FC341C7; Fri, 22 Jul 2022 09:13:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658481229; bh=kSgwTRsllFILj+qKMFsmLtIGbXkCDdd8/3UJkSJqtAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vR4Q7WzkX/zcF7rJ68DNnHMhAwFSQKtDOyVa3EOHnjijGN2nCeds9ER3k63k6U5+Z 9xvHqD/xoRxeEr/V82hf/QchW0aiDikgohzNbcOgrEgxcUCjn21wj75L5TC6Y0bRur AerY7kMcmUYLzyrSFl/ZujSl4JgHN+jDlMKSO5v8= 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 Subject: [PATCH 5.15 21/89] objtool: Default ignore INT3 for unreachable Date: Fri, 22 Jul 2022 11:10:55 +0200 Message-Id: <20220722091134.557824731@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220722091133.320803732@linuxfoundation.org> References: <20220722091133.320803732@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.8 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 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: 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 @@ -2965,9 +2965,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); } @@ -3014,9 +3013,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); } @@ -3187,7 +3185,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; /*