Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250307173813.GX1827@brightrain.aerifal.cx>
Date: Fri, 7 Mar 2025 12:38:13 -0500
From: Rich Felker <dalias@...c.org>
To: Thorsten Glaser <tg@...bsd.de>, musl@...ts.openwall.com
Subject: Re: f128 aliases for long double math symbols

On Fri, Mar 07, 2025 at 06:17:30PM +0100, Szabolcs Nagy wrote:
> * Rich Felker <dalias@...c.org> [2025-03-04 15:24:17 -0500]:
> 
> > On Tue, Mar 04, 2025 at 09:10:25PM +0100, Thorsten Glaser wrote:
> > > On Tue, 4 Mar 2025, Rich Felker wrote:
> > > 
> > > >Not if they're implemented with code at the same address. If they're
> > > >the *same function*.
> > > 
> > > But they *are*!
> > > 
> > > I don’t see anything saying that, if I use the memmove implementation
> > > for memcpy, they cannot be aliased to the same function pointer. (At
> > > least in C99, haven’t looked at C23.)
> > 
> > The standard defines a memmove function and a memcpy function. These
> > are two functions. Thereby they compare not equal. The fact that you
> > can make up some mechanism outside of the standard to use the same
> > definition for both doesn't somehow make them the same function.
> 
> those have compatible type so the type argument does not work.

The type issue is completely separate. It's a matter of the library
implementation invoking UB with respect to the compiler implementation
by defining the function with a wrong type. This will break for
example with LTO or certain kinds of call integrity hardening that
check signatures. This one would be a non-issue if we decided we
control the entire implementation (e.g. only support traditional asm
linkage, no LTO or fancy hardening tooling) and simply define it as
working.

The issue at hand is one of the implementation not conforming to
requirements that applications are permitted to rely upon.

> i dont think the standard explicitly requires unequal library
> functions.

I don't see how you read that. The standard specifies two functions,
and specifies that different functions compare not-equal. It does not
rigorously define the word "different" but that's par for WG14.

> in practice aliasing is widely used so de facto
> portable code cannot rely on different address.

In practice a lot of non-conforming and broken things were done by
historical implementations. That's why musl exists.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.