All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: linux-man@vger.kernel.org
Cc: Seth McDonald <sethmcmail@pm.me>,
	 Eugene Syromyatnikov <evgsyr@gmail.com>,
	Ingo Schwarze <schwarze@openbsd.org>, DJ Delorie <dj@redhat.com>,
	 Paul Floyd <pjfloyd@wanadoo.fr>, John Scott <jscott@posteo.net>,
	misc@openbsd.org
Subject: Re: [PATCH v4 1/1] man/man3/aligned_alloc.3: HISTORY: Document bogus specification from C11
Date: Mon, 22 Dec 2025 22:36:00 +0100	[thread overview]
Message-ID: <aUm5o1hd1pLy7QOH@devuan> (raw)
In-Reply-To: <f19bb100f31e5c5b9f0edaf1807ef66d99627316.1766439016.git.alx@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1802 bytes --]

Here's how it looks:

$ MANWIDTH=72 diffman-git f19bb100f31e
--- f19bb100f31e^:man/man3/aligned_alloc.3
+++ f19bb100f31e:man/man3/aligned_alloc.3
@@ -52,6 +52,41 @@ STANDARDS
 HISTORY
      glibc 2.16.  C11, POSIX.1‐2024.
 
+   C11
+     In C11, the specification of this function had several issues.
+
+     •  size had to be a multiple of alignment.  Otherwise, the behav‐
+        ior was undefined.
+
+     •  If alignment was not a power of two, the behavior was unde‐
+        fined.
+
+     DR460 reported both cases of UB as unnecessarily dangerous, and
+     fixed them with a Technical Corrigendum that transformed them into
+     errors.
+
+     N2072 reported that the requirement that size is a multiple of
+     alignment is superfluous, and removed it with a Technical Corri‐
+     gendum.
+
+     C17 incorporates both technical corrigenda.  The API has been sta‐
+     ble since C17.
+
+     glibc originally implemented it as silently aligning as
+     stdc_bit_ceil(alignment) instead of alignment.  Since glibc 2.38,
+     it implements the C17 specification.
+
+     Some implementations, such as FreeBSD/jemalloc, implement the C17
+     specification, even though their documentation claims the C11
+     specification.
+
+     Some implementations, such as OpenBSD, implement C11 amended with
+     DR460, even though their documentation claims having undefined be‐
+     havior.
+
+     No known implementations have exploited the undefined behavior in
+     a more dangerous way.  This function should be safe to use.
+
 NOTES
      On many systems there are alignment restrictions, for example, on
      buffers used for direct block device I/O.  POSIX specifies the


-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2025-12-22 21:36 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10 12:39 [PATCH v1 00/12] man/man3/posix_memalign.3: Several fixes, and split the page Alejandro Colomar
2025-12-10 12:40 ` [PATCH v1 01/12] man/man3/posix_memalign.3: Remove confusing exception Alejandro Colomar
2025-12-10 12:40 ` [PATCH v1 02/12] man/man3/posix_memalign.3: wfix Alejandro Colomar
2025-12-10 12:40 ` [PATCH v1 03/12] man/man3/posix_memalign.3: STANDARDS: aligned_alloc() conforms to ISO C17, not C11 Alejandro Colomar
2025-12-10 12:40 ` [PATCH v1 04/12] man/man3/posix_memalign.3: STANDARDS: aligned_alloc() conforms to C23 Alejandro Colomar
2025-12-10 12:40 ` [PATCH v1 05/12] man/man3/posix_memalign.3: STANDARDS: aligned_alloc() and posix_memalign() conform to POSIX.1-2024 Alejandro Colomar
2025-12-10 12:40 ` [PATCH v1 06/12] man/man3/{posix_,}memalign.3: Split memalign() from posix_memalign(3) Alejandro Colomar
2025-12-10 12:40 ` [PATCH v1 07/12] man/man3/{posix_memalign,pvalloc}.3: Split pvalloc() " Alejandro Colomar
2025-12-10 12:40 ` [PATCH v1 08/12] man/man3/{posix_memalign,valloc}.3: Split valloc() " Alejandro Colomar
2025-12-10 12:40 ` [PATCH v1 09/12] man/man3/{aligned_alloc,posix_memalign}.3: Split aligned_alloc() " Alejandro Colomar
2025-12-10 12:40 ` [PATCH v1 10/12] man/man3/posix_memalign.3: CAVEATS: Add section, and move paragraph to it Alejandro Colomar
2025-12-10 12:40 ` [PATCH v1 11/12] man/man3/posix_memalign.3: Remove redundant text Alejandro Colomar
2025-12-10 12:40 ` [PATCH v1 12/12] man/man3/posix_memalign.3: NOTES: Remove superfluous section Alejandro Colomar
2025-12-10 16:29 ` [PATCH v1 00/12] man/man3/posix_memalign.3: Several fixes, and split the page Eugene Syromyatnikov
2025-12-10 17:12   ` Alejandro Colomar
2025-12-10 22:50     ` Eugene Syromyatnikov
2025-12-11  0:04       ` Alejandro Colomar
2025-12-11  3:46         ` Eugene Syromyatnikov
2025-12-11 10:39           ` Alejandro Colomar
2025-12-15 14:41 ` [PATCH v2 00/14] " Alejandro Colomar
2025-12-15 14:41   ` [PATCH v2 01/14] man/man3/posix_memalign.3: Remove confusing exception Alejandro Colomar
2025-12-15 14:41   ` [PATCH v2 02/14] man/man3/posix_memalign.3: wfix Alejandro Colomar
2025-12-15 14:41   ` [PATCH v2 03/14] man/man3/posix_memalign.3: STANDARDS: aligned_alloc() conforms to C17, not C11 Alejandro Colomar
2025-12-15 14:41   ` [PATCH v2 04/14] man/man3/posix_memalign.3: STANDARDS: aligned_alloc() conforms to C23 Alejandro Colomar
2025-12-15 14:41   ` [PATCH v2 05/14] man/man3/posix_memalign.3: STANDARDS: aligned_alloc() and posix_memalign() conform to POSIX.1-2024 Alejandro Colomar
2025-12-15 14:41   ` [PATCH v2 06/14] man/man3/{posix_,}memalign.3: Split memalign() from posix_memalign(3) Alejandro Colomar
2025-12-15 14:41   ` [PATCH v2 07/14] man/man3/{posix_memalign,pvalloc}.3: Split pvalloc() " Alejandro Colomar
2025-12-15 14:41   ` [PATCH v2 08/14] man/man3/{posix_memalign,valloc}.3: Split valloc() " Alejandro Colomar
2025-12-15 14:41   ` [PATCH v2 09/14] man/man3/{aligned_alloc,posix_memalign}.3: Split aligned_alloc() " Alejandro Colomar
2025-12-15 14:42   ` [PATCH v2 10/14] man/man3/posix_memalign.3: CAVEATS: Add section, and move paragraph to it Alejandro Colomar
2025-12-15 14:42   ` [PATCH v2 11/14] man/man3/posix_memalign.3: Remove redundant text Alejandro Colomar
2025-12-15 14:42   ` [PATCH v2 12/14] man/man3/posix_memalign.3: NOTES: Remove superfluous section Alejandro Colomar
2025-12-15 14:42   ` [PATCH v2 13/14] man/man3/memalign.3: wfix Alejandro Colomar
2025-12-15 14:42   ` [PATCH v2 14/14] man/man3/aligned_alloc.3: HISTORY: Document bogus specification from C11 Alejandro Colomar
2025-12-17 13:03   ` [PATCH v2 00/14] man/man3/posix_memalign.3: Several fixes, and split the page Seth McDonald
2025-12-17 13:28     ` Alejandro Colomar
2025-12-17 13:51 ` [PATCH v3 0/1] man/man3/aligned_alloc.3: HISTORY: Document bogus specification from C11 Alejandro Colomar
2025-12-17 13:51   ` [PATCH v3 1/1] " Alejandro Colomar
2025-12-17 13:53     ` Alejandro Colomar
2025-12-17 14:42     ` Eugene Syromyatnikov
2025-12-17 15:37       ` Eugene Syromyatnikov
2025-12-17 17:05         ` Alejandro Colomar
2025-12-17 20:40           ` Alejandro Colomar
2025-12-17 16:46       ` Alejandro Colomar
2025-12-22 21:33 ` [PATCH v4 0/1] " Alejandro Colomar
2025-12-22 21:33   ` [PATCH v4 1/1] " Alejandro Colomar
2025-12-22 21:36     ` Alejandro Colomar [this message]
2025-12-23  0:15   ` G. Branden Robinson
2025-12-23  0:35     ` Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aUm5o1hd1pLy7QOH@devuan \
    --to=alx@kernel.org \
    --cc=dj@redhat.com \
    --cc=evgsyr@gmail.com \
    --cc=jscott@posteo.net \
    --cc=linux-man@vger.kernel.org \
    --cc=misc@openbsd.org \
    --cc=pjfloyd@wanadoo.fr \
    --cc=schwarze@openbsd.org \
    --cc=sethmcmail@pm.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.