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
(14) |
|
2
|
3
(6) |
4
(9) |
5
(23) |
6
(6) |
7
(10) |
8
(2) |
|
9
(1) |
10
(5) |
11
(2) |
12
(5) |
13
(2) |
14
(2) |
15
(4) |
|
16
(3) |
17
(22) |
18
(21) |
19
(15) |
20
(24) |
21
(5) |
22
(5) |
|
23
(14) |
24
(2) |
25
(2) |
26
(1) |
27
|
28
|
29
(1) |
|
30
|
31
|
|
|
|
|
|
|
From: <sv...@va...> - 2016-10-01 14:11:05
|
Author: philippe
Date: Sat Oct 1 15:10:59 2016
New Revision: 16000
Log:
Well, 5 seconds is too short for me to type a attach pid command
so increase to 8 seconds.
Modified:
trunk/coregrind/m_main.c
Modified: trunk/coregrind/m_main.c
==============================================================================
--- trunk/coregrind/m_main.c (original)
+++ trunk/coregrind/m_main.c Sat Oct 1 15:10:59 2016
@@ -2166,7 +2166,7 @@
/* Hook to delay things long enough so we can get the pid and
attach GDB in another shell. */
if (VG_(clo_wait_for_gdb)) {
- const int ms = 5000; // milliseconds
+ const int ms = 8000; // milliseconds
VG_(debugLog)(1, "main", "Wait for GDB during %d ms\n", ms);
VG_(printf)("pid=%d, entering delay %d ms loop\n", VG_(getpid)(), ms);
VG_(poll)(NULL, 0, ms);
|
|
From: Hauke M. <ha...@ha...> - 2016-10-01 13:54:22
|
Hi, With valgrind 3.11 I am always getting this error when trying to use valgrind: ------------------------------------------------------------------------ root@lede:/# valgrind uname -a valgrind: mmap(0x400000, 303104) failed in UME with error 22 (Invalid argument). valgrind: this can be caused by executables with very large text, data or bss segments. root@lede:/# ------------------------------------------------------------------------ Then I tried the current svn snapshot from version r15986 and I am getting this error: ------------------------------------------------------------------------ root@lede:/# valgrind uname -a ==1174== Memcheck, a memory error detector ==1174== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==1174== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info ==1174== Command: uname -a ==1174== ==1174== Conditional jump or move depends on uninitialised value(s) ==1174== at 0x4072D14: ??? (in /lib/libc.so) ==1174== by 0x4082930: ??? (in /lib/libc.so) ==1174== ==1174== Conditional jump or move depends on uninitialised value(s) ==1174== at 0x4072454: ??? (in /lib/libc.so) ==1174== by 0x40728C8: ??? (in /lib/libc.so) ==1174== vex mips->IR: unhandled instruction bytes: 0x41 0x67 0x25 0x22 ==1174== valgrind: Unrecognised instruction at address 0x4078a5. ==1174== at 0x4078A5: ??? (in /bin/busybox) ==1174== by 0x401E5D0: ??? (in /lib/libc.so) ==1174== Your program just tried to execute an instruction that Valgrind ==1174== did not recognise. There are two possible reasons for this. ==1174== 1. Your program has a bug and erroneously jumped to a non-code ==1174== location. If you are running Memcheck and you just saw a ==1174== warning about a bad jump, it's probably your program's fault. ==1174== 2. The instruction is legitimate but Valgrind doesn't handle it, ==1174== i.e. it's Valgrind's fault. If you think this is the case or ==1174== you are not sure, please let us know and we'll try to fix it. ==1174== Either way, Valgrind will now raise a SIGILL signal which will ==1174== probably kill your program. ==1174== ==1174== Process terminating with default action of signal 4 (SIGILL) ==1174== Illegal opcode at address 0x4078A5 ==1174== at 0x4078A5: ??? (in /bin/busybox) ==1174== by 0x401E5D0: ??? (in /lib/libc.so) ==1174== ==1174== HEAP SUMMARY: ==1174== in use at exit: 0 bytes in 0 blocks ==1174== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==1174== ==1174== All heap blocks were freed -- no leaks are possible ==1174== ==1174== For counts of detected and suppressed errors, rerun with: -v ==1174== Use --track-origins=yes to see where uninitialised values come from ==1174== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) Illegal instruction root@lede:/# uname -a Linux lede 4.4.23 #0 Fri Sep 30 18:08:21 2016 mips GNU/Linux root@lede:/# valgrind --version valgrind-3.12.0.SVN ------------------------------------------------------------------------ With bspatch in valgrind svn I can make the impossible happen ------------------------------------------------------------------------ root@lede:/# valgrind bspatch ==1211== Memcheck, a memory error detector ==1211== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==1211== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info ==1211== Command: bspatch ==1211== ==1211== Conditional jump or move depends on uninitialised value(s) ==1211== at 0x4072D14: ??? (in /lib/libc.so) ==1211== by 0x4082930: ??? (in /lib/libc.so) ==1211== ==1211== Conditional jump or move depends on uninitialised value(s) ==1211== at 0x4072454: ??? (in /lib/libc.so) ==1211== by 0x40728C8: ??? (in /lib/libc.so) ==1211== vex mips->IR: unhandled instruction bytes: 0x40 0x74 0x4 0x67 vex: priv/guest_mips_toIR.c:1001 (jmp_lit32): Assertion `dres->whatNext == Dis_Continue' failed. vex storage: T total 25185864 bytes allocated vex storage: P total 0 bytes allocated valgrind: the 'impossible' happened: LibVEX called failure_exit(). host stacktrace: ==1211== at 0x3805DD5C: ??? (in /usr/lib/valgrind/memcheck-mips32-linux) ==1211== by 0x3805DD48: ??? (in /usr/lib/valgrind/memcheck-mips32-linux) sched status: running_tid=1 Thread 1: status = VgTs_Runnable (lwpid 1211) ==1211== at 0x4008E1: ??? (in /usr/bin/bspatch) ==1211== by 0x401E5D0: ??? (in /lib/libc.so) Note: see also the FAQ in the source distribution. It contains workarounds to several common problems. In particular, if Valgrind aborted or crashed after identifying problems in your program, there's a good chance that fixing those problems will prevent Valgrind aborting or crashing, especially if it happened in m_mallocfree.c. If that doesn't help, please report this bug to: www.valgrind.org In the bug report, send all the above text, the valgrind version, and what OS and version you are using. Thanks. root@lede:/# bspatch bspatch: usage: bspatch oldfile newfile patchfile root@lede:/# ------------------------------------------------------------------------ This is LEDE (OpenWrt) with kernel 4.4, gcc 5.4.0, musl 1.1.15 and a MIPS Big Endian CPU. The system is build without floating point support (MIPS 34Kc CPU without FPU, kernel without FPU emulation and GCC without FPU support) To make this work this patch is needed: https://git.lede-project.org/?p=source.git;a=blob;f=package/devel/valgrind/patches/130-mips_fix_soft_float.patch What is wrong in the current svn version of valgrind? What commit fixed the problem in the version 3.11 so that I can backport it to the released version? Hauke |
|
From: <sv...@va...> - 2016-10-01 13:47:01
|
Author: philippe
Date: Sat Oct 1 14:46:53 2016
New Revision: 15999
Log:
Replace --wait-for-gdb=yes memory loop by a call to VG_(poll) (5000 milliseconds)
Depending on the cpu speed, this loop was way too fast or too slow.
=> replace by a syscall that will always give the same waiting time.
A few notes:
A VG_(poll) is available on all supported OS
B no signals are supposed to interrupt the syscall, as at that place, nothing works yet.
C gdb can attach to a process blocked in a syscall.
If ever B or C would not be true on some setups, then we could instead do a loop
of e.g. 50 * VG_(poll) (100 milli-seconds)
Modified:
trunk/coregrind/m_main.c
Modified: trunk/coregrind/m_main.c
==============================================================================
--- trunk/coregrind/m_main.c (original)
+++ trunk/coregrind/m_main.c Sat Oct 1 14:46:53 2016
@@ -2166,36 +2166,10 @@
/* Hook to delay things long enough so we can get the pid and
attach GDB in another shell. */
if (VG_(clo_wait_for_gdb)) {
- ULong iters, q;
- VG_(debugLog)(1, "main", "Wait for GDB\n");
- VG_(printf)("pid=%d, entering delay loop\n", VG_(getpid)());
-
-# if defined(VGP_x86_linux)
- iters = 10;
-# elif defined(VGP_amd64_linux) || defined(VGP_ppc64be_linux) \
- || defined(VGP_ppc64le_linux) || defined(VGP_tilegx_linux)
- iters = 10;
-# elif defined(VGP_ppc32_linux)
- iters = 5;
-# elif defined(VGP_arm_linux)
- iters = 5;
-# elif defined(VGP_arm64_linux)
- iters = 5;
-# elif defined(VGP_s390x_linux)
- iters = 10;
-# elif defined(VGP_mips32_linux) || defined(VGP_mips64_linux)
- iters = 10;
-# elif defined(VGO_darwin)
- iters = 3;
-# elif defined(VGO_solaris)
- iters = 10;
-# else
-# error "Unknown plat"
-# endif
-
- iters *= 1000ULL * 1000 * 1000;
- for (q = 0; q < iters; q++)
- __asm__ __volatile__("" ::: "memory","cc");
+ const int ms = 5000; // milliseconds
+ VG_(debugLog)(1, "main", "Wait for GDB during %d ms\n", ms);
+ VG_(printf)("pid=%d, entering delay %d ms loop\n", VG_(getpid)(), ms);
+ VG_(poll)(NULL, 0, ms);
}
//--------------------------------------------------------------
|
|
From: <sv...@va...> - 2016-10-01 11:54:59
|
Author: mjw
Date: Sat Oct 1 12:54:52 2016
New Revision: 15998
Log:
Don't crash, but warn and return EINVAL on unknown fcntl command.
Bug #369446
LTP: testcases/kernel/syscalls/fcntl/fcntl13
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/syswrap-linux.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sat Oct 1 12:54:52 2016
@@ -188,6 +188,7 @@
369383 x86 sys_modify_ldt wrapper crashes on bad ptr
369402 Bad set/get_thread_area pointer crashes valgrind
369441 bad lvec argument crashes process_vm_readv/writev syscall wrappers
+369446 valgrind crashes on unknown fcntl command
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c Sat Oct 1 12:54:52 2016
@@ -5487,7 +5487,8 @@
default:
PRINT("sys_fcntl[UNKNOWN] ( %lu, %lu, %lu )", ARG1, ARG2, ARG3);
- I_die_here;
+ VG_(umsg)("Warning: unimplemented fcntl command: %lu\n", ARG2);
+ SET_STATUS_Failure( VKI_EINVAL );
break;
}
|
|
From: <sv...@va...> - 2016-10-01 11:54:58
|
Author: mjw
Date: Sat Oct 1 12:54:51 2016
New Revision: 15997
Log:
Don't check bad iovec array in process_vm_readv/writev. Bug #369441.
Found by LTP testcases/kernel/syscalls/cma/process_vm01.
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/syswrap-linux.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sat Oct 1 12:54:51 2016
@@ -187,6 +187,7 @@
369362 Bad sigaction arguments crash valgrind
369383 x86 sys_modify_ldt wrapper crashes on bad ptr
369402 Bad set/get_thread_area pointer crashes valgrind
+369441 bad lvec argument crashes process_vm_readv/writev syscall wrappers
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c Sat Oct 1 12:54:51 2016
@@ -5004,8 +5004,8 @@
ARG2, ARG3 * sizeof(struct vki_iovec) );
PRE_MEM_READ( "process_vm_readv(rvec)",
ARG4, ARG5 * sizeof(struct vki_iovec) );
- if (ARG2 != 0) {
- /* TODO: Don't do any of the following if lvec is invalid */
+ if (ARG2 != 0
+ && ML_(safe_to_deref) ((void *)ARG2, sizeof(struct vki_iovec) * ARG3)) {
const struct vki_iovec *vec = (const struct vki_iovec *)ARG2;
UInt i;
for (i = 0; i < ARG3; i++)
@@ -5042,8 +5042,8 @@
ARG2, ARG3 * sizeof(struct vki_iovec) );
PRE_MEM_READ( "process_vm_writev(rvec)",
ARG4, ARG5 * sizeof(struct vki_iovec) );
- if (ARG2 != 0) {
- /* TODO: Don't do any of the following if lvec is invalid */
+ if (ARG2 != 0
+ && ML_(safe_to_deref) ((void *)ARG2, sizeof(struct vki_iovec) * ARG3)) {
const struct vki_iovec *vec = (const struct vki_iovec *)ARG2;
UInt i;
for (i = 0; i < ARG3; i++)
|
|
From: <sv...@va...> - 2016-10-01 11:54:57
|
Author: mjw
Date: Sat Oct 1 12:54:50 2016
New Revision: 15996
Log:
linux-x86 check get/set_thread_area pointer before use. Bug #369402.
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/syswrap-x86-linux.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sat Oct 1 12:54:50 2016
@@ -186,6 +186,7 @@
369361 vmsplice syscall wrapper crashes on bad iovec
369362 Bad sigaction arguments crash valgrind
369383 x86 sys_modify_ldt wrapper crashes on bad ptr
+369402 Bad set/get_thread_area pointer crashes valgrind
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: trunk/coregrind/m_syswrap/syswrap-x86-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-x86-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-x86-linux.c Sat Oct 1 12:54:50 2016
@@ -634,7 +634,7 @@
vg_assert(8 == sizeof(VexGuestX86SegDescr));
vg_assert(sizeof(HWord) == sizeof(VexGuestX86SegDescr*));
- if (info == NULL)
+ if (info == NULL || ! ML_(safe_to_deref)(info, sizeof(vki_modify_ldt_t)))
return VG_(mk_SysRes_Error)( VKI_EFAULT );
gdt = (VexGuestX86SegDescr*)VG_(threads)[tid].arch.vex.guest_GDT;
@@ -686,7 +686,7 @@
vg_assert(sizeof(HWord) == sizeof(VexGuestX86SegDescr*));
vg_assert(8 == sizeof(VexGuestX86SegDescr));
- if (info == NULL)
+ if (info == NULL || ! ML_(safe_to_deref)(info, sizeof(vki_modify_ldt_t)))
return VG_(mk_SysRes_Error)( VKI_EFAULT );
idx = info->entry_number;
|
|
From: <sv...@va...> - 2016-10-01 11:54:56
|
Author: mjw
Date: Sat Oct 1 12:54:50 2016
New Revision: 15995
Log:
Fix crash in sys_modify_ldt wrapper on bad ptr. Bug #369383.
Make sure ptr is safe_to_deref if not NULL.
Also fixup some corner case error return codes.
We have to do that ourselves since we never actually call into the kernel.
Found by LTP testcases/kernel/syscalls/modify_ldt/modify_ldt01.
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/syswrap-x86-linux.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sat Oct 1 12:54:50 2016
@@ -185,6 +185,7 @@
369360 Bad sigprocmask old or new sets can crash valgrind
369361 vmsplice syscall wrapper crashes on bad iovec
369362 Bad sigaction arguments crash valgrind
+369383 x86 sys_modify_ldt wrapper crashes on bad ptr
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: trunk/coregrind/m_syswrap/syswrap-x86-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-x86-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-x86-linux.c Sat Oct 1 12:54:50 2016
@@ -596,24 +596,31 @@
static SysRes sys_modify_ldt ( ThreadId tid,
Int func, void* ptr, UInt bytecount )
{
- SysRes ret = VG_(mk_SysRes_Error)( VKI_ENOSYS );
+ SysRes ret;
- switch (func) {
- case 0:
- ret = read_ldt(tid, ptr, bytecount);
- break;
- case 1:
- ret = write_ldt(tid, ptr, bytecount, 1);
- break;
- case 2:
- VG_(unimplemented)("sys_modify_ldt: func == 2");
- /* god knows what this is about */
- /* ret = read_default_ldt(ptr, bytecount); */
- /*UNREACHED*/
- break;
- case 0x11:
- ret = write_ldt(tid, ptr, bytecount, 0);
- break;
+ if (func != 0 && func != 1 && func != 2 && func != 0x11) {
+ ret = VG_(mk_SysRes_Error)( VKI_ENOSYS );
+ } else if (ptr != NULL && ! ML_(safe_to_deref)(ptr, bytecount)) {
+ ret = VG_(mk_SysRes_Error)( VKI_EFAULT );
+ } else {
+ switch (func) {
+ case 0:
+ ret = read_ldt(tid, ptr, bytecount);
+ break;
+ case 1:
+ ret = write_ldt(tid, ptr, bytecount, 1);
+ break;
+ case 2:
+ ret = VG_(mk_SysRes_Error)( VKI_ENOSYS );
+ VG_(unimplemented)("sys_modify_ldt: func == 2");
+ /* god knows what this is about */
+ /* ret = read_default_ldt(ptr, bytecount); */
+ /*UNREACHED*/
+ break;
+ case 0x11:
+ ret = write_ldt(tid, ptr, bytecount, 0);
+ break;
+ }
}
return ret;
}
|
|
From: <sv...@va...> - 2016-10-01 11:54:55
|
Author: mjw
Date: Sat Oct 1 12:54:49 2016
New Revision: 15994
Log:
Fix crash in linux [rt_]sigaction wrapper with bad old/new sigaction handler.
Since we try to modify the old/new sigaction handler before passing it
to the kernel we must make sure that (if they aren't NULL) it is safe
to use. If not we should bail out early with EFAULT.
Bug #369362
Found by LTP testcases/kernel/syscalls/rt_sigaction/rt_sigaction02.
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/syswrap-linux.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sat Oct 1 12:54:49 2016
@@ -184,6 +184,7 @@
369359 msghdr_foreachfield can crash when handling bad iovec
369360 Bad sigprocmask old or new sets can crash valgrind
369361 vmsplice syscall wrapper crashes on bad iovec
+369362 Bad sigaction arguments crash valgrind
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c Sat Oct 1 12:54:49 2016
@@ -3277,7 +3277,7 @@
PRE_MEM_READ( "sigaction(act->sa_handler)", (Addr)&sa->ksa_handler, sizeof(sa->ksa_handler));
PRE_MEM_READ( "sigaction(act->sa_mask)", (Addr)&sa->sa_mask, sizeof(sa->sa_mask));
PRE_MEM_READ( "sigaction(act->sa_flags)", (Addr)&sa->sa_flags, sizeof(sa->sa_flags));
- if (ML_(safe_to_deref)(sa,sizeof(sa))
+ if (ML_(safe_to_deref)(sa,sizeof(sa))
&& (sa->sa_flags & VKI_SA_RESTORER))
PRE_MEM_READ( "sigaction(act->sa_restorer)", (Addr)&sa->sa_restorer, sizeof(sa->sa_restorer));
}
@@ -3287,26 +3287,43 @@
oldp = &old;
}
- if (ARG2 != 0) {
- struct vki_old_sigaction *oldnew = (struct vki_old_sigaction *)ARG2;
+ /* If the new or old sigaction is not NULL, but the structs
+ aren't accessible then sigaction returns EFAULT and we cannot
+ use either struct for our own bookkeeping. Just fail early. */
+ if (ARG2 != 0
+ && ! ML_(safe_to_deref)((void *)ARG2,
+ sizeof(struct vki_old_sigaction))) {
+ VG_(umsg)("Warning: bad act handler address %p in sigaction()\n",
+ (void *)ARG2);
+ SET_STATUS_Failure ( VKI_EFAULT );
+ } else if ((ARG3 != 0
+ && ! ML_(safe_to_deref)((void *)ARG3,
+ sizeof(struct vki_old_sigaction)))) {
+ VG_(umsg)("Warning: bad oldact handler address %p in sigaction()\n",
+ (void *)ARG3);
+ SET_STATUS_Failure ( VKI_EFAULT );
+ } else {
+ if (ARG2 != 0) {
+ struct vki_old_sigaction *oldnew = (struct vki_old_sigaction *)ARG2;
- new.ksa_handler = oldnew->ksa_handler;
- new.sa_flags = oldnew->sa_flags;
- new.sa_restorer = oldnew->sa_restorer;
- convert_sigset_to_rt(&oldnew->sa_mask, &new.sa_mask);
- newp = &new;
- }
+ new.ksa_handler = oldnew->ksa_handler;
+ new.sa_flags = oldnew->sa_flags;
+ new.sa_restorer = oldnew->sa_restorer;
+ convert_sigset_to_rt(&oldnew->sa_mask, &new.sa_mask);
+ newp = &new;
+ }
- SET_STATUS_from_SysRes( VG_(do_sys_sigaction)(ARG1, newp, oldp) );
+ SET_STATUS_from_SysRes( VG_(do_sys_sigaction)(ARG1, newp, oldp) );
- if (ARG3 != 0 && SUCCESS && RES == 0) {
- struct vki_old_sigaction *oldold = (struct vki_old_sigaction *)ARG3;
+ if (ARG3 != 0 && SUCCESS && RES == 0) {
+ struct vki_old_sigaction *oldold = (struct vki_old_sigaction *)ARG3;
- oldold->ksa_handler = oldp->ksa_handler;
- oldold->sa_flags = oldp->sa_flags;
- oldold->sa_restorer = oldp->sa_restorer;
- oldold->sa_mask = oldp->sa_mask.sig[0];
- }
+ oldold->ksa_handler = oldp->ksa_handler;
+ oldold->sa_flags = oldp->sa_flags;
+ oldold->sa_restorer = oldp->sa_restorer;
+ oldold->sa_mask = oldp->sa_mask.sig[0];
+ }
+ }
}
POST(sys_sigaction)
{
@@ -3373,20 +3390,39 @@
PRE_MEM_READ( "rt_sigaction(act->sa_handler)", (Addr)&sa->ksa_handler, sizeof(sa->ksa_handler));
PRE_MEM_READ( "rt_sigaction(act->sa_mask)", (Addr)&sa->sa_mask, sizeof(sa->sa_mask));
PRE_MEM_READ( "rt_sigaction(act->sa_flags)", (Addr)&sa->sa_flags, sizeof(sa->sa_flags));
- if (sa->sa_flags & VKI_SA_RESTORER)
+ if (ML_(safe_to_deref)(sa,sizeof(sa))
+ && (sa->sa_flags & VKI_SA_RESTORER))
PRE_MEM_READ( "rt_sigaction(act->sa_restorer)", (Addr)&sa->sa_restorer, sizeof(sa->sa_restorer));
}
if (ARG3 != 0)
PRE_MEM_WRITE( "rt_sigaction(oldact)", ARG3, sizeof(vki_sigaction_fromK_t));
- // XXX: doesn't seem right to be calling do_sys_sigaction for
- // sys_rt_sigaction... perhaps this function should be renamed
- // VG_(do_sys_rt_sigaction)() --njn
-
- SET_STATUS_from_SysRes(
- VG_(do_sys_sigaction)(ARG1, (const vki_sigaction_toK_t *)ARG2,
- (vki_sigaction_fromK_t *)ARG3)
- );
+ /* If the new or old sigaction is not NULL, but the structs
+ aren't accessible then sigaction returns EFAULT and we cannot
+ use either struct for our own bookkeeping. Just fail early. */
+ if (ARG2 != 0
+ && ! ML_(safe_to_deref)((void *)ARG2,
+ sizeof(vki_sigaction_toK_t))) {
+ VG_(umsg)("Warning: bad act handler address %p in rt_sigaction()\n",
+ (void *)ARG2);
+ SET_STATUS_Failure ( VKI_EFAULT );
+ } else if ((ARG3 != 0
+ && ! ML_(safe_to_deref)((void *)ARG3,
+ sizeof(vki_sigaction_fromK_t)))) {
+ VG_(umsg)("Warning: bad oldact handler address %p in rt_sigaction()\n",
+ (void *)ARG3);
+ SET_STATUS_Failure ( VKI_EFAULT );
+ } else {
+
+ // XXX: doesn't seem right to be calling do_sys_sigaction for
+ // sys_rt_sigaction... perhaps this function should be renamed
+ // VG_(do_sys_rt_sigaction)() --njn
+
+ SET_STATUS_from_SysRes(
+ VG_(do_sys_sigaction)(ARG1, (const vki_sigaction_toK_t *)ARG2,
+ (vki_sigaction_fromK_t *)ARG3)
+ );
+ }
}
POST(sys_rt_sigaction)
{
|
|
From: <sv...@va...> - 2016-10-01 11:54:54
|
Author: mjw
Date: Sat Oct 1 12:54:48 2016
New Revision: 15993
Log:
Fix crash in vmsplice linux kernel wrapper when iovec is bad. Bug #369361.
Found by LTP testcases/kernel/syscalls/vmsplice/vmsplice02.
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/syswrap-linux.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sat Oct 1 12:54:48 2016
@@ -183,6 +183,7 @@
369356 pre_mem_read_sockaddr syscall wrapper can crash with bad sockaddr
369359 msghdr_foreachfield can crash when handling bad iovec
369360 Bad sigprocmask old or new sets can crash valgrind
+369361 vmsplice syscall wrapper crashes on bad iovec
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c Sat Oct 1 12:54:48 2016
@@ -5310,10 +5310,14 @@
for (iov = (struct vki_iovec *)ARG2;
iov < (struct vki_iovec *)ARG2 + ARG3; iov++)
{
- if ((fdfl & VKI_O_ACCMODE) == VKI_O_RDONLY)
- PRE_MEM_WRITE( "vmsplice(iov[...])", (Addr)iov->iov_base, iov->iov_len );
- else
- PRE_MEM_READ( "vmsplice(iov[...])", (Addr)iov->iov_base, iov->iov_len );
+ if (ML_(safe_to_deref) (iov, sizeof(struct vki_iovec))) {
+ if ((fdfl & VKI_O_ACCMODE) == VKI_O_RDONLY)
+ PRE_MEM_WRITE( "vmsplice(iov[...])",
+ (Addr)iov->iov_base, iov->iov_len );
+ else
+ PRE_MEM_READ( "vmsplice(iov[...])",
+ (Addr)iov->iov_base, iov->iov_len );
+ }
}
}
}
|
|
From: <sv...@va...> - 2016-10-01 11:54:53
|
Author: mjw
Date: Sat Oct 1 12:54:47 2016
New Revision: 15992
Log:
Fix crash when old/new sigprocmask isn't safe to dereference. Bug #369360.
Since we want to use the set and oldset for bookkeeping we also want
to make sure they are addressable otherwise, like the kernel, we EFAULT.
Also use EINVAL instead of EMFILE as failure when sigset size is wrong.
Found by LTP testcases/kernel/syscalls/rt_sigprocmask/rt_sigprocmask02.
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/syswrap-linux.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sat Oct 1 12:54:47 2016
@@ -182,6 +182,7 @@
369209 valgrind loops and eats up all memory if cwd doesn't exist.
369356 pre_mem_read_sockaddr syscall wrapper can crash with bad sockaddr
369359 msghdr_foreachfield can crash when handling bad iovec
+369360 Bad sigprocmask old or new sets can crash valgrind
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c Sat Oct 1 12:54:47 2016
@@ -3408,8 +3408,23 @@
PRE_MEM_WRITE( "rt_sigprocmask(oldset)", ARG3, sizeof(vki_sigset_t));
// Like the kernel, we fail if the sigsetsize is not exactly what we expect.
+ // Since we want to use the set and oldset for bookkeeping we also want
+ // to make sure they are addressable otherwise, like the kernel, we EFAULT.
if (sizeof(vki_sigset_t) != ARG4)
- SET_STATUS_Failure( VKI_EMFILE );
+ SET_STATUS_Failure( VKI_EINVAL );
+ else if (ARG2 != 0
+ && ! ML_(safe_to_deref)((void *)ARG2, sizeof(vki_sigset_t))) {
+ VG_(dmsg)("Warning: Bad set handler address %p in sigprocmask\n",
+ (void *)ARG2);
+ SET_STATUS_Failure ( VKI_EFAULT );
+ }
+ else if (ARG3 != 0
+ && ! ML_(safe_to_deref)((void *)ARG3, sizeof(vki_sigset_t))) {
+ VG_(dmsg)("Warning: Bad oldset address %p in sigprocmask\n",
+ (void *)ARG3);
+ SET_STATUS_Failure ( VKI_EFAULT );
+ }
+
else {
SET_STATUS_from_SysRes(
VG_(do_sys_sigprocmask) ( tid, ARG1 /*how*/,
|
|
From: <sv...@va...> - 2016-10-01 11:54:52
|
Author: mjw
Date: Sat Oct 1 12:54:41 2016
New Revision: 15991
Log:
Fix crash in msghdr_foreachfield when iov_len isn't safe to dereference.
Also stop checking when max length of bytes have been reached.
Bug #369359
Found by LTP testcases/kernel/syscalls/recvmsg/recvmsg01.
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/syswrap-generic.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sat Oct 1 12:54:41 2016
@@ -181,6 +181,7 @@
369169 ppc64 fails jm_int_isa_2_07 test
369209 valgrind loops and eats up all memory if cwd doesn't exist.
369356 pre_mem_read_sockaddr syscall wrapper can crash with bad sockaddr
+369359 msghdr_foreachfield can crash when handling bad iovec
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-generic.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c Sat Oct 1 12:54:41 2016
@@ -1056,15 +1056,19 @@
VG_(sprintf) ( fieldName, "(%s.msg_iov)", name );
- foreach_func ( tid, True, fieldName,
- (Addr)iov, msg->msg_iovlen * sizeof( struct vki_iovec ) );
-
- for ( i = 0; i < msg->msg_iovlen; ++i, ++iov ) {
- UInt iov_len = iov->iov_len <= length ? iov->iov_len : length;
- VG_(sprintf) ( fieldName, "(%s.msg_iov[%u])", name, i );
- foreach_func ( tid, False, fieldName,
- (Addr)iov->iov_base, iov_len );
- length = length - iov_len;
+ if (ML_(safe_to_deref)(&msg->msg_iovlen, sizeof (UInt))) {
+ foreach_func ( tid, True, fieldName, (Addr)iov,
+ msg->msg_iovlen * sizeof( struct vki_iovec ) );
+
+ for ( i = 0; i < msg->msg_iovlen && length > 0; ++i, ++iov ) {
+ if (ML_(safe_to_deref)(&iov->iov_len, sizeof (UInt))) {
+ UInt iov_len = iov->iov_len <= length ? iov->iov_len : length;
+ VG_(sprintf) ( fieldName, "(%s.msg_iov[%u])", name, i );
+ foreach_func ( tid, False, fieldName,
+ (Addr)iov->iov_base, iov_len );
+ length = length - iov_len;
+ }
+ }
}
}
|
|
From: <sv...@va...> - 2016-10-01 11:54:51
|
Author: mjw
Date: Sat Oct 1 12:54:40 2016
New Revision: 15990
Log:
Fix pre_mem_read_sockaddr crash on invalid syscall arguments. Bug #369356.
Don't do any more checks if it isn't safe to inspect the address family.
Likewise, don't check sun_path if the string address isn't safe.
Found by LTP testcases/kernel/syscalls/bind/bind01.
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/syswrap-generic.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sat Oct 1 12:54:40 2016
@@ -180,6 +180,7 @@
361253 [s390x] ex_clone.c:42: undefined reference to `pthread_create'
369169 ppc64 fails jm_int_isa_2_07 test
369209 valgrind loops and eats up all memory if cwd doesn't exist.
+369356 pre_mem_read_sockaddr syscall wrapper can crash with bad sockaddr
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-generic.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c Sat Oct 1 12:54:40 2016
@@ -1128,12 +1128,20 @@
VG_(sprintf) ( outmsg, description, "sa_family" );
PRE_MEM_READ( outmsg, (Addr) &sa->sa_family, sizeof(vki_sa_family_t));
+ /* Don't do any extra checking if we cannot determine the sa_family. */
+ if (! ML_(safe_to_deref) (&sa->sa_family, sizeof(vki_sa_family_t))) {
+ VG_(free) (outmsg);
+ return;
+ }
+
switch (sa->sa_family) {
case VKI_AF_UNIX:
- VG_(sprintf) ( outmsg, description, "sun_path" );
- PRE_MEM_RASCIIZ( outmsg, (Addr) saun->sun_path );
- // GrP fixme max of sun_len-2? what about nul char?
+ if (ML_(safe_to_deref) (&saun->sun_path, sizeof (Addr))) {
+ VG_(sprintf) ( outmsg, description, "sun_path" );
+ PRE_MEM_RASCIIZ( outmsg, (Addr) saun->sun_path );
+ // GrP fixme max of sun_len-2? what about nul char?
+ }
break;
case VKI_AF_INET:
|
|
From: <sv...@va...> - 2016-10-01 11:54:46
|
Author: mjw
Date: Sat Oct 1 12:54:38 2016
New Revision: 15989
Log:
Don't require the current working directory to exist. Bug #369209.
At startup valgrind fetches the current working directory and stashes
it away to be used later (in debug messages, read config files or create
log files). But if the current working directory didn't exist (or there
was some other error getting its path) then valgrind would go in an
endless loop. This was caused by assuming that any error meant a larger
buffer needed to be created to store the cwd path (ERANGE). However
there could be other reasons calling getcwd failed.
Fix this by only looping and resizing the buffer when the error is
ERANGE. Any other error just means we cannot fetch and store the current
working directory. Fix all callers to check get_startup_wd() returns
NULL. Only abort startup if a relative path needs to be used for
user supplied relative log files. Debug messages will just show
"<NO CWD>". And skip reading any config files from the startup_wd
if it doesn't exist.
Also add a new testcase that tests executing valgrind in a deep,
inaccessible and/or non-existing directory (none/tests/nocwd.vgtest).
Added:
trunk/none/tests/nocwd.c
trunk/none/tests/nocwd.stderr.exp
trunk/none/tests/nocwd.stdout.exp
trunk/none/tests/nocwd.vgtest
Modified:
trunk/NEWS
trunk/coregrind/m_commandline.c
trunk/coregrind/m_libcfile.c
trunk/coregrind/m_main.c
trunk/coregrind/m_options.c
trunk/coregrind/pub_core_libcfile.h
trunk/drd/drd_error.c
trunk/include/pub_tool_libcfile.h
trunk/none/tests/Makefile.am
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sat Oct 1 12:54:38 2016
@@ -179,6 +179,7 @@
369000 AMD64 fma4 instructions unsupported.
361253 [s390x] ex_clone.c:42: undefined reference to `pthread_create'
369169 ppc64 fails jm_int_isa_2_07 test
+369209 valgrind loops and eats up all memory if cwd doesn't exist.
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: trunk/coregrind/m_commandline.c
==============================================================================
--- trunk/coregrind/m_commandline.c (original)
+++ trunk/coregrind/m_commandline.c Sat Oct 1 12:54:38 2016
@@ -220,9 +220,10 @@
// Don't read ./.valgrindrc if "." is the same as "$HOME", else its
// contents will be applied twice. (bug #142488)
+ // Also don't try to read it if there is no cwd.
if (home) {
const HChar *cwd = VG_(get_startup_wd)();
- f2_clo = ( VG_STREQ(home, cwd)
+ f2_clo = ( (cwd == NULL || VG_STREQ(home, cwd))
? NULL : read_dot_valgrindrc(".") );
}
Modified: trunk/coregrind/m_libcfile.c
==============================================================================
--- trunk/coregrind/m_libcfile.c (original)
+++ trunk/coregrind/m_libcfile.c Sat Oct 1 12:54:38 2016
@@ -548,16 +548,12 @@
Hence VG_(record_startup_wd) notes it (in a platform dependent way)
and VG_(get_startup_wd) produces the noted value. */
static HChar *startup_wd;
-static Bool startup_wd_acquired = False;
/* Record the process' working directory at startup. Is intended to
be called exactly once, at startup, before the working directory
- changes. Return True for success, False for failure, so that the
- caller can bomb out suitably without creating module cycles if
- there is a problem. */
-Bool VG_(record_startup_wd) ( void )
+ changes. */
+void VG_(record_startup_wd) ( void )
{
- vg_assert(!startup_wd_acquired);
# if defined(VGO_linux) || defined(VGO_solaris)
/* Simple: just ask the kernel */
SysRes res;
@@ -567,11 +563,15 @@
startup_wd = VG_(realloc)("startup_wd", startup_wd, szB);
VG_(memset)(startup_wd, 0, szB);
res = VG_(do_syscall2)(__NR_getcwd, (UWord)startup_wd, szB-1);
- } while (sr_isError(res));
+ } while (sr_isError(res) && sr_Err(res) == VKI_ERANGE);
+
+ if (sr_isError(res)) {
+ VG_(free)(startup_wd);
+ startup_wd = NULL;
+ return;
+ }
vg_assert(startup_wd[szB-1] == 0);
- startup_wd_acquired = True;
- return True;
# elif defined(VGO_darwin)
/* We can't ask the kernel, so instead rely on launcher-*.c to
@@ -585,23 +585,19 @@
(Int)VG_(getppid)());
wd = VG_(getenv)( envvar );
if (wd == NULL)
- return False;
+ return;
SizeT need = VG_(strlen)(wd) + 1;
startup_wd = VG_(malloc)("startup_wd", need);
VG_(strcpy)(startup_wd, wd);
- startup_wd_acquired = True;
- return True;
}
# else
# error Unknown OS
# endif
}
-/* Return the previously acquired startup_wd. */
+/* Return the previously acquired startup_wd or NULL. */
const HChar *VG_(get_startup_wd) ( void )
{
- vg_assert(startup_wd_acquired);
-
return startup_wd;
}
Modified: trunk/coregrind/m_main.c
==============================================================================
--- trunk/coregrind/m_main.c (original)
+++ trunk/coregrind/m_main.c Sat Oct 1 12:54:38 2016
@@ -1853,12 +1853,9 @@
// Record the working directory at startup
// p: none
VG_(debugLog)(1, "main", "Getting the working directory at startup\n");
- { Bool ok = VG_(record_startup_wd)();
- if (!ok)
- VG_(err_config_error)( "Can't establish current working "
- "directory at startup\n");
- }
- VG_(debugLog)(1, "main", "... %s\n", VG_(get_startup_wd)() );
+ VG_(record_startup_wd)();
+ const HChar *wd = VG_(get_startup_wd)();
+ VG_(debugLog)(1, "main", "... %s\n", wd != NULL ? wd : "<NO CWD>" );
//============================================================
// Command line argument handling order:
Modified: trunk/coregrind/m_options.c
==============================================================================
--- trunk/coregrind/m_options.c (original)
+++ trunk/coregrind/m_options.c Sat Oct 1 12:54:38 2016
@@ -273,6 +273,10 @@
// If 'out' is not an absolute path name, prefix it with the startup dir.
if (out[0] != '/') {
+ if (base_dir == NULL) {
+ message = "Current working dir doesn't exist, use absolute path\n";
+ goto bad;
+ }
len = VG_(strlen)(base_dir) + 1 + VG_(strlen)(out) + 1;
HChar *absout = VG_(malloc)("options.efn.4", len);
Modified: trunk/coregrind/pub_core_libcfile.h
==============================================================================
--- trunk/coregrind/pub_core_libcfile.h (original)
+++ trunk/coregrind/pub_core_libcfile.h Sat Oct 1 12:54:38 2016
@@ -102,11 +102,10 @@
/* Record the process' working directory at startup. Is intended to
be called exactly once, at startup, before the working directory
- changes. Return True for success, False for failure, so that the
- caller can bomb out suitably without creating module cycles if
- there is a problem. The saved value can later be acquired by
- calling VG_(get_startup_wd) (in pub_tool_libcfile.h). */
-extern Bool VG_(record_startup_wd) ( void );
+ changes. The saved value can later be acquired by calling
+ VG_(get_startup_wd) (in pub_tool_libcfile.h). Note that might
+ return if the working directory couldn't be found. */
+extern void VG_(record_startup_wd) ( void );
#endif // __PUB_CORE_LIBCFILE_H
Modified: trunk/drd/drd_error.c
==============================================================================
--- trunk/drd/drd_error.c (original)
+++ trunk/drd/drd_error.c Sat Oct 1 12:54:38 2016
@@ -32,7 +32,6 @@
#include "pub_tool_basics.h"
#include "pub_tool_libcassert.h" /* tl_assert() */
#include "pub_tool_libcbase.h" /* strlen() */
-#include "pub_tool_libcfile.h" /* VG_(get_startup_wd)() */
#include "pub_tool_libcprint.h" /* VG_(printf)() */
#include "pub_tool_machine.h"
#include "pub_tool_mallocfree.h" /* VG_(malloc), VG_(free) */
Modified: trunk/include/pub_tool_libcfile.h
==============================================================================
--- trunk/include/pub_tool_libcfile.h (original)
+++ trunk/include/pub_tool_libcfile.h Sat Oct 1 12:54:38 2016
@@ -104,7 +104,8 @@
extern const HChar* VG_(tmpdir)(void);
/* Return the working directory at startup. The returned string is
- persistent. */
+ persistent. Might be NULL if the current working directory doesn't
+ exist. */
extern const HChar *VG_(get_startup_wd) ( void );
#endif // __PUB_TOOL_LIBCFILE_H
Modified: trunk/none/tests/Makefile.am
==============================================================================
--- trunk/none/tests/Makefile.am (original)
+++ trunk/none/tests/Makefile.am Sat Oct 1 12:54:38 2016
@@ -140,6 +140,7 @@
mq.stderr.exp mq.vgtest \
munmap_exe.stderr.exp munmap_exe.vgtest \
nestedfns.stderr.exp nestedfns.stdout.exp nestedfns.vgtest \
+ nocwd.stdout.exp nocwd.stderr.exp nocwd.vgtest \
nodir.stderr.exp nodir.vgtest \
pending.stdout.exp pending.stderr.exp pending.vgtest \
ppoll_alarm.stdout.exp ppoll_alarm.stderr.exp ppoll_alarm.vgtest \
@@ -219,6 +220,7 @@
manythreads \
mmap_fcntl_bug \
munmap_exe map_unaligned map_unmap mq \
+ nocwd \
pending \
procfs-cmdline-exe \
pselect_alarm \
Added: trunk/none/tests/nocwd.c
==============================================================================
--- trunk/none/tests/nocwd.c (added)
+++ trunk/none/tests/nocwd.c Sat Oct 1 12:54:38 2016
@@ -0,0 +1,45 @@
+#include <limits.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+int
+main (int argc, char **argv)
+{
+ char template[] = "/tmp/wd_test_XXXXXX";
+ char *tmpdir = mkdtemp(template);
+ if (tmpdir == NULL)
+ {
+ perror ("Couldn't mkdtemp");
+ exit (-1);
+ }
+
+ if (chdir (tmpdir) != 0)
+ {
+ perror ("Couldn't chdir into tmpdir");
+ exit (-1);
+ }
+
+ /* Go deep. */
+ int dirslen = PATH_MAX;
+ while (dirslen > 0)
+ {
+ /* We don't do any error checking in case some OS fails. */
+ mkdir ("subdir", S_IRWXU);
+ chdir ("subdir");
+ dirslen -= strlen ("subdir");
+ }
+
+ /* Make one component inaccessible. */
+ chmod(tmpdir, 0);
+
+ /* Remove the current dir (don't check error, might fail). */
+ rmdir ("../subdir");
+
+ execlp ("echo", "echo", "Hello", "World", (char *) NULL);
+ perror ("Couldn't execlp");
+ return -1;
+}
Added: trunk/none/tests/nocwd.stderr.exp
==============================================================================
(empty)
Added: trunk/none/tests/nocwd.stdout.exp
==============================================================================
--- trunk/none/tests/nocwd.stdout.exp (added)
+++ trunk/none/tests/nocwd.stdout.exp Sat Oct 1 12:54:38 2016
@@ -0,0 +1 @@
+Hello World
Added: trunk/none/tests/nocwd.vgtest
==============================================================================
--- trunk/none/tests/nocwd.vgtest (added)
+++ trunk/none/tests/nocwd.vgtest Sat Oct 1 12:54:38 2016
@@ -0,0 +1,2 @@
+prog: nocwd
+vgopts: -q --trace-children=yes
|
Author: mjw
Date: Sat Oct 1 11:12:31 2016
New Revision: 15988
Log:
Use AM_LDFLAGS instead of LDFLAGS in exp-bbv/tests Makefiles.
That makes it possible to add to LDFLAGS instead of overriding
when doing make. Useful if you want to have different LD_FLAGS
added for the main and check makes.
Modified:
trunk/exp-bbv/tests/amd64-linux/Makefile.am
trunk/exp-bbv/tests/arm-linux/Makefile.am
trunk/exp-bbv/tests/ppc32-linux/Makefile.am
trunk/exp-bbv/tests/x86-linux/Makefile.am
trunk/exp-bbv/tests/x86/Makefile.am
Modified: trunk/exp-bbv/tests/amd64-linux/Makefile.am
==============================================================================
--- trunk/exp-bbv/tests/amd64-linux/Makefile.am (original)
+++ trunk/exp-bbv/tests/amd64-linux/Makefile.am Sat Oct 1 11:12:31 2016
@@ -25,7 +25,7 @@
AM_CCASFLAGS += -ffreestanding
-LDFLAGS += -nostartfiles -nodefaultlibs
+AM_LDFLAGS = -nostartfiles -nodefaultlibs
clone_test_SOURCES = clone_test.S
complex_rep_SOURCES = complex_rep.S
Modified: trunk/exp-bbv/tests/arm-linux/Makefile.am
==============================================================================
--- trunk/exp-bbv/tests/arm-linux/Makefile.am (original)
+++ trunk/exp-bbv/tests/arm-linux/Makefile.am Sat Oct 1 11:12:31 2016
@@ -16,7 +16,7 @@
AM_CCASFLAGS += -ffreestanding -Xassembler -I$(top_srcdir)/exp-bbv/tests
-LDFLAGS += -nostartfiles -nodefaultlibs
+AM_LDFLAGS = -nostartfiles -nodefaultlibs
ll_SOURCES = ll.S
million_SOURCES = million.S
Modified: trunk/exp-bbv/tests/ppc32-linux/Makefile.am
==============================================================================
--- trunk/exp-bbv/tests/ppc32-linux/Makefile.am (original)
+++ trunk/exp-bbv/tests/ppc32-linux/Makefile.am Sat Oct 1 11:12:31 2016
@@ -16,7 +16,7 @@
AM_CCASFLAGS += -ffreestanding -m32 -Xassembler -I$(top_srcdir)/exp-bbv/tests
-LDFLAGS += -nostartfiles -nodefaultlibs -m32
+AM_LDFLAGS = -nostartfiles -nodefaultlibs -m32
ll_SOURCES = ll.S
million_SOURCES = million.S
Modified: trunk/exp-bbv/tests/x86-linux/Makefile.am
==============================================================================
--- trunk/exp-bbv/tests/x86-linux/Makefile.am (original)
+++ trunk/exp-bbv/tests/x86-linux/Makefile.am Sat Oct 1 11:12:31 2016
@@ -16,7 +16,7 @@
AM_CCASFLAGS += -ffreestanding -Xassembler -I$(top_srcdir)/exp-bbv/tests
-LDFLAGS += @FLAG_M32@ -static -nostartfiles -nodefaultlibs
+AM_LDFLAGS = @FLAG_M32@ -static -nostartfiles -nodefaultlibs
clone_test_SOURCES = clone_test.S
ll_SOURCES = ll.S
Modified: trunk/exp-bbv/tests/x86/Makefile.am
==============================================================================
--- trunk/exp-bbv/tests/x86/Makefile.am (original)
+++ trunk/exp-bbv/tests/x86/Makefile.am Sat Oct 1 11:12:31 2016
@@ -18,7 +18,7 @@
AM_CCASFLAGS += -ffreestanding
-LDFLAGS += @FLAG_M32@ -static -nostartfiles -nodefaultlibs
+AM_LDFLAGS = @FLAG_M32@ -static -nostartfiles -nodefaultlibs
complex_rep_SOURCES = complex_rep.S
fldcw_check_SOURCES = fldcw_check.S
|