From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 CA917534462; Tue, 8 Sep 2026 12:17:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788869870; cv=none; b=QCyJZeFYx3N/0yZneQUDCcLCnOb86zWSWI6DKMOkf2YLup+6/bHrr9ObtOJsS1KvDzyanHJkzvf/bDFC0LiuJD/4QaOcu96U3XitYBcq+mDh4HHkXR9OmFxpKMu5M/sPLzE2smfxVIeY0AbMp9zyinQqcQwTdph3IGJdP+DhwAk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788869870; c=relaxed/simple; bh=EXeq2Vr4raOiZ6OTjTJiqOmAisF7v3kfahVm62okJuQ=; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Date: Message-Id; b=iXyYASuNHsuhlzEsDn3F2N3SS2KJoKsj11c1OioiXxS3GnX0q3fe7GShyus9Adbvystj7c/3aUvDKNtx4y9bjKezNuV1ScTc10d7cDzvztTA9tahGLHIimfSgdHHbxYGgBKADxWQ+E7vmVmV8hT5iFpkvV0zdSE9/K0BMPhkrFM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CBiTsBlS; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CBiTsBlS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81D641F00A3A; Tue, 8 Sep 2026 12:17:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788869865; bh=85eHNuaIk7Vu2t/8lRxCE/ArYUXA4/mGVgZwVAYWVUA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=CBiTsBlSix4Le45A7BLnLjAhkJkx07Kmr8/jmFtjOVwzhWPHFI2i4NsP/VvnGITXr 0M0ndYLvrjZlMIM4Q9ERrF3AD/mUIMekCd56IuhRIsz7C+QfyXiFBPkPh+Q/7flHnR MVVStRI6zP+nzwXD7eqR4aU8z7I05sHzKdxvXNrMjCcJqfh2vhnnNcwl9t7hlXsZqE rbxIhxqL3ohm63JwXAVYqey4HS03ZwRCRa2kvyNBSJTQCJL2XbAGuQWEkvyS0ioH/Q YQZTksW/jyAePIuHiJrXB3rJOLDmOGrJ0h/llhD4mcOYWc8B1ZoVlFk6wNGGFGKi5k XgwgPy32+RHJA== From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 1/5] livepatch: Fail object initialization on duplicate patched function Reply-To: sashiko-reviews@lists.linux.dev To: "Petr Mladek" , "Harry Hsu" , joe.lawrence@redhat.com, mbenes@suse.cz, jpoimboe@kernel.org Cc: song@kernel.org, shuah@kernel.org, live-patching@vger.kernel.org, jikos@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260908120325.299649-2-pmladek@suse.com> References: <20260908120325.299649-1-pmladek@suse.com> <20260908120325.299649-2-pmladek@suse.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 08 Sep 2026 12:17:44 +0000 Message-Id: <20260908121744.81D641F00A3A@smtp.kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [High] Atomic replace patches will fail to load if previous patches targe= ted aliased functions. -- commit e5553650270f93e11fe885d264a3829802223d3a Author: Harry Hsu livepatch: Fail object initialization on duplicate patched function This commit introduces a check to prevent patching multiple aliases of a function within a single livepatch. It fails object initialization if alias= es resolving to the same address are detected. > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > index a240d1144e89c..a6762cbe74b70 100644 > --- a/kernel/livepatch/core.c > +++ b/kernel/livepatch/core.c [ ... ] > @@ -885,6 +885,21 @@ static int klp_init_object_loaded(struct klp_patch *= patch, > if (ret) > return ret; > =20 > + /* > + * Aliased symbols share one address, so they would resolve to > + * the same klp_ops and stack up on a single ops->func_stack, > + * leaving the redirection ambiguous. > + */ > + klp_for_each_func(obj, prev_func) { > + if (prev_func =3D=3D func) > + break; > + if (prev_func->old_func =3D=3D func->old_func) { > + pr_err("'%s' and '%s' resolve to the same address, aliased symbols a= re not supported\n", > + prev_func->old_name, func->old_name); > + return -EINVAL; [Severity: High] Will this check inadvertently reject nop functions generated by an atomic replace patch when previous patches targeted aliased functions? If previously loaded livepatches targeted aliased functions (for example, o= ne patch targets __do_sys_fork and another targets __x64_sys_fork), they were permitted since they resided in different patches. When an atomic replace patch is loaded, klp_add_nops() loops over all previously patched functions and adds nops for them to the new patch. Since nop deduplication is based on old_name, nops for both aliases are added. Later, this check in klp_init_object_loaded() resolves their addresses and finds duplicate old_func addresses. This causes the initialization to fail with -EINVAL, which prevents the system from atomically replacing existing livepatches and might force a reboot if the old patches cannot be safely disabled manually. > + } > + } > + > ret =3D kallsyms_lookup_size_offset((unsigned long)func->old_func, --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260908120325.2996= 49-1-pmladek@suse.com?part=3D1