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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 BAADDC5518A for ; Wed, 22 Apr 2020 10:38:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 89EE32073A for ; Wed, 22 Apr 2020 10:38:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587551924; bh=YTEsb73itkQL/bKAHc2dPoNzxc5Vsey7cfT5do3YXzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=UAk9HUzUX62h5CbTX2795TS6Wn4YCaxcCVnwZV8gwdALNFm0t0gxtpq7LKGbrzp4X A9Yo+tHKRRwZwqfJ8tVccbq7xssBfnENz03u5o6e7vKtT7Eyq3Is0eyJ+QKg8a0WEq Tpv3w+hgEp2MOmLzF0OYqwEY2En2nQsEtIAU4Fo8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731485AbgDVKin (ORCPT ); Wed, 22 Apr 2020 06:38:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:58114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729810AbgDVKVl (ORCPT ); Wed, 22 Apr 2020 06:21:41 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 BDF022076E; Wed, 22 Apr 2020 10:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587550901; bh=YTEsb73itkQL/bKAHc2dPoNzxc5Vsey7cfT5do3YXzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oA/W6tgAy2tYmwrZqAe07gVNyTWrac5Coev7ISNWC7uak+E/+5b8qZboahFT1F5BX bTNRE8ksWJtKYdnUMze4vIJO4PiId0XHPHTj7Nmb0Xj4O+Wwi2MMW0GYIdHnrAIbR8 mVkE0xODQxJpoaXN9HwOQwJDX015EjyFQl+Ci/Bg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Poimboeuf , Borislav Petkov , Miroslav Benes , "Peter Zijlstra (Intel)" Subject: [PATCH 5.6 003/166] objtool: Fix switch table detection in .text.unlikely Date: Wed, 22 Apr 2020 11:55:30 +0200 Message-Id: <20200422095048.339759418@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200422095047.669225321@linuxfoundation.org> References: <20200422095047.669225321@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Josh Poimboeuf commit b401efc120a399dfda1f4d2858a4de365c9b08ef upstream. If a switch jump table's indirect branch is in a ".cold" subfunction in .text.unlikely, objtool doesn't detect it, and instead prints a false warning: drivers/media/v4l2-core/v4l2-ioctl.o: warning: objtool: v4l_print_format.cold()+0xd6: sibling call from callable instruction with modified stack frame drivers/hwmon/max6650.o: warning: objtool: max6650_probe.cold()+0xa5: sibling call from callable instruction with modified stack frame drivers/media/dvb-frontends/drxk_hard.o: warning: objtool: init_drxk.cold()+0x16f: sibling call from callable instruction with modified stack frame Fix it by comparing the function, instead of the section and offset. Fixes: 13810435b9a7 ("objtool: Support GCC 8's cold subfunctions") Signed-off-by: Josh Poimboeuf Signed-off-by: Borislav Petkov Reviewed-by: Miroslav Benes Acked-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/157c35d42ca9b6354bbb1604fe9ad7d1153ccb21.1585761021.git.jpoimboe@redhat.com Signed-off-by: Greg Kroah-Hartman --- tools/objtool/check.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1011,10 +1011,7 @@ static struct rela *find_jump_table(stru * it. */ for (; - &insn->list != &file->insn_list && - insn->sec == func->sec && - insn->offset >= func->offset; - + &insn->list != &file->insn_list && insn->func && insn->func->pfunc == func; insn = insn->first_jump_src ?: list_prev_entry(insn, list)) { if (insn != orig_insn && insn->type == INSN_JUMP_DYNAMIC)