From patchwork Tue Sep 29 11:00:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 263357 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=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, 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 AD312C4741F for ; Tue, 29 Sep 2020 11:11:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 639A3221EF for ; Tue, 29 Sep 2020 11:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601377918; bh=4XE1DWf9nEaI5nkMyoVhNtkeaLmFM9LshbFKtDEupbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2O2xjcsTcW6Ap9iwLzwaWQJfTZrPUG4KhCZsmT9rPRwMyxNx2QD7v+hT+A6xTH6M6 n1K5XctW1Xf1/I9fyq+GPYO1OMvNtmPyPiI1ImGcqr+hYt21ACkp5ZO6aFP9lUmL+v iik7zLmnxkdwQCF6/I3ZMJCf1gJ3sq5j3Oq3k//k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728493AbgI2LL5 (ORCPT ); Tue, 29 Sep 2020 07:11:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:52838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729240AbgI2LLb (ORCPT ); Tue, 29 Sep 2020 07:11:31 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 58F6F21924; Tue, 29 Sep 2020 11:11:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601377880; bh=4XE1DWf9nEaI5nkMyoVhNtkeaLmFM9LshbFKtDEupbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=psfB7KjcHSf/bu6idl/YLS2BQ94msH+DJ1pOruH5v6X5Rf3wjxUojZzh8Xdy5Z3au sKpfDSn7w+dE/46c5+ntG4ASpjCSVbx7NzXl622JZ28Ae8gIVFYSNFEqn7FOUTkuoX HMXelI214tKChfUFetaIC9MMuOLqvOAJhF931wJU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Josh Poimboeuf , Borislav Petkov , Sasha Levin Subject: [PATCH 4.9 105/121] objtool: Fix noreturn detection for ignored functions Date: Tue, 29 Sep 2020 13:00:49 +0200 Message-Id: <20200929105935.386215422@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105930.172747117@linuxfoundation.org> References: <20200929105930.172747117@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 c7399d7f4bc77..31c512f19662e 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -502,7 +502,7 @@ static int add_jump_destinations(struct objtool_file *file) insn->type != INSN_JUMP_UNCONDITIONAL) continue; - if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET) + if (insn->offset == FAKE_JUMP_OFFSET) continue; rela = find_rela_by_dest_range(insn->sec, insn->offset,