Date: Fri, 24 Apr 2026 15:29:15 +0000 From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: c9501b977642 - stable/15 - powerpc: Fix alignment of initial PCB on kstack Message-ID: <69eb8c4b.35e01.f51230e@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c9501b97764246c59dcc5d3fb4cbaa54aea7e41e commit c9501b97764246c59dcc5d3fb4cbaa54aea7e41e Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2026-01-27 18:30:46 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2026-04-24 15:26:39 +0000 powerpc: Fix alignment of initial PCB on kstack Commit cc81c44dd806737f98b4fd4094674dd71c8749f3 aimed to consolidate duplicated code between the Book-E and AIM backends. For cpu_thread_alloc cpu_thread_alloc and cpu_fork it used the AIM functions which used a bogus alignment mask (~0x2f). The Book-E functions used a proper alignment mask (~0x3f). The AIM functions appear to have been busted since they were first imported in commit 919cb3362fded33aca682a6ac57777f8fff86e36. To fix, use the Book-E mask which requests 64 byte alignment. Probably this was harmless in practice since td_kstack is page aligned and struct pcb is probably a multiple of 32 bytes in size, so the 0x10 bit should have been clear anyway. Reviewed by: fuz, jhibbits Fixes: cc81c44dd806 ("Unify ABI-related bits of the Book-E and AIM...") Effort: CHERI upstreaming Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D54839 (cherry picked from commit 9272b780626640ce9b9ac378fbdd2783aaa33625) --- sys/powerpc/powerpc/exec_machdep.c | 2 +- sys/powerpc/powerpc/vm_machdep.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c index 8a33d0f589a7..fde24370842e 100644 --- a/sys/powerpc/powerpc/exec_machdep.c +++ b/sys/powerpc/powerpc/exec_machdep.c @@ -1095,7 +1095,7 @@ cpu_thread_alloc(struct thread *td) struct pcb *pcb; pcb = (struct pcb *)((td->td_kstack + td->td_kstack_pages * PAGE_SIZE - - sizeof(struct pcb)) & ~0x2fUL); + sizeof(struct pcb)) & ~0x3fUL); td->td_pcb = pcb; td->td_frame = (struct trapframe *)pcb - 1; } diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c index d47beedb595e..1fd853783cc8 100644 --- a/sys/powerpc/powerpc/vm_machdep.c +++ b/sys/powerpc/powerpc/vm_machdep.c @@ -124,7 +124,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) cpu_update_pcb(td1); pcb = (struct pcb *)((td2->td_kstack + - td2->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb)) & ~0x2fUL); + td2->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb)) & ~0x3fUL); td2->td_pcb = pcb; /* Copy the pcb */home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69eb8c4b.35e01.f51230e>
