You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
1
(5) |
2
(15) |
3
(20) |
|
4
(4) |
5
(11) |
6
(8) |
7
(36) |
8
(23) |
9
(6) |
10
(4) |
|
11
(4) |
12
(19) |
13
(17) |
14
(33) |
15
(16) |
16
(17) |
17
(4) |
|
18
(4) |
19
(30) |
20
(22) |
21
(23) |
22
(29) |
23
(20) |
24
(12) |
|
25
(7) |
26
(33) |
27
(10) |
28
(12) |
29
(19) |
30
(15) |
31
(8) |
|
From: Julian S. <js...@ac...> - 2009-01-21 23:55:59
|
On Wednesday 07 January 2009, Tom Hughes wrote: > Julian Seward wrote: > >> So we should try and find the PT_LOAD associated with each mapping we > >> see, which would allow us to calculate the bias for that section, then > >> use the p_vaddr and p_memsz of the segment (which give the svma address > >> and size) to match against the svma addresses in the section table to > >> work out the bias for each section. > >> > [...] > > The first patch reworks the detection of ELF sections to work the way > that I described, and in doing so gets rid of a load of kludges. I discovered on Monday that the 3.4 unwinder is partially borked on SLES9 amd64, whereas 3.3 works fine. In particular any attempt to unwind through libc.so ends in failure, a totally garbage stack trace that leads nowhere. Applying both your patches (valgrind-elf-sections.patch and valgrind-globals.patch) seems to fix it. I suspect only the first is necessary for the unwind stuff, but the second is important for ptrcheck. So .. do you have final version of these that you can commit on the trunk? I'm now inclined to push them to the stable branch if they continue to look good. I had not realised the breakage in 3.4 was so serious. You mentioned you had a third patch almost done, for recognition of rodata sections. Can you maybe send that too? J |
|
From: <sv...@va...> - 2009-01-21 22:53:59
|
Author: njn
Date: 2009-01-21 22:53:53 +0000 (Wed, 21 Jan 2009)
New Revision: 9016
Log:
Remove redundant "0 ||" in conditional.
Modified:
branches/DARWIN/coregrind/m_replacemalloc/vg_replace_malloc.c
Modified: branches/DARWIN/coregrind/m_replacemalloc/vg_replace_malloc.c
===================================================================
--- branches/DARWIN/coregrind/m_replacemalloc/vg_replace_malloc.c 2009-01-21 22:52:39 UTC (rev 9015)
+++ branches/DARWIN/coregrind/m_replacemalloc/vg_replace_malloc.c 2009-01-21 22:53:53 UTC (rev 9016)
@@ -140,7 +140,7 @@
static void init(void) __attribute__((constructor));
#define MALLOC_TRACE(format, args...) \
- if (0 || info.clo_trace_malloc) { \
+ if (info.clo_trace_malloc) { \
VALGRIND_INTERNAL_PRINTF(format, ## args ); }
/* Below are new versions of malloc, __builtin_new, free,
|
|
From: <sv...@va...> - 2009-01-21 22:52:45
|
Author: njn Date: 2009-01-21 22:52:39 +0000 (Wed, 21 Jan 2009) New Revision: 9015 Log: Merge part of r8943 from the Darwin branch -- use VGA_* instead of VGP_* for selecting the arch-specific tests. Modified: trunk/none/tests/Makefile.am Modified: trunk/none/tests/Makefile.am =================================================================== --- trunk/none/tests/Makefile.am 2009-01-21 22:44:23 UTC (rev 9014) +++ trunk/none/tests/Makefile.am 2009-01-21 22:52:39 UTC (rev 9015) @@ -3,16 +3,16 @@ include $(top_srcdir)/Makefile.flags.am SUBDIRS = . -if VGP_X86_LINUX +if VGA_X86 SUBDIRS += x86 endif -if VGP_AMD64_LINUX +if VGA_AMD64 SUBDIRS += amd64 endif -if VGP_PPC32_LINUX +if VGA_PPC32 SUBDIRS += ppc32 endif -if VGP_PPC64_LINUX +if VGA_PPC64 SUBDIRS += ppc64 endif |
|
From: <sv...@va...> - 2009-01-21 22:44:28
|
Author: njn Date: 2009-01-21 22:44:23 +0000 (Wed, 21 Jan 2009) New Revision: 9014 Log: Merge r8991 (s/VG_ARCH/VG_ARCH_PRI) from trunk. Modified: branches/DARWIN/valgrind.pc.in Modified: branches/DARWIN/valgrind.pc.in =================================================================== --- branches/DARWIN/valgrind.pc.in 2009-01-21 22:42:39 UTC (rev 9013) +++ branches/DARWIN/valgrind.pc.in 2009-01-21 22:44:23 UTC (rev 9014) @@ -2,7 +2,7 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/valgrind -arch=@VG_ARCH@ +arch=@VG_ARCH_PRI@ os=@VG_OS@ platform=@VG_PLATFORM_PRI@ valt_load_address=@VALT_LOAD_ADDRESS@ |
|
From: <sv...@va...> - 2009-01-21 22:42:44
|
Author: njn
Date: 2009-01-21 22:42:39 +0000 (Wed, 21 Jan 2009)
New Revision: 9013
Log:
Improve a conditional compilation guard.
Modified:
branches/DARWIN/helgrind/hg_intercepts.c
Modified: branches/DARWIN/helgrind/hg_intercepts.c
===================================================================
--- branches/DARWIN/helgrind/hg_intercepts.c 2009-01-21 22:40:06 UTC (rev 9012)
+++ branches/DARWIN/helgrind/hg_intercepts.c 2009-01-21 22:42:39 UTC (rev 9013)
@@ -756,7 +756,7 @@
/*--- pthread_barrier_t functions ---*/
/*----------------------------------------------------------------*/
-#if !defined(VGO_darwin)
+#if defined(HAVE_PTHREAD_BARRIER)
/* Handled: pthread_barrier_init
pthread_barrier_wait
@@ -863,7 +863,7 @@
return ret;
}
-#endif
+#endif // defined(HAVE_PTHREAD_BARRIER)
/*----------------------------------------------------------------*/
/*--- pthread_rwlock_t functions ---*/
|
|
From: <sv...@va...> - 2009-01-21 22:40:12
|
Author: njn
Date: 2009-01-21 22:40:06 +0000 (Wed, 21 Jan 2009)
New Revision: 9012
Log:
Remove dead macros.
Modified:
branches/DARWIN/include/pub_tool_basics_asm.h
Modified: branches/DARWIN/include/pub_tool_basics_asm.h
===================================================================
--- branches/DARWIN/include/pub_tool_basics_asm.h 2009-01-21 22:27:20 UTC (rev 9011)
+++ branches/DARWIN/include/pub_tool_basics_asm.h 2009-01-21 22:40:06 UTC (rev 9012)
@@ -38,9 +38,6 @@
#define VGAPPEND(str1,str2) str1##str2
-#define VGAPPEND4_(str1,str2,str3,str4) str1##str2##str3##str4
-#define VGAPPEND4(str1,str2,str3,str4) VGAPPEND4_(str1,str2,str3,str4)
-
/* VG_ is for symbols exported from modules. ML_ (module-local) is
for symbols which are not intended to be visible outside modules,
but which cannot be declared as C 'static's since they need to be
@@ -52,10 +49,6 @@
#define VG_(str) VGAPPEND(vgPlain_, str)
#define ML_(str) VGAPPEND(vgModuleLocal_, str)
-/* VGO_(foo) is the same as VG_(foo), except with an OS tag. */
-#define VGO_(str) VGAPPEND4(vgPlain_, VG_OS, _, str)
-#define MLO_(str) VGAPPEND4(vgModuleLocal_, VG_OS, _, str)
-
/* _VG_(foo) is the same as VG_(foo), except with a leading underscore.
This is needed for assembly definitions on some platforms, and
should not be used in C files.
|
|
From: <sv...@va...> - 2009-01-21 22:27:25
|
Author: njn
Date: 2009-01-21 22:27:20 +0000 (Wed, 21 Jan 2009)
New Revision: 9011
Log:
Mostly-merge r9010 (fix AC_TRY_COMPILE macros) from the trunk... it was
already partly done in this branch.
Modified:
branches/DARWIN/configure.in
Modified: branches/DARWIN/configure.in
===================================================================
--- branches/DARWIN/configure.in 2009-01-21 22:25:50 UTC (rev 9010)
+++ branches/DARWIN/configure.in 2009-01-21 22:27:20 UTC (rev 9011)
@@ -301,7 +301,7 @@
safe_CFLAGS=$CFLAGS
CFLAGS="-m32"
AC_TRY_LINK(, [
- int main () { return 0 ; }
+ return 0;
],
[
AC_MSG_RESULT([yes])
@@ -938,7 +938,7 @@
CFLAGS="-m32"
AC_TRY_COMPILE(, [
-int main () { return 0 ; }
+ return 0;
],
[
FLAG_M32="-m32"
@@ -959,7 +959,7 @@
CFLAGS="-maix32"
AC_TRY_COMPILE(, [
-return 0 ;
+ return 0;
],
[
FLAG_MAIX32="-maix32"
@@ -980,7 +980,7 @@
CFLAGS="-m64"
AC_TRY_COMPILE(, [
-return 0 ;
+ return 0;
],
[
FLAG_M64="-m64"
@@ -1001,7 +1001,7 @@
CFLAGS="-maix64"
AC_TRY_COMPILE(, [
-return 0 ;
+ return 0;
],
[
FLAG_MAIX64="-maix64"
@@ -1022,7 +1022,7 @@
CFLAGS="-mmmx"
AC_TRY_COMPILE(, [
-return 0 ;
+ return 0;
],
[
FLAG_MMMX="-mmmx"
@@ -1043,7 +1043,7 @@
CFLAGS="-msse"
AC_TRY_COMPILE(, [
-return 0 ;
+ return 0;
],
[
FLAG_MSSE="-msse"
@@ -1064,7 +1064,7 @@
CFLAGS="-mpreferred-stack-boundary=2"
AC_TRY_COMPILE(, [
-return 0 ;
+ return 0;
],
[
PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
@@ -1085,7 +1085,7 @@
CFLAGS="-Wno-pointer-sign"
AC_TRY_COMPILE(, [
-return 0 ;
+ return 0;
],
[
no_pointer_sign=yes
@@ -1108,7 +1108,7 @@
CFLAGS="-Wdeclaration-after-statement"
AC_TRY_COMPILE(, [
-return 0 ;
+ return 0;
],
[
declaration_after_statement=yes
@@ -1191,7 +1191,7 @@
CFLAGS="-fno-stack-protector"
AC_TRY_COMPILE(, [
-int main () { return 0 ; }
+ return 0;
],
[
no_stack_protector=yes
|
|
From: <sv...@va...> - 2009-01-21 22:25:57
|
Author: njn
Date: 2009-01-21 22:25:50 +0000 (Wed, 21 Jan 2009)
New Revision: 9010
Log:
In AC_TRY_COMPILE, only include the function body, not the surrounding "int
main { ... }".
Modified:
trunk/configure.in
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2009-01-21 22:19:26 UTC (rev 9009)
+++ trunk/configure.in 2009-01-21 22:25:50 UTC (rev 9010)
@@ -280,7 +280,7 @@
safe_CFLAGS=$CFLAGS
CFLAGS="-m32"
AC_TRY_LINK(, [
- int main () { return 0 ; }
+ return 0;
],
[
AC_MSG_RESULT([yes])
@@ -862,7 +862,7 @@
CFLAGS="-m32"
AC_TRY_COMPILE(, [
-int main () { return 0 ; }
+ return 0;
],
[
FLAG_M32="-m32"
@@ -883,7 +883,7 @@
CFLAGS="-maix32"
AC_TRY_COMPILE(, [
-int main () { return 0 ; }
+ return 0;
],
[
FLAG_MAIX32="-maix32"
@@ -904,7 +904,7 @@
CFLAGS="-m64"
AC_TRY_COMPILE(, [
-int main () { return 0 ; }
+ return 0;
],
[
FLAG_M64="-m64"
@@ -925,7 +925,7 @@
CFLAGS="-maix64"
AC_TRY_COMPILE(, [
-int main () { return 0 ; }
+ return 0;
],
[
FLAG_MAIX64="-maix64"
@@ -946,7 +946,7 @@
CFLAGS="-mmmx"
AC_TRY_COMPILE(, [
-int main () { return 0 ; }
+ return 0;
],
[
FLAG_MMMX="-mmmx"
@@ -967,7 +967,7 @@
CFLAGS="-msse"
AC_TRY_COMPILE(, [
-int main () { return 0 ; }
+ return 0;
],
[
FLAG_MSSE="-msse"
@@ -988,7 +988,7 @@
CFLAGS="-mpreferred-stack-boundary=2"
AC_TRY_COMPILE(, [
-int main () { return 0 ; }
+ return 0;
],
[
PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
@@ -1009,7 +1009,7 @@
CFLAGS="-Wno-pointer-sign"
AC_TRY_COMPILE(, [
-int main () { return 0 ; }
+ return 0;
],
[
no_pointer_sign=yes
@@ -1032,7 +1032,7 @@
CFLAGS="-Wdeclaration-after-statement"
AC_TRY_COMPILE(, [
-int main () { return 0 ; }
+ return 0;
],
[
declaration_after_statement=yes
@@ -1115,7 +1115,7 @@
CFLAGS="-fno-stack-protector"
AC_TRY_COMPILE(, [
-int main () { return 0 ; }
+ return 0;
],
[
no_stack_protector=yes
|
|
From: <sv...@va...> - 2009-01-21 22:19:33
|
Author: njn
Date: 2009-01-21 22:19:26 +0000 (Wed, 21 Jan 2009)
New Revision: 9009
Log:
Replace some 4-space indents with 3-space indents. Merged from DARWIN.
Modified:
trunk/cachegrind/cg-x86.c
trunk/cachegrind/cg_arch.h
Modified: trunk/cachegrind/cg-x86.c
===================================================================
--- trunk/cachegrind/cg-x86.c 2009-01-21 04:11:13 UTC (rev 9008)
+++ trunk/cachegrind/cg-x86.c 2009-01-21 22:19:26 UTC (rev 9009)
@@ -42,12 +42,12 @@
static void micro_ops_warn(Int actual_size, Int used_size, Int line_size)
{
- VG_(message)(Vg_DebugMsg,
- "warning: Pentium 4 with %d KB micro-op instruction trace cache",
- actual_size);
- VG_(message)(Vg_DebugMsg,
- " Simulating a %d KB I-cache with %d B lines",
- used_size, line_size);
+ VG_(message)(Vg_DebugMsg,
+ "warning: Pentium 4 with %d KB micro-op instruction trace cache",
+ actual_size);
+ VG_(message)(Vg_DebugMsg,
+ " Simulating a %d KB I-cache with %d B lines",
+ used_size, line_size);
}
/* Intel method is truly wretched. We have to do an insane indexing into an
Modified: trunk/cachegrind/cg_arch.h
===================================================================
--- trunk/cachegrind/cg_arch.h 2009-01-21 04:11:13 UTC (rev 9008)
+++ trunk/cachegrind/cg_arch.h 2009-01-21 22:19:26 UTC (rev 9009)
@@ -33,9 +33,9 @@
// For cache simulation
typedef struct {
- int size; // bytes
- int assoc;
- int line_size; // bytes
+ int size; // bytes
+ int assoc;
+ int line_size; // bytes
} cache_t;
// Gives the configuration of I1, D1 and L2 caches. They get overridden
|
|
From: Bart V. A. <bar...@gm...> - 2009-01-21 13:05:52
|
On Wed, Jan 21, 2009 at 1:46 PM, Julian Seward <js...@ac...> wrote: > >> Please don't try to compile Valgrind with gcc 2.9.x -- at least the >> DRD source code is compiled incorrectly with this compiler version, >> probably due to an optimizer bug. > > Do you know what part of DRD is affected? Any details of the problem? The regression test drd/tests/drd_bitmap_test succeeds when Valgrind is compiled with any gcc 3.x or 4.x compiler, but fails when compiled with gcc 2.9.x. The source file drd_bitmap_test.c includes the DRD source files that perform bitmap manipulations. I assume it is a bug in the optimizer of gcc 2.9.x. Bart. |
|
From: Julian S. <js...@ac...> - 2009-01-21 13:01:06
|
> Please don't try to compile Valgrind with gcc 2.9.x -- at least the > DRD source code is compiled incorrectly with this compiler version, > probably due to an optimizer bug. Do you know what part of DRD is affected? Any details of the problem? J |
|
From: Bart V. A. <bar...@gm...> - 2009-01-21 12:45:32
|
On Wed, Jan 21, 2009 at 1:25 PM, Julian Seward <js...@ac...> wrote:
> On Tuesday 20 January 2009, Nicholas Nethercote wrote:
>> On Wed, Jan 21, 2009 at 12:08 AM, Florian Krohm <br...@ac...> wrote:
>> > On Monday 19 January 2009 23:16:09 sv...@va... wrote:
>> >> - VG_(printf)("%d %d\n", *thin_size, sizeof(struct MACH_HEADER));
>> >> + VG_(printf)("%d %lu\n", *thin_size, sizeof(struct MACH_HEADER));
>> >
>> > C99 has %zu for arguments of type size_t. It's possible, though, that
>> > some older versions of gcc -Wformat don't handle this. What is the
>> > minimum GCC version that you assume for compilation ?
>>
>> We still have a --workaround-gcc296-bugs flag...
>
> That really means "ignore accesses in the 256 or so bytes below %esp"
> (just pretend you didn't see them). Maybe it should be renamed.
>
> Minimum version of gcc now is 3.0.x, I believe.
Please don't try to compile Valgrind with gcc 2.9.x -- at least the
DRD source code is compiled incorrectly with this compiler version,
probably due to an optimizer bug.
Bart.
|
|
From: Julian S. <js...@ac...> - 2009-01-21 12:40:24
|
On Tuesday 20 January 2009, Nicholas Nethercote wrote:
> On Wed, Jan 21, 2009 at 12:08 AM, Florian Krohm <br...@ac...> wrote:
> > On Monday 19 January 2009 23:16:09 sv...@va... wrote:
> >> - VG_(printf)("%d %d\n", *thin_size, sizeof(struct MACH_HEADER));
> >> + VG_(printf)("%d %lu\n", *thin_size, sizeof(struct MACH_HEADER));
> >
> > C99 has %zu for arguments of type size_t. It's possible, though, that
> > some older versions of gcc -Wformat don't handle this. What is the
> > minimum GCC version that you assume for compilation ?
>
> We still have a --workaround-gcc296-bugs flag...
That really means "ignore accesses in the 256 or so bytes below %esp"
(just pretend you didn't see them). Maybe it should be renamed.
Minimum version of gcc now is 3.0.x, I believe.
J
|
|
From: Bart V. A. <bar...@gm...> - 2009-01-21 08:37:08
|
Nightly build on georgia-tech-cellbuzz-native ( cellbuzz, ppc64, Fedora 7, native ) started at 2009-01-21 02:00:01 EST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... done Regression test results follow == 406 tests, 44 stderr failures, 11 stdout failures, 2 post failures == exp-ptrcheck/tests/bad_percentify (stderr) exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/fp (stderr) exp-ptrcheck/tests/globalerr (stderr) exp-ptrcheck/tests/hackedbz2 (stderr) exp-ptrcheck/tests/hp_bounds (stderr) exp-ptrcheck/tests/hp_dangle (stderr) exp-ptrcheck/tests/justify (stderr) exp-ptrcheck/tests/partial_bad (stderr) exp-ptrcheck/tests/partial_good (stderr) exp-ptrcheck/tests/preen_invars (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) exp-ptrcheck/tests/realloc (stderr) exp-ptrcheck/tests/stackerr (stderr) exp-ptrcheck/tests/strcpy (stderr) exp-ptrcheck/tests/supp (stderr) exp-ptrcheck/tests/tricky (stderr) exp-ptrcheck/tests/unaligned (stderr) exp-ptrcheck/tests/zero (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc20_verifywrap (stderr) massif/tests/long-names (post) massif/tests/overloaded-new (post) memcheck/tests/deep_templates (stdout) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/varinfo1 (stderr) memcheck/tests/varinfo2 (stderr) memcheck/tests/varinfo3 (stderr) memcheck/tests/varinfo4 (stderr) memcheck/tests/varinfo5 (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/x86-linux/scalar (stderr) memcheck/tests/x86-linux/scalar_exit_group (stderr) memcheck/tests/x86-linux/scalar_fork (stderr) memcheck/tests/x86-linux/scalar_supp (stderr) memcheck/tests/x86-linux/scalar_vfork (stderr) memcheck/tests/zeropage (stdout) none/tests/async-sigs (stdout) none/tests/faultstatus (stderr) none/tests/fdleak_cmsg (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) none/tests/ppc32/jm-fp (stdout) none/tests/ppc32/jm-vmx (stdout) none/tests/ppc32/round (stdout) none/tests/ppc32/test_gx (stdout) none/tests/ppc64/jm-fp (stdout) none/tests/ppc64/jm-vmx (stdout) none/tests/ppc64/round (stdout) |
|
From: Nicholas N. <n.n...@gm...> - 2009-01-21 05:09:31
|
On Wed, Jan 21, 2009 at 2:25 PM, Tom Hughes <th...@cy...> wrote: > > Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2009-01-21 03:05:04 GMT > Results differ from 24 hours ago > > Checking out valgrind source tree ... done > Configuring valgrind ... done > Building valgrind ... failed > > Last 20 lines of verbose log follow echo > make[4]: Entering directory `/tmp/vgtest/2009-01-21/valgrind/VEX' > rm -f auxprogs/genoffsets.s > gcc -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wmissing-declarations -g -O2 -fstrict-aliasing -O -S -o auxprogs/genoffsets.s \ > auxprogs/genoffsets.c > grep xyzzy auxprogs/genoffsets.s | grep define \ > | sed "s/xyzzy\\$//g" | sed "s/xyzzy//g" \ > > pub/libvex_guest_offsets.h > rm -f auxprogs/genoffsets.s > make[4]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/VEX' > gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-syswrap-main.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo -c -o libcoregrind_x86_linux_a-syswrap-main.o `test -f 'm_syswrap/syswrap-main.c' || echo './'`m_syswrap/syswrap-main.c > mv -f .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo .deps/libcoregrind_x86_linux_a-syswrap-main.Po > gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-elf.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-elf.Tpo -c -o libcoregrind_x86_linux_a-elf.o `test -f 'm_ume/elf.c' || echo './'`m_ume/elf.c > m_ume/elf.c:45:22: error: priv_ume.h: No such file or directory > make[3]: *** [libcoregrind_x86_linux_a-elf.o] Error 1 > make[3]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind' > make[2]: *** [all] Error 2 > make[2]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind' > make: *** [all] Error 2 My mistake, it should be fixed now. Nick |
|
From: <sv...@va...> - 2009-01-21 04:11:39
|
Author: njn Date: 2009-01-21 04:11:13 +0000 (Wed, 21 Jan 2009) New Revision: 9008 Log: This should have been part of r9004. Added: trunk/coregrind/m_ume/priv_ume.h Added: trunk/coregrind/m_ume/priv_ume.h =================================================================== --- trunk/coregrind/m_ume/priv_ume.h (rev 0) +++ trunk/coregrind/m_ume/priv_ume.h 2009-01-21 04:11:13 UTC (rev 9008) @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------*/ +/*--- User-mode execve(). priv_ume.h ---*/ +/*--------------------------------------------------------------------*/ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright (C) 2000-2005 Julian Seward + js...@ac... + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307, USA. + + The GNU General Public License is contained in the file COPYING. +*/ + +#ifndef __PRIV_UME_H +#define __PRIV_UME_H + +#if defined(VGO_linux) +# define HAVE_ELF +# define HAVE_SCRIPT + +#elif defined(VGO_aix5) +// The AIX port doesn't use UME. + +#else +#error unknown architecture +#endif + +extern int VG_(do_exec_inner)(const HChar *exe, ExeInfo *info); + +#if defined(HAVE_ELF) +extern Bool VG_(match_ELF) ( Char *hdr, Int len ); +extern Int VG_(load_ELF) ( Int fd, const HChar *name, ExeInfo *info ); +#endif + +#if defined(HAVE_SCRIPT) +extern Bool VG_(match_script) ( Char *hdr, Int len ); +extern Int VG_(load_script) ( Int fd, const HChar *name, ExeInfo *info ); +#endif + +#endif /* __PRIV_UME_H */ + +/*--------------------------------------------------------------------*/ +/*--- end ---*/ +/*--------------------------------------------------------------------*/ + |
|
From: <sv...@va...> - 2009-01-21 03:46:00
|
Author: njn
Date: 2009-01-21 03:45:42 +0000 (Wed, 21 Jan 2009)
New Revision: 9007
Log:
Update instructions for getting the code.
Modified:
branches/DARWIN/README.Apple
Modified: branches/DARWIN/README.Apple
===================================================================
--- branches/DARWIN/README.Apple 2009-01-21 03:32:09 UTC (rev 9006)
+++ branches/DARWIN/README.Apple 2009-01-21 03:45:42 UTC (rev 9007)
@@ -15,10 +15,8 @@
As much RAM as you can afford
Valgrind 3.3.1 r8805, VEX r1875
-Get and patch Valgrind sources:
- svn co -r8805 svn://svn.valgrind.org/valgrind/trunk valgrind
- svn update -r1875 valgrind/VEX
- patch -p1 -d valgrind < /path/to/valgrind-opensource.patch
+Get the DARWIN branch:
+ svn co svn://svn.valgrind.org/valgrind/branches/DARWIN valgrind
Build and install into /usr/local/bin/valgrind:
cd valgrind
|
|
From: Tom H. <th...@cy...> - 2009-01-21 03:34:58
|
Nightly build on vauxhall ( x86_64, Fedora 10 ) started at 2009-01-21 03:20:06 GMT
Results differ from 24 hours ago
Checking out valgrind source tree ... done
Configuring valgrind ... done
Building valgrind ... failed
Last 20 lines of verbose log follow echo
make[4]: Entering directory `/tmp/vgtest/2009-01-21/valgrind/VEX'
rm -f auxprogs/genoffsets.s
gcc -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wmissing-declarations -g -O2 -fstrict-aliasing -O -S -o auxprogs/genoffsets.s \
auxprogs/genoffsets.c
grep xyzzy auxprogs/genoffsets.s | grep define \
| sed "s/xyzzy\\$//g" | sed "s/xyzzy//g" \
> pub/libvex_guest_offsets.h
rm -f auxprogs/genoffsets.s
make[4]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/VEX'
gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-syswrap-main.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo -c -o libcoregrind_x86_linux_a-syswrap-main.o `test -f 'm_syswrap/syswrap-main.c' || echo './'`m_syswrap/syswrap-main.c
mv -f .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo .deps/libcoregrind_x86_linux_a-syswrap-main.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-elf.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-elf.Tpo -c -o libcoregrind_x86_linux_a-elf.o `test -f 'm_ume/elf.c' || echo './'`m_ume/elf.c
m_ume/elf.c:45:22: error: priv_ume.h: No such file or directory
make[3]: *** [libcoregrind_x86_linux_a-elf.o] Error 1
make[3]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind'
make: *** [all] Error 2
=================================================
== Results from 24 hours ago ==
=================================================
Checking out valgrind source tree ... done
Configuring valgrind ... done
Building valgrind ... done
Running regression tests ... failed
Regression test results follow
== 481 tests, 3 stderr failures, 0 stdout failures, 0 post failures ==
exp-ptrcheck/tests/base (stderr)
exp-ptrcheck/tests/preen_invars (stderr)
memcheck/tests/x86-linux/scalar (stderr)
=================================================
== Difference between 24 hours ago and now ==
=================================================
*** old.short Wed Jan 21 03:34:02 2009
--- new.short Wed Jan 21 03:34:50 2009
***************
*** 3,13 ****
Configuring valgrind ... done
! Building valgrind ... done
! Running regression tests ... failed
!
! Regression test results follow
!
! == 481 tests, 3 stderr failures, 0 stdout failures, 0 post failures ==
! exp-ptrcheck/tests/base (stderr)
! exp-ptrcheck/tests/preen_invars (stderr)
! memcheck/tests/x86-linux/scalar (stderr)
--- 3,26 ----
Configuring valgrind ... done
! Building valgrind ... failed
+ Last 20 lines of verbose log follow echo
+ make[4]: Entering directory `/tmp/vgtest/2009-01-21/valgrind/VEX'
+ rm -f auxprogs/genoffsets.s
+ gcc -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wmissing-declarations -g -O2 -fstrict-aliasing -O -S -o auxprogs/genoffsets.s \
+ auxprogs/genoffsets.c
+ grep xyzzy auxprogs/genoffsets.s | grep define \
+ | sed "s/xyzzy\\$//g" | sed "s/xyzzy//g" \
+ > pub/libvex_guest_offsets.h
+ rm -f auxprogs/genoffsets.s
+ make[4]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/VEX'
+ gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-syswrap-main.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo -c -o libcoregrind_x86_linux_a-syswrap-main.o `test -f 'm_syswrap/syswrap-main.c' || echo './'`m_syswrap/syswrap-main.c
+ mv -f .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo .deps/libcoregrind_x86_linux_a-syswrap-main.Po
+ gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-elf.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-elf.Tpo -c -o libcoregrind_x86_linux_a-elf.o `test -f 'm_ume/elf.c' || echo './'`m_ume/elf.c
+ m_ume/elf.c:45:22: error: priv_ume.h: No such file or directory
+ make[3]: *** [libcoregrind_x86_linux_a-elf.o] Error 1
+ make[3]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind'
+ make[2]: *** [all] Error 2
+ make[2]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind'
+ make[1]: *** [all-recursive] Error 1
+ make[1]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind'
+ make: *** [all] Error 2
|
|
From: <sv...@va...> - 2009-01-21 03:32:30
|
Author: njn
Date: 2009-01-21 03:32:09 +0000 (Wed, 21 Jan 2009)
New Revision: 9006
Log:
Make it compile again on Mac.
Modified:
branches/DARWIN/coregrind/m_ume/macho.c
branches/DARWIN/coregrind/m_ume/priv_ume.h
Modified: branches/DARWIN/coregrind/m_ume/macho.c
===================================================================
--- branches/DARWIN/coregrind/m_ume/macho.c 2009-01-21 03:03:07 UTC (rev 9005)
+++ branches/DARWIN/coregrind/m_ume/macho.c 2009-01-21 03:32:09 UTC (rev 9006)
@@ -35,8 +35,9 @@
#include "pub_core_debuglog.h"
#include "pub_core_libcassert.h" // VG_(exit), vg_assert
#include "pub_core_libcbase.h" // VG_(memcmp), etc
+#include "pub_core_libcfile.h" // VG_(open) et al
#include "pub_core_libcprint.h"
-#include "pub_core_libcfile.h" // VG_(open) et al
+#include "pub_core_libcproc.h"
#include "pub_core_machine.h" // VG_ELF_CLASS (XXX: which should be moved)
#include "pub_core_mallocfree.h" // VG_(malloc), VG_(free)
#include "pub_core_syscall.h" // VG_(strerror)
@@ -717,7 +718,7 @@
}
-Bool VG_(match_macho)(char *hdr, Int len)
+Bool VG_(match_macho)(Char *hdr, Int len)
{
vki_uint32_t *magic = (vki_uint32_t *)hdr;
Modified: branches/DARWIN/coregrind/m_ume/priv_ume.h
===================================================================
--- branches/DARWIN/coregrind/m_ume/priv_ume.h 2009-01-21 03:03:07 UTC (rev 9005)
+++ branches/DARWIN/coregrind/m_ume/priv_ume.h 2009-01-21 03:32:09 UTC (rev 9006)
@@ -37,6 +37,10 @@
#elif defined(VGO_aix5)
// The AIX port doesn't use UME.
+#elif defined(VGO_darwin)
+# define HAVE_MACHO
+# define HAVE_SCRIPT
+
#else
#error unknown architecture
#endif
@@ -53,6 +57,11 @@
extern Int VG_(load_script) ( Int fd, const HChar *name, ExeInfo *info );
#endif
+#if defined(HAVE_MACHO)
+extern Bool VG_(match_macho) ( Char *hdr, Int len );
+extern Int VG_(load_macho) ( Int fd, const HChar *name, ExeInfo *info );
+#endif
+
#endif /* __PRIV_UME_H */
/*--------------------------------------------------------------------*/
|
|
From: Tom H. <th...@cy...> - 2009-01-21 03:25:53
|
Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2009-01-21 03:05:04 GMT
Results differ from 24 hours ago
Checking out valgrind source tree ... done
Configuring valgrind ... done
Building valgrind ... failed
Last 20 lines of verbose log follow echo
make[4]: Entering directory `/tmp/vgtest/2009-01-21/valgrind/VEX'
rm -f auxprogs/genoffsets.s
gcc -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wmissing-declarations -g -O2 -fstrict-aliasing -O -S -o auxprogs/genoffsets.s \
auxprogs/genoffsets.c
grep xyzzy auxprogs/genoffsets.s | grep define \
| sed "s/xyzzy\\$//g" | sed "s/xyzzy//g" \
> pub/libvex_guest_offsets.h
rm -f auxprogs/genoffsets.s
make[4]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/VEX'
gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-syswrap-main.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo -c -o libcoregrind_x86_linux_a-syswrap-main.o `test -f 'm_syswrap/syswrap-main.c' || echo './'`m_syswrap/syswrap-main.c
mv -f .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo .deps/libcoregrind_x86_linux_a-syswrap-main.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-elf.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-elf.Tpo -c -o libcoregrind_x86_linux_a-elf.o `test -f 'm_ume/elf.c' || echo './'`m_ume/elf.c
m_ume/elf.c:45:22: error: priv_ume.h: No such file or directory
make[3]: *** [libcoregrind_x86_linux_a-elf.o] Error 1
make[3]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind'
make: *** [all] Error 2
=================================================
== Results from 24 hours ago ==
=================================================
Checking out valgrind source tree ... done
Configuring valgrind ... done
Building valgrind ... done
Running regression tests ... failed
Regression test results follow
== 472 tests, 7 stderr failures, 0 stdout failures, 0 post failures ==
exp-ptrcheck/tests/base (stderr)
exp-ptrcheck/tests/ccc (stderr)
exp-ptrcheck/tests/preen_invars (stderr)
exp-ptrcheck/tests/pth_create (stderr)
exp-ptrcheck/tests/pth_specific (stderr)
helgrind/tests/tc20_verifywrap (stderr)
memcheck/tests/x86-linux/scalar (stderr)
=================================================
== Difference between 24 hours ago and now ==
=================================================
*** old.short Wed Jan 21 03:24:30 2009
--- new.short Wed Jan 21 03:25:44 2009
***************
*** 3,17 ****
Configuring valgrind ... done
! Building valgrind ... done
! Running regression tests ... failed
!
! Regression test results follow
!
! == 472 tests, 7 stderr failures, 0 stdout failures, 0 post failures ==
! exp-ptrcheck/tests/base (stderr)
! exp-ptrcheck/tests/ccc (stderr)
! exp-ptrcheck/tests/preen_invars (stderr)
! exp-ptrcheck/tests/pth_create (stderr)
! exp-ptrcheck/tests/pth_specific (stderr)
! helgrind/tests/tc20_verifywrap (stderr)
! memcheck/tests/x86-linux/scalar (stderr)
--- 3,26 ----
Configuring valgrind ... done
! Building valgrind ... failed
+ Last 20 lines of verbose log follow echo
+ make[4]: Entering directory `/tmp/vgtest/2009-01-21/valgrind/VEX'
+ rm -f auxprogs/genoffsets.s
+ gcc -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wmissing-declarations -g -O2 -fstrict-aliasing -O -S -o auxprogs/genoffsets.s \
+ auxprogs/genoffsets.c
+ grep xyzzy auxprogs/genoffsets.s | grep define \
+ | sed "s/xyzzy\\$//g" | sed "s/xyzzy//g" \
+ > pub/libvex_guest_offsets.h
+ rm -f auxprogs/genoffsets.s
+ make[4]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/VEX'
+ gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-syswrap-main.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo -c -o libcoregrind_x86_linux_a-syswrap-main.o `test -f 'm_syswrap/syswrap-main.c' || echo './'`m_syswrap/syswrap-main.c
+ mv -f .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo .deps/libcoregrind_x86_linux_a-syswrap-main.Po
+ gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-elf.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-elf.Tpo -c -o libcoregrind_x86_linux_a-elf.o `test -f 'm_ume/elf.c' || echo './'`m_ume/elf.c
+ m_ume/elf.c:45:22: error: priv_ume.h: No such file or directory
+ make[3]: *** [libcoregrind_x86_linux_a-elf.o] Error 1
+ make[3]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind'
+ make[2]: *** [all] Error 2
+ make[2]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind'
+ make[1]: *** [all-recursive] Error 1
+ make[1]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind'
+ make: *** [all] Error 2
|
|
From: Tom H. <th...@cy...> - 2009-01-21 03:22:27
|
Nightly build on mg ( x86_64, Fedora 9 ) started at 2009-01-21 03:10:05 GMT
Results differ from 24 hours ago
Checking out valgrind source tree ... done
Configuring valgrind ... done
Building valgrind ... failed
Last 20 lines of verbose log follow echo
make[4]: Entering directory `/tmp/vgtest/2009-01-21/valgrind/VEX'
rm -f auxprogs/genoffsets.s
gcc -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wmissing-declarations -g -O2 -fstrict-aliasing -O -S -o auxprogs/genoffsets.s \
auxprogs/genoffsets.c
grep xyzzy auxprogs/genoffsets.s | grep define \
| sed "s/xyzzy\\$//g" | sed "s/xyzzy//g" \
> pub/libvex_guest_offsets.h
rm -f auxprogs/genoffsets.s
make[4]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/VEX'
gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-syswrap-main.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo -c -o libcoregrind_x86_linux_a-syswrap-main.o `test -f 'm_syswrap/syswrap-main.c' || echo './'`m_syswrap/syswrap-main.c
mv -f .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo .deps/libcoregrind_x86_linux_a-syswrap-main.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-elf.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-elf.Tpo -c -o libcoregrind_x86_linux_a-elf.o `test -f 'm_ume/elf.c' || echo './'`m_ume/elf.c
m_ume/elf.c:45:22: error: priv_ume.h: No such file or directory
make[3]: *** [libcoregrind_x86_linux_a-elf.o] Error 1
make[3]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind'
make: *** [all] Error 2
=================================================
== Results from 24 hours ago ==
=================================================
Checking out valgrind source tree ... done
Configuring valgrind ... done
Building valgrind ... done
Running regression tests ... failed
Regression test results follow
== 478 tests, 5 stderr failures, 2 stdout failures, 0 post failures ==
exp-ptrcheck/tests/ccc (stderr)
exp-ptrcheck/tests/preen_invars (stderr)
exp-ptrcheck/tests/pth_create (stderr)
exp-ptrcheck/tests/pth_specific (stderr)
memcheck/tests/linux/timerfd-syscall (stdout)
memcheck/tests/x86-linux/scalar (stderr)
none/tests/mremap2 (stdout)
=================================================
== Difference between 24 hours ago and now ==
=================================================
*** old.short Wed Jan 21 03:21:05 2009
--- new.short Wed Jan 21 03:22:18 2009
***************
*** 3,17 ****
Configuring valgrind ... done
! Building valgrind ... done
! Running regression tests ... failed
!
! Regression test results follow
!
! == 478 tests, 5 stderr failures, 2 stdout failures, 0 post failures ==
! exp-ptrcheck/tests/ccc (stderr)
! exp-ptrcheck/tests/preen_invars (stderr)
! exp-ptrcheck/tests/pth_create (stderr)
! exp-ptrcheck/tests/pth_specific (stderr)
! memcheck/tests/linux/timerfd-syscall (stdout)
! memcheck/tests/x86-linux/scalar (stderr)
! none/tests/mremap2 (stdout)
--- 3,26 ----
Configuring valgrind ... done
! Building valgrind ... failed
+ Last 20 lines of verbose log follow echo
+ make[4]: Entering directory `/tmp/vgtest/2009-01-21/valgrind/VEX'
+ rm -f auxprogs/genoffsets.s
+ gcc -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wmissing-declarations -g -O2 -fstrict-aliasing -O -S -o auxprogs/genoffsets.s \
+ auxprogs/genoffsets.c
+ grep xyzzy auxprogs/genoffsets.s | grep define \
+ | sed "s/xyzzy\\$//g" | sed "s/xyzzy//g" \
+ > pub/libvex_guest_offsets.h
+ rm -f auxprogs/genoffsets.s
+ make[4]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/VEX'
+ gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-syswrap-main.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo -c -o libcoregrind_x86_linux_a-syswrap-main.o `test -f 'm_syswrap/syswrap-main.c' || echo './'`m_syswrap/syswrap-main.c
+ mv -f .deps/libcoregrind_x86_linux_a-syswrap-main.Tpo .deps/libcoregrind_x86_linux_a-syswrap-main.Po
+ gcc -DHAVE_CONFIG_H -I. -I.. -I../coregrind -I.. -I../coregrind/x86 -I../coregrind/linux -I../coregrind/x86-linux -I../include -I../VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVG_LIBDIR="\"/tmp/vgtest/2009-01-21/Inst/lib/valgrind"\" -m32 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -MT libcoregrind_x86_linux_a-elf.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-elf.Tpo -c -o libcoregrind_x86_linux_a-elf.o `test -f 'm_ume/elf.c' || echo './'`m_ume/elf.c
+ m_ume/elf.c:45:22: error: priv_ume.h: No such file or directory
+ make[3]: *** [libcoregrind_x86_linux_a-elf.o] Error 1
+ make[3]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind'
+ make[2]: *** [all] Error 2
+ make[2]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind/coregrind'
+ make[1]: *** [all-recursive] Error 1
+ make[1]: Leaving directory `/tmp/vgtest/2009-01-21/valgrind'
+ make: *** [all] Error 2
|
|
From: <sv...@va...> - 2009-01-21 03:03:36
|
Author: njn Date: 2009-01-21 03:03:07 +0000 (Wed, 21 Jan 2009) New Revision: 9005 Log: Create m_ume/ module. Based on r9004 on the trunk. Added: branches/DARWIN/coregrind/m_ume/ branches/DARWIN/coregrind/m_ume/elf.c branches/DARWIN/coregrind/m_ume/macho.c branches/DARWIN/coregrind/m_ume/main.c branches/DARWIN/coregrind/m_ume/priv_ume.h branches/DARWIN/coregrind/m_ume/script.c Removed: branches/DARWIN/coregrind/m_ume.c branches/DARWIN/coregrind/m_ume_elf.c branches/DARWIN/coregrind/m_ume_macho.c branches/DARWIN/coregrind/m_ume_script.c branches/DARWIN/coregrind/priv_ume.h branches/DARWIN/memcheck/tests/vgtest_ume.c branches/DARWIN/memcheck/tests/vgtest_ume.disabled branches/DARWIN/memcheck/tests/vgtest_ume.stderr.exp Modified: branches/DARWIN/coregrind/Makefile.am branches/DARWIN/coregrind/m_debuginfo/debuginfo.c branches/DARWIN/coregrind/m_initimg/initimg-linux.c branches/DARWIN/coregrind/pub_core_machine.h branches/DARWIN/coregrind/pub_core_ume.h branches/DARWIN/memcheck/tests/Makefile.am [... diff too large to include ...] |
|
From: <sv...@va...> - 2009-01-21 02:27:13
|
Author: njn
Date: 2009-01-21 02:26:56 +0000 (Wed, 21 Jan 2009)
New Revision: 9004
Log:
- Split up m_ume.c into m_ume/{main,elf,script}.c. This will make merging
the DARWIN branch easier later.
- Remove the disabled vgtest_ume test, it's very unlikely it'll ever work
again.
- Move VG_(find_auxv) to initimg-linux.c, the only place it's used, and make
it static.
Added:
trunk/coregrind/m_ume/
trunk/coregrind/m_ume/elf.c
trunk/coregrind/m_ume/main.c
trunk/coregrind/m_ume/script.c
Removed:
trunk/coregrind/m_ume.c
trunk/memcheck/tests/vgtest_ume.c
trunk/memcheck/tests/vgtest_ume.disabled
trunk/memcheck/tests/vgtest_ume.stderr.exp
Modified:
trunk/coregrind/Makefile.am
trunk/coregrind/m_initimg/initimg-linux.c
trunk/coregrind/pub_core_ume.h
trunk/memcheck/tests/Makefile.am
Modified: trunk/coregrind/Makefile.am
===================================================================
--- trunk/coregrind/Makefile.am 2009-01-20 23:07:34 UTC (rev 9003)
+++ trunk/coregrind/Makefile.am 2009-01-21 02:26:56 UTC (rev 9004)
@@ -140,6 +140,7 @@
pub_core_vkiscnums.h \
pub_core_wordfm.h \
pub_core_xarray.h \
+ m_aspacemgr/priv_aspacemgr.h \
m_coredump/priv_elf.h \
m_debuginfo/priv_misc.h \
m_debuginfo/priv_storage.h \
@@ -163,7 +164,7 @@
m_syswrap/priv_syswrap-linux-variants.h \
m_syswrap/priv_syswrap-aix5.h \
m_syswrap/priv_syswrap-main.h \
- m_aspacemgr/priv_aspacemgr.h \
+ m_ume/priv_ume.h \
launcher-aix5-bootblock.h \
m_initimg/simple_huffman.c
@@ -203,7 +204,6 @@
m_trampoline.S \
m_translate.c \
m_transtab.c \
- m_ume.c \
m_vki.c \
m_vkiscnums.c \
m_wordfm.c \
@@ -222,7 +222,10 @@
m_replacemalloc/replacemalloc_core.c \
m_scheduler/scheduler.c \
m_scheduler/sema.c \
- m_syswrap/syswrap-main.c
+ m_syswrap/syswrap-main.c \
+ m_ume/elf.c \
+ m_ume/main.c \
+ m_ume/script.c
COREGRIND_LINUX_SOURCE = \
m_coredump/coredump-elf.c \
Modified: trunk/coregrind/m_initimg/initimg-linux.c
===================================================================
--- trunk/coregrind/m_initimg/initimg-linux.c 2009-01-20 23:07:34 UTC (rev 9003)
+++ trunk/coregrind/m_initimg/initimg-linux.c 2009-01-21 02:26:56 UTC (rev 9004)
@@ -412,6 +412,38 @@
---------------------------------------------------------------- */
+struct auxv
+{
+ Word a_type;
+ union {
+ void *a_ptr;
+ Word a_val;
+ } u;
+};
+
+static
+struct auxv *find_auxv(UWord* sp)
+{
+ sp++; // skip argc (Nb: is word-sized, not int-sized!)
+
+ while (*sp != 0) // skip argv
+ sp++;
+ sp++;
+
+ while (*sp != 0) // skip env
+ sp++;
+ sp++;
+
+#if defined(VGA_ppc32) || defined(VGA_ppc64)
+# if defined AT_IGNOREPPC
+ while (*sp == AT_IGNOREPPC) // skip AT_IGNOREPPC entries
+ sp += 2;
+# endif
+#endif
+
+ return (struct auxv *)sp;
+}
+
static
Addr setup_client_stack( void* init_sp,
char** orig_envp,
@@ -425,9 +457,9 @@
char *strtab; /* string table */
char *stringbase;
Addr *ptr;
- struct ume_auxv *auxv;
- const struct ume_auxv *orig_auxv;
- const struct ume_auxv *cauxv;
+ struct auxv *auxv;
+ const struct auxv *orig_auxv;
+ const struct auxv *cauxv;
unsigned stringsize; /* total size of strings in bytes */
unsigned auxsize; /* total size of auxv in bytes */
Int argc; /* total argc */
@@ -442,7 +474,7 @@
vg_assert( VG_(args_for_client) );
/* use our own auxv as a prototype */
- orig_auxv = VG_(find_auxv)(init_sp);
+ orig_auxv = find_auxv(init_sp);
/* ==================== compute sizes ==================== */
@@ -636,7 +668,7 @@
*ptr++ = 0;
/* --- auxv --- */
- auxv = (struct ume_auxv *)ptr;
+ auxv = (struct auxv *)ptr;
*client_auxv = (UInt *)auxv;
# if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
Copied: trunk/coregrind/m_ume/elf.c (from rev 9003, trunk/coregrind/m_ume.c)
===================================================================
--- trunk/coregrind/m_ume/elf.c (rev 0)
+++ trunk/coregrind/m_ume/elf.c 2009-01-21 02:26:56 UTC (rev 9004)
@@ -0,0 +1,519 @@
+
+/*--------------------------------------------------------------------*/
+/*--- User-mode execve() for ELF executables m_ume_elf.c ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2008 Julian Seward
+ js...@ac...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include "pub_core_basics.h"
+#include "pub_core_vki.h"
+
+#include "pub_core_aspacemgr.h" // various mapping fns
+#include "pub_core_debuglog.h"
+#include "pub_core_libcassert.h" // VG_(exit), vg_assert
+#include "pub_core_libcbase.h" // VG_(memcmp), etc
+#include "pub_core_libcprint.h"
+#include "pub_core_libcfile.h" // VG_(open) et al
+#include "pub_core_machine.h" // VG_ELF_CLASS (XXX: which should be moved)
+#include "pub_core_mallocfree.h" // VG_(malloc), VG_(free)
+#include "pub_core_syscall.h" // VG_(strerror)
+#include "pub_core_ume.h" // self
+
+#include "priv_ume.h"
+
+
+#if defined(HAVE_ELF)
+
+/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
+#define _GNU_SOURCE
+#define _FILE_OFFSET_BITS 64
+/* This is for ELF types etc, and also the AT_ constants. */
+#include <elf.h>
+/* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
+
+
+#if VG_WORDSIZE == 8
+#define ESZ(x) Elf64_##x
+#elif VG_WORDSIZE == 4
+#define ESZ(x) Elf32_##x
+#else
+#error VG_WORDSIZE needs to ==4 or ==8
+#endif
+
+struct elfinfo
+{
+ ESZ(Ehdr) e;
+ ESZ(Phdr) *p;
+ Int fd;
+};
+
+static void check_mmap(SysRes res, Addr base, SizeT len)
+{
+ if (res.isError) {
+ VG_(printf)("valgrind: mmap(0x%llx, %lld) failed in UME "
+ "with error %lu (%s).\n",
+ (ULong)base, (Long)len,
+ res.err, VG_(strerror)(res.err) );
+ if (res.err == VKI_EINVAL) {
+ VG_(printf)("valgrind: this can be caused by executables with "
+ "very large text, data or bss segments.\n");
+ }
+ VG_(exit)(1);
+ }
+}
+
+/*------------------------------------------------------------*/
+/*--- Loading ELF files ---*/
+/*------------------------------------------------------------*/
+
+static
+struct elfinfo *readelf(Int fd, const char *filename)
+{
+ SysRes sres;
+ struct elfinfo *e = VG_(malloc)("ume.re.1", sizeof(*e));
+ Int phsz;
+
+ vg_assert(e);
+ e->fd = fd;
+
+ sres = VG_(pread)(fd, &e->e, sizeof(e->e), 0);
+ if (sres.isError || sres.res != sizeof(e->e)) {
+ VG_(printf)("valgrind: %s: can't read ELF header: %s\n",
+ filename, VG_(strerror)(sres.err));
+ goto bad;
+ }
+
+ if (VG_(memcmp)(&e->e.e_ident[0], ELFMAG, SELFMAG) != 0) {
+ VG_(printf)("valgrind: %s: bad ELF magic number\n", filename);
+ goto bad;
+ }
+ if (e->e.e_ident[EI_CLASS] != VG_ELF_CLASS) {
+ VG_(printf)("valgrind: wrong ELF executable class "
+ "(eg. 32-bit instead of 64-bit)\n");
+ goto bad;
+ }
+ if (e->e.e_ident[EI_DATA] != VG_ELF_DATA2XXX) {
+ VG_(printf)("valgrind: executable has wrong endian-ness\n");
+ goto bad;
+ }
+ if (!(e->e.e_type == ET_EXEC || e->e.e_type == ET_DYN)) {
+ VG_(printf)("valgrind: this is not an executable\n");
+ goto bad;
+ }
+
+ if (e->e.e_machine != VG_ELF_MACHINE) {
+ VG_(printf)("valgrind: executable is not for "
+ "this architecture\n");
+ goto bad;
+ }
+
+ if (e->e.e_phentsize != sizeof(ESZ(Phdr))) {
+ VG_(printf)("valgrind: sizeof ELF Phdr wrong\n");
+ goto bad;
+ }
+
+ phsz = sizeof(ESZ(Phdr)) * e->e.e_phnum;
+ e->p = VG_(malloc)("ume.re.2", phsz);
+ vg_assert(e->p);
+
+ sres = VG_(pread)(fd, e->p, phsz, e->e.e_phoff);
+ if (sres.isError || sres.res != phsz) {
+ VG_(printf)("valgrind: can't read phdr: %s\n",
+ VG_(strerror)(sres.err));
+ VG_(free)(e->p);
+ goto bad;
+ }
+
+ return e;
+
+ bad:
+ VG_(free)(e);
+ return NULL;
+}
+
+/* Map an ELF file. Returns the brk address. */
+static
+ESZ(Addr) mapelf(struct elfinfo *e, ESZ(Addr) base)
+{
+ Int i;
+ SysRes res;
+ ESZ(Addr) elfbrk = 0;
+
+ for (i = 0; i < e->e.e_phnum; i++) {
+ ESZ(Phdr) *ph = &e->p[i];
+ ESZ(Addr) addr, brkaddr;
+ ESZ(Word) memsz;
+
+ if (ph->p_type != PT_LOAD)
+ continue;
+
+ addr = ph->p_vaddr+base;
+ memsz = ph->p_memsz;
+ brkaddr = addr+memsz;
+
+ if (brkaddr > elfbrk)
+ elfbrk = brkaddr;
+ }
+
+ for (i = 0; i < e->e.e_phnum; i++) {
+ ESZ(Phdr) *ph = &e->p[i];
+ ESZ(Addr) addr, bss, brkaddr;
+ ESZ(Off) off;
+ ESZ(Word) filesz;
+ ESZ(Word) memsz;
+ unsigned prot = 0;
+
+ if (ph->p_type != PT_LOAD)
+ continue;
+
+ if (ph->p_flags & PF_X) prot |= VKI_PROT_EXEC;
+ if (ph->p_flags & PF_W) prot |= VKI_PROT_WRITE;
+ if (ph->p_flags & PF_R) prot |= VKI_PROT_READ;
+
+ addr = ph->p_vaddr+base;
+ off = ph->p_offset;
+ filesz = ph->p_filesz;
+ bss = addr+filesz;
+ memsz = ph->p_memsz;
+ brkaddr = addr+memsz;
+
+ // Tom says: In the following, do what the Linux kernel does and only
+ // map the pages that are required instead of rounding everything to
+ // the specified alignment (ph->p_align). (AMD64 doesn't work if you
+ // use ph->p_align -- part of stage2's memory gets trashed somehow.)
+ //
+ // The condition handles the case of a zero-length segment.
+ if (VG_PGROUNDUP(bss)-VG_PGROUNDDN(addr) > 0) {
+ if (0) VG_(debugLog)(0,"ume","mmap_file_fixed_client #1\n");
+ res = VG_(am_mmap_file_fixed_client)(
+ VG_PGROUNDDN(addr),
+ VG_PGROUNDUP(bss)-VG_PGROUNDDN(addr),
+ prot, /*VKI_MAP_FIXED|VKI_MAP_PRIVATE, */
+ e->fd, VG_PGROUNDDN(off)
+ );
+ if (0) VG_(am_show_nsegments)(0,"after #1");
+ check_mmap(res, VG_PGROUNDDN(addr),
+ VG_PGROUNDUP(bss)-VG_PGROUNDDN(addr));
+ }
+
+ // if memsz > filesz, fill the remainder with zeroed pages
+ if (memsz > filesz) {
+ UInt bytes;
+
+ bytes = VG_PGROUNDUP(brkaddr)-VG_PGROUNDUP(bss);
+ if (bytes > 0) {
+ if (0) VG_(debugLog)(0,"ume","mmap_anon_fixed_client #2\n");
+ res = VG_(am_mmap_anon_fixed_client)(
+ VG_PGROUNDUP(bss), bytes,
+ prot
+ );
+ if (0) VG_(am_show_nsegments)(0,"after #2");
+ check_mmap(res, VG_PGROUNDUP(bss), bytes);
+ }
+
+ bytes = bss & (VKI_PAGE_SIZE - 1);
+
+ // The 'prot' condition allows for a read-only bss
+ if ((prot & VKI_PROT_WRITE) && (bytes > 0)) {
+ bytes = VKI_PAGE_SIZE - bytes;
+ VG_(memset)((char *)bss, 0, bytes);
+ }
+ }
+ }
+
+ return elfbrk;
+}
+
+Bool VG_(match_ELF)(Char *hdr, Int len)
+{
+ ESZ(Ehdr) *e = (ESZ(Ehdr) *)hdr;
+ return (len > sizeof(*e)) && VG_(memcmp)(&e->e_ident[0], ELFMAG, SELFMAG) == 0;
+}
+
+
+/* load_ELF pulls an ELF executable into the address space, prepares
+ it for execution, and writes info about it into INFO. In
+ particular it fills in .init_eip, which is the starting point.
+
+ Returns zero on success, non-zero (a VKI_E.. value) on failure.
+
+ The sequence of activities is roughly as follows:
+
+ - use readelf() to extract program header info from the exe file.
+
+ - scan the program header, collecting info (not sure what all those
+ info-> fields are, or whether they are used, but still) and in
+ particular looking out fo the PT_INTERP header, which describes
+ the interpreter. If such a field is found, the space needed to
+ hold the interpreter is computed into interp_size.
+
+ - map the executable in, by calling mapelf(). This maps in all
+ loadable sections, and I _think_ also creates any .bss areas
+ required. mapelf() returns the address just beyond the end of
+ the furthest-along mapping it creates. The executable is mapped
+ starting at EBASE, which is usually read from it (eg, 0x8048000
+ etc) except if it's a PIE, in which case I'm not sure what
+ happens.
+
+ The returned address is recorded in info->brkbase as the start
+ point of the brk (data) segment, as it is traditional to place
+ the data segment just after the executable. Neither load_ELF nor
+ mapelf creates the brk segment, though: that is for the caller of
+ load_ELF to attend to.
+
+ - If the initial phdr scan didn't find any mention of an
+ interpreter (interp == NULL), this must be a statically linked
+ executable, and we're pretty much done.
+
+ - Otherwise, we need to use mapelf() a second time to load the
+ interpreter. The interpreter can go anywhere, but mapelf() wants
+ to be told a specific address to put it at. So an advisory query
+ is passed to aspacem, asking where it would put an anonymous
+ client mapping of size INTERP_SIZE. That address is then used
+ as the mapping address for the interpreter.
+
+ - The entry point in INFO is set to the interpreter's entry point,
+ and we're done. */
+Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info)
+{
+ SysRes sres;
+ struct elfinfo *e;
+ struct elfinfo *interp = NULL;
+ ESZ(Addr) minaddr = ~0; /* lowest mapped address */
+ ESZ(Addr) maxaddr = 0; /* highest mapped address */
+ ESZ(Addr) interp_addr = 0; /* interpreter (ld.so) address */
+ ESZ(Word) interp_size = 0; /* interpreter size */
+ ESZ(Word) interp_align = VKI_PAGE_SIZE;
+ Int i;
+ void *entry;
+ ESZ(Addr) ebase = 0;
+
+ /* The difference between where the interpreter got mapped and
+ where it asked to be mapped. Needed for computing the ppc64 ELF
+ entry point and initial tocptr (R2) value. */
+ ESZ(Word) interp_offset = 0;
+
+#ifdef HAVE_PIE
+ ebase = info->exe_base;
+#endif
+
+ e = readelf(fd, name);
+
+ if (e == NULL)
+ return VKI_ENOEXEC;
+
+ /* The kernel maps position-independent executables at TASK_SIZE*2/3;
+ duplicate this behavior as close as we can. */
+ if (e->e.e_type == ET_DYN && ebase == 0) {
+ ebase = VG_PGROUNDDN(info->exe_base
+ + (info->exe_end - info->exe_base) * 2 / 3);
+ /* We really don't want to load PIEs at zero or too close. It
+ works, but it's unrobust (NULL pointer reads and writes
+ become legit, which is really bad) and causes problems for
+ exp-ptrcheck, which assumes all numbers below 1MB are
+ nonpointers. So, hackily, move it above 1MB. */
+ /* Later .. is appears ppc32-linux tries to put [vdso] at 1MB,
+ which totally screws things up, because nothing else can go
+ there. So bump the hacky load addess along by 0x8000, to
+ 0x108000. */
+ if (ebase < 0x108000)
+ ebase = 0x108000;
+ }
+
+ info->phnum = e->e.e_phnum;
+ info->entry = e->e.e_entry + ebase;
+ info->phdr = 0;
+
+ for (i = 0; i < e->e.e_phnum; i++) {
+ ESZ(Phdr) *ph = &e->p[i];
+
+ switch(ph->p_type) {
+ case PT_PHDR:
+ info->phdr = ph->p_vaddr + ebase;
+ break;
+
+ case PT_LOAD:
+ if (ph->p_vaddr < minaddr)
+ minaddr = ph->p_vaddr;
+ if (ph->p_vaddr+ph->p_memsz > maxaddr)
+ maxaddr = ph->p_vaddr+ph->p_memsz;
+ break;
+
+ case PT_INTERP: {
+ HChar *buf = VG_(malloc)("ume.LE.1", ph->p_filesz+1);
+ Int j;
+ Int intfd;
+ Int baseaddr_set;
+
+ vg_assert(buf);
+ VG_(pread)(fd, buf, ph->p_filesz, ph->p_offset);
+ buf[ph->p_filesz] = '\0';
+
+ sres = VG_(open)(buf, VKI_O_RDONLY, 0);
+ if (sres.isError) {
+ VG_(printf)("valgrind: m_ume.c: can't open interpreter\n");
+ VG_(exit)(1);
+ }
+ intfd = sres.res;
+
+ interp = readelf(intfd, buf);
+ if (interp == NULL) {
+ VG_(printf)("valgrind: m_ume.c: can't read interpreter\n");
+ return 1;
+ }
+ VG_(free)(buf);
+
+ baseaddr_set = 0;
+ for (j = 0; j < interp->e.e_phnum; j++) {
+ ESZ(Phdr) *iph = &interp->p[j];
+ ESZ(Addr) end;
+
+ if (iph->p_type != PT_LOAD)
+ continue;
+
+ if (!baseaddr_set) {
+ interp_addr = iph->p_vaddr;
+ interp_align = iph->p_align;
+ baseaddr_set = 1;
+ }
+
+ /* assumes that all segments in the interp are close */
+ end = (iph->p_vaddr - interp_addr) + iph->p_memsz;
+
+ if (end > interp_size)
+ interp_size = end;
+ }
+ break;
+
+ default:
+ // do nothing
+ break;
+ }
+ }
+ }
+
+ if (info->phdr == 0)
+ info->phdr = minaddr + ebase + e->e.e_phoff;
+
+ if (info->exe_base != info->exe_end) {
+ if (minaddr >= maxaddr ||
+ (minaddr + ebase < info->exe_base ||
+ maxaddr + ebase > info->exe_end)) {
+ VG_(printf)("Executable range %p-%p is outside the\n"
+ "acceptable range %p-%p\n",
+ (char *)minaddr + ebase, (char *)maxaddr + ebase,
+ (char *)info->exe_base, (char *)info->exe_end);
+ return VKI_ENOMEM;
+ }
+ }
+
+ info->brkbase = mapelf(e, ebase); /* map the executable */
+
+ if (info->brkbase == 0)
+ return VKI_ENOMEM;
+
+ if (interp != NULL) {
+ /* reserve a chunk of address space for interpreter */
+ MapRequest mreq;
+ Addr advised;
+ Bool ok;
+
+ /* Don't actually reserve the space. Just get an advisory
+ indicating where it would be allocated, and pass that to
+ mapelf(), which in turn asks aspacem to do some fixed maps at
+ the specified address. This is a bit of hack, but it should
+ work because there should be no intervening transactions with
+ aspacem which could cause those fixed maps to fail.
+
+ Placement policy is:
+
+ if the interpreter asks to be loaded at zero
+ ignore that and put it wherever we like (mappings at zero
+ are bad news)
+ else
+ try and put it where it asks for, but if that doesn't work,
+ just put it anywhere.
+ */
+ if (interp_addr == 0) {
+ mreq.rkind = MAny;
+ mreq.start = 0;
+ mreq.len = interp_size;
+ } else {
+ mreq.rkind = MHint;
+ mreq.start = interp_addr;
+ mreq.len = interp_size;
+ }
+
+ advised = VG_(am_get_advisory)( &mreq, True/*client*/, &ok );
+
+ if (!ok) {
+ /* bomb out */
+ SysRes res = VG_(mk_SysRes_Error)(VKI_EINVAL);
+ if (0) VG_(printf)("reserve for interp: failed\n");
+ check_mmap(res, (Addr)interp_addr, interp_size);
+ /*NOTREACHED*/
+ }
+
+ (void)mapelf(interp, (ESZ(Addr))advised - interp_addr);
+
+ VG_(close)(interp->fd);
+
+ entry = (void *)(advised - interp_addr + interp->e.e_entry);
+ info->interp_base = (ESZ(Addr))advised;
+ interp_offset = advised - interp_addr;
+
+ VG_(free)(interp->p);
+ VG_(free)(interp);
+ } else
+ entry = (void *)(ebase + e->e.e_entry);
+
+ info->exe_base = minaddr + ebase;
+ info->exe_end = maxaddr + ebase;
+
+#if defined(VGP_ppc64_linux)
+ /* On PPC64, a func ptr is represented by a TOC entry ptr. This
+ TOC entry contains three words; the first word is the function
+ address, the second word is the TOC ptr (r2), and the third word
+ is the static chain value. */
+ info->init_ip = ((ULong*)entry)[0];
+ info->init_toc = ((ULong*)entry)[1];
+ info->init_ip += interp_offset;
+ info->init_toc += interp_offset;
+#else
+ info->init_ip = (Addr)entry;
+ info->init_toc = 0; /* meaningless on this platform */
+#endif
+ VG_(free)(e->p);
+ VG_(free)(e);
+
+ return 0;
+}
+
+#endif /* defined(HAVE_ELF) */
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
Property changes on: trunk/coregrind/m_ume/elf.c
___________________________________________________________________
Name: svn:keywords
+ author date id revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Copied: trunk/coregrind/m_ume/main.c (from rev 9003, trunk/coregrind/m_ume.c)
===================================================================
--- trunk/coregrind/m_ume/main.c (rev 0)
+++ trunk/coregrind/m_ume/main.c 2009-01-21 02:26:56 UTC (rev 9004)
@@ -0,0 +1,286 @@
+
+/*--------------------------------------------------------------------*/
+/*--- User-mode execve(), and other stuff shared between stage1 ---*/
+/*--- and stage2. m_ume.c ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2008 Julian Seward
+ js...@ac...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+
+#include "pub_core_basics.h"
+#include "pub_core_vki.h"
+
+#include "pub_core_libcbase.h"
+#include "pub_core_libcassert.h" // VG_(exit), vg_assert
+#include "pub_core_libcfile.h" // VG_(close) et al
+#include "pub_core_libcprint.h" // VG_(message)
+#include "pub_core_mallocfree.h" // VG_(strdup)
+#include "pub_core_syscall.h" // VG_(mk_SysRes_Error)
+#include "pub_core_options.h" // VG_(clo_xml)
+#include "pub_core_ume.h" // self
+
+#include "priv_ume.h"
+
+
+typedef struct {
+ const HChar *name;
+ Bool (*match_fn)(Char *hdr, Int len);
+ Int (*load_fn)(Int fd, const HChar *name, ExeInfo *info);
+} ExeHandler;
+
+static ExeHandler exe_handlers[] = {
+#if defined(HAVE_ELF)
+ { "ELF", VG_(match_ELF), VG_(load_ELF) },
+#endif
+#if defined(HAVE_SCRIPT)
+ { "script", VG_(match_script), VG_(load_script) },
+#endif
+};
+#define EXE_HANDLER_COUNT (sizeof(exe_handlers)/sizeof(exe_handlers[0]))
+
+
+// Check the file looks executable.
+SysRes
+VG_(pre_exec_check)(const HChar* exe_name, Int* out_fd, Bool allow_setuid)
+{
+ Int fd, ret, i;
+ SysRes res;
+ Char buf[4096];
+ SizeT bufsz = 4096, fsz;
+ Bool is_setuid = False;
+
+ // Check it's readable
+ res = VG_(open)(exe_name, VKI_O_RDONLY, 0);
+ if (res.isError) {
+ return res;
+ }
+ fd = res.res;
+
+ // Check we have execute permissions
+ ret = VG_(check_executable)(&is_setuid, (HChar*)exe_name, allow_setuid);
+ if (0 != ret) {
+ VG_(close)(fd);
+ if (is_setuid && !VG_(clo_xml)) {
+ VG_(message)(Vg_UserMsg, "");
+ VG_(message)(Vg_UserMsg,
+ "Warning: Can't execute setuid/setgid executable: %s",
+ exe_name);
+ VG_(message)(Vg_UserMsg, "Possible workaround: remove "
+ "--trace-children=yes, if in effect");
+ VG_(message)(Vg_UserMsg, "");
+ }
+ return VG_(mk_SysRes_Error)(ret);
+ }
+
+ fsz = (SizeT)VG_(fsize)(fd);
+ if (fsz < bufsz)
+ bufsz = fsz;
+
+ res = VG_(pread)(fd, buf, bufsz, 0);
+ if (res.isError || res.res != bufsz) {
+ VG_(close)(fd);
+ return VG_(mk_SysRes_Error)(VKI_EACCES);
+ }
+ bufsz = res.res;
+
+ // Look for a matching executable format
+ for (i = 0; i < EXE_HANDLER_COUNT; i++) {
+ if ((*exe_handlers[i].match_fn)(buf, bufsz)) {
+ res = VG_(mk_SysRes_Success)(i);
+ break;
+ }
+ }
+ if (i == EXE_HANDLER_COUNT) {
+ // Rejected by all executable format handlers.
+ res = VG_(mk_SysRes_Error)(VKI_ENOEXEC);
+ }
+
+ // Write the 'out_fd' param if necessary, or close the file.
+ if (!res.isError && out_fd) {
+ *out_fd = fd;
+ } else {
+ VG_(close)(fd);
+ }
+
+ return res;
+}
+
+// returns: 0 = success, non-0 is failure
+//
+// We can execute only binaries (ELF, etc) or scripts that begin with "#!".
+// (Not, for example, scripts that don't begin with "#!"; see the
+// VG_(do_exec)() invocation from m_main.c for how that's handled.)
+Int VG_(do_exec_inner)(const HChar* exe, ExeInfo* info)
+{
+ SysRes res;
+ Int fd;
+ Int ret;
+
+ res = VG_(pre_exec_check)(exe, &fd, False/*allow_setuid*/);
+ if (res.isError)
+ return res.err;
+
+ vg_assert2(res.res >= 0 && res.res < EXE_HANDLER_COUNT,
+ "invalid VG_(pre_exec_check) result");
+
+ ret = (*exe_handlers[res.res].load_fn)(fd, exe, info);
+
+ VG_(close)(fd);
+
+ return ret;
+}
+
+
+static Bool is_hash_bang_file(Char* f)
+{
+ SysRes res = VG_(open)(f, VKI_O_RDONLY, 0);
+ if (!res.isError) {
+ Char buf[3] = {0,0,0};
+ Int fd = res.res;
+ Int n = VG_(read)(fd, buf, 2);
+ if (n == 2 && VG_STREQ("#!", buf))
+ return True;
+ }
+ return False;
+}
+
+// Look at the first 80 chars, and if any are greater than 127, it's binary.
+// This is crude, but should be good enough. Note that it fails on a
+// zero-length file, as we want.
+static Bool is_binary_file(Char* f)
+{
+ SysRes res = VG_(open)(f, VKI_O_RDONLY, 0);
+ if (!res.isError) {
+ UChar buf[80];
+ Int fd = res.res;
+ Int n = VG_(read)(fd, buf, 80);
+ Int i;
+ for (i = 0; i < n; i++) {
+ if (buf[i] > 127)
+ return True; // binary char found
+ }
+ return False;
+ } else {
+ // Something went wrong. This will only happen if we earlier
+ // succeeded in opening the file but fail here (eg. the file was
+ // deleted between then and now).
+ VG_(printf)("valgrind: %s: unknown error\n", f);
+ VG_(exit)(126); // 126 == NOEXEC
+ }
+}
+
+// If the do_exec fails we try to emulate what the shell does (I used
+// bash as a guide). It's worth noting that the shell can execute some
+// things that VG_(do_exec)() (which subsitutes for the kernel's exec())
+// will refuse to (eg. scripts lacking a "#!" prefix).
+static Int do_exec_shell_followup(Int ret, HChar* exe_name, ExeInfo* info)
+{
+ Char* default_interp_name = "/bin/sh";
+ SysRes res;
+ struct vg_stat st;
+
+ if (VKI_ENOEXEC == ret) {
+ // It was an executable file, but in an unacceptable format. Probably
+ // is a shell script lacking the "#!" prefix; try to execute it so.
+
+ // Is it a binary file?
+ if (is_binary_file(exe_name)) {
+ VG_(printf)("valgrind: %s: cannot execute binary file\n", exe_name);
+ VG_(exit)(126); // 126 == NOEXEC
+ }
+
+ // Looks like a script. Run it with /bin/sh. This includes
+ // zero-length files.
+
+ info->interp_name = VG_(strdup)("ume.desf.1", default_interp_name);
+ info->interp_args = NULL;
+ if (info->argv && info->argv[0] != NULL)
+ info->argv[0] = (char *)exe_name;
+
+ ret = VG_(do_exec_inner)(info->interp_name, info);
+
+ if (0 != ret) {
+ // Something went wrong with executing the default interpreter
+ VG_(printf)("valgrind: %s: bad interpreter (%s): %s\n",
+ exe_name, info->interp_name, VG_(strerror)(ret));
+ VG_(exit)(126); // 126 == NOEXEC
+ }
+
+ } else if (0 != ret) {
+ // Something else went wrong. Try to make the error more specific,
+ // and then print a message and abort.
+
+ // Was it a directory?
+ res = VG_(stat)(exe_name, &st);
+ if (!res.isError && VKI_S_ISDIR(st.st_mode)) {
+ VG_(printf)("valgrind: %s: is a directory\n", exe_name);
+
+ // Was it not executable?
+ } else if (0 != VG_(check_executable)(NULL, exe_name,
+ False/*allow_setuid*/)) {
+ VG_(printf)("valgrind: %s: %s\n", exe_name, VG_(strerror)(ret));
+
+ // Did it start with "#!"? If so, it must have been a bad interpreter.
+ } else if (is_hash_bang_file(exe_name)) {
+ VG_(printf)("valgrind: %s: bad interpreter: %s\n",
+ exe_name, VG_(strerror)(ret));
+
+ // Otherwise it was something else.
+ } else {
+ VG_(printf)("valgrind: %s: %s\n", exe_name, VG_(strerror)(ret));
+ }
+ // 126 means NOEXEC; I think this is Posix, and that in some cases we
+ // should be returning 127, meaning NOTFOUND. Oh well.
+ VG_(exit)(126);
+ }
+ return ret;
+}
+
+
+// This emulates the kernel's exec(). If it fails, it then emulates the
+// shell's handling of the situation.
+// See ume.h for an indication of which entries of 'info' are inputs, which
+// are outputs, and which are both.
+/* returns: 0 = success, non-0 is failure */
+Int VG_(do_exec)(const HChar* exe_name, ExeInfo* info)
+{
+ Int ret;
+
+ info->interp_name = NULL;
+ info->interp_args = NULL;
+
+ ret = VG_(do_exec_inner)(exe_name, info);
+
+ if (0 != ret) {
+ Char* exe_name_casted = (Char*)exe_name;
+ ret = do_exec_shell_followup(ret, exe_name_casted, info);
+ }
+ return ret;
+}
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
Property changes on: trunk/coregrind/m_ume/main.c
___________________________________________________________________
Name: svn:keywords
+ author date id revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Copied: trunk/coregrind/m_ume/script.c (from rev 9003, trunk/coregrind/m_ume.c)
===================================================================
--- trunk/coregrind/m_ume/script.c (rev 0)
+++ trunk/coregrind/m_ume/script.c 2009-01-21 02:26:56 UTC (rev 9004)
@@ -0,0 +1,150 @@
+
+/*--------------------------------------------------------------------*/
+/*--- User-mode execve() for #! scripts. m_ume_script.c ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2008 Julian Seward
+ js...@ac...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include "pub_core_basics.h"
+#include "pub_core_vki.h"
+
+#include "pub_core_libcbase.h"
+#include "pub_core_libcassert.h" // VG_(exit), vg_assert
+#include "pub_core_libcfile.h" // VG_(close) et al
+#include "pub_core_libcprint.h"
+#include "pub_core_mallocfree.h" // VG_(strdup)
+#include "pub_core_ume.h" // self
+
+#include "priv_ume.h" // self
+
+
+#if defined(HAVE_SCRIPT)
+
+Bool VG_(match_script)(Char *hdr, Int len)
+{
+ Char* end = hdr + len;
+ Char* interp = hdr + 2;
+
+ // len < 4: need '#', '!', plus at least a '/' and one more char
+ if (len < 4) return False;
+ if (0 != VG_(memcmp)(hdr, "#!", 2)) return False;
+
+ // Find interpreter name, make sure it's an absolute path (starts with
+ // '/') and has at least one more char. First, skip over any space
+ // between the #! and the start of the interpreter name
+ while (interp < end && VG_(isspace)(*interp)) interp++;
+
+ // overrun?
+ if (interp >= end) return False; // can't find start of interp name
+
+ // interp should now point at the /
+ if (*interp != '/') return False; // absolute path only for interpreter
+
+ // check for something plausible after the /
+ interp++;
+ if (interp >= end) return False;
+ if (VG_(isspace)(*interp)) return False;
+
+ // Here we should get the full interpreter name and check it with
+ // check_executable(). See the "EXEC FAILED" failure when running shell
+ // for an example.
+
+ return True; // looks like a #! script
+}
+
+
+/* returns: 0 = success, non-0 is failure */
+Int VG_(load_script)(Int fd, const HChar* name, ExeInfo* info)
+{
+ Char hdr[4096];
+ Int len = 4096;
+ Int eol;
+ Char* interp;
+ Char* end;
+ Char* cp;
+ Char* arg = NULL;
+ SysRes res;
+
+ // Read the first part of the file.
+ res = VG_(pread)(fd, hdr, len, 0);
+ if (res.isError) {
+ VG_(close)(fd);
+ return VKI_EACCES;
+ } else {
+ len = res.res;
+ }
+
+ vg_assert('#' == hdr[0] && '!' == hdr[1]);
+
+ end = hdr + len;
+ interp = hdr + 2;
+ while (interp < end && VG_(isspace)(*interp))
+ interp++;
+
+ vg_assert(*interp == '/'); /* absolute path only for interpreter */
+
+ /* skip over interpreter name */
+ for (cp = interp; cp < end && !VG_(isspace)(*cp); cp++)
+ ;
+
+ eol = (*cp == '\n');
+
+ *cp++ = '\0';
+
+ if (!eol && cp < end) {
+ /* skip space before arg */
+ while (cp < end && VG_(isspace)(*cp) && *cp != '\n')
+ cp++;
+
+ /* arg is from here to eol */
+ arg = cp;
+ while (cp < end && *cp != '\n')
+ cp++;
+ *cp = '\0';
+ }
+
+ info->interp_name = VG_(strdup)("ume.ls.1", interp);
+ vg_assert(NULL != info->interp_name);
+ if (arg != NULL && *arg != '\0') {
+ info->interp_args = VG_(strdup)("ume.ls.2", arg);
+ vg_assert(NULL != info->interp_args);
+ }
+
+ if (info->argv && info->argv[0] != NULL)
+ info->argv[0] = (char *)name;
+
+ if (0)
+ VG_(printf)("#! script: interp_name=\"%s\" interp_args=\"%s\"\n",
+ info->interp_name, info->interp_args);
+
+ return VG_(do_exec_inner)(interp, info);
+}
+
+#endif /* defined(HAVE_SCRIPT) */
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
Property changes on: trunk/coregrind/m_ume/script.c
___________________________________________________________________
Name: svn:keywords
+ author date id revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Deleted: trunk/coregrind/m_ume.c
===================================================================
--- trunk/coregrind/m_ume.c 2009-01-20 23:07:34 UTC (rev 9003)
+++ trunk/coregrind/m_ume.c 2009-01-21 02:26:56 UTC (rev 9004)
@@ -1,873 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- User-mode execve(), and other stuff shared between stage1 ---*/
-/*--- and stage2. m_ume.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2000-2008 Julian Seward
- js...@ac...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-
-#include "pub_core_basics.h"
-#include "pub_core_vki.h"
-
-#if defined(VGO_linux)
-
-#include "pub_core_aspacemgr.h" // various mapping fns
-#include "pub_core_debuglog.h"
-#include "pub_core_libcbase.h"
-#include "pub_core_machine.h"
-#include "pub_core_libcprint.h"
-#include "pub_core_libcfile.h" // VG_(close) et al
-#include "pub_core_libcproc.h" // VG_(geteuid), VG_(getegid)
-#include "pub_core_libcassert.h" // VG_(exit), vg_assert
-#include "pub_core_mallocfree.h" // VG_(malloc), VG_(free)
-#include "pub_core_syscall.h" // VG_(strerror)
-#include "pub_core_options.h" // VG_(clo_xml)
-#include "pub_core_ume.h" // self
-
-/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-/* This is for ELF types etc, and also the AT_ constants. */
-#include <elf.h>
-/* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
-
-
-#if VG_WORDSIZE == 8
-#define ESZ(x) Elf64_##x
-#elif VG_WORDSIZE == 4
-#define ESZ(x) Elf32_##x
-#else
-#error VG_WORDSIZE needs to ==4 or ==8
-#endif
-
-struct elfinfo
-{
- ESZ(Ehdr) e;
- ESZ(Phdr) *p;
- Int fd;
-};
-
-static void check_mmap(SysRes res, Addr base, SizeT len)
-{
- if (res.isError) {
- VG_(printf)("valgrind: mmap(0x%llx, %lld) failed in UME "
- "with error %lu (%s).\n",
- (ULong)base, (Long)len,
- res.err, VG_(strerror)(res.err) );
- if (res.err == VKI_EINVAL) {
- VG_(printf)("valgrind: this can be caused by executables with "
- "very large text, data or bss segments.\n");
- }
- VG_(exit)(1);
- }
-}
-
-/*------------------------------------------------------------*/
-/*--- Finding auxv on the stack ---*/
-/*------------------------------------------------------------*/
-
-struct ume_auxv *VG_(find_auxv)(UWord* sp)
-{
- sp++; // skip argc (Nb: is word-sized, not int-sized!)
-
- while (*sp != 0) // skip argv
- sp++;
- sp++;
-
- while (*sp != 0) // skip env
- sp++;
- sp++;
-
-#if defined(VGA_ppc32) || defined(VGA_ppc64)
-# if defined AT_IGNOREPPC
- while (*sp == AT_IGNOREPPC) // skip AT_IGNOREPPC entries
- sp += 2;
-# endif
-#endif
-
- return (struct ume_auxv *)sp;
-}
-
-/*------------------------------------------------------------*/
-/*--- Loading ELF files ---*/
-/*------------------------------------------------------------*/
-
-static
-struct elfinfo *readelf(Int fd, const char *filename)
-{
- SysRes sres;
- struct elfinfo *e = VG_(malloc)("ume.re.1", sizeof(*e));
- Int phsz;
-
- vg_assert(e);
- e->fd = fd;
-
- sres = VG_(pread)(fd, &e->e, sizeof(e->e), 0);
- if (sres.isError || sres.res != sizeof(e->e)) {
- VG_(printf)("valgrind: %s: can't read ELF header: %s\n",
- filename, VG_(strerror)(sres.err));
- goto bad;
- }
-
- if (VG_(memcmp)(&e->e.e_ident[0], ELFMAG, SELFMAG) != 0) {
- VG_(printf)("valgrind: %s: bad ELF magic number\n", filename);
- goto bad;
- }
- if (e->e.e_ident[EI_CLASS] != VG_ELF_CLASS) {
- VG_(printf)("valgrind: wrong ELF executable class "
- "(eg. 32-bit instead of 64-bit)\n");
- goto bad;
- }
- if (e->e.e_ident[EI_DATA] != VG_ELF_DATA2XXX) {
- VG_(printf)("valgrind: executable has wrong endian-ness\n");
- goto bad;
- }
- if (!(e->e.e_type == ET_EXEC || e->e.e_type == ET_DYN)) {
- VG_(printf)("valgrind: this is not an executable\n");
- goto bad;
- }
-
- if (e->e.e_machine != VG_ELF_MACHINE) {
- VG_(printf)("valgrind: executable is not for "
- "this architecture\n");
- goto bad;
- }
-
- if (e->e.e_phentsize != sizeof(ESZ(Phdr))) {
- VG_(printf)("valgrind: sizeof ELF Phdr wrong\n");
- goto bad;
- }
-
- phsz = sizeof(ESZ(Phdr)) * e->e.e_phnum;
- e->p = VG_(malloc)("ume.re.2", phsz);
- vg_assert(e->p);
-
- sres = VG_(pread)(fd, e->p, phsz, e->e.e_phoff);
- if (sres.isError || sres.res != phsz) {
- VG_(printf)("valgrind: can't read phdr: %s\n",
- VG_(strerror)(sres.err));
- VG_(free)(e->p);
- goto bad;
- }
-
- return e;
-
- bad:
- VG_(free)(e);
- return NULL;
-}
-
-/* Map an ELF file. Returns the brk address. */
-static
-ESZ(Addr) mapelf(struct elfinfo *e, ESZ(Addr) base)
-{
- Int i;
- SysRes res;
- ESZ(Addr) elfbrk = 0;
-
- for(i = 0; i < e->e.e_phnum; i++) {
- ESZ(Phdr) *ph = &e->p[i];
- ESZ(Addr) addr, brkaddr;
- ESZ(Word) memsz;
-
- if (ph->p_type != PT_LOAD)
- continue;
-
- addr = ph->p_vaddr+base;
- memsz = ph->p_memsz;
- brkaddr = addr+memsz;
-
- if (brkaddr > elfbrk)
- elfbrk = brkaddr;
- }
-
- for(i = 0; i < e->e.e_phnum; i++) {
- ESZ(Phdr) *ph = &e->p[i];
- ESZ(Addr) addr, bss, brkaddr;
- ESZ(Off) off;
- ESZ(Word) filesz;
- ESZ(Word) memsz;
- unsigned prot = 0;
-
- if (ph->p_type != PT_LOAD)
- continue;
-
- if (ph->p_flags & PF_X) prot |= VKI_PROT_EXEC;
- if (ph->p_flags & PF_W) prot |= VKI_PROT_WRITE;
- if (ph->p_flags & PF_R) prot |= VKI_PROT_READ;
-
- addr = ph->p_vaddr+base;
- off = ph->p_offset;
- filesz = ph->p_filesz;
- bss = addr+filesz;
- memsz = ph->p_memsz;
- brkaddr = addr+memsz;
-
- // Tom says: In the following, do what the Linux kernel does and only
- // map the pages that are required instead of rounding everything to
- // the specified alignment (ph->p_align). (AMD64 doesn't work if you
- // use ph->p_align -- part of stage2's memory gets trashed somehow.)
- //
- // The condition handles the case of a zero-length segment.
- if (VG_PGROUNDUP(bss)-VG_PGROUNDDN(addr) > 0) {
- if (0) VG_(debugLog)(0,"ume","mmap_file_fixed_client #1\n");
- res = VG_(am_mmap_file_fixed_client)(
- VG_PGROUNDDN(addr),
- VG_PGROUNDUP(bss)-VG_PGROUNDDN(addr),
- prot, /*VKI_MAP_FIXED|VKI_MAP_PRIVATE, */
- e->fd, VG_PGROUNDDN(off)
- );
- if (0) VG_(am_show_nsegments)(0,"after #1");
- check_mmap(res, VG_PGROUNDDN(addr),
- VG_PGROUNDUP(bss)-VG_PGROUNDDN(addr));
- }
-
- // if memsz > filesz, fill the remainder with zeroed pages
- if (memsz > filesz) {
- UInt bytes;
-
- bytes = VG_PGROUNDUP(brkaddr)-VG_PGROUNDUP(bss);
- if (bytes > 0) {
- if (0) VG_(debugLog)(0,"ume","mmap_anon_fixed_client #2\n");
- res = VG_(am_mmap_anon_fixed_client)(
- VG_PGROUNDUP(bss), bytes,
- prot
- );
- if (0) VG_(am_show_nsegments)(0,"after #2");
- check_mmap(res, VG_PGROUNDUP(bss), bytes);
- }
-
- bytes = bss & (VKI_PAGE_SIZE - 1);
-
- // The 'prot' condition allows for a read-only bss
- if ((prot & VKI_PROT_WRITE) && (bytes > 0)) {
- bytes = VKI_PAGE_SIZE - bytes;
- VG_(memset)((char *)bss, 0, bytes);
- }
- }
- }
-
- return elfbrk;
-}
-
-static Bool match_ELF(const char *hdr, Int len)
-{
- ESZ(Ehdr) *e = (ESZ(Ehdr) *)hdr;
- return (len > sizeof(*e)) && VG_(memcmp)(&e->e_ident[0], ELFMAG, SELFMAG) == 0;
-}
-
-
-/* load_ELF pulls an ELF executable into the address space, prepares
- it for execution, and writes info about it into INFO. In
- particular it fills in .init_eip, which is the starting point.
-
- Returns zero on success, non-zero (a VKI_E.. value) on failure.
-
- The sequence of activities is roughly as follows:
-
- - use readelf() to extract program header info from the exe file.
-
- - scan the program header, collecting info (not sure what all those
- info-> fields are, or whether they are used, but still) and in
- particular looking out fo the PT_INTERP header, which describes
- the interpreter. If such a field is found, the space needed to
- hold the interpreter is computed into interp_size.
-
- - map the executable in, by calling mapelf(). This maps in all
- loadable sections, and I _think_ also creates any .bss areas
- required. mapelf() returns the address just beyond the end of
- the furthest-along mapping it creates. The executable is mapped
- starting at EBASE, which is usually read from it (eg, 0x8048000
- etc) except if it's a PIE, in which case I'm not sure what
- happens.
-
- The returned address is recorded in info->brkbase as the start
- point of the brk (data) segment, as it is traditional to place
- the data segment just after the executable. Neither load_ELF nor
- mapelf creates the brk segment, though: that is for the caller of
- load_ELF to attend to.
-
- - If the initial phdr scan didn't find any mention of an
- interpreter (interp == NULL), this must be a statically linked
- executable, and we're pretty much done.
-
- - Otherwise, we need to use mapelf() a second time to load the
- interpreter. The interpreter can go anywhere, but mapelf() wants
- to be told a specific address to put it at. So an advisory query
- is passed to aspacem, asking where it would put an anonymous
- client mapping of size INTERP_SIZE. That address is then used
- as the mapping address for the interpreter.
-
- - The entry point in INFO is set to the interpreter's entry point,
- and we're done. */
-static Int load_ELF(Int fd, const HChar* name, /*MOD*/ExeInfo* info)
-{
- SysRes sres;
- struct elfinfo *e;
- struct elfinfo *interp = NULL;
- ESZ(Addr) minaddr = ~0; /* lowest mapped address */
- ESZ(Addr) maxaddr = 0; /* highest mapped address */
- ESZ(Addr) interp_addr = 0; /* interpreter (ld.so) address */
- ESZ(Word) interp_size = 0; /* interpreter size */
- ESZ(Word) interp_align = VKI_PAGE_SIZE;
- Int i;
- void *entry;
- ESZ(Addr) ebase = 0;
-
- /* The difference between where the interpreter got mapped and
- where it asked to be mapped. Needed for computing the ppc64 ELF
- entry point and initial tocptr (R2) value. */
- ESZ(Word) interp_offset = 0;
-
-#ifdef HAVE_PIE
- ebase = info->exe_base;
-#endif
-
- e = readelf(fd, name);
-
- if (e == NULL)
- return VKI_ENOEXEC;
-
- /* The kernel maps position-independent executables at TASK_SIZE*2/3;
- duplicate this behavior as close as we can. */
- if (e->e.e_type == ET_DYN && ebase == 0) {
- ebase = VG_PGROUNDDN(info->exe_base
- + (info->exe_end - info->exe_base) * 2 / 3);
- /* We really don't want to load PIEs at zero or too close. It
- works, but it's unrobust (NULL pointer reads and writes
- become legit, which is really bad) and causes problems for
- exp-ptrcheck, which assumes all numbers below 1MB are
- nonpointers. So, hackily, move it above 1MB. */
- /* Later .. is appears ppc32-linux tries to put [vdso] at 1MB,
- which totally screws things up, because nothing else can go
- there. So bump the hacky load addess along by 0x8000, to
- 0x108000. */
- if (ebase < 0x108000)
- ebase = 0x108000;
- }
-
- info->phnum = e->e.e_phnum;
- info->entry = e->e.e_entry + ebase;
- info->phdr = 0;
-
- for(i = 0; i < e->e.e_phnum; i++) {
- ESZ(Phdr) *ph = &e->p[i];
-
- switch(ph->p_type) {
- case PT_PHDR:
- info->phdr = ph->p_vaddr + ebase;
- break;
-
- case PT_LOAD:
- if (ph->p_vaddr < minaddr)
- minaddr = ph->p_vaddr;
- if (ph->p_vaddr+ph->p_memsz > maxaddr)
- maxaddr = ph->p_vaddr+ph->p_memsz;
- break;
-
- case PT_INTERP: {
- HChar *buf = VG_(malloc)("ume.LE.1", ph->p_filesz+1);
- Int j;
- Int intfd;
- Int baseaddr_set;
-
- vg_assert(buf);
- VG_(pread)(fd, buf, ph->p_filesz, ph->p_offset);
- buf[ph->p_filesz] = '\0';
-
- sres = VG_(open)(buf, VKI_O_RDONLY, 0);
- if (sres.isError) {
- VG_(printf)("valgrind: m_ume.c: can't open interpreter\n");
- VG_(exit)(1);
- }
- intfd = sres.res;
-
- interp = readelf(intfd, buf);
- if (interp == NULL) {
- VG_(printf)("valgrind: m_ume.c: can't read interpreter\n");
- return 1;
- }
- VG_(free)(buf);
-
- baseaddr_set = 0;
- for(j = 0; j < interp->e.e_phnum; j++) {
- ESZ(Phdr) *iph = &interp->p[j];
- ESZ(Addr) end;
-
- if (iph->p_type != PT_LOAD)
- continue;
-
- if (!baseaddr_set) {
- interp_addr = iph->p_vaddr;
- interp_align = iph->p_align;
- baseaddr_set = 1;
- }
-
- /* assumes that all segments in the interp are close */
- end = (iph->p_vaddr - interp_addr) + iph->p_memsz;
-
- if (end > interp_size)
- interp_size = end;
- }
- break;
-
- default:
- // do nothing
- break;
- }
- }
- }
-
- if (info->phdr == 0)
- info->phdr = minaddr + ebase + e->e.e_phoff;
-
- if (info->exe_base != info->exe_end) {
- if (minaddr >= maxaddr ||
- (minaddr + ebase < info->exe_base ||
- maxaddr + ebase > info->exe_end)) {
- VG_(printf)("Executable range %p-%p is outside the\n"
- "acceptable range %p-%p\n",
- (char *)minaddr + ebase, (char *)maxaddr + ebase,
- (char *)info->exe_base, (char *)info->exe_end);
- return VKI_ENOMEM;
- }
- }
-
- info->brkbase = mapelf(e, ebase); /* map the executable */
-
- if (info->brkbase == 0)
- return VKI_ENOMEM;
-
- if (interp != NULL) {
- /* reserve a chunk of address space for interpreter */
- MapRequest mreq;
- Addr advised;
- Bool ok;
-
- /* Don't actually reserve the space. Just get an advisory
- indicating where it would be allocated, and pass that to
- mapelf(), which in turn asks aspacem to do some fixed maps at
- the specified address. This is a bit of hack, but it should
- work because there should be no intervening transactions with
- aspacem which could cause those fixed maps to fail.
-
- Placement policy is:
-
- if the interpreter asks to be loaded at zero
- ignore that and put it wherever we like (mappings at zero
- are bad news)
- else
- try and put it where it asks for, but if that doesn't work,
- just put it anywhere.
- */
- if (interp_addr == 0) {
- mreq.rkind = MAny;
- mreq.start = 0;
- mreq.len = interp_size;
- } else {
- mreq.rkind = MHint;
- mreq.start = interp_addr;
- mreq.len = interp_size;
- }
-
- advised = VG_(am_get_advisory)( &mreq, True/*client*/, &ok );
-
- if (!ok) {
- /* bomb out */
- SysRes res = VG_(mk_SysRes_Error)(VKI_EINVAL);
- if (0) VG_(printf)("reserve for interp: failed\n");
- check_mmap(res, (Addr)interp_addr, interp_size);
- /*NOTREACHED*/
- }
-
- (void)mapelf(interp, (ESZ(Addr))advised - interp_addr);
-
- VG_(close)(interp->fd);
-
- entry = (void *)(advised - interp_addr + interp->e.e_entry);
- info->interp_base = (ESZ(Addr))advised;
- interp_offset = advised - interp_addr;
-
- VG_(free)(interp->p);
- VG_(free)(interp);
- } else
- entry = (void *)(ebase + e->e.e_entry);
-
- info->exe_base = minaddr + ebase;
- info->exe_end = maxaddr + ebase;
-
-#if defined(VGP_ppc64_linux)
- /* On PPC64, a func ptr is represented by a TOC entry ptr. This
- TOC entry contains three words; the first word is the function
- address, the second word is the TOC ptr (r2), and the third word
- is the static chain value. */
- info->init_ip = ((ULong*)entry)[0];
- info->init_toc = ((ULong*)entry)[1];
- info->init_ip += interp_offset;
- info->init_toc += interp_offset;
-#else
- info->init_ip = (Addr)entry;
- info->init_toc = 0; /* meaningless on this platform */
-#endif
- VG_(free)(e->p);
- VG_(free)(e);
-
- return 0;
-}
-
-
-static Bool match_script(char *hdr, Int len)
-{
- Char* end = hdr + len;
- Char* interp = hdr + 2;
-
- // len < 4: need '#', '!', plus at least a '/' and one more char
- if (len < 4) return False;
- if (0 != VG_(memcmp)(hdr, "#!", 2)) return False;
-
- // Find interpreter name, make sure it's an absolute path (starts with
- // '/') and has at least one more char. First, skip over any space
- // between the #! and the start of the interpreter name
- while (interp < end && VG_(isspace)(*interp)) interp++;
-
- // overrun?
- if (interp >= end) return False; // can't find start of interp name
-
- // interp should now point at the /
- if (*interp != '/') return False; // absolute path only for interpreter
-
- // check for something plausible after the /
- interp++;
- if (interp >= end) return False;
- if (VG_(isspace)(*interp)) return False;
-
- // Here we should get the full interpreter name and check it with
- // check_executable(). See the "EXEC FAILED" failure when running shell
- // for an example.
-
- return True; // looks like a #! script
-}
-
-// Forward declaration.
-static Int do_exec_inner(const HChar* exe, ExeInfo* info);
-
-/* returns: 0 = success, non-0 is failure */
-static Int load_script(Int fd, const HChar* name, ExeInfo* info)
-{
- Char hdr[4096];
- Int len = 4096;
- Int eol;
- Char* interp;
- Char* end;
- Char* cp;
- Char* arg = NULL;
- SysRes res;
-
- // Read the first part of the file.
- res = VG_(pread)(fd, hdr, len, 0);
- if (res.isError) {
- VG_(close)(fd);
- return VKI_EACCES;
- } else {
- len = res.res;
- }
-
- vg_assert('#' == hdr[0] && '!' == hdr[1]);
-
- end = hdr + len;
- interp = hdr + 2;
- while (interp < end && VG_(isspace)(*interp))
- interp++;
-
- vg_assert(*interp == '/'); /* absolute path only for interpreter */
-
- /* skip over interpreter name */
- for (cp = interp; cp < end && !VG_(isspace)(*cp); cp++)
- ;
-
- eol = (*cp == '\n');
-
- *cp++ = '\0';
-
- if (!eol && cp < end) {
- /* skip space before arg */
- while (cp < end && VG_(isspace)(*cp) && *cp != '\n')
- cp++;
-
- /* arg is from here to eol */
- arg = cp;
- while (cp < end && *cp != '\n')
- cp++;
- *cp = '\0';
- }
-
- info->interp_name = VG_(strdup)("ume.ls.1", interp);
- vg_assert(NULL != info->interp_name);
- if (arg != NULL && *arg != '\0') {
- info->interp_args = VG_(strdup)("ume.ls.2", arg);
- vg_assert(NULL != info->interp_args);
- }
-
- if (info->argv && info->argv[0] != NULL)
- info->argv[0] = (char *)name;
-
- if (0)
- VG_(printf)("#! script: interp_name=\"%s\" interp_args=\"%s\"\n",
- info->interp_name, info->interp_args);
-
- return do_exec_inner(interp, info);
-}
-
-
-typedef enum {
- VG_EXE_FORMAT_ELF = 1,
- VG_EXE_FORMAT_SCRIPT = 2,
-} ExeFormat;
-
-// Check the file looks executable.
-SysRes
-VG_(pre_exec_check)(const HChar* exe_name, Int* out_fd, Bool allow_setuid)
-{
- Int fd, ret;
- SysRes res;
- Char buf[4096];
- SizeT bufsz = 4096, fsz;
- Bool is_setuid = False;
-
- // Check it's readable
- res = VG_(open)(exe_name, VKI_O_RDONLY, 0);
- if (res.isError) {
- return res;
- }
- fd = res.res;
-
- // Check we have execute permissions
- ret = VG_(check_executable)(&is_setuid, (HChar*)exe_name, allow_setuid);
- if (0 != ret) {
- VG_(close)(fd);
- if (is_setuid && !VG_(clo_xml)) {
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg,
- "Warning: Can't execute setuid/setgid executable: %s",
- exe_name);
- VG_(message)(Vg_UserMsg, "Possible workaround: remove "
- "--trace-children=yes, if in effect");
- VG_(message)(Vg_UserMsg, "");
- }
- return VG_(mk_SysRes_Error)(ret);
- }
-
- fsz = (SizeT)VG_(fsize)(fd);
- if (fsz < bufsz)
- bufsz = fsz;
-
- res = VG_(pread)(fd, buf, bufsz, 0);
- if (res.isError || res.res != bufsz) {
- VG_(close)(fd);
- return VG_(mk_SysRes_Error)(VKI_EACCES);
- }
- bufsz = res.res;
-
- if (match_ELF(buf, bufsz)) {
- res = VG_(mk_SysRes_Success)(VG_EXE_FORMAT_ELF);
- } else if (match_script(buf, bufsz)) {
- res = VG_(mk_SysRes_Success)(VG_EXE_FORMAT_SCRIPT);
- } else {
- res = VG_(mk_SysRes_Error)(VKI_ENOEXEC);
- }
-
- // Write the 'out_fd' param if necessary, or close the file.
- if (!res.isError && out_fd) {
- *out_fd = fd;
- } else {
- VG_(close)(fd);
- }
-
- return res;
-}
-
-// returns: 0 = success, non-0 is failure
-//
-// We can execute only ELF binaries or scripts that begin with "#!". (Not,
-// for example, scripts that don't begin with "#!"; see the VG_(do_exec)()
-// invocation from m_main.c for how that's handled.)
-static Int do_exec_inner(const HChar *exe, ExeInfo* info)
-{
- SysRes res;
- Int fd;
- Int ret;
-
- res = VG_(pre_exec_check)(exe, &fd, False/*allow_setuid*/);
- if (res.isError)
- return res.err;
-
- switch (res.res) {
- case VG_EXE_FORMAT_ELF: ret = load_ELF (fd, exe, info); break;
- case VG_EXE_FORMAT_SCRIPT: ret = load_script(fd, exe, info); break;
- default:
- vg_assert2(0, "unrecognised VG_EXE_FORMAT value\n");
- }
-
- VG_(close)(fd);
-
- return ret;
-}
-
-
-static Bool is_hash_bang_file(Char* f)
-{
- SysRes res = VG_(open)(f, VKI_O_RDONLY, 0);
- if (!res.isError) {
- Char buf[3] = {0,0,0};
- Int fd = res.res;
- Int n = VG_(read)(fd, buf, 2);
- if (n == 2 && VG_STREQ("#!", buf))
- return True;
- }
- return False;
-}
-
-// Look at the first 80 chars, and if any are greater than 127, it's binary.
-// This is crude, but should be good enough. Note that it fails on a
-// zero-length file, as we want.
-static Bool is_binary_file(Char* f)
-{
- SysRes res = VG_(open)(f, VKI_O_RDONLY, 0);
- if (!res.isError) {
- UChar buf[80];
- Int fd = res.res;
- Int n = VG_(read)(fd, buf, 80);
- Int i;
- for (i = 0; i < n; i++) {
- if (buf[i] > 127)
- return True; // binary char found
- }
- return False;
- } else {
- // Something went wrong. This will only happen if we earlier
- // succeeded...
[truncated message content] |