Page MenuHomeFreeBSD

powerpc: Fix alignment of initial PCB on kstack
ClosedPublic

Authored by jhb on Jan 23 2026, 6:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jul 8, 1:14 AM
Unknown Object (File)
Mon, Jul 6, 3:01 PM
Unknown Object (File)
Mon, Jul 6, 3:26 AM
Unknown Object (File)
Sat, Jul 4, 2:05 AM
Unknown Object (File)
Thu, Jul 2, 10:26 PM
Unknown Object (File)
Thu, Jul 2, 4:47 PM
Unknown Object (File)
Thu, Jun 18, 2:48 PM
Unknown Object (File)
Thu, Jun 18, 1:42 PM
Subscribers

Details

Summary

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.

Fixes: cc81c44dd806 ("Unify ABI-related bits of the Book-E and AIM...")
Effort: CHERI upstreaming
Sponsored by: AFRL, DARPA

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Jan 23 2026, 6:45 PM

If that's used any more often than these two locations, we may want to add a STACK_ALIGNMENT macro.

This revision is now accepted and ready to land.Jan 23 2026, 7:09 PM

These are the only two I found. Some other architectures have a STACKALIGN macro

This revision was automatically updated to reflect the committed changes.