stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Zhong" <Scott.Zh...@roguewave.com>
Subject RE: [PATCH] STDCXX-705
Date Tue, 29 Jan 2008 22:25:16 GMT
cat t.cpp && aCC -V +DD32 t.cpp && file a.out && ./a.out
#include <stdio.h>

int main()
{
  printf("%s", (char*)(void*)(0x0 - 1));

  return 0;
}
aCC: HP ANSI C++ B3910B A.03.63
92453-07 linker command s800.sgs ld PA64 B.11.45 REL 050725
/usr/ccs/bin/ld: 92453-07 linker linker ld B.11.45 050725
a.out:          PA-RISC1.1 shared executable dynamically linked -not
stripped dynamically linked
Segmentation fault (core dumped)

aCC -V +DD64 t.cpp && file a.out && ./a.out

aCC: HP ANSI C++ B3910B A.03.63
92453-07 linker command s800.sgs ld PA64 B.11.45 REL 050725
a.out:          ELF-64 executable object file - PA-RISC 2.0 (LP64)
Segmentation fault (core dumped)

cat t.cpp && aCC +DD32 t.cpp && file a.out && ./a.out
#include <stdio.h>

int main()
{
  printf ("%s", (char*)(void*)(0x0 - 1));

  return 0;
}
a.out:          ELF-32 executable object file - IA64
Segmentation fault (core dumped)

cat t.cpp && aCC +DD64 t.cpp && file a.out && ./a.out
#include <stdio.h>

int main()
{
  printf ("%s", (char*)(void*)(0x0 - 1));

  return 0;
}
a.out:          ELF-64 executable object file - IA64
Segmentation fault (core dumped)


-----Original Message-----
From: Martin Sebor [mailto:sebor@roguewave.com] 
Sent: Tuesday, January 29, 2008 3:07 PM
To: dev@stdcxx.apache.org
Subject: Re: [PATCH] STDCXX-705

Scott Zhong wrote:
> I tried to access the red zone and a seg fault didn't occur

Odd.

> but when
> trying to access the kernel address space it does cause a seg fault.

What about the 32-bit address spaces, especially in the MPAS
model where the stack (supposedly) starts at 0xffffffff? And
what about HP-UX on PA-RISC?

Martin

> I
> propose to change 0.printf.cpp to the following:
> 
> Index: 0.printf.cpp
> ===================================================================
> --- 0.printf.cpp        (revision 616446)
> +++ 0.printf.cpp        (working copy)
> @@ -165,15 +165,7 @@
>              ++addr;
>      }
>      else {
> -
> -#ifndef _RWSTD_OS_HP_UX
> -        // the first page is usually unmapped
> -        addr = (char*)32;
> -#else
> -        // the first page on HP-UX is readable, this might work
> -        addr = (char*)(void*)bad_address + 1024 * 1024 * 16;
> -#endif   // _RWSTD_OS_HP_UX
> -
> +        addr = (char*)(void*)(0x0 - 1);
>      }
>  
>      return addr;
> 

Mime
View raw message