History log of /freebsd-current/sys/riscv/riscv/stack_machdep.c
Revision Date Author Comments
# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 9b9e7f4c 08-Dec-2020 John Baldwin <jhb@FreeBSD.org>

Stack unwinding robustness fixes for RISC-V.

- Push the kstack_contains check down into unwind_frame() so that it
is honored by DDB and DTrace.

- Check that the trapframe for an exception frame is contained in the
traced thread's kernel stack for DDB traces.

Reviewed by: markj
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27357


# 5941edfc 01-Dec-2020 John Baldwin <jhb@FreeBSD.org>

Add a kstack_contains() helper function.

This is useful for stack unwinders which need to avoid out-of-bounds
reads of a kernel stack which can trigger kernel faults.

Reviewed by: kib, markj
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27356


# 40db51b4 12-Aug-2020 John Baldwin <jhb@FreeBSD.org>

Check that the frame pointer is within the current stack.

This same check is used on other architectures. Previously this would
permit a stack frame to unwind into any arbitrary kernel address
(including unmapped addresses).

Reviewed by: mhorne
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25996


# 367de39e 12-Aug-2020 John Baldwin <jhb@FreeBSD.org>

Use uintptr_t instead of uint64_t for pointers in stack frames.

Reviewed by: mhorne
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25995


# 1c29da02 31-Jan-2020 Mark Johnston <markj@FreeBSD.org>

Reimplement stack capture of running threads on i386 and amd64.

After r355784 the td_oncpu field is no longer synchronized by the thread
lock, so the stack capture interrupt cannot be delievered precisely.
Fix this using a loop which drops the thread lock and restarts if the
wrong thread was sampled from the stack capture interrupt handler.

Change the implementation to use a regular interrupt instead of an NMI.
Now that we drop the thread lock, there is no advantage to the latter.

Simplify the KPIs. Remove stack_save_td_running() and add a return
value to stack_save_td(). On platforms that do not support stack
capture of running threads, stack_save_td() returns EOPNOTSUPP. If the
target thread is running in user mode, stack_save_td() returns EBUSY.

Reviewed by: kib
Reported by: mjg, pho
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23355


# d52d6d7c 10-Mar-2016 Ruslan Bukin <br@FreeBSD.org>

Add support for ddb(4).

Sponsored by: DARPA, AFRL
Sponsored by: HEIF5


# 0b7bfc0b 22-Feb-2016 Ruslan Bukin <br@FreeBSD.org>

Provide stack(9) MD stubs for RISC-V so ktr(9) can be compiled in.