Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6555664rwl; Mon, 9 Jan 2023 09:46:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXsyOoB72KCGJjboeYVrzYjEQ42WxscT/w3SOyC8rL8Giq5/Ev5GP1F650NeGgwXD/RIr4nB X-Received: by 2002:a17:90b:8d4:b0:227:1c79:ac2b with SMTP id ds20-20020a17090b08d400b002271c79ac2bmr2969171pjb.5.1673286377541; Mon, 09 Jan 2023 09:46:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673286377; cv=none; d=google.com; s=arc-20160816; b=ExCSLVThn+Hnu/NAQGdRAuLhOS6QeyMT2YNRObzGzAkJlpH1tfP1gIVtLOCS0s0Mqu 0jtJSlRfzV0y6WUcTrShQ08Iy8u+N8vtmOvjYVA3/+fx9tVDA/yz890STM7hP57x674m 6M/ghtL8MZ3c5V2jWdGpn64RqvDxvo7fWkTtmrZJ8QQzhxfb7Cs9lggbAcUzFdA3Ez43 QEG8KIY42KTL9AjmIal9rzbg0Sp689LqyV/7F87IJL9xCel5774WrmQw1zp1EPr+xeoj v2ww5MBMfAAS4PRG22C40oPsNGwQRRX0jEGtRCNYKoFAy6C+pB/RVkMp4XSybuyxk25M bmYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=MmTEpx1rglD7bjrUm/jwfOColHcEYONm70QHf3GenQE=; b=rZb1qiwflsIoMesPOuziiHQC21EwXT7rIW4OjlePB04OAojR+t7FoQ3R/y/LbMeTYX /+EvRLYoyqutPlq6Wi1T2e+Ft6O4tJFIOwMQS9XH629f+giGOzbqAa2vnBoOGwm4UGFF t7OFPh8a19l7YqZdHmrxrYIHUEuTa7Fc5U298lQbOxB3x0CprPVN9sNFLEIJhXJrMyjT WiYpFcqdiynoUsHUF6+HTLv2jCkxjcifmNiO4NFkC2YUAind5+99DrADae43Qx0TOoMT MEveOqrucwcAKyoJNS0mGj6G8AgtdoEHoJMgLK0dAy8EJVyc6tWSZeiuLght95LF69of fcUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DCj6r5ws; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd10-20020a17090b4cca00b0022618cab553si13132993pjb.73.2023.01.09.09.46.11; Mon, 09 Jan 2023 09:46:17 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=DCj6r5ws; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235181AbjAIRCB (ORCPT + 53 others); Mon, 9 Jan 2023 12:02:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236688AbjAIRBr (ORCPT ); Mon, 9 Jan 2023 12:01:47 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E89E93DBD6; Mon, 9 Jan 2023 09:01:20 -0800 (PST) Date: Mon, 09 Jan 2023 17:01:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673283678; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MmTEpx1rglD7bjrUm/jwfOColHcEYONm70QHf3GenQE=; b=DCj6r5wsypfJH6WwaMxb2hEk3kB6Ef0xX/aFxrjpDXZBUSIDgjD0YGX0+vHQ9FThTIEE46 1Hz3RxBFTpcZ6c4W6YZWRGPzsIept9hmT/ZAN2tFKcCyEBFV8ibsvZq9lC8DGWUnGwSAaq 9Zk91fyoFTo3S3gRA4KbHS9FzjBn85ZAEF/JLkb8M/do+WM4OOC6exg9lO13U5NUrg3njA 6aaIE8j+N4kvcJxUM9AXgWYqOU3daAmIBsIUcuu6SmkDs5lh01UxFOapM6wEE6etsRvEgE XjnG+VPbc8pt7CQ7P4w+KgMvX+HJiUmaWO4M97HsustiKe0AzXvJwv3cSsYqzQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673283678; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MmTEpx1rglD7bjrUm/jwfOColHcEYONm70QHf3GenQE=; b=W/tVs/DyFQosdn+X9LEpr5YOUqiwQWGNiZ8uZrpirBKCR9M1y2mY7uTE4cQZUHgBkzsiYh qKTk9F1cFSPH98DQ== From: "tip-bot2 for Nicholas Piggin" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/urgent] objtool: Tolerate STT_NOTYPE symbols at end of section Cc: "Naveen N. Rao" , Sathvika Vasireddy , Nicholas Piggin , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221220101323.3119939-1-npiggin@gmail.com> References: <20221220101323.3119939-1-npiggin@gmail.com> MIME-Version: 1.0 Message-ID: <167328367772.4906.2873693536526803314.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 The following commit has been merged into the core/urgent branch of tip: Commit-ID: cad90e5381d840cf2296aaac9b3eff71a30b7c5b Gitweb: https://git.kernel.org/tip/cad90e5381d840cf2296aaac9b3eff71a30b7c5b Author: Nicholas Piggin AuthorDate: Tue, 20 Dec 2022 20:13:23 +10:00 Committer: Ingo Molnar CommitterDate: Mon, 09 Jan 2023 17:53:46 +01:00 objtool: Tolerate STT_NOTYPE symbols at end of section Hand-written asm often contains non-function symbols in executable sections. _end symbols for finding the size of instruction blocks for runtime processing is one such usage. optprobe_template_end is one example that causes the warning: objtool: optprobe_template_end(): can't find starting instruction This is because the symbol happens to be at the end of the file (and therefore end of a section in the object file). So ignore end-of-section STT_NOTYPE symbols instead of bailing out because an instruction can't be found. While we're here, add a more descriptive warning for STT_FUNC symbols found at the end of a section. [ This also solves a PowerPC regression reported by Sathvika Vasireddy. ] Reported-by: Naveen N. Rao Reported-by: Sathvika Vasireddy Signed-off-by: Nicholas Piggin Signed-off-by: Ingo Molnar Acked-by: Sathvika Vasireddy Link: https://lore.kernel.org/r/20221220101323.3119939-1-npiggin@gmail.com --- tools/objtool/check.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 4350be7..4b7c8b3 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -427,6 +427,15 @@ static int decode_instructions(struct objtool_file *file) if (func->type != STT_NOTYPE && func->type != STT_FUNC) continue; + if (func->offset == sec->sh.sh_size) { + /* Heuristic: likely an "end" symbol */ + if (func->type == STT_NOTYPE) + continue; + WARN("%s(): STT_FUNC at end of section", + func->name); + return -1; + } + if (func->return_thunk || func->alias != func) continue;