From nobody Tue Jun 30 13:54:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BA92C4332F for ; Mon, 17 Jan 2022 14:56:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239691AbiAQO42 (ORCPT ); Mon, 17 Jan 2022 09:56:28 -0500 Received: from linux.microsoft.com ([13.77.154.182]:59402 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239064AbiAQO40 (ORCPT ); Mon, 17 Jan 2022 09:56:26 -0500 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id DF10920B9132; Mon, 17 Jan 2022 06:56:24 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DF10920B9132 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1642431385; bh=rhBHT4pWL2EtwnMnXHgdH8kKNewQrrrjf2uA0J7NbA8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nzZvszMwzJPT/hLbYHnUV+wx3gVYk8YiVpdlSWKnEYVEkPOL6BXk0LyNvI53jiIRX HAtLP1HZ/n2AuOxl9SG6RP+sKkBrQOovtM/JaZITY4DP0pVsyU3EcVVVpa9vHX9crB sprEvRzK63heR62MevwiNV04lF9xlOO0Kf74QCqA= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, madvenka@linux.microsoft.com Subject: [PATCH v13 01/11] arm64: Remove NULL task check from unwind_frame() Date: Mon, 17 Jan 2022 08:55:58 -0600 Message-Id: <20220117145608.6781-2-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117145608.6781-1-madvenka@linux.microsoft.com> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220117145608.6781-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Madhavan T. Venkataraman" Currently, there is a check for a NULL task in unwind_frame(). It is not needed since all current consumers pass a non-NULL task. Signed-off-by: Madhavan T. Venkataraman Reviewed-by: Mark Brown Reviewed-by: Mark Rutland --- arch/arm64/kernel/stacktrace.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index 0fb58fed54cb..5f5bb35b7b41 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -69,9 +69,6 @@ static int notrace unwind_frame(struct task_struct *tsk, unsigned long fp =3D frame->fp; struct stack_info info; =20 - if (!tsk) - tsk =3D current; - /* Final frame; nothing to unwind */ if (fp =3D=3D (unsigned long)task_pt_regs(tsk)->stackframe) return -ENOENT; --=20 2.25.1 From nobody Tue Jun 30 13:54:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07A95C433FE for ; Mon, 17 Jan 2022 14:56:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240158AbiAQO4d (ORCPT ); Mon, 17 Jan 2022 09:56:33 -0500 Received: from linux.microsoft.com ([13.77.154.182]:59428 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234410AbiAQO41 (ORCPT ); Mon, 17 Jan 2022 09:56:27 -0500 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id DF0C020B9134; Mon, 17 Jan 2022 06:56:25 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DF0C020B9134 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1642431386; bh=nCGfF1Ec543gDZX90i0Wj4ykW5t8sYcF+sNVLRaM38M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mkFciEK9/fF7l/P0E9YH87kZ2BjkgwDOzGA7nToGLvMs+qGXslobneuM6UmiQoIF9 /5Ll9sKjwo6N+VLz7OfrFkykyLLDngPS+w/XvzUSGqbtPzIDDxBzs1urDo8Itv/OY9 ctWoNs6RKGtHiW/IF9ptI6OBAOMPTR5MAj9hYnKs= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, madvenka@linux.microsoft.com Subject: [PATCH v13 02/11] arm64: Rename unwinder functions Date: Mon, 17 Jan 2022 08:55:59 -0600 Message-Id: <20220117145608.6781-3-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117145608.6781-1-madvenka@linux.microsoft.com> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220117145608.6781-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Madhavan T. Venkataraman" Rename unwinder functions for consistency and better naming. - Rename start_backtrace() to unwind_init(). - Rename unwind_frame() to unwind_next(). - Rename walk_stackframe() to unwind(). Signed-off-by: Madhavan T. Venkataraman Reviewed-by: Mark Brown Reviewed-by: Mark Rutland --- arch/arm64/kernel/stacktrace.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index 5f5bb35b7b41..b980d96dccfc 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -33,8 +33,8 @@ */ =20 =20 -static void start_backtrace(struct stackframe *frame, unsigned long fp, - unsigned long pc) +static void unwind_init(struct stackframe *frame, unsigned long fp, + unsigned long pc) { frame->fp =3D fp; frame->pc =3D pc; @@ -45,7 +45,7 @@ static void start_backtrace(struct stackframe *frame, uns= igned long fp, /* * Prime the first unwind. * - * In unwind_frame() we'll check that the FP points to a valid stack, + * In unwind_next() we'll check that the FP points to a valid stack, * which can't be STACK_TYPE_UNKNOWN, and the first unwind will be * treated as a transition to whichever stack that happens to be. The * prev_fp value won't be used, but we set it to 0 such that it is @@ -63,8 +63,8 @@ static void start_backtrace(struct stackframe *frame, uns= igned long fp, * records (e.g. a cycle), determined based on the location and fp value o= f A * and the location (but not the fp value) of B. */ -static int notrace unwind_frame(struct task_struct *tsk, - struct stackframe *frame) +static int notrace unwind_next(struct task_struct *tsk, + struct stackframe *frame) { unsigned long fp =3D frame->fp; struct stack_info info; @@ -104,7 +104,7 @@ static int notrace unwind_frame(struct task_struct *tsk, =20 /* * Record this frame record's values and location. The prev_fp and - * prev_type are only meaningful to the next unwind_frame() invocation. + * prev_type are only meaningful to the next unwind_next() invocation. */ frame->fp =3D READ_ONCE_NOCHECK(*(unsigned long *)(fp)); frame->pc =3D READ_ONCE_NOCHECK(*(unsigned long *)(fp + 8)); @@ -137,23 +137,23 @@ static int notrace unwind_frame(struct task_struct *t= sk, =20 return 0; } -NOKPROBE_SYMBOL(unwind_frame); +NOKPROBE_SYMBOL(unwind_next); =20 -static void notrace walk_stackframe(struct task_struct *tsk, - struct stackframe *frame, - bool (*fn)(void *, unsigned long), void *data) +static void notrace unwind(struct task_struct *tsk, + struct stackframe *frame, + bool (*fn)(void *, unsigned long), void *data) { while (1) { int ret; =20 if (!fn(data, frame->pc)) break; - ret =3D unwind_frame(tsk, frame); + ret =3D unwind_next(tsk, frame); if (ret < 0) break; } } -NOKPROBE_SYMBOL(walk_stackframe); +NOKPROBE_SYMBOL(unwind); =20 static bool dump_backtrace_entry(void *arg, unsigned long where) { @@ -195,14 +195,14 @@ noinline notrace void arch_stack_walk(stack_trace_con= sume_fn consume_entry, struct stackframe frame; =20 if (regs) - start_backtrace(&frame, regs->regs[29], regs->pc); + unwind_init(&frame, regs->regs[29], regs->pc); else if (task =3D=3D current) - start_backtrace(&frame, + unwind_init(&frame, (unsigned long)__builtin_frame_address(1), (unsigned long)__builtin_return_address(0)); else - start_backtrace(&frame, thread_saved_fp(task), + unwind_init(&frame, thread_saved_fp(task), thread_saved_pc(task)); =20 - walk_stackframe(task, &frame, consume_entry, cookie); + unwind(task, &frame, consume_entry, cookie); } --=20 2.25.1 From nobody Tue Jun 30 13:54:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08926C433EF for ; Mon, 17 Jan 2022 14:56:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240230AbiAQO4f (ORCPT ); Mon, 17 Jan 2022 09:56:35 -0500 Received: from linux.microsoft.com ([13.77.154.182]:59440 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239681AbiAQO42 (ORCPT ); Mon, 17 Jan 2022 09:56:28 -0500 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id E010F20B9135; Mon, 17 Jan 2022 06:56:26 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E010F20B9135 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1642431387; bh=nykp3rs0XOpcYsBECMARYtst/Pmw64LTMHHGbXbr7fw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=X/f4piblahRnpO/bFO0TFzeeJdHFGpkBh1gvuTCd5N6lgMdNSbYXVKsXL9LXxEZix k9bjN4XwB6G9SzpsGocydGkLUTG7UTplRvYHFgVKXWkzyJDSwRRkbIkeTQlatkLyLO gDmKc0zUseDl1/8FdlsDP/wnoXRG9aPeVGMxjtwY= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, madvenka@linux.microsoft.com Subject: [PATCH v13 03/11] arm64: Rename stackframe to unwind_state Date: Mon, 17 Jan 2022 08:56:00 -0600 Message-Id: <20220117145608.6781-4-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117145608.6781-1-madvenka@linux.microsoft.com> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220117145608.6781-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Madhavan T. Venkataraman" Rename "struct stackframe" to "struct unwind_state" for consistency and better naming. Accordingly, rename variable/argument "frame" to "state". Signed-off-by: Madhavan T. Venkataraman Reviewed-by: Mark Brown Reviewed-by: Mark Rutland --- arch/arm64/include/asm/stacktrace.h | 2 +- arch/arm64/kernel/stacktrace.c | 66 ++++++++++++++--------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/arch/arm64/include/asm/stacktrace.h b/arch/arm64/include/asm/s= tacktrace.h index e77cdef9ca29..41ec360515f6 100644 --- a/arch/arm64/include/asm/stacktrace.h +++ b/arch/arm64/include/asm/stacktrace.h @@ -52,7 +52,7 @@ struct stack_info { * associated with the most recently encountered replacement= lr * value. */ -struct stackframe { +struct unwind_state { unsigned long fp; unsigned long pc; DECLARE_BITMAP(stacks_done, __NR_STACK_TYPES); diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index b980d96dccfc..a1a7ff93b84f 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -33,13 +33,13 @@ */ =20 =20 -static void unwind_init(struct stackframe *frame, unsigned long fp, +static void unwind_init(struct unwind_state *state, unsigned long fp, unsigned long pc) { - frame->fp =3D fp; - frame->pc =3D pc; + state->fp =3D fp; + state->pc =3D pc; #ifdef CONFIG_KRETPROBES - frame->kr_cur =3D NULL; + state->kr_cur =3D NULL; #endif =20 /* @@ -51,9 +51,9 @@ static void unwind_init(struct stackframe *frame, unsigne= d long fp, * prev_fp value won't be used, but we set it to 0 such that it is * definitely not an accessible stack address. */ - bitmap_zero(frame->stacks_done, __NR_STACK_TYPES); - frame->prev_fp =3D 0; - frame->prev_type =3D STACK_TYPE_UNKNOWN; + bitmap_zero(state->stacks_done, __NR_STACK_TYPES); + state->prev_fp =3D 0; + state->prev_type =3D STACK_TYPE_UNKNOWN; } =20 /* @@ -64,9 +64,9 @@ static void unwind_init(struct stackframe *frame, unsigne= d long fp, * and the location (but not the fp value) of B. */ static int notrace unwind_next(struct task_struct *tsk, - struct stackframe *frame) + struct unwind_state *state) { - unsigned long fp =3D frame->fp; + unsigned long fp =3D state->fp; struct stack_info info; =20 /* Final frame; nothing to unwind */ @@ -79,7 +79,7 @@ static int notrace unwind_next(struct task_struct *tsk, if (!on_accessible_stack(tsk, fp, 16, &info)) return -EINVAL; =20 - if (test_bit(info.type, frame->stacks_done)) + if (test_bit(info.type, state->stacks_done)) return -EINVAL; =20 /* @@ -95,27 +95,27 @@ static int notrace unwind_next(struct task_struct *tsk, * stack to another, it's never valid to unwind back to that first * stack. */ - if (info.type =3D=3D frame->prev_type) { - if (fp <=3D frame->prev_fp) + if (info.type =3D=3D state->prev_type) { + if (fp <=3D state->prev_fp) return -EINVAL; } else { - set_bit(frame->prev_type, frame->stacks_done); + set_bit(state->prev_type, state->stacks_done); } =20 /* * Record this frame record's values and location. The prev_fp and * prev_type are only meaningful to the next unwind_next() invocation. */ - frame->fp =3D READ_ONCE_NOCHECK(*(unsigned long *)(fp)); - frame->pc =3D READ_ONCE_NOCHECK(*(unsigned long *)(fp + 8)); - frame->prev_fp =3D fp; - frame->prev_type =3D info.type; + state->fp =3D READ_ONCE_NOCHECK(*(unsigned long *)(fp)); + state->pc =3D READ_ONCE_NOCHECK(*(unsigned long *)(fp + 8)); + state->prev_fp =3D fp; + state->prev_type =3D info.type; =20 - frame->pc =3D ptrauth_strip_insn_pac(frame->pc); + state->pc =3D ptrauth_strip_insn_pac(state->pc); =20 #ifdef CONFIG_FUNCTION_GRAPH_TRACER if (tsk->ret_stack && - (frame->pc =3D=3D (unsigned long)return_to_handler)) { + (state->pc =3D=3D (unsigned long)return_to_handler)) { unsigned long orig_pc; /* * This is a case where function graph tracer has @@ -123,16 +123,16 @@ static int notrace unwind_next(struct task_struct *ts= k, * to hook a function return. * So replace it to an original value. */ - orig_pc =3D ftrace_graph_ret_addr(tsk, NULL, frame->pc, - (void *)frame->fp); - if (WARN_ON_ONCE(frame->pc =3D=3D orig_pc)) + orig_pc =3D ftrace_graph_ret_addr(tsk, NULL, state->pc, + (void *)state->fp); + if (WARN_ON_ONCE(state->pc =3D=3D orig_pc)) return -EINVAL; - frame->pc =3D orig_pc; + state->pc =3D orig_pc; } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ #ifdef CONFIG_KRETPROBES - if (is_kretprobe_trampoline(frame->pc)) - frame->pc =3D kretprobe_find_ret_addr(tsk, (void *)frame->fp, &frame->kr= _cur); + if (is_kretprobe_trampoline(state->pc)) + state->pc =3D kretprobe_find_ret_addr(tsk, (void *)state->fp, &state->kr= _cur); #endif =20 return 0; @@ -140,15 +140,15 @@ static int notrace unwind_next(struct task_struct *ts= k, NOKPROBE_SYMBOL(unwind_next); =20 static void notrace unwind(struct task_struct *tsk, - struct stackframe *frame, + struct unwind_state *state, bool (*fn)(void *, unsigned long), void *data) { while (1) { int ret; =20 - if (!fn(data, frame->pc)) + if (!fn(data, state->pc)) break; - ret =3D unwind_next(tsk, frame); + ret =3D unwind_next(tsk, state); if (ret < 0) break; } @@ -192,17 +192,17 @@ noinline notrace void arch_stack_walk(stack_trace_con= sume_fn consume_entry, void *cookie, struct task_struct *task, struct pt_regs *regs) { - struct stackframe frame; + struct unwind_state state; =20 if (regs) - unwind_init(&frame, regs->regs[29], regs->pc); + unwind_init(&state, regs->regs[29], regs->pc); else if (task =3D=3D current) - unwind_init(&frame, + unwind_init(&state, (unsigned long)__builtin_frame_address(1), (unsigned long)__builtin_return_address(0)); else - unwind_init(&frame, thread_saved_fp(task), + unwind_init(&state, thread_saved_fp(task), thread_saved_pc(task)); =20 - unwind(task, &frame, consume_entry, cookie); + unwind(task, &state, consume_entry, cookie); } --=20 2.25.1 From nobody Tue Jun 30 13:54:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3AB4C43217 for ; Mon, 17 Jan 2022 14:56:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240268AbiAQO4i (ORCPT ); Mon, 17 Jan 2022 09:56:38 -0500 Received: from linux.microsoft.com ([13.77.154.182]:59462 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239743AbiAQO43 (ORCPT ); Mon, 17 Jan 2022 09:56:29 -0500 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id E01FE20B9137; Mon, 17 Jan 2022 06:56:27 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E01FE20B9137 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1642431388; bh=iltLKVcth/w3lsN6QiNX6zEGsWq02EiMywUsEzd+d2M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=iWhhFPx637qzAF3ITigRhhH+CktW3lAtlGV+dBWjbpWnRabUxsnwV7e7QblUUF6L3 VenP3F4tnqMpYQslpDCFb3RmflP1hMfWQk0Kf5AJTBkOSpIIQpQJ41Io+9fuuuEKHU ahFGTNjGC6+b9sj7iq/VPMgOdynTd5luwbD/cKQk= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, madvenka@linux.microsoft.com Subject: [PATCH v13 04/11] arm64: Split unwind_init() Date: Mon, 17 Jan 2022 08:56:01 -0600 Message-Id: <20220117145608.6781-5-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117145608.6781-1-madvenka@linux.microsoft.com> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220117145608.6781-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Madhavan T. Venkataraman" unwind_init() is currently a single function that initializes all of the unwind state. Split it into the following functions and call them appropriately: - unwind_init_from_regs() - initialize from regs passed by caller. - unwind_init_from_current() - initialize for the current task from the caller of arch_stack_walk(). - unwind_init_from_task() - initialize from the saved state of a task other than the current task. In this case, the other task must not be running. This is done for two reasons: - the different ways of initializing are clear - specialized code can be added to each initializer in the future. Signed-off-by: Madhavan T. Venkataraman Reviewed-by for this? I will fix the comments on the next send. --- arch/arm64/kernel/stacktrace.c | 54 +++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index a1a7ff93b84f..b2b568e5deba 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -33,11 +33,8 @@ */ =20 =20 -static void unwind_init(struct unwind_state *state, unsigned long fp, - unsigned long pc) +static void unwind_init_common(struct unwind_state *state) { - state->fp =3D fp; - state->pc =3D pc; #ifdef CONFIG_KRETPROBES state->kr_cur =3D NULL; #endif @@ -56,6 +53,46 @@ static void unwind_init(struct unwind_state *state, unsi= gned long fp, state->prev_type =3D STACK_TYPE_UNKNOWN; } =20 +/* + * TODO: document requirements here. + */ +static inline void unwind_init_from_regs(struct unwind_state *state, + struct pt_regs *regs) +{ + unwind_init_common(state); + + state->fp =3D regs->regs[29]; + state->pc =3D regs->pc; +} + +/* + * TODO: document requirements here. + * + * Note: this is always inlined, and we expect our caller to be a noinline + * function, such that this starts from our caller's caller. + */ +static __always_inline void unwind_init_from_current(struct unwind_state *= state) +{ + unwind_init_common(state); + + state->fp =3D (unsigned long)__builtin_frame_address(1); + state->pc =3D (unsigned long)__builtin_return_address(0); +} + +/* + * TODO: document requirements here. + * + * The caller guarantees that the task is not running. + */ +static inline void unwind_init_from_task(struct unwind_state *state, + struct task_struct *task) +{ + unwind_init_common(state); + + state->fp =3D thread_saved_fp(task); + state->pc =3D thread_saved_pc(task); +} + /* * Unwind from one frame record (A) to the next frame record (B). * @@ -195,14 +232,11 @@ noinline notrace void arch_stack_walk(stack_trace_con= sume_fn consume_entry, struct unwind_state state; =20 if (regs) - unwind_init(&state, regs->regs[29], regs->pc); + unwind_init_from_regs(&state, regs); else if (task =3D=3D current) - unwind_init(&state, - (unsigned long)__builtin_frame_address(1), - (unsigned long)__builtin_return_address(0)); + unwind_init_from_current(&state); else - unwind_init(&state, thread_saved_fp(task), - thread_saved_pc(task)); + unwind_init_from_task(&state, task); =20 unwind(task, &state, consume_entry, cookie); } --=20 2.25.1 From nobody Tue Jun 30 13:54:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B152C433EF for ; Mon, 17 Jan 2022 14:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240185AbiAQO4l (ORCPT ); Mon, 17 Jan 2022 09:56:41 -0500 Received: from linux.microsoft.com ([13.77.154.182]:59472 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239896AbiAQO4a (ORCPT ); Mon, 17 Jan 2022 09:56:30 -0500 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id E00A120B9138; Mon, 17 Jan 2022 06:56:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E00A120B9138 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1642431389; bh=HZJdhCECd6gjD/mxDs8WLqHpl5qu7cQyOQ3KiJ9KXYU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nP/zzg3esa0VcP74oi3KabpAsDkeUAmwCdd3XX795VVJNrJJOrkjrEG+ip0EYSTX0 VZirOXFdgxuMxMdw1phY5C/akDYDFDy498xDaCgkr2uw3fYghmIRmcpSHRmR0/P6W9 wsbOySuf6qIH11D3mw1x/v/qLW86O76WdcdKtStM= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, madvenka@linux.microsoft.com Subject: [PATCH v13 05/11] arm64: Copy the task argument to unwind_state Date: Mon, 17 Jan 2022 08:56:02 -0600 Message-Id: <20220117145608.6781-6-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117145608.6781-1-madvenka@linux.microsoft.com> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220117145608.6781-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Madhavan T. Venkataraman" Copy the task argument passed to arch_stack_walk() to unwind_state so that it can be passed to unwind functions via unwind_state rather than as a separate argument. The task is a fundamental part of the unwind state. Signed-off-by: Madhavan T. Venkataraman --- arch/arm64/include/asm/stacktrace.h | 3 +++ arch/arm64/kernel/stacktrace.c | 29 ++++++++++++++++------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/arch/arm64/include/asm/stacktrace.h b/arch/arm64/include/asm/s= tacktrace.h index 41ec360515f6..af423f5d7ad8 100644 --- a/arch/arm64/include/asm/stacktrace.h +++ b/arch/arm64/include/asm/stacktrace.h @@ -51,6 +51,8 @@ struct stack_info { * @kr_cur: When KRETPROBES is selected, holds the kretprobe instance * associated with the most recently encountered replacement= lr * value. + * + * @task: Pointer to the task structure. */ struct unwind_state { unsigned long fp; @@ -61,6 +63,7 @@ struct unwind_state { #ifdef CONFIG_KRETPROBES struct llist_node *kr_cur; #endif + struct task_struct *task; }; =20 extern void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk, diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index b2b568e5deba..1b32e55735aa 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -33,8 +33,10 @@ */ =20 =20 -static void unwind_init_common(struct unwind_state *state) +static void unwind_init_common(struct unwind_state *state, + struct task_struct *task) { + state->task =3D task; #ifdef CONFIG_KRETPROBES state->kr_cur =3D NULL; #endif @@ -57,9 +59,10 @@ static void unwind_init_common(struct unwind_state *stat= e) * TODO: document requirements here. */ static inline void unwind_init_from_regs(struct unwind_state *state, + struct task_struct *task, struct pt_regs *regs) { - unwind_init_common(state); + unwind_init_common(state, task); =20 state->fp =3D regs->regs[29]; state->pc =3D regs->pc; @@ -71,9 +74,10 @@ static inline void unwind_init_from_regs(struct unwind_s= tate *state, * Note: this is always inlined, and we expect our caller to be a noinline * function, such that this starts from our caller's caller. */ -static __always_inline void unwind_init_from_current(struct unwind_state *= state) +static __always_inline void unwind_init_from_current(struct unwind_state *= state, + struct task_struct *task) { - unwind_init_common(state); + unwind_init_common(state, task); =20 state->fp =3D (unsigned long)__builtin_frame_address(1); state->pc =3D (unsigned long)__builtin_return_address(0); @@ -87,7 +91,7 @@ static __always_inline void unwind_init_from_current(stru= ct unwind_state *state) static inline void unwind_init_from_task(struct unwind_state *state, struct task_struct *task) { - unwind_init_common(state); + unwind_init_common(state, task); =20 state->fp =3D thread_saved_fp(task); state->pc =3D thread_saved_pc(task); @@ -100,11 +104,11 @@ static inline void unwind_init_from_task(struct unwin= d_state *state, * records (e.g. a cycle), determined based on the location and fp value o= f A * and the location (but not the fp value) of B. */ -static int notrace unwind_next(struct task_struct *tsk, - struct unwind_state *state) +static int notrace unwind_next(struct unwind_state *state) { unsigned long fp =3D state->fp; struct stack_info info; + struct task_struct *tsk =3D state->task; =20 /* Final frame; nothing to unwind */ if (fp =3D=3D (unsigned long)task_pt_regs(tsk)->stackframe) @@ -176,8 +180,7 @@ static int notrace unwind_next(struct task_struct *tsk, } NOKPROBE_SYMBOL(unwind_next); =20 -static void notrace unwind(struct task_struct *tsk, - struct unwind_state *state, +static void notrace unwind(struct unwind_state *state, bool (*fn)(void *, unsigned long), void *data) { while (1) { @@ -185,7 +188,7 @@ static void notrace unwind(struct task_struct *tsk, =20 if (!fn(data, state->pc)) break; - ret =3D unwind_next(tsk, state); + ret =3D unwind_next(state); if (ret < 0) break; } @@ -232,11 +235,11 @@ noinline notrace void arch_stack_walk(stack_trace_con= sume_fn consume_entry, struct unwind_state state; =20 if (regs) - unwind_init_from_regs(&state, regs); + unwind_init_from_regs(&state, task, regs); else if (task =3D=3D current) - unwind_init_from_current(&state); + unwind_init_from_current(&state, task); else unwind_init_from_task(&state, task); =20 - unwind(task, &state, consume_entry, cookie); + unwind(&state, consume_entry, cookie); } --=20 2.25.1 From nobody Tue Jun 30 13:54:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5CF8C433F5 for ; Mon, 17 Jan 2022 14:56:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240144AbiAQO45 (ORCPT ); Mon, 17 Jan 2022 09:56:57 -0500 Received: from linux.microsoft.com ([13.77.154.182]:59488 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239983AbiAQO4b (ORCPT ); Mon, 17 Jan 2022 09:56:31 -0500 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id DFFED20B913A; Mon, 17 Jan 2022 06:56:29 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DFFED20B913A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1642431390; bh=2pCZVm8MtKA36IH8thLS7DpFXD0j/nj2Mxtd3QCoxKQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rCer+V83dEQpthi9Cg459ZrRToi90T/9efdI9SsiNnY3oGwYq+jHVn1Ea4f0nP6Wp l0Xr7Jr/1FzTl4uAoV95W35x1OudhGCfym/KFARfkD+BdDdT/TxSQZCexRc2kSI8Ho JYoYU2L6FszLjyeS4Nsr7MEY2xCmGTgayB1HJ4FA= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, madvenka@linux.microsoft.com Subject: [PATCH v13 06/11] arm64: Use stack_trace_consume_fn and rename args to unwind() Date: Mon, 17 Jan 2022 08:56:03 -0600 Message-Id: <20220117145608.6781-7-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117145608.6781-1-madvenka@linux.microsoft.com> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220117145608.6781-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Madhavan T. Venkataraman" Rename the arguments to unwind() for better consistency. Also, use the typedef stack_trace_consume_fn for the consume_entry function as it is already defined in linux/stacktrace.h. Signed-off-by: Madhavan T. Venkataraman Reviewed-by: Mark Rutland --- arch/arm64/kernel/stacktrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index 1b32e55735aa..f772dac78b11 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -181,12 +181,12 @@ static int notrace unwind_next(struct unwind_state *s= tate) NOKPROBE_SYMBOL(unwind_next); =20 static void notrace unwind(struct unwind_state *state, - bool (*fn)(void *, unsigned long), void *data) + stack_trace_consume_fn consume_entry, void *cookie) { while (1) { int ret; =20 - if (!fn(data, state->pc)) + if (!consume_entry(cookie, state->pc)) break; ret =3D unwind_next(state); if (ret < 0) --=20 2.25.1 From nobody Tue Jun 30 13:54:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0F7AC433EF for ; Mon, 17 Jan 2022 14:56:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234810AbiAQO4r (ORCPT ); Mon, 17 Jan 2022 09:56:47 -0500 Received: from linux.microsoft.com ([13.77.154.182]:59502 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240048AbiAQO4c (ORCPT ); Mon, 17 Jan 2022 09:56:32 -0500 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id E00C620B913D; Mon, 17 Jan 2022 06:56:30 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E00C620B913D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1642431391; bh=ZhoGzr5Fv5bSybGDUyS+xs/qmB4s2zJk9d0Xu+fRQ/I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Sxlm95ovv7KYAdyqSO8ETsDjzRa64NrRhOPqwk+/WX9uvsPqtDPO8iDj849Vgrw6c KHcjy670Cv1nD0Owt0eq0a9WILtP5mClBNV71dv61ayqYmcJ/H/+IIaWY95BWTywb9 LK2ICaOSmcKF5iPizI0TAHIXwCUE9GdTDxL4VMbk= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, madvenka@linux.microsoft.com Subject: [PATCH v13 07/11] arm64: Make the unwind loop in unwind() similar to other architectures Date: Mon, 17 Jan 2022 08:56:04 -0600 Message-Id: <20220117145608.6781-8-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117145608.6781-1-madvenka@linux.microsoft.com> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220117145608.6781-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Madhavan T. Venkataraman" Change the loop in unwind() =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Change the unwind loop in unwind() to: while (unwind_continue(state, consume_entry, cookie)) unwind_next(state); This is easy to understand and maintain. New function unwind_continue() =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D Define a new function unwind_continue() that is used in the unwind loop to check for conditions that terminate a stack trace. The conditions checked are: - If the bottom of the stack (final frame) has been reached, terminate. - If the consume_entry() function returns false, the caller of unwind has asked to terminate the stack trace. So, terminate. - If unwind_next() failed for some reason (like stack corruption), terminate. Do not return an error value from unwind_next() =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D We want to check for terminating conditions only in unwind_continue() from the unwinder loop. So, do not return an error value from unwind_next(). Simply set a flag in unwind_state and check the flag in unwind_continue(). Final FP =3D=3D=3D=3D=3D=3D=3D=3D Introduce a new field "final_fp" in "struct unwind_state". Initialize this to the final frame of the stack trace: task_pt_regs(task)->stackframe This is where the stacktrace must terminate if it is successful. Add an explicit comment to that effect. Signed-off-by: Madhavan T. Venkataraman Reviewed-by: Mark Brown --- arch/arm64/include/asm/stacktrace.h | 6 +++ arch/arm64/kernel/stacktrace.c | 72 ++++++++++++++++++----------- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/arch/arm64/include/asm/stacktrace.h b/arch/arm64/include/asm/s= tacktrace.h index af423f5d7ad8..c11b048ffd0e 100644 --- a/arch/arm64/include/asm/stacktrace.h +++ b/arch/arm64/include/asm/stacktrace.h @@ -53,6 +53,10 @@ struct stack_info { * value. * * @task: Pointer to the task structure. + * + * @final_fp Pointer to the final frame. + * + * @failed: Unwind failed. */ struct unwind_state { unsigned long fp; @@ -64,6 +68,8 @@ struct unwind_state { struct llist_node *kr_cur; #endif struct task_struct *task; + unsigned long final_fp; + bool failed; }; =20 extern void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk, diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index f772dac78b11..73fc6b5ee6fd 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -53,6 +53,10 @@ static void unwind_init_common(struct unwind_state *stat= e, bitmap_zero(state->stacks_done, __NR_STACK_TYPES); state->prev_fp =3D 0; state->prev_type =3D STACK_TYPE_UNKNOWN; + state->failed =3D false; + + /* Stack trace terminates here. */ + state->final_fp =3D (unsigned long)task_pt_regs(task)->stackframe; } =20 /* @@ -97,6 +101,25 @@ static inline void unwind_init_from_task(struct unwind_= state *state, state->pc =3D thread_saved_pc(task); } =20 +static bool notrace unwind_continue(struct unwind_state *state, + stack_trace_consume_fn consume_entry, + void *cookie) +{ + if (state->failed) { + /* PC is suspect. Cannot consume it. */ + return false; + } + + if (!consume_entry(cookie, state->pc)) { + /* Caller terminated the unwind. */ + state->failed =3D true; + return false; + } + + return state->fp !=3D state->final_fp; +} +NOKPROBE_SYMBOL(unwind_continue); + /* * Unwind from one frame record (A) to the next frame record (B). * @@ -104,24 +127,26 @@ static inline void unwind_init_from_task(struct unwin= d_state *state, * records (e.g. a cycle), determined based on the location and fp value o= f A * and the location (but not the fp value) of B. */ -static int notrace unwind_next(struct unwind_state *state) +static void notrace unwind_next(struct unwind_state *state) { unsigned long fp =3D state->fp; struct stack_info info; struct task_struct *tsk =3D state->task; =20 - /* Final frame; nothing to unwind */ - if (fp =3D=3D (unsigned long)task_pt_regs(tsk)->stackframe) - return -ENOENT; - - if (fp & 0x7) - return -EINVAL; + if (fp & 0x7) { + state->failed =3D true; + return; + } =20 - if (!on_accessible_stack(tsk, fp, 16, &info)) - return -EINVAL; + if (!on_accessible_stack(tsk, fp, 16, &info)) { + state->failed =3D true; + return; + } =20 - if (test_bit(info.type, state->stacks_done)) - return -EINVAL; + if (test_bit(info.type, state->stacks_done)) { + state->failed =3D true; + return; + } =20 /* * As stacks grow downward, any valid record on the same stack must be @@ -137,8 +162,10 @@ static int notrace unwind_next(struct unwind_state *st= ate) * stack. */ if (info.type =3D=3D state->prev_type) { - if (fp <=3D state->prev_fp) - return -EINVAL; + if (fp <=3D state->prev_fp) { + state->failed =3D true; + return; + } } else { set_bit(state->prev_type, state->stacks_done); } @@ -166,8 +193,10 @@ static int notrace unwind_next(struct unwind_state *st= ate) */ orig_pc =3D ftrace_graph_ret_addr(tsk, NULL, state->pc, (void *)state->fp); - if (WARN_ON_ONCE(state->pc =3D=3D orig_pc)) - return -EINVAL; + if (WARN_ON_ONCE(state->pc =3D=3D orig_pc)) { + state->failed =3D true; + return; + } state->pc =3D orig_pc; } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ @@ -175,23 +204,14 @@ static int notrace unwind_next(struct unwind_state *s= tate) if (is_kretprobe_trampoline(state->pc)) state->pc =3D kretprobe_find_ret_addr(tsk, (void *)state->fp, &state->kr= _cur); #endif - - return 0; } NOKPROBE_SYMBOL(unwind_next); =20 static void notrace unwind(struct unwind_state *state, stack_trace_consume_fn consume_entry, void *cookie) { - while (1) { - int ret; - - if (!consume_entry(cookie, state->pc)) - break; - ret =3D unwind_next(state); - if (ret < 0) - break; - } + while (unwind_continue(state, consume_entry, cookie)) + unwind_next(state); } NOKPROBE_SYMBOL(unwind); =20 --=20 2.25.1 From nobody Tue Jun 30 13:54:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8861DC433EF for ; Mon, 17 Jan 2022 14:57:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240367AbiAQO5E (ORCPT ); Mon, 17 Jan 2022 09:57:04 -0500 Received: from linux.microsoft.com ([13.77.154.182]:59516 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240192AbiAQO4d (ORCPT ); Mon, 17 Jan 2022 09:56:33 -0500 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id E005B20B9132; Mon, 17 Jan 2022 06:56:31 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E005B20B9132 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1642431392; bh=Gu/RiiXWRBLp+NeSXyYMhePY/Y68RWORmCeNAWcv3uE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Hlbw1O1WRSKKJdXQXYgsD8vj8ZdO0MtoFe2CmlOg2sJ8bXm8U+vKAkrIlzfjzrikN zk6H5cDNDrMliL5T+9EfagreP5IwaaG/b92mp4m61pu7a1UanupbiDafz1Cx9eXf6A cFm/RaeCISpCzj8UatjExxyWnkmYn8jP7pHfRtFo= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, madvenka@linux.microsoft.com Subject: [PATCH v13 08/11] arm64: Introduce stack trace reliability checks in the unwinder Date: Mon, 17 Jan 2022 08:56:05 -0600 Message-Id: <20220117145608.6781-9-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117145608.6781-1-madvenka@linux.microsoft.com> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220117145608.6781-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Madhavan T. Venkataraman" There are some kernel features and conditions that make a stack trace unreliable. Callers may require the unwinder to detect these cases. E.g., livepatch. Introduce a new function called unwind_check_reliability() that will detect these cases and set a flag in the stack frame. Call unwind_check_reliability() for every frame in unwind(). Introduce the first reliability check in unwind_check_reliability() - If a return PC is not a valid kernel text address, consider the stack trace unreliable. It could be some generated code. Other reliability checks will be added in the future. Let unwind() return a boolean to indicate if the stack trace is reliable. Signed-off-by: Madhavan T. Venkataraman Reviewed-by: Mark Brown --- arch/arm64/include/asm/stacktrace.h | 3 +++ arch/arm64/kernel/stacktrace.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/stacktrace.h b/arch/arm64/include/asm/s= tacktrace.h index c11b048ffd0e..26eba9d7e5c7 100644 --- a/arch/arm64/include/asm/stacktrace.h +++ b/arch/arm64/include/asm/stacktrace.h @@ -57,6 +57,8 @@ struct stack_info { * @final_fp Pointer to the final frame. * * @failed: Unwind failed. + * + * @reliable: Stack trace is reliable. */ struct unwind_state { unsigned long fp; @@ -70,6 +72,7 @@ struct unwind_state { struct task_struct *task; unsigned long final_fp; bool failed; + bool reliable; }; =20 extern void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk, diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index 73fc6b5ee6fd..3dc0374e83f7 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -18,6 +18,25 @@ #include #include =20 +/* + * Check the stack frame for conditions that make further unwinding unreli= able. + */ +static void unwind_check_reliability(struct unwind_state *state) +{ + if (state->fp =3D=3D state->final_fp) { + /* Final frame; no more unwind, no need to check reliability */ + return; + } + + /* + * If the PC is not a known kernel text address, then we cannot + * be sure that a subsequent unwind will be reliable, as we + * don't know that the code follows our unwind requirements. + */ + if (!__kernel_text_address(state->pc)) + state->reliable =3D false; +} + /* * AArch64 PCS assigns the frame pointer to x29. * @@ -54,6 +73,7 @@ static void unwind_init_common(struct unwind_state *state, state->prev_fp =3D 0; state->prev_type =3D STACK_TYPE_UNKNOWN; state->failed =3D false; + state->reliable =3D true; =20 /* Stack trace terminates here. */ state->final_fp =3D (unsigned long)task_pt_regs(task)->stackframe; @@ -207,11 +227,15 @@ static void notrace unwind_next(struct unwind_state *= state) } NOKPROBE_SYMBOL(unwind_next); =20 -static void notrace unwind(struct unwind_state *state, +static bool notrace unwind(struct unwind_state *state, stack_trace_consume_fn consume_entry, void *cookie) { - while (unwind_continue(state, consume_entry, cookie)) + unwind_check_reliability(state); + while (unwind_continue(state, consume_entry, cookie)) { unwind_next(state); + unwind_check_reliability(state); + } + return !state->failed && state->reliable; } NOKPROBE_SYMBOL(unwind); =20 --=20 2.25.1 From nobody Tue Jun 30 13:54:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67723C433EF for ; Mon, 17 Jan 2022 14:57:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237225AbiAQO5O (ORCPT ); Mon, 17 Jan 2022 09:57:14 -0500 Received: from linux.microsoft.com ([13.77.154.182]:59528 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240211AbiAQO4e (ORCPT ); Mon, 17 Jan 2022 09:56:34 -0500 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id E001120B9143; Mon, 17 Jan 2022 06:56:32 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E001120B9143 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1642431393; bh=xafsbMfU+et9efkkBLXyx0qT50e2RVE8G6KU0KNMtOM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Ioa7zbuSfxYtS7hklK90XFWTYwe00nCuwgwWJcAuMa98j3UOzGnH6RQS7m0qIRoma WTCCnyTWddqR85bOb46b0541x7CKMl0lmZlGlJt/sBIMgoblzO4cifUV7eMR8ticPC /FSDPeWhqIfh4x40BfRLAMZSvESHGeYTFgZeZhyI= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, madvenka@linux.microsoft.com Subject: [PATCH v13 09/11] arm64: Create a list of SYM_CODE functions, check return PC against list Date: Mon, 17 Jan 2022 08:56:06 -0600 Message-Id: <20220117145608.6781-10-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117145608.6781-1-madvenka@linux.microsoft.com> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220117145608.6781-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Madhavan T. Venkataraman" SYM_CODE functions don't follow the usual calling conventions. Check if the return PC in a stack frame falls in any of these. If it does, consider the stack trace unreliable. Define a special section for unreliable functions =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Define a SYM_CODE_END() macro for arm64 that adds the function address range to a new section called "sym_code_functions". Linker file =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Include the "sym_code_functions" section under read-only data in vmlinux.lds.S. Initialization =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Define an early_initcall() to create a sym_code_functions[] array from the linker data. Unwinder check =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Add a reliability check in unwind_check_reliability() that compares a return PC with sym_code_functions[]. If there is a match, then return failure. Signed-off-by: Madhavan T. Venkataraman Reviewed-by: Mark Brown --- arch/arm64/include/asm/linkage.h | 12 +++++++ arch/arm64/include/asm/sections.h | 1 + arch/arm64/kernel/stacktrace.c | 55 +++++++++++++++++++++++++++++++ arch/arm64/kernel/vmlinux.lds.S | 10 ++++++ 4 files changed, 78 insertions(+) diff --git a/arch/arm64/include/asm/linkage.h b/arch/arm64/include/asm/link= age.h index b77e9b3f5371..a47e7914b289 100644 --- a/arch/arm64/include/asm/linkage.h +++ b/arch/arm64/include/asm/linkage.h @@ -63,4 +63,16 @@ SYM_FUNC_END_ALIAS(x); \ SYM_FUNC_END_ALIAS(__pi_##x) =20 +/* + * Record the address range of each SYM_CODE function in a struct code_ran= ge + * in a special section. + */ +#define SYM_CODE_END(name) \ + SYM_END(name, SYM_T_NONE) ;\ + 99: ;\ + .pushsection "sym_code_functions", "aw" ;\ + .quad name ;\ + .quad 99b ;\ + .popsection + #endif diff --git a/arch/arm64/include/asm/sections.h b/arch/arm64/include/asm/sec= tions.h index 152cb35bf9df..ac01189668c5 100644 --- a/arch/arm64/include/asm/sections.h +++ b/arch/arm64/include/asm/sections.h @@ -22,5 +22,6 @@ extern char __irqentry_text_start[], __irqentry_text_end[= ]; extern char __mmuoff_data_start[], __mmuoff_data_end[]; extern char __entry_tramp_text_start[], __entry_tramp_text_end[]; extern char __relocate_new_kernel_start[], __relocate_new_kernel_end[]; +extern char __sym_code_functions_start[], __sym_code_functions_end[]; =20 #endif /* __ASM_SECTIONS_H */ diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index 3dc0374e83f7..8bfe31cbee46 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -18,11 +18,40 @@ #include #include =20 +struct code_range { + unsigned long start; + unsigned long end; +}; + +static struct code_range *sym_code_functions; +static int num_sym_code_functions; + +int __init init_sym_code_functions(void) +{ + size_t size =3D (unsigned long)__sym_code_functions_end - + (unsigned long)__sym_code_functions_start; + + sym_code_functions =3D (struct code_range *)__sym_code_functions_start; + /* + * Order it so that sym_code_functions is not visible before + * num_sym_code_functions. + */ + smp_mb(); + num_sym_code_functions =3D size / sizeof(struct code_range); + + return 0; +} +early_initcall(init_sym_code_functions); + /* * Check the stack frame for conditions that make further unwinding unreli= able. */ static void unwind_check_reliability(struct unwind_state *state) { + const struct code_range *range; + unsigned long pc; + int i; + if (state->fp =3D=3D state->final_fp) { /* Final frame; no more unwind, no need to check reliability */ return; @@ -35,6 +64,32 @@ static void unwind_check_reliability(struct unwind_state= *state) */ if (!__kernel_text_address(state->pc)) state->reliable =3D false; + + /* + * Check the return PC against sym_code_functions[]. If there is a + * match, then the consider the stack frame unreliable. + * + * As SYM_CODE functions don't follow the usual calling conventions, + * we assume by default that any SYM_CODE function cannot be unwound + * reliably. + * + * Note that this includes: + * + * - Exception handlers and entry assembly + * - Trampoline assembly (e.g., ftrace, kprobes) + * - Hypervisor-related assembly + * - Hibernation-related assembly + * - CPU start-stop, suspend-resume assembly + * - Kernel relocation assembly + */ + pc =3D state->pc; + for (i =3D 0; i < num_sym_code_functions; i++) { + range =3D &sym_code_functions[i]; + if (pc >=3D range->start && pc < range->end) { + state->reliable =3D false; + return; + } + } } =20 /* diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.ld= s.S index 50bab186c49b..6381e75e566e 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -122,6 +122,14 @@ jiffies =3D jiffies_64; #define TRAMP_TEXT #endif =20 +#define SYM_CODE_FUNCTIONS \ + . =3D ALIGN(16); \ + .symcode : AT(ADDR(.symcode) - LOAD_OFFSET) { \ + __sym_code_functions_start =3D .; \ + KEEP(*(sym_code_functions)) \ + __sym_code_functions_end =3D .; \ + } + /* * The size of the PE/COFF section that covers the kernel image, which * runs from _stext to _edata, must be a round multiple of the PE/COFF @@ -209,6 +217,8 @@ SECTIONS swapper_pg_dir =3D .; . +=3D PAGE_SIZE; =20 + SYM_CODE_FUNCTIONS + . =3D ALIGN(SEGMENT_ALIGN); __init_begin =3D .; __inittext_begin =3D .; --=20 2.25.1 From nobody Tue Jun 30 13:54:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F2E9C433EF for ; Mon, 17 Jan 2022 14:57:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234725AbiAQO5U (ORCPT ); Mon, 17 Jan 2022 09:57:20 -0500 Received: from linux.microsoft.com ([13.77.154.182]:59542 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240228AbiAQO4f (ORCPT ); Mon, 17 Jan 2022 09:56:35 -0500 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id E01E020B9135; Mon, 17 Jan 2022 06:56:33 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E01E020B9135 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1642431394; bh=9WA4XIJPEMIkNXPJTh9pLlS/9AGYwYxQhbHnVCj+qRU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JkM2/+NpbTQG+du2kijrRPRMkIZMfpMXMTwwDq6efmyIjMR2f/GcoJt8ILlKe8uK/ B8EeGSFFFqWJGRym4RB5KmjqrO4a/C6o/sUHL++7RQxz8+7F6wBVuHehjbgpvnazfo v48/w/AhOq85aFjGBpjR29V6p7rJ+wN6WoPbBwko= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, madvenka@linux.microsoft.com Subject: [PATCH v13 10/11] arm64: Introduce arch_stack_walk_reliable() Date: Mon, 17 Jan 2022 08:56:07 -0600 Message-Id: <20220117145608.6781-11-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117145608.6781-1-madvenka@linux.microsoft.com> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220117145608.6781-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Madhavan T. Venkataraman" Introduce arch_stack_walk_reliable() for ARM64. This works like arch_stack_walk() except that it returns -EINVAL if the stack trace is not reliable. Until all the reliability checks are in place, arch_stack_walk_reliable() may not be used by livepatch. But it may be used by debug and test code. Signed-off-by: Madhavan T. Venkataraman Reviewed-by: Mark Brown --- arch/arm64/kernel/stacktrace.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index 8bfe31cbee46..4902fac5745f 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -342,3 +342,25 @@ noinline notrace void arch_stack_walk(stack_trace_cons= ume_fn consume_entry, =20 unwind(&state, consume_entry, cookie); } + +/* + * arch_stack_walk_reliable() may not be used for livepatch until all of + * the reliability checks are in place in unwind_consume(). However, + * debug and test code can choose to use it even if all the checks are not + * in place. + */ +noinline int notrace arch_stack_walk_reliable(stack_trace_consume_fn consu= me_fn, + void *cookie, + struct task_struct *task) +{ + struct unwind_state state; + bool reliable; + + if (task =3D=3D current) + unwind_init_from_current(&state, task); + else + unwind_init_from_task(&state, task); + + reliable =3D unwind(&state, consume_fn, cookie); + return reliable ? 0 : -EINVAL; +} --=20 2.25.1 From nobody Tue Jun 30 13:54:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D04FFC433F5 for ; Mon, 17 Jan 2022 14:57:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234703AbiAQO5T (ORCPT ); Mon, 17 Jan 2022 09:57:19 -0500 Received: from linux.microsoft.com ([13.77.154.182]:59502 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240255AbiAQO4g (ORCPT ); Mon, 17 Jan 2022 09:56:36 -0500 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id E010E20B9137; Mon, 17 Jan 2022 06:56:34 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E010E20B9137 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1642431395; bh=BKQVFrzc9NWvFdLTdrRxXKa1sIlB+Nm5XhtURANzAOE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qWkTAEUEiL8JCNmJH4E+PQCIMLN6T1rZxsyo/jtsOmI/DWe2yh8ACu0wnbSHqTHza 93pXi/I3ysWVdIWUYbHCyq8tGiQKq1epNuqM5xlFWMICH0UaFZkURHY5DDlkJQWn/e i0/KEsCdIURpWJ0Ddkh78hpBKfQ0Ehp2ZdhcpgcU= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, madvenka@linux.microsoft.com Subject: [PATCH v13 11/11] arm64: Select HAVE_RELIABLE_STACKTRACE Date: Mon, 17 Jan 2022 08:56:08 -0600 Message-Id: <20220117145608.6781-12-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117145608.6781-1-madvenka@linux.microsoft.com> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220117145608.6781-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Madhavan T. Venkataraman" Select HAVE_RELIABLE_STACKTRACE in arm64/Kconfig to allow arch_stack_walk_reliable() to be used. Note that this is conditional upon STACK_VALIDATION which will be added when frame pointer validation is implemented (say via objtool). Signed-off-by: Madhavan T. Venkataraman --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index f6e333b59314..bc7b3514b563 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -223,6 +223,7 @@ config ARM64 select THREAD_INFO_IN_TASK select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD select TRACE_IRQFLAGS_SUPPORT + select HAVE_RELIABLE_STACKTRACE if FRAME_POINTER && STACK_VALIDATION help ARM 64-bit (AArch64) Linux support. =20 --=20 2.25.1