Date: Mon, 16 Sep 2019 15:00:11 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352405 - stable/12/sys/arm64/arm64 Message-ID: <201909161500.x8GF0B3o045949@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andrew Date: Mon Sep 16 15:00:11 2019 New Revision: 352405 URL: https://svnweb.freebsd.org/changeset/base/352405 Log: MFC r342937: 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: stable/12/sys/arm64/arm64/vm_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/vm_machdep.c ============================================================================== --- stable/12/sys/arm64/arm64/vm_machdep.c Mon Sep 16 14:51:49 2019 (r352404) +++ stable/12/sys/arm64/arm64/vm_machdep.c Mon Sep 16 15:00:11 2019 (r352405) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909161500.x8GF0B3o045949>