Re: gcc versus clang issue for 32-bit binaries

2020-06-10 Thread Michael Tuexen
> On 10. Jun 2020, at 20:30, Damjan Jovanovic wrote: > > MAP_FIXED is generally bad news, as it overwrites any prior mappings within > the range of addresses being mapped to. > > They should use MAP_FIXED | MAP_EXCL instead, which will fail if any mappings > already exist in the range, and the

Re: gcc versus clang issue for 32-bit binaries

2020-06-10 Thread Michael Tuexen
> On 10. Jun 2020, at 18:59, Mark Johnston wrote: > > On Wed, Jun 10, 2020 at 06:41:50PM +0200, Michael Tuexen wrote: >> Dear all, >> >> consider the following program test.c: >> >> #include >> #include >> >> int >> main(void) >> { >> void *p; >> >> p = mmap((void *)0x200

Re: gcc versus clang issue for 32-bit binaries

2020-06-10 Thread Damjan Jovanovic
MAP_FIXED is generally bad news, as it overwrites any prior mappings within the range of addresses being mapped to. They should use MAP_FIXED | MAP_EXCL instead, which will fail if any mappings already exist in the range, and then maybe retry with another range if it fails. Linux and NetBSD have M

Re: gcc versus clang issue for 32-bit binaries

2020-06-10 Thread Michael Tuexen
> On 10. Jun 2020, at 18:59, Mark Johnston wrote: > > On Wed, Jun 10, 2020 at 06:41:50PM +0200, Michael Tuexen wrote: >> Dear all, >> >> consider the following program test.c: >> >> #include >> #include >> >> int >> main(void) >> { >> void *p; >> >> p = mmap((void *)0x20

Re: gcc versus clang issue for 32-bit binaries

2020-06-10 Thread Mark Johnston
On Wed, Jun 10, 2020 at 06:41:50PM +0200, Michael Tuexen wrote: > Dear all, > > consider the following program test.c: > > #include > #include > > int > main(void) > { > void *p; > > p = mmap((void *)0x2000, 0x100, PROT_READ | PROT_WRITE | > PROT_EXEC, MAP_ANON | M

gcc versus clang issue for 32-bit binaries

2020-06-10 Thread Michael Tuexen
Dear all, consider the following program test.c: #include #include int main(void) { void *p; p = mmap((void *)0x2000, 0x100, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0); printf("p= %p\n", p); return (0); } O