From nobody Wed Dec 17 01:25:17 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A4831EF084 for ; Mon, 24 Mar 2025 21:56:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742853384; cv=none; b=SUZTt4OsNIt2dpsJrZHZ1uNWrVxeJHftbn4udHvIsQZkisXIOFN/CARKpyACZ+W5QSuriUOVQsGboX8O6xr1EPOBqtaO18ynk7hDBsIPzkj/lFv7SqzD8ioP0aZqXTUj9qT0iJ76aDotCQ9vQcpx3R0EI2QzpLvBWBxFZDMm0RE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742853384; c=relaxed/simple; bh=uc7Pk6gShU8z9EP+FaeNJKnbU7Tk2Rys/5jL1sospsc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nAs+6+RnQd5ov3Z0IkknTYYA4VNAD8FWCGXmDsnNMBPdtqVffhHzukcBOpCwFK2SK1CrbrcHhH1Dc94O0G45hD7qC6PEakpRg7HgIrDsGob5i7HE3w79uArRsbXUm0TlKmfLp5sEqZFKhRxmT3VSnPpockYWI28PnHRJO1O9gL0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ohOrKSOF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ohOrKSOF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA3EAC4CEF2; Mon, 24 Mar 2025 21:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742853384; bh=uc7Pk6gShU8z9EP+FaeNJKnbU7Tk2Rys/5jL1sospsc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ohOrKSOFm9abZ+QWHS356IUANj2s4DgA+rXbj7gbNU71B6QYSHjV/WxC+j9CMDEqT LedqdkjnoSv903r77BXkRJpIRrK5Bm/BnkaK7n5VMxzQsEtOG8XCr6yx2+G+pff2b5 LsuGwnWC5tO9QrnTudTLDwRH1wB4dSsu6xsAbJpjwjqy5I6f4I9BmEd8fwn6XU+upa uR7eVzX6XFZ/bOkb1DVPiaq6qCsJFI3pjGLNL5BBY6JO/kM4arr/aoiBQL+lE90XS7 W7k0U2hxI2j8BkcO1yA0VIcF2AMRdsDM/w2w4yb1ftdzq895KF2PTAL9MWWur1JAik jip2bDU8lphOA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Miroslav Benes , Brendan Jackman , Nathan Chancellor Subject: [PATCH 06/22] objtool: Fix init_module() handling Date: Mon, 24 Mar 2025 14:55:56 -0700 Message-ID: <366bfdbe92736cde9fb01d5d3eb9b98e9070a1ec.1742852846.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If IBT is enabled and a module uses the deprecated init_module() magic function name rather than module_init(fn), its ENDBR will get removed, causing an IBT failure during module load. Objtool does print an obscure warning, but then does nothing to either correct it or return an error. Improve the usefulness of the warning and return an error so it will at least fail the build with CONFIG_OBJTOOL_WERROR. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index bac88ca82dec..8edb7044f7fc 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -828,8 +828,11 @@ static int create_ibt_endbr_seal_sections(struct objto= ol_file *file) if (opts.module && sym && sym->type =3D=3D STT_FUNC && insn->offset =3D=3D sym->offset && (!strcmp(sym->name, "init_module") || - !strcmp(sym->name, "cleanup_module"))) - WARN("%s(): not an indirect call target", sym->name); + !strcmp(sym->name, "cleanup_module"))) { + WARN("%s(): Magic init_module() function name is deprecated, use module= _init(fn) instead", + sym->name); + return -1; + } =20 if (!elf_init_reloc_text_sym(file->elf, sec, idx * sizeof(int), idx, --=20 2.48.1