[PATCH v3 1/2] arm64: Implement arch_stack_walk_reliable

2025-04-05 Thread Weinan Liu
On Thu, Mar 20, 2025 at 10:16 AM Song Liu wrote: > > static __always_inline void > @@ -230,8 +231,26 @@ kunwind_next_frame_record(struct kunwind_state *state) > new_fp = READ_ONCE(record->fp); > new_pc = READ_ONCE(record->lr); > > - if (!new_fp && !new_pc) > -

Re: [PATCH 1/2] arm64: Implement arch_stack_walk_reliable

2025-03-19 Thread Weinan Liu
On Tue, Mar 18, 2025 at 10:39 PM Josh Poimboeuf wrote: > > On Tue, Mar 18, 2025 at 08:58:52PM -0700, Song Liu wrote: > > On a closer look, I think we also need some logic in unwind_find_stack() > > so that we can see when the unwinder hits the exception boundary. For > > this reason, we may still

Re: [PATCH 0/8] unwind, arm64: add sframe unwinder for kernel

2025-02-25 Thread Weinan Liu
On Tue, Feb 25, 2025 at 11:38 AM Indu Bhagat wrote: > > On Mon, Feb 10, 2025 at 12:30 AM Weinan Liu wrote: > >> I already have a WIP patch to add sframe support to the kernel module. > >> However, it is not yet working. I had trouble unwinding frames for the > >>

Re: [PATCH 0/8] unwind, arm64: add sframe unwinder for kernel

2025-02-25 Thread Weinan Liu
On Tue, Feb 25, 2025 at 10:13 AM Josh Poimboeuf wrote: > > On Tue, Feb 25, 2025 at 01:02:24AM +, Weinan Liu wrote: > > On Mon, Feb 10, 2025 at 12:30 AM Weinan Liu wrote: > > > I already have a WIP patch to add sframe support to the kernel module. > > > However

Re: [PATCH 0/8] unwind, arm64: add sframe unwinder for kernel

2025-02-24 Thread Weinan Liu
On Mon, Feb 10, 2025 at 12:30 AM Weinan Liu wrote: > I already have a WIP patch to add sframe support to the kernel module. > However, it is not yet working. I had trouble unwinding frames for the > kernel module using the current algorithm. > > Indu has likely identified the is

Re: [PATCH 0/8] unwind, arm64: add sframe unwinder for kernel

2025-02-10 Thread Weinan Liu
On Fri, Feb 7, 2025 at 4:16 AM Puranjay Mohan wrote: > > Yes, I think we should, but others people could add more to this. > > I have been testing this series with Kpatch and created a PR that works > with this unwinder: https://github.com/dynup/kpatch/pull/1439 > > For the modules, I think we n

Re: [PATCH 0/8] unwind, arm64: add sframe unwinder for kernel

2025-02-06 Thread Weinan Liu
> After some debugging this is what I found: > > devtmpfsd() calls devtmpfs_work_loop() which is marked '__noreturn' and has an > infinite loop. The compiler puts the `bl` to devtmpfs_work_loop() as the the > last instruction in devtmpfsd() and therefore on entry to > devtmpfs_work_loop(), > LR p

Re: [PATCH 4/8] unwind: Implement generic sframe unwinder library

2025-02-01 Thread Weinan Liu
On Thu, Jan 30, 2025 at 2:29 AM Prasanna Kumar T S M wrote: > On 30-01-2025 15:52, Prasanna Kumar T S M wrote: > > > > On 28-01-2025 03:03, Weinan Liu wrote: > > > This change introduces a kernel space unwinder using sframe table for > > > architect

Re: [PATCH 4/8] unwind: Implement generic sframe unwinder library

2025-02-01 Thread Weinan Liu
On Thu, Jan 30, 2025 at 2:22 AM Prasanna Kumar T S M wrote: > On 28-01-2025 03:03, Weinan Liu wrote: > > diff --git a/include/linux/sframe_lookup.h b/include/linux/sframe_lookup.h > > new file mode 100644 > > index ..1c26cf1f38d4 > > --- /dev/n

Re: [PATCH 0/8] unwind, arm64: add sframe unwinder for kernel

2025-01-28 Thread Weinan Liu
Not only does objdump show that func_start_addr all 0s, but the func_start_addr in the kernel module's sframe table is also incorrect. I'll prepare a repro so we can investigate this. > > I can share a fix for 32589 so atleast we can verify that the starting > point is sane. > Great! Thanks. This

[PATCH 8/8] arm64: Enable livepatch for ARM64

2025-01-27 Thread Weinan Liu
Since SFrame is considered as reliable stacktrace, enable livepatch in arch/arm64/Kconfig Signed-off-by: Weinan Liu --- arch/arm64/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 100570a048c5..c292bc73b65c 100644 --- a/arch/arm64

[PATCH 7/8] arm64: Define TIF_PATCH_PENDING for livepatch

2025-01-27 Thread Weinan Liu
ned-off-by: Madhavan T. Venkataraman Signed-off-by: Weinan Liu --- arch/arm64/include/asm/thread_info.h | 4 +++- arch/arm64/kernel/entry-common.c | 4 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_in

[PATCH 5/8] unwind: arm64: Add sframe unwinder on arm64

2025-01-27 Thread Weinan Liu
Add unwind_next_frame_sframe() function to unwind by sframe info. Built with GNU Binutils 2.42 to verify that this sframe unwinder can backtrace correctly on arm64. Signed-off-by: Weinan Liu --- arch/arm64/include/asm/stacktrace/common.h | 4 ++ arch/arm64/kernel/setup.c | 2

[PATCH 6/8] unwind: arm64: add reliable stacktrace support for arm64

2025-01-27 Thread Weinan Liu
unwinder Signed-off-by: Weinan Liu --- arch/arm64/include/asm/stacktrace/common.h | 2 + arch/arm64/kernel/stacktrace.c | 47 +- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/stacktrace/common.h b/arch/arm64/include/asm

[PATCH 4/8] unwind: Implement generic sframe unwinder library

2025-01-27 Thread Weinan Liu
/lkml/42c0a99236af65c09c8182e260af7bcf5aa1e158.1730150953.git.jpoim...@kernel.org/ [2] https://sourceware.org/binutils/docs/sframe-spec.html Signed-off-by: Weinan Liu --- include/linux/sframe_lookup.h | 43 kernel/Makefile | 1 + kernel/sframe_lookup.c| 196 ++ 3

[PATCH 3/8] unwind: add sframe v2 header

2025-01-27 Thread Weinan Liu
.git.jpoim...@kernel.org/ [2]: https://sourceware.org/binutils/docs/sframe-spec.html Signed-off-by: Weinan Liu --- kernel/sframe.h | 215 1 file changed, 215 insertions(+) create mode 100644 kernel/sframe.h diff --git a/kernel/sframe.h b/kernel/sframe.h

[PATCH 2/8] arm64: entry: add unwind info for various kernel entries

2025-01-27 Thread Weinan Liu
. Annotate CFI unwind info for assembly for interrupt and exception handlers. Signed-off-by: Weinan Liu --- arch/arm64/kernel/entry.S | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 5ae2a34b50bd..fe3e3e29ee5d 100644 --- a

[PATCH 0/8] unwind, arm64: add sframe unwinder for kernel

2025-01-27 Thread Weinan Liu
50953.git.jpoim...@kernel.org/ Madhavan T. Venkataraman (1): arm64: Define TIF_PATCH_PENDING for livepatch Weinan Liu (7): unwind: build kernel with sframe info arm64: entry: add unwind info for various kernel entries unwind: add sframe v2 header unwind: Implement generic sframe unwinder library

[PATCH 1/8] unwind: build kernel with sframe info

2025-01-27 Thread Weinan Liu
Use the -Wa,--gsframe flags to build the code, so GAS will generate a new .sframe section for the stack trace information. Currently, the sframe format only supports arm64 and x86_64 architectures. Add this configuration on arm64 to enable sframe unwinder in the future. Signed-off-by: Weinan Liu

Re: ARM64 Livepatch based on SFrame

2024-09-27 Thread Weinan Liu
We from Google are working on implementing SFrame unwinder for the Linux kernel, And we will be happy to collaborate with others for adding arm64 livepatch support Weinan

Re: [RFC 28/31] x86/alternative: Create symbols for special section entrie

2024-09-05 Thread Weinan Liu
I'm observing multiple compilation errors when using clang-16 after applying this particular patch. # CC init/main.o :4:1: error: symbol '__bug_table_0' is already defined __bug_table_0: ^ :4:1: error: symbol '__bug_table_0' is already defined __bug_table_0: ^ :4:1: error: symbol '__jump_tab