<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/arch/arm64/include/asm/stacktrace.h, branch v6.12.80</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-01-16T14:27:31+00:00</updated>
<entry>
<title>arm64: efi: Account for the EFI runtime stack in stack unwinder</title>
<updated>2023-01-16T14:27:31+00:00</updated>
<author>
<name>Ard Biesheuvel</name>
<email>ardb@kernel.org</email>
</author>
<published>2022-12-09T11:10:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7ea55715c421d22c1b63f7129cae6a654091b695'/>
<id>urn:sha1:7ea55715c421d22c1b63f7129cae6a654091b695</id>
<content type='text'>
The EFI runtime services run from a dedicated stack now, and so the
stack unwinder needs to be informed about this.

Acked-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64: move on_thread_stack() to &lt;asm/stacktrace.h&gt;</title>
<updated>2022-11-18T14:36:47+00:00</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2022-11-17T12:09:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4585a934203d0ee1009bd31724190116aed01c10'/>
<id>urn:sha1:4585a934203d0ee1009bd31724190116aed01c10</id>
<content type='text'>
Currently on_thread_stack() is defined in &lt;asm/processor.h&gt;, depending
upon definitiong from &lt;asm/stacktrace.h&gt; despite this header not being
included. This ends up being fragile, and any user of on_thread_stack()
must include both &lt;asm/processor.h&gt; and &lt;asm/stacktrace.h&gt;.

We organised things this way due to header dependencies back in commit:

  0b3e336601b82c6a ("arm64: Add support for STACKLEAK gcc plugin")

... but now that we no longer use current_top_of_stack(), and given that
stackleak includes &lt;asm/stacktrace.h&gt; via &lt;linux/stackleak.h&gt;, we no
longer need the definition to live in &lt;asm/processor.h&gt;.

Move on_thread_stack() to &lt;asm/stacktrace.h&gt;, where all its dependencies
are guaranteed to be defined. This requires having arm64's irq.c
explicitly include &lt;asm/stacktrace.h&gt;, and I've taken the opportunity to
sort the includes, which were slightly out of order.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20221117120902.3974163-3-mark.rutland@arm.com
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64: stacktrace: track all stack boundaries explicitly</title>
<updated>2022-09-09T11:30:08+00:00</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2022-09-01T13:06:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8df137300d1964c3810991aa2fe17a105348b647'/>
<id>urn:sha1:8df137300d1964c3810991aa2fe17a105348b647</id>
<content type='text'>
Currently we call an on_accessible_stack() callback for each step of the
unwinder, requiring redundant work to be performed in the core of the
unwind loop (e.g. disabling preemption around accesses to per-cpu
variables containing stack boundaries). To prevent unwind loops which go
through a stack multiple times, we have to track the set of unwound
stacks, requiring a stack_type enum which needs to cater for all the
stacks of all possible callees. To prevent loops within a stack, we must
track the prior FP values.

This patch reworks the unwinder to minimize the work in the core of the
unwinder, and to remove the need for the stack_type enum. The set of
accessible stacks (and their boundaries) are determined at the start of
the unwind, and the current stack is tracked during the unwind, with
completed stacks removed from the set of accessible stacks. This makes
the boundary checks more accurate (e.g. detecting overlapped frame
records), and removes the need for separate tracking of the prior FP and
visited stacks.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Reviewed-by: Kalesh Singh &lt;kaleshsingh@google.com&gt;
Reviewed-by: Madhavan T. Venkataraman &lt;madvenka@linux.microsoft.com&gt;
Reviewed-by: Mark Brown &lt;broonie@kernel.org&gt;
Cc: Fuad Tabba &lt;tabba@google.com&gt;
Cc: Marc Zyngier &lt;maz@kernel.org&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Link: https://lore.kernel.org/r/20220901130646.1316937-9-mark.rutland@arm.com
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: stacktrace: rework stack boundary discovery</title>
<updated>2022-09-09T11:30:07+00:00</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2022-09-01T13:06:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d1f684e46bbd43eac5c6fb00906c57425d7022a6'/>
<id>urn:sha1:d1f684e46bbd43eac5c6fb00906c57425d7022a6</id>
<content type='text'>
In subsequent patches we'll want to acquire the stack boundaries
ahead-of-time, and we'll need to be able to acquire the relevant
stack_info regardless of whether we have an object the happens to be on
the stack.

This patch replaces the on_XXX_stack() helpers with stackinfo_get_XXX()
helpers, with the caller being responsible for the checking whether an
object is on a relevant stack. For the moment this is moved into the
on_accessible_stack() functions, making these slightly larger;
subsequent patches will remove the on_accessible_stack() functions and
simplify the logic.

The on_irq_stack() and on_task_stack() helpers are kept as these are
used by IRQ entry sequences and stackleak respectively. As they're only
used as predicates, the stack_info pointer parameter is removed in both
cases.

As the on_accessible_stack() functions are always passed a non-NULL info
pointer, these now update info unconditionally. When updating the type
to STACK_TYPE_UNKNOWN, the low/high bounds are also modified, but as
these will not be consumed this should have no adverse affect.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Reviewed-by: Kalesh Singh &lt;kaleshsingh@google.com&gt;
Reviewed-by: Madhavan T. Venkataraman &lt;madvenka@linux.microsoft.com&gt;
Reviewed-by: Mark Brown &lt;broonie@kernel.org&gt;
Cc: Fuad Tabba &lt;tabba@google.com&gt;
Cc: Marc Zyngier &lt;maz@kernel.org&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Link: https://lore.kernel.org/r/20220901130646.1316937-7-mark.rutland@arm.com
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>arm64: stacktrace: move SDEI stack helpers to stacktrace code</title>
<updated>2022-09-09T11:30:07+00:00</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2022-09-01T13:06:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=75758d511432c129db39b50dd3c108e65dd1a2b1'/>
<id>urn:sha1:75758d511432c129db39b50dd3c108e65dd1a2b1</id>
<content type='text'>
For clarity and ease of maintenance, it would be helpful for all the
stack helpers to be in the same place.

Move the SDEI stack helpers into the stacktrace code where all the other
stack helpers live.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Reviewed-by: Kalesh Singh &lt;kaleshsingh@google.com&gt;
Reviewed-by: Madhavan T. Venkataraman &lt;madvenka@linux.microsoft.com&gt;
Reviewed-by: Mark Brown &lt;broonie@kernel.org&gt;
Cc: Fuad Tabba &lt;tabba@google.com&gt;
Cc: James Morse &lt;james.morse@arm.com&gt;
Cc: Marc Zyngier &lt;maz@kernel.org&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Link: https://lore.kernel.org/r/20220901130646.1316937-5-mark.rutland@arm.com
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>KVM: arm64: Make unwind()/on_accessible_stack() per-unwinder functions</title>
<updated>2022-07-27T17:18:03+00:00</updated>
<author>
<name>Marc Zyngier</name>
<email>maz@kernel.org</email>
</author>
<published>2022-07-27T14:29:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4e00532f37365967e9896966b1fe61888e659259'/>
<id>urn:sha1:4e00532f37365967e9896966b1fe61888e659259</id>
<content type='text'>
Having multiple versions of on_accessible_stack() (one per unwinder)
makes it very hard to reason about what is used where due to the
complexity of the various includes, the forward declarations, and
the reliance on everything being 'inline'.

Instead, move the code back where it should be. Each unwinder
implements:

- on_accessible_stack() as well as the helpers it depends on,

- unwind()/unwind_next(), as they pass on_accessible_stack as
  a parameter to unwind_next_common() (which is the only common
  code here)

This hardly results in any duplication, and makes it much
easier to reason about the code.

Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Reviewed-by: Kalesh Singh &lt;kaleshsingh@google.com&gt;
Tested-by: Kalesh Singh &lt;kaleshsingh@google.com&gt;
Reviewed-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Link: https://lore.kernel.org/r/20220727142906.1856759-4-maz@kernel.org
</content>
</entry>
<entry>
<title>arm64: stacktrace: Factor out common unwind()</title>
<updated>2022-07-26T09:48:43+00:00</updated>
<author>
<name>Kalesh Singh</name>
<email>kaleshsingh@google.com</email>
</author>
<published>2022-07-26T07:37:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f51e7146740514347d6c5526a2c393e224a19c0d'/>
<id>urn:sha1:f51e7146740514347d6c5526a2c393e224a19c0d</id>
<content type='text'>
Move unwind() to stacktrace/common.h, and as a result
the kernel unwind_next() to asm/stacktrace.h. This allow
reusing unwind() in the implementation of the nVHE HYP
stack unwinder, later in the series.

Signed-off-by: Kalesh Singh &lt;kaleshsingh@google.com&gt;
Reviewed-by: Fuad Tabba &lt;tabba@google.com&gt;
Reviewed-by: Mark Brown &lt;broonie@kernel.org&gt;
Tested-by: Fuad Tabba &lt;tabba@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20220726073750.3219117-6-kaleshsingh@google.com
</content>
</entry>
<entry>
<title>arm64: stacktrace: Factor out on_accessible_stack_common()</title>
<updated>2022-07-26T09:48:09+00:00</updated>
<author>
<name>Kalesh Singh</name>
<email>kaleshsingh@google.com</email>
</author>
<published>2022-07-26T07:37:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=15a59f19a015185bff90a68f601caec151dea4b4'/>
<id>urn:sha1:15a59f19a015185bff90a68f601caec151dea4b4</id>
<content type='text'>
Move common on_accessible_stack checks to stacktrace/common.h. This is
used in the implementation of the nVHE hypervisor unwinder later in
this series.

Signed-off-by: Kalesh Singh &lt;kaleshsingh@google.com&gt;
Reviewed-by: Fuad Tabba &lt;tabba@google.com&gt;
Reviewed-by: Mark Brown &lt;broonie@kernel.org&gt;
Tested-by: Fuad Tabba &lt;tabba@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20220726073750.3219117-3-kaleshsingh@google.com
</content>
</entry>
<entry>
<title>arm64: stacktrace: Add shared header for common stack unwinding code</title>
<updated>2022-07-26T09:47:14+00:00</updated>
<author>
<name>Kalesh Singh</name>
<email>kaleshsingh@google.com</email>
</author>
<published>2022-07-26T07:37:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6bf212c89c48458d8deef1c973678c62528dab04'/>
<id>urn:sha1:6bf212c89c48458d8deef1c973678c62528dab04</id>
<content type='text'>
In order to reuse the arm64 stack unwinding logic for the nVHE
hypervisor stack, move the common code to a shared header
(arch/arm64/include/asm/stacktrace/common.h).

The nVHE hypervisor cannot safely link against kernel code, so we
make use of the shared header to avoid duplicated logic later in
this series.

Signed-off-by: Kalesh Singh &lt;kaleshsingh@google.com&gt;
Reviewed-by: Mark Brown &lt;broonie@kernel.org&gt;
Reviewed-by: Fuad Tabba &lt;tabba@google.com&gt;
Tested-by: Fuad Tabba &lt;tabba@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20220726073750.3219117-2-kaleshsingh@google.com
</content>
</entry>
<entry>
<title>arm64: stacktrace: make struct stackframe private to stacktrace.c</title>
<updated>2022-04-22T14:33:13+00:00</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2022-04-13T14:59:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=96bb1530c4f9039996bf95d28dcc957861558696'/>
<id>urn:sha1:96bb1530c4f9039996bf95d28dcc957861558696</id>
<content type='text'>
Now that arm64 uses arch_stack_walk() consistently, struct stackframe is
only used within stacktrace.c. To make it easier to read and maintain
this code, it would be nicer if the definition were there too.

Move the definition into stacktrace.c.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Madhavan T. Venkataraman &lt;madvenka@linux.microsoft.com&gt;
Cc: Mark Brown &lt;broonie@kernel.org&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Reviewed-by: Madhavan T. Venkataraman &lt;madvenka@linux.microsoft.com&gt;
Reviwed-by: Mark Brown &lt;broonie@kernel.org&gt;
Reviewed-by: Kalesh Singh &lt;kaleshsingh@google.com&gt; for the series.
Link: https://lore.kernel.org/r/20220413145910.3060139-4-mark.rutland@arm.com
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
</feed>
