|
From: <sv...@va...> - 2005-09-25 09:55:31
|
Author: sewardj
Date: 2005-09-25 10:55:29 +0100 (Sun, 25 Sep 2005)
New Revision: 4758
Log:
Allow --weird-hacks=3Denable-outer, which stops an outer valgrind zapping
the -d output from an inner one.
Modified:
branches/ASPACEM/coregrind/m_main.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
Modified: branches/ASPACEM/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_main.c 2005-09-25 08:16:30 UTC (rev 4757=
)
+++ branches/ASPACEM/coregrind/m_main.c 2005-09-25 09:55:29 UTC (rev 4758=
)
@@ -890,7 +890,8 @@
"\n"
" uncommon user options for all Valgrind tools:\n"
" --run-libc-freeres=3Dno|yes free up glibc memory at exit? [yes]\n"
-" --weird-hacks=3Dhack1,hack2,... recognised hacks: lax-ioctls,ioctl=
-mmap [none]\n"
+" --weird-hacks=3Dhack1,hack2,... known hacks: lax-ioctls,ioctl-mmap=
\n"
+" enable-outer [none]\n"
" --pointercheck=3Dno|yes enforce client address space limits [ye=
s]\n"
" --show-emwarns=3Dno|yes show warnings about emulation limits? [=
no]\n"
" --smc-check=3Dnone|stack|all checks for self-modifying code: none,=
\n"
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-25 08:=
16:30 UTC (rev 4757)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-25 09:=
55:29 UTC (rev 4758)
@@ -4985,11 +4985,18 @@
=20
PRE(sys_write)
{
+ Bool ok;
*flags |=3D SfMayBlock;
PRINT("sys_write ( %d, %p, %llu )", ARG1, ARG2, (ULong)ARG3);
PRE_REG_READ3(ssize_t, "write",
unsigned int, fd, const char *, buf, vki_size_t, count)=
;
- if (!ML_(fd_allowed)(ARG1, "write", tid, False))
+ /* check to see if it is allowed. If not, try for an exemption from
+ --weird-hacks=3Denable-outer (used for self hosting). */
+ ok =3D ML_(fd_allowed)(ARG1, "write", tid, False);
+ if (!ok && ARG1 =3D=3D 2/*stderr*/=20
+ && VG_(strstr)(VG_(clo_weird_hacks),"enable-outer"))
+ ok =3D True;
+ if (!ok)
SET_STATUS_Failure( VKI_EBADF );
else
PRE_MEM_READ( "write(buf)", ARG2, ARG3 );
|
|
From: Oswald B. <os...@kd...> - 2005-09-25 10:05:53
|
On Sun, Sep 25, 2005 at 10:55:29AM +0100, sv...@va... wrote: > + ok = ML_(fd_allowed)(ARG1, "write", tid, False); > + if (!ok && ARG1 == 2/*stderr*/ > + && VG_(strstr)(VG_(clo_weird_hacks),"enable-outer")) > not sure how often the other conditions are true, but strstr is slooooow. better parse the weird_hacks content at startup. -- Hi! I'm a .signature virus! Copy me into your ~/.signature, please! -- Chaos, panic, and disorder - my work here is done. |
|
From: Julian S. <js...@ac...> - 2005-09-25 10:11:36
|
On Sunday 25 September 2005 11:05, Oswald Buddenhagen wrote: > On Sun, Sep 25, 2005 at 10:55:29AM +0100, sv...@va... wrote: > > + ok = ML_(fd_allowed)(ARG1, "write", tid, False); > > + if (!ok && ARG1 == 2/*stderr*/ > > + && VG_(strstr)(VG_(clo_weird_hacks),"enable-outer")) > > not sure how often the other conditions are true, but strstr is > slooooow. better parse the weird_hacks content at startup. I thought about this, hence the formulation. ML_(fd_allowed) will almost always return True under normal operation, so it doesn't matter that VG_(strstr) is a bit slow -- usually it won't get called. J |
|
From: Nicholas N. <nj...@cs...> - 2005-09-25 15:39:59
|
On Sun, 25 Sep 2005, sv...@va... wrote: > Log: > Allow --weird-hacks=enable-outer, which stops an outer valgrind zapping > the -d output from an inner one. Hmm, that is ugly. I also tried changing innerVG to write to fd 9, and then using "9>" on the command line to capture it. BTW, the ioctl-mmap weird hack is dead. I'll remove all traces of it. N |