svn commit: r342937 - head/sys/arm64/arm64
Andrew Turner
andrew at FreeBSD.org
Fri Jan 11 11:32:47 UTC 2019
Author: andrew
Date: Fri Jan 11 11:32:46 2019
New Revision: 342937
URL: https://svnweb.freebsd.org/changeset/base/342937
Log:
Fix the location of td->td_frame at the top of the kernel stack.
In cpu_thread_alloc we would allocate space for the trap frame at the top of
the kernel stack. This is just below the pcb, however due to a missing cast
the pointer arithmetic would use the pcb size, not the trapframe size. As
the pcb is larger than the trapframe this is safe, however later in cpu_fork
we include the case leading to the two disagreeing on the location.
Fix by using the same arithmetic in both locations.
Found by: An early KASAN patch
Sponsored by: DARPA, AFRL
Modified:
head/sys/arm64/arm64/vm_machdep.c
Modified: head/sys/arm64/arm64/vm_machdep.c
==============================================================================
--- head/sys/arm64/arm64/vm_machdep.c Fri Jan 11 09:40:34 2019 (r342936)
+++ head/sys/arm64/arm64/vm_machdep.c Fri Jan 11 11:32:46 2019 (r342937)
@@ -228,7 +228,7 @@ cpu_thread_alloc(struct thread *td)
td->td_pcb = (struct pcb *)(td->td_kstack +
td->td_kstack_pages * PAGE_SIZE) - 1;
td->td_frame = (struct trapframe *)STACKALIGN(
- td->td_pcb - 1);
+ (struct trapframe *)td->td_pcb - 1);
}
void
More information about the svn-src-head
mailing list