[PATCH v2 14/14] man/man3/aligned_alloc.3: HISTORY: Document bogus specification from C11
From: Alejandro Colomar <alx@kernel.org>
Date: 2025-12-15 14:42:20
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Alejandro Colomar <alx@kernel.org>
Date: 2025-12-15 14:42:20
Subsystem:
the rest · Maintainer:
Linus Torvalds
And document that OpenBSD still implements the C11 specification (but without the UB). Fixes: 7fd1e0f2be21 (2023-05-20; "posix_memalign.3: Update aligned_alloc(3) to match C17") Reported-by: Eugene Syromyatnikov <redacted> Cc: Seth McDonald <redacted> Cc: DJ Delorie <redacted> Cc: John Scott <redacted> Cc: Paul Floyd <redacted> Cc: <redacted> Cc: Ingo Schwarze <redacted> Signed-off-by: Alejandro Colomar <alx@kernel.org> --- man/man3/aligned_alloc.3 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/man/man3/aligned_alloc.3 b/man/man3/aligned_alloc.3
index cdc9ba1a2..0c9a12787 100644
--- a/man/man3/aligned_alloc.3
+++ b/man/man3/aligned_alloc.3@@ -76,6 +76,35 @@ .SH HISTORY glibc 2.16. C11, POSIX.1-2024. +.SS C11 +In C11, +the specification of this function had several issues. +.IP \[bu] 3 +.I size +had to be a multiple of +.IR alignment . +Otherwise, +the behavior was undefined. +.IP +Some implementations still implement that restriction, +such as OpenBSD. +However, +in those implementations, +the function reports an error, +and don't exploit the UB. +It was only a theoretical UB. +.IP +This restriction was removed in C17. +.IP \[bu] +If +.I alignment +was not a power of two, +the behavior was undefined. +.IP +No implementations ever exploited this UB. +It was only a theoretical UB. +.IP +This UB was removed in C17. .SH NOTES On many systems there are alignment restrictions, for example, on buffers used for direct block device I/O.
--
2.51.0