From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A777C43468 for ; Mon, 21 Sep 2020 14:43:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06F1F2076E for ; Mon, 21 Sep 2020 14:43:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600699394; bh=puesQLL1vTui9u2CuuuBOVYfBiDNpon7FKU4BmliOZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=YABP5hyNMsr9yHjATrLIv2/NaO5x8r0rnVeGKZctU9mmBSZotXMNmeBMKHmA/eHjX zH/xzzrrzl0CP7G3OGdHamDE3+YXyOPMBZAw3ms9ERS7o7bTzrz2lfaq2ZT1xHs2rm T73iLs8hPKCT4u9xX/QSXaU1yTp1qy06n9eiifLc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728227AbgIUOnN (ORCPT ); Mon, 21 Sep 2020 10:43:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:49588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727696AbgIUOkv (ORCPT ); Mon, 21 Sep 2020 10:40:51 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4032A23719; Mon, 21 Sep 2020 14:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600699250; bh=puesQLL1vTui9u2CuuuBOVYfBiDNpon7FKU4BmliOZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r+r9xlfIhnq7bE0dECxqV8AH70RvFe8larUYuo6rsmUWgPOICeL5VLjKwu04tuJtP In2aXBeVgcuTN6eZeHlFvetqOe19dLYzoIopwHTgXrjICzpA74WefiBm/mEmB6/p6V NemA9UuzBgP7cFLcXYbjvp03iXVgBQ/XOTSU7MVM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Josh Poimboeuf , Linus Torvalds , Borislav Petkov , Sasha Levin Subject: [PATCH AUTOSEL 5.8 18/20] objtool: Fix noreturn detection for ignored functions Date: Mon, 21 Sep 2020 10:40:25 -0400 Message-Id: <20200921144027.2135390-18-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200921144027.2135390-1-sashal@kernel.org> References: <20200921144027.2135390-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josh Poimboeuf [ Upstream commit db6c6a0df840e3f52c84cc302cc1a08ba11a4416 ] When a function is annotated with STACK_FRAME_NON_STANDARD, objtool doesn't validate its code paths. It also skips sibling call detection within the function. But sibling call detection is actually needed for the case where the ignored function doesn't have any return instructions. Otherwise objtool naively marks the function as implicit static noreturn, which affects the reachability of its callers, resulting in "unreachable instruction" warnings. Fix it by just enabling sibling call detection for ignored functions. The 'insn->ignore' check in add_jump_destinations() is no longer needed after e6da9567959e ("objtool: Don't use ignore flag for fake jumps"). Fixes the following warning: arch/x86/kvm/vmx/vmx.o: warning: objtool: vmx_handle_exit_irqoff()+0x142: unreachable instruction which triggers on an allmodconfig with CONFIG_GCOV_KERNEL unset. Reported-by: Linus Torvalds Signed-off-by: Josh Poimboeuf Signed-off-by: Borislav Petkov Acked-by: Linus Torvalds Link: https://lkml.kernel.org/r/5b1e2536cdbaa5246b60d7791b76130a74082c62.1599751464.git.jpoimboe@redhat.com Signed-off-by: Sasha Levin --- tools/objtool/check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 5e0d70a89fb87..773e6c7ee5f93 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -619,7 +619,7 @@ static int add_jump_destinations(struct objtool_file *file) if (!is_static_jump(insn)) continue; - if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET) + if (insn->offset == FAKE_JUMP_OFFSET) continue; rela = find_rela_by_dest_range(file->elf, insn->sec, -- 2.25.1