Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3201420pxk; Mon, 21 Sep 2020 07:45:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkgmSjyXG76etUYxBc5psH03UU1P1K1//9LLM02dKu2CPnAkTmTLU70OvzyinUpHRm/RuG X-Received: by 2002:a17:906:7116:: with SMTP id x22mr51547395ejj.426.1600699505149; Mon, 21 Sep 2020 07:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600699505; cv=none; d=google.com; s=arc-20160816; b=eCbCFcdYBGX+ny7vD+jbHPMGZTRET0UEjg1mA3ZcGUnrZjAhmcymCJfaLnRF7sxNcY HPcwaVxYJWqmj/cYBUh2S0NES7FZfCPlkz7lOFqEYpRlGDOexkFnxg3AyED82cxI8U6k 7UPvjDAfxcdqmWPR1QJzZ1GcDbYpVRM9hPDMmrvyvc4qcVPVNpOJsAcWEJ6N31+CwgiR h4PmaWkNqmdICXxbDOI6T83UQw/VXYJW2WvQ8Q/Tn39FQOJx20rF8yaL5ZZPKtTrPQYj pYRfI353Z4mM/vfQeRiFxCnJBmVqy6Di5fSeDexWPXuzqd4IOVdia57KIpHpb56C54sT qchw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Zy6P1kucHV9llXrgVdA5cfEKUHZ5pA4eWOqTeq9mTUM=; b=KTrGIHLF8WuI07T2uialOxeWRG3pKDBcfhfL5ekOH0QpS/VCUDGA9bjO0brq8aZHMf K6i/8TvVTs3s1YaRKgkEKvQfLHVp+sk6FDvEd2kpV4lyUv2NZjen7gWnH8xH0biOkE4j ZgHKYqs5ovWPJ6RBnypgSCv7HM9rVOFxJWQG4yrak3IsLG8UOlp9Zh+xqsc0q9WNSel6 lHq0tTn1y34T8ohKulg0OQM9q67Se3ZAhldez2EC5W+Hpxml0GpfYqmbAR4vk8tSk7XD 8vnz7WfRhI2o7JLJAyYnJIgeunifKkYyFSL6blZot7vm4Fpm1xYYV2w++P7kE+wGR9LT DiLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JPugEoKD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si8352194eds.533.2020.09.21.07.44.39; Mon, 21 Sep 2020 07:45:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JPugEoKD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728176AbgIUOmi (ORCPT + 99 others); Mon, 21 Sep 2020 10:42:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:50386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728003AbgIUOlO (ORCPT ); Mon, 21 Sep 2020 10:41:14 -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 28412235F8; Mon, 21 Sep 2020 14:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600699273; bh=kdHRcq3EG9jPL5PimFZc3zEHwD/Gj7kxr/jNsQtN2ac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JPugEoKDMht9+G1iVU5w+g9usRgHK9C3uUk7X+4bG6NEXfBg5AbIFPjxvzm6Rq01i l8TFLg9F1Q7SWn1FrYKJSKEpLz+NfyIvWJcqloo3EU4qGiPsb/Kw/1meReTTPHd7Y5 DSOP6oQojowvv7Z0IIpfDWwD2pHKqe7YRtj8P3PI= 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.4 15/15] objtool: Fix noreturn detection for ignored functions Date: Mon, 21 Sep 2020 10:40:54 -0400 Message-Id: <20200921144054.2135602-15-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200921144054.2135602-1-sashal@kernel.org> References: <20200921144054.2135602-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 48b234d8f251e..1b7e748170e54 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -556,7 +556,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, -- 2.25.1