|
From: Jeremy F. <je...@go...> - 2005-03-09 05:07:22
|
Nicholas Nethercote wrote:
> On Tue, 8 Mar 2005, Jeremy Fitzhardinge wrote:
> strace tells me the program (run natively) calls the syscall open()
> rather than creat(). Weird.
The creat() call was made obsolete by O_CREAT; if an architecture has a
creat() syscall, its only for ancient backwards compatibility.
> Neither of those are very appealing.
I had a better idea. We could:
* put back the ban on the lower 64k
* create a PROT_NONE mapping there
The mapping would appear in /proc/self/maps, and prevent a sub-Valgrind
from trying to put padding there. The only downside is the other
programs might get confused if they see the mapping there, and if they
hit a NULL pointer they'd get a SEGV_ACCERR rather than a SEGV_MAPERR
(which could be fixed up in the signal handler, because that's a piece
of code which really needs some more special cases).
> The former. I think the issue was that it gets very confusing if you
> pass 0x0 as the 'addr' parameter to VG_(find_map_space)() -- because
> it interprets that to mean "I don't care where you put it".
Yeah. mmap() uses smallish negative values to represent special pointer
values; that's why on x86-64, the 32-bit address space only goes up to
0xffff0000 (also the kernel internals represent the end of a mapping as
address-just-after, and having a mapping go from N-0 would be too
confusing).
> The way to fix this is to add another Bool arg --
> "use_address_as_suggestion" or something -- to VG_(find_map_space)().
> If it's true, we use the passed address as a suggestion (even if it's
> zero). If it's false, we put the block anywhere.
Or use (Addr)-1.
> In contrast, in languages like Haskell you have a "Maybe" type that
> looks like this:
>
> Maybe a = Just a | Nothing
Yep, it's one of my favorite things in CAML, along with pattern matching.
> No, but it's my standard trick for forcing a program to pause at a
> particular point -- usually to look at what /proc/self/maps looks like.
I generally use pause();
> I'm not sure. I'm very uneasy about changing native behaviour. I'm
> worried that in all the 250-odd syscalls there might be some cases
> that are like this but occur in less contrived code.
I'm not planning on worrying about it for 2.4.0 unless it breaks some
real code; we can reconsider it for 2.4.1+3.0.
J
|