From nobody Tue Sep 29 02:02:56 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 CFAC946984E; Thu, 13 Aug 2026 11:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786619799; cv=none; b=SWcBYp0hS6zw/UISfQ+p3G+D8p9PaNIEsMtz2CLPpUW/MSnug+7aRACaac4FjozXOATz7AjaBvMVDt4wh3WKNYeroSwfsnHYpEKDlqzoP76SLlu1M3LErlX/jOpZ260qPFJ5TKjcJf3U6OpE4cYNKgB4LBLoDp7SiWAL87I9xk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786619799; c=relaxed/simple; bh=osMhj2TPX7Yb3gSHwZiuEp4xcDcW9BOGWbcT7acXyd0=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=ZcstxHjCBnU7Q53L0GBMlQGlslvq8XgWIcalC8TFXKMTn0/+X4ETc281/ZoHWifYMoL8ive0eca26cfFrCxir0CfwTHvcHUFhoUiK79M15KjWnMrrB6wk+EuBjwux/5qJ2Z6KDZ5heAw1kw+kHFuQ1yr/KkK41gfoRJ5VGaodog= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=CBjc6P6V; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=228AP8wp; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="CBjc6P6V"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="228AP8wp" Date: Thu, 13 Aug 2026 11:16:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786619791; 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=hHuHNIFK3dAkicvD5GLqELnCZBfYGOzKp4Y0G/+AmcY=; b=CBjc6P6VKlAT2ICUI6S+3It6nXh6fF8zuM9qvd87K917Xvd5W8SfiIOwHoHXiSPYnF5QSf B871G+z5IFocp+2wpuiNw5alb4lbXkdJwVm0WMTccszMWB7tezsmrhsr7TQBNyMN3rl/LP r7WECSdTsF7JrHZlBH7QgP5ChvMvORCeZRveAml748rTOGpiIolFDHu9G21m/OtQ3478uf DNyYPh5oLMpRScbqL2F8Qi4xVlqQFaNCASSrhJpH7l3B+hlGYnHs7wEmtA5I1lKhYVBmLS iUMvQhLeBlm49Sg2pKnIGgEDpB2NT73exCwo3gUJv1tK/9TLUeSSkkKqlL6+JQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786619791; 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=hHuHNIFK3dAkicvD5GLqELnCZBfYGOzKp4Y0G/+AmcY=; b=228AP8wpin/+/tEV0W12MWMN/CRihRwomXkhW7cSfzD/iRnvjtbB4eD9HErJHI+3Z8jPLe QoiBMwV4pFP3rUAQ== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool/klp: Explicitly disallow patching or referencing init code/data Cc: Joe Lawrence , Song Liu , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <516e14f84cfbffa27dc19d3dcf35097504097966.1786138493.git.jpoimboe@kernel.org> References: <516e14f84cfbffa27dc19d3dcf35097504097966.1786138493.git.jpoimboe@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178661978962.442315.11868212051508442735.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the objtool/core branch of tip: Commit-ID: 69f361b8a7a2f65c1bb236ea0899cdaad7267653 Gitweb: https://git.kernel.org/tip/69f361b8a7a2f65c1bb236ea0899cdaad= 7267653 Author: Josh Poimboeuf AuthorDate: Fri, 07 Aug 2026 14:37:49 -07:00 Committer: Josh Poimboeuf CommitterDate: Tue, 11 Aug 2026 16:10:38 -07:00 objtool/klp: Explicitly disallow patching or referencing init code/data Explicitly disallow the patching and referencing of init code/data. Otherwise it could potentially introduce some odd edge cases depending on whether the target object's init section has been freed yet (note that the init code still exists in the target module when doing late module patching). Such edge cases include sympos calculation and the patching and/or referencing of non-existent (init-freed) code/data. Not to mention the inherent differences in behavior that occur when the init code is only patched *some* of the time depending on module loading order or kernel config. Acked-by: Joe Lawrence Acked-by: Song Liu Link: https://patch.msgid.link/516e14f84cfbffa27dc19d3dcf35097504097966.178= 6138493.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf --- tools/objtool/klp-sympos.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/objtool/klp-sympos.c b/tools/objtool/klp-sympos.c index bbfae51..dfca9dd 100644 --- a/tools/objtool/klp-sympos.c +++ b/tools/objtool/klp-sympos.c @@ -367,6 +367,11 @@ static unsigned long find_vmlinux_sympos(struct symbol= *sym) return sympos; } =20 +static bool is_init_sym(struct symbol *sym) +{ + return strstarts(sym->sec->name, ".init"); +} + /* * "sympos" is used by livepatch to disambiguate duplicate symbol names. */ @@ -376,6 +381,11 @@ unsigned long klp_find_sympos(struct elf *elf, struct = symbol *sym) bool has_dup =3D false; struct symbol *s; =20 + if (is_init_sym(sym)) { + ERROR("%s: can't patch or reference init code/data", sym->name); + return ULONG_MAX; + } + if (sym->bind !=3D STB_LOCAL) return 0; =20