Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200119121743.GF2020@voyager>
Date: Sun, 19 Jan 2020 13:17:43 +0100
From: Markus Wichmann <nullplan@....net>
To: musl@...ts.openwall.com
Subject: Re: Minor style patch to exit.c

On Sun, Jan 19, 2020 at 12:31:34PM +0100, Szabolcs Nagy wrote:
> this has undefined behaviour.
>
> the original code was carefully written to avoid that.
> you need to keep the uintptr_t cast since -- and > are
> undefined for pointers that go out of bound or don't
> point to the same object (and the _start, _end symbols
> don't represent the same c language object, they are
> independent).
>

So there was something I missed. Those linker symbols sure cause
trouble.

FTR: The problem is that we are taking the addresses of ostensibly
independent objects and comparing them. The only way to make the change
I'd like to make would be to get the linker to generate an actual
pointer object with a value, instead of generating some external
variable whose address is meaningful. And even if that were possible (I
think you can get the linker to write something into a section), that is
not part of the ABI, or of the normal linker script. So then you'd
always require a custom linker script. All for the convenience of not
having to do this conversion.

Oh well, at least I learned something.

Ciao,
Markus

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.