Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/sys/kern



Module Name:    src
Committed By:   riastradh
Date:           Sun Sep 27 22:00:33 UTC 2026

Modified Files:
        src/sys/kern: kern_proc.c

Log Message:
proc(9): Allocate struct proc with declared alignment.

The definition of struct proc includes __aligned(COHERENCY_UNIT) on
the p_auxlock member, so the compiler will assume struct proc
pointers are aligned as such.

As a space optimization on uniprocessor systems, we define the
variable `coherency_unit' (as part of the module ABI) to be
COHERENCY_UNIT (often 64 or 128) in MULTIPROCESSOR builds, but
toALIGNBYTES+1 (often 4, 8, or 16) for !MULTIPROCESSOR builds where
cache line sharing isn't as much of a problem.

But this isn't safe as an optimization for allocating objects that
have statically declared (as part of their ABI) COHERENCY_UNIT
alignment.

PR port-evbmips/60812: UBSan: Undefined Behavior in [sys-src]  member
access within misaligned address  [..] for type '[..]' which requires
128 byte alignment


To generate a diff of this commit:
cvs rdiff -u -r1.286 -r1.287 src/sys/kern/kern_proc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index