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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF6F4C021A6 for ; Fri, 14 Feb 2025 07:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9uAjxIlbcICoCcD2/IIOD0jpMv5rXMuodA7z7Ttw2Og=; b=VBKiSpdn8+7evpHHaWec/QZrQR PIaqWM4UeSVHIVXlpOsCBV9nurCvrZ4IDCKz+SmnuZesduwNtW8EJeb+BgUOHK4EcVDYCJrCvJQNH niTo7aD5fCOQ77CIi+9xq3+5kmAL6fj/KbdObzGyAG7Ef6fl5Zb0Gk+MEu58sEbDUysfgr+vL7Kku sady+o1/XnJ8uJoNj0n1urrnru4Hlc01YS5Jm8h45iQydiqABJZvaNPtrPnbc9aYCz2ZhbXwKgPJO 1PJ70GVb83ySYwtTv8EyjyO0l979XCILkygHd92lUI8tobje6qyKsfs24QuoMsHzij300GVOFLsKd vbzAzL1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tiqbl-0000000E1z8-2s3u; Fri, 14 Feb 2025 07:59:33 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tiqaK-0000000E1qn-1RlY for linux-arm-kernel@lists.infradead.org; Fri, 14 Feb 2025 07:58:05 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id AA8E05C5417; Fri, 14 Feb 2025 07:57:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80737C4CED1; Fri, 14 Feb 2025 07:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739519882; bh=d3Ys6i0pcHC4QJ9ezhAppBA19L0NecIOEu/6ko+SHUg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=LRYL1LKIIgSuex9GsqyripdUVEEnfE32XtoUYWVHfqL/q8yrz2okT5sl4Fq6+SlOt 3Vie9hJEh7jAeH1O1gxyo9IrUaTNXNWoLBgIzCqYe4n8UHtxcPwj3Rw6cYEE6GMqO6 hkpGk7rcLe1H6ZUG6eqAYLu+BHPAMTGfSny25GHDUGF3PYVhlZzZ9UyFtazDffgjby rLR8l2PzMr+Et4sRI+RV9+E+xEkhRsKjwPZZJfixBSUphKWAFy1wwUHNPZZhN5Okgw rzRS0iIEjRFvTaVF+/Hnvr7a69uZiv+dMbzsWohH+5v8aKA4bLeeBC7HfFQ5hoXUfl 1Ypmidf6UO8jg== From: Puranjay Mohan To: Indu Bhagat , Song Liu , Josh Poimboeuf Cc: Weinan Liu , Steven Rostedt , Peter Zijlstra , Mark Rutland , roman.gushchin@linux.dev, Will Deacon , Ian Rogers , linux-toolchains@vger.kernel.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, joe.lawrence@redhat.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 0/8] unwind, arm64: add sframe unwinder for kernel In-Reply-To: <3069bb9c-6245-4754-a187-ac8253103d32@oracle.com> References: <20250127213310.2496133-1-wnliu@google.com> <20250212234946.yuskayyu4gx3ul7m@jpoimboe> <20250213024507.mvjkalvyqsxihp54@jpoimboe> <3069bb9c-6245-4754-a187-ac8253103d32@oracle.com> Date: Fri, 14 Feb 2025 07:57:47 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250213_235804_497613_01B9C765 X-CRM114-Status: GOOD ( 22.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Indu Bhagat writes: > On 2/12/25 11:25 PM, Song Liu wrote: >> On Wed, Feb 12, 2025 at 6:45=E2=80=AFPM Josh Poimboeuf wrote: >>> >>> On Wed, Feb 12, 2025 at 06:36:04PM -0800, Song Liu wrote: >>>>>> [ 81.261748] copy_process+0xfdc/0xfd58 [livepatch_special_static] >>>>> >>>>> Does that copy_process+0xfdc/0xfd58 resolve to this line in >>>>> copy_process()? >>>>> >>>>> refcount_inc(¤t->signal->sigcnt); >>>>> >>>>> Maybe the klp rela reference to 'current' is bogus, or resolving to t= he >>>>> wrong address somehow? >>>> >>>> It resolves the following line. >>>> >>>> p->signal->tty =3D tty_kref_get(current->signal->tty); >>>> >>>> I am not quite sure how 'current' should be resolved. >>> >>> Hm, on arm64 it looks like the value of 'current' is stored in the >>> SP_EL0 register. So I guess that shouldn't need any relocations. >>> >>>> The size of copy_process (0xfd58) is wrong. It is only about >>>> 5.5kB in size. Also, the copy_process function in the .ko file >>>> looks very broken. I will try a few more things. >>=20 >> When I try each step of kpatch-build, the copy_process function >> looks reasonable (according to gdb-disassemble) in fork.o and >> output.o. However, copy_process looks weird in livepatch-special-static.= o, >> which is generated by ld: >>=20 >> ld -EL -maarch64linux -z norelro -z noexecstack >> --no-warn-rwx-segments -T ././kpatch.lds -r -o >> livepatch-special-static.o ./patch-hook.o ./output.o >>=20 >> I have attached these files to the email. I am not sure whether >> the email server will let them through. >>=20 >> Indu, does this look like an issue with ld? >>=20 > > Sorry for the delay. > > Looks like there has been progress since and issue may be elsewhere, but: > > FWIW, I looked at the .sframe and .rela.sframe sections here, the data=20 > does look OK. I noted that there is no .sframe for copy_process () in=20 > output.o... I will take a look into it. Hi Indu, I saw another issue in my kernel build with sframes enabled (-Wa,--gsframe): ld: warning: orphan section `.init.sframe' from `arch/arm64/kernel/pi/lib-f= dt.pi.o' being placed in section `.init.sframe' [... Many more similar warnings (.init.sframe) ...] So, this orphan sections is generated in the build process. I am using GNU ld version 2.41-50 and gcc (GCC) 11.4.1 Is this section needed for sframes to work? or can we discard .init.sframe section with a patch like following to the linker script: =2D- 8< -- diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index 6a437bd08..8e704c0a6 100644 =2D-- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -1044,9 +1044,16 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROP= ELLER_CLANG) # define SANITIZER_DISCARDS #endif +#if defined(CONFIG_SFRAME_UNWIND_TABLE) +#define DISCARD_INIT_SFRAME *(.init.sframe) +#else +#define DISCARD_INIT_SFRAME +#endif + #define COMMON_DISCARDS = \ SANITIZER_DISCARDS \ PATCHABLE_DISCARDS \ + DISCARD_INIT_SFRAME \ *(.discard) \ *(.discard.*) \ *(.export_symbol) \ =2D- >8 -- Thanks, Puranjay --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIoEARYKADIWIQQ3wHGvVs/5bdl78BKwwPkjG3B2nQUCZ673fRQccHVyYW5qYXlA a2VybmVsLm9yZwAKCRCwwPkjG3B2ne/eAQC3MvMRgb8+tzHOKgUa02OQ8qhh8Qda ugo9amOhQSojUwEA/O95Eq3WPvdzumKfUGDoCSjxPWA9E0HeESbhvVIuIAw= =Qfo9 -----END PGP SIGNATURE----- --=-=-=--