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:01:23 UTC 2026

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

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

The definition of struct pool_cache has __aligned(CACHE_LINE_SIZE) on
the pc_fullgroups member, so the compiler will assume struct
pool_cache 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
to ALIGNBYTES+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) CACHE_LINE_SIZE
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.298 -r1.299 src/sys/kern/subr_pool.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