lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72=BGFp95jyyF6-uQWT8K8dS5qBpBD55duUYpF4hJDbFxw@mail.gmail.com>
Date: Thu, 6 Feb 2025 20:37:07 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Danilo Krummrich <dakr@...nel.org>, Alejandro Colomar <alx@...nel.org>
Cc: Tamir Duberstein <tamird@...il.com>, Miguel Ojeda <ojeda@...nel.org>, 
	Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>, 
	Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>, 
	Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>, 
	Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, rust-for-linux@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] rust: alloc: satisfy `aligned_alloc` requirements

On Thu, Feb 6, 2025 at 7:58 PM Danilo Krummrich <dakr@...nel.org> wrote:
>
> What makes you think so?
>
> AFAICS, the man page applies for posix_memalign, aligned_alloc, memalign,
> valloc and pvalloc.
>
> In case behavior differs between the functions, this is stated explicitly, e.g.
> in the "RETURN VALUE" section.
>
> The "ERRORS" setion does not differentiate, hence it should apply to all the
> functions above, including aligned_alloc.
>
> Do I miss anything?

The explanation of the requirements (in the Linux man page) mention
different requirements for each function.

Moreover, in practice, glibc seemed to allow almost any alignment up
to 2023, and since then they have this:

    +/* Similar to memalign, but starting with ISO C17 the standard
    +   requires an error for alignments that are not supported by the
    +   implementation.  Valid alignments for the current implementation
    +   are non-negative powers of two.  */
    +  if (!powerof2 (alignment) || alignment == 0)
    +    {
    +      __set_errno (EINVAL);
    +      return 0;
    +    }

Including a test that does not fail for a degenerate alignment (1).
Thus I don't think the "multiple of sizeof" part applies today or in
the past for that implementation (again, in practice).

But I don't know how those sections are formally supposed to work or
what requirements (and/or behavior) the man pages are supposed to be
documenting -- Cc'ing Alejandro. It seems clarifying the page would
help.

Cheers,
Miguel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ