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
(1) |
|
2
|
3
(6) |
4
(5) |
5
|
6
(2) |
7
(1) |
8
|
|
9
|
10
(4) |
11
(2) |
12
(2) |
13
(3) |
14
(1) |
15
|
|
16
(4) |
17
|
18
(3) |
19
(3) |
20
(3) |
21
|
22
|
|
23
(1) |
24
(10) |
25
(13) |
26
(6) |
27
(2) |
28
(3) |
29
(5) |
|
30
(6) |
|
|
|
|
|
|
|
From: <sv...@va...> - 2017-04-29 22:48:30
|
Author: rhyskidd
Date: Sat Apr 29 23:48:23 2017
New Revision: 16320
Log:
macos: Add a no-op wrapper for a new-in-10.12 syscall: ulock_wake
Patch from Louis Brunner.
Modified:
trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
trunk/coregrind/m_syswrap/syswrap-darwin.c
Modified: trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
==============================================================================
--- trunk/coregrind/m_syswrap/priv_syswrap-darwin.h (original)
+++ trunk/coregrind/m_syswrap/priv_syswrap-darwin.h Sat Apr 29 23:48:23 2017
@@ -623,7 +623,7 @@
// 513
// 514
// NYI ulock_wait // 515
-// NYI ulock_wake // 516
+DECL_TEMPLATE(darwin, ulock_wake); // 516
// NYI fclonefileat // 517
// NYI fs_snapshot // 518
// 519
Modified: trunk/coregrind/m_syswrap/syswrap-darwin.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-darwin.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-darwin.c Sat Apr 29 23:48:23 2017
@@ -9773,6 +9773,14 @@
void*, buffer, size_t, size);
}
+PRE(ulock_wake)
+{
+ PRINT("ulock_wake(operation:%ld, addr:%#lx, wake_value:%ld) FIXME",
+ ARG1, ARG2, ARG3);
+ PRE_REG_READ3(int, "ulock_wake",
+ uint32_t, operation, void*, addr, uint64_t, wake_value);
+}
+
#endif /* DARWIN_VERS >= DARWIN_10_12 */
@@ -10348,7 +10356,7 @@
_____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(513)), // ???
_____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(514)), // ???
// _____(__NR_ulock_wait), // 515
-// _____(__NR_ulock_wake), // 516
+ MACX_(__NR_ulock_wake, ulock_wake), // 516
// _____(__NR_fclonefileat), // 517
// _____(__NR_fs_snapshot), // 518
_____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(519)), // ???
|
|
From: <sv...@va...> - 2017-04-29 22:35:37
|
Author: rhyskidd
Date: Sat Apr 29 23:35:30 2017
New Revision: 16319
Log:
macos: Add a no-op wrapper for a new-in-10.12 syscall: getentropy
Patch from Louis Brunner.
Modified:
trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
trunk/coregrind/m_syswrap/syswrap-darwin.c
Modified: trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
==============================================================================
--- trunk/coregrind/m_syswrap/priv_syswrap-darwin.h (original)
+++ trunk/coregrind/m_syswrap/priv_syswrap-darwin.h Sat Apr 29 23:35:30 2017
@@ -607,7 +607,7 @@
// NYI work_interval_ctl // 499
#endif /* DARWIN_VERS >= DARWIN_10_11 */
#if DARWIN_VERS >= DARWIN_10_12
-// NYI getentropy // 500
+DECL_TEMPLATE(darwin, getentropy); // 500
// NYI necp_open // 501
// NYI necp_client_action // 502
// 503
Modified: trunk/coregrind/m_syswrap/syswrap-darwin.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-darwin.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-darwin.c Sat Apr 29 23:35:30 2017
@@ -9761,6 +9761,22 @@
/* ---------------------------------------------------------------------
+ Added for macOS 10.12 (Sierra)
+ ------------------------------------------------------------------ */
+
+#if DARWIN_VERS >= DARWIN_10_12
+
+PRE(getentropy)
+{
+ PRINT("getentropy(buffer:%#lx, size:%ld) FIXME", ARG1, ARG2);
+ PRE_REG_READ2(int, "getentropy",
+ void*, buffer, size_t, size);
+}
+
+#endif /* DARWIN_VERS >= DARWIN_10_12 */
+
+
+/* ---------------------------------------------------------------------
syscall tables
------------------------------------------------------------------ */
@@ -10316,7 +10332,7 @@
// _____(__NR_kdebug_typefilter), // 177
// _____(__NR_clonefileat), // 462
// _____(__NR_renameatx_np), // 488
-// _____(__NR_getentropy), // 500
+ MACX_(__NR_getentropy, getentropy), // 500
// _____(__NR_necp_open), // 501
// _____(__NR_necp_client_action), // 502
_____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(503)), // ???
|
|
From: <sv...@va...> - 2017-04-29 22:06:30
|
Author: rhyskidd
Date: Sat Apr 29 23:06:20 2017
New Revision: 16318
Log:
macos: Improve macOS 10.12 support. bz#365327.
The new macOS 10.12 way of loading dylib (placing them at the end of the currently
loaded segments) requires that Valgrind needs to know where the last segment was loaded.
A new structure (load_info_t) has been created to store all this information and easily
carry it around.
Changes:
- dyld text address is relative instead of absolute (macOS 10.12)
- Handle dylinker's offset (macOS 10.12)
- Handle the executable requesting a non-default stack address (macOS 10.12)
- Refactor to use load_info_t structure (all macOS)
Patch from Louis Brunner.
Modified:
trunk/coregrind/m_ume/macho.c
Modified: trunk/coregrind/m_ume/macho.c
==============================================================================
--- trunk/coregrind/m_ume/macho.c (original)
+++ trunk/coregrind/m_ume/macho.c Sat Apr 29 23:06:20 2017
@@ -67,6 +67,15 @@
#define SECTION section_64
#endif
+typedef struct load_info_t {
+ vki_uint8_t *stack_start; // allocated thread stack (hot end)
+ vki_uint8_t *stack_end; // allocated thread stack (cold end)
+ vki_uint8_t *text; // start of text segment (i.e. the mach headers)
+ vki_uint8_t *entry; // static entry point
+ vki_uint8_t *linker_entry; // dylinker entry point
+ Addr linker_offset; // dylinker text offset
+ vki_size_t max_addr; // biggest address reached while loading segments
+} load_info_t;
static void print(const HChar *str)
{
@@ -99,30 +108,24 @@
static int
load_thin_file(int fd, vki_off_t offset, vki_off_t size, unsigned long filetype,
- const HChar *filename,
- vki_uint8_t **out_stack_start, vki_uint8_t **out_stack_end,
- vki_uint8_t **out_text, vki_uint8_t **out_entry, vki_uint8_t **out_linker_entry);
+ const HChar *filename, load_info_t *out_info);
static int
load_fat_file(int fd, vki_off_t offset, vki_off_t size, unsigned long filetype,
- const HChar *filename,
- vki_uint8_t **out_stack_start, vki_uint8_t **out_stack_end,
- vki_uint8_t **out_text, vki_uint8_t **out_entry, vki_uint8_t **out_linker_entry);
+ const HChar *filename, load_info_t *out_info);
static int
load_mach_file(int fd, vki_off_t offset, vki_off_t size, unsigned long filetype,
- const HChar *filename,
- vki_uint8_t **out_stack_start, vki_uint8_t **out_stack_end,
- vki_uint8_t **out_text, vki_uint8_t **out_entry, vki_uint8_t **out_linker_entry);
+ const HChar *filename, load_info_t *out_info);
/* Open and map a dylinker file.
Returns 0 on success, -1 on any failure.
filename must be an absolute path.
- The dylinker's entry point is returned in *out_linker_entry.
+ The dylinker's entry point is returned in out_info->linker_entry.
*/
static int
-open_dylinker(const HChar *filename, vki_uint8_t **out_linker_entry)
+open_dylinker(const HChar *filename, load_info_t *out_info)
{
struct vg_stat sb;
vki_size_t filesize;
@@ -149,8 +152,7 @@
}
filesize = sb.size;
- err = load_mach_file(fd, 0, filesize, MH_DYLINKER, filename,
- NULL, NULL, NULL, out_linker_entry, NULL);
+ err = load_mach_file(fd, 0, filesize, MH_DYLINKER, filename, out_info);
if (err) {
VG_(printf)("...while loading dylinker: %s\n", filename);
}
@@ -164,20 +166,22 @@
fd[offset..size) is a Mach-O thin file.
Returns 0 on success, -1 on any failure.
If this segment contains the executable's Mach headers, their
- loaded address is returned in *text.
+ loaded address is returned in out_info->text.
If this segment is a __UNIXSTACK, its start address is returned in
- *stack_start.
+ out_info->stack_start.
*/
static int
load_segment(int fd, vki_off_t offset, vki_off_t size,
- vki_uint8_t **text, vki_uint8_t **stack_start,
- struct SEGMENT_COMMAND *segcmd, const HChar *filename)
+ struct SEGMENT_COMMAND *segcmd, const HChar *filename,
+ load_info_t *out_info)
{
SysRes res;
Addr addr;
vki_size_t filesize; // page-aligned
vki_size_t vmsize; // page-aligned
+ vki_size_t vmend; // page-aligned
unsigned int prot;
+ Addr slided_addr = segcmd->vmaddr + out_info->linker_offset;
// GrP fixme mark __UNIXSTACK as SF_STACK
@@ -206,12 +210,12 @@
// Record the segment containing the Mach headers themselves
if (segcmd->fileoff == 0 && segcmd->filesize != 0) {
- if (text) *text = (vki_uint8_t *)segcmd->vmaddr;
+ out_info->text = (vki_uint8_t *)slided_addr;
}
// Record the __UNIXSTACK start
if (0 == VG_(strcmp)(segcmd->segname, SEG_UNIXSTACK)) {
- if (stack_start) *stack_start = (vki_uint8_t *)segcmd->vmaddr;
+ out_info->stack_start = (vki_uint8_t *)slided_addr;
}
// Sanity-check the segment
@@ -219,6 +223,12 @@
print("bad executable (invalid segment command)\n");
return -1;
}
+
+ vmend = VG_PGROUNDUP(slided_addr + segcmd->vmsize);
+ if (vmend > out_info->max_addr) {
+ out_info->max_addr = vmend;
+ }
+
if (segcmd->vmsize == 0) {
return 0; // nothing to map - ok
}
@@ -233,7 +243,7 @@
filesize = VG_PGROUNDUP(segcmd->filesize);
vmsize = VG_PGROUNDUP(segcmd->vmsize);
if (filesize > 0) {
- addr = (Addr)segcmd->vmaddr;
+ addr = slided_addr;
VG_(debugLog)(2, "ume", "mmap fixed (file) (%#lx, %lu)\n", addr, filesize);
res = VG_(am_mmap_named_file_fixed_client)(addr, filesize, prot, fd,
offset + segcmd->fileoff,
@@ -250,7 +260,7 @@
if (filesize != vmsize) {
// page-aligned part
SizeT length = vmsize - filesize;
- addr = (Addr)(filesize + segcmd->vmaddr);
+ addr = (Addr)(filesize + slided_addr);
VG_(debugLog)(2, "ume", "mmap fixed (anon) (%#lx, %lu)\n", addr, length);
res = VG_(am_mmap_anon_fixed_client)(addr, length, prot);
check_mmap(res, addr, length, "load_segment2");
@@ -263,16 +273,15 @@
/*
Parse a LC_THREAD or LC_UNIXTHREAD command.
Return 0 on success, -1 on any failure.
- The stack address is returned in *stack. If the executable requested
- a non-default stack address, *customstack is set to TRUE. The thread's
- entry point is returned in *entry.
+ If the thread is a LC_UNIXTHREAD, the stack address is returned in out_info->stack_end.
+ If the executable requested a non-default stack address,
+ *customstack is set to TRUE. The thread's entry point is returned in out_info->entry.
The stack itself (if any) is not mapped.
Other custom register settings are silently ignored (GrP fixme).
*/
static int
-load_genericthread(vki_uint8_t **stack_end,
- int *customstack, vki_uint8_t **entry,
- struct thread_command *threadcmd)
+load_genericthread(struct thread_command *threadcmd, int type,
+ int *customstack, load_info_t *out_info)
{
unsigned int flavor;
unsigned int count;
@@ -298,12 +307,12 @@
#if defined(VGA_x86)
if (flavor == i386_THREAD_STATE && count == i386_THREAD_STATE_COUNT) {
i386_thread_state_t *state = (i386_thread_state_t *)p;
- if (entry) *entry = (vki_uint8_t *)state->__eip;
- if (stack_end) {
- *stack_end = (vki_uint8_t *)(state->__esp ? state->__esp
- : VKI_USRSTACK);
- vg_assert(VG_IS_PAGE_ALIGNED(*stack_end));
- (*stack_end)--;
+ out_info->entry = (vki_uint8_t *)state->__eip;
+ if (type == LC_UNIXTHREAD) {
+ out_info->stack_end =
+ (vki_uint8_t *)(state->__esp ? state->__esp : VKI_USRSTACK);
+ vg_assert(VG_IS_PAGE_ALIGNED(out_info->stack_end));
+ out_info->stack_end--;
}
if (customstack) *customstack = state->__esp;
return 0;
@@ -312,12 +321,12 @@
#elif defined(VGA_amd64)
if (flavor == x86_THREAD_STATE64 && count == x86_THREAD_STATE64_COUNT){
x86_thread_state64_t *state = (x86_thread_state64_t *)p;
- if (entry) *entry = (vki_uint8_t *)state->__rip;
- if (stack_end) {
- *stack_end = (vki_uint8_t *)(state->__rsp ? state->__rsp
- : VKI_USRSTACK64);
- vg_assert(VG_IS_PAGE_ALIGNED(*stack_end));
- (*stack_end)--;
+ out_info->entry = (vki_uint8_t *)state->__rip;
+ if (type == LC_UNIXTHREAD) {
+ out_info->stack_end =
+ (vki_uint8_t *)(state->__rsp ? state->__rsp : VKI_USRSTACK64);
+ vg_assert(VG_IS_PAGE_ALIGNED(out_info->stack_end));
+ out_info->stack_end--;
}
if (customstack) *customstack = state->__rsp;
return 0;
@@ -350,21 +359,19 @@
/*
Processes a LC_UNIXTHREAD command.
Returns 0 on success, -1 on any failure.
- The stack is mapped in and returned in *out_stack.
- The thread's entry point is returned in *out_entry.
+ The stack is mapped in and returned in out_info->stack_start and out_info->stack_end.
+ The thread's entry point is returned in out_info->entry.
*/
static int
-load_unixthread(vki_uint8_t **out_stack_start, vki_uint8_t **out_stack_end,
- vki_uint8_t **out_entry, struct thread_command *threadcmd)
+load_unixthread(struct thread_command *threadcmd, load_info_t *out_info)
{
int err;
- vki_uint8_t *stack_end;
int customstack;
- err = load_genericthread(&stack_end, &customstack, out_entry, threadcmd);
+ err = load_genericthread(threadcmd, LC_UNIXTHREAD, &customstack, out_info);
if (err) return -1;
- if (!stack_end) {
+ if (!out_info->stack_end) {
print("bad executable (no thread stack)\n");
return -1;
}
@@ -372,18 +379,16 @@
if (!customstack) {
// Map the stack
vki_size_t stacksize = VG_PGROUNDUP(default_stack_size());
- vm_address_t stackbase = VG_PGROUNDDN(stack_end+1-stacksize);
+ vm_address_t stackbase = VG_PGROUNDDN(out_info->stack_end+1-stacksize);
SysRes res;
res = VG_(am_mmap_anon_fixed_client)(stackbase, stacksize, VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC);
check_mmap(res, stackbase, stacksize, "load_unixthread1");
- if (out_stack_start) *out_stack_start = (vki_uint8_t *)stackbase;
+ out_info->stack_start = (vki_uint8_t *)stackbase;
} else {
// custom stack - mapped via __UNIXTHREAD segment
}
- if (out_stack_end) *out_stack_end = stack_end;
-
return 0;
}
@@ -396,9 +401,8 @@
above zero. */
#if DARWIN_VERS >= DARWIN_10_8
static int
-handle_lcmain ( vki_uint8_t **out_stack_start,
- vki_uint8_t **out_stack_end,
- vki_size_t requested_size )
+handle_lcmain ( vki_size_t requested_size,
+ load_info_t *out_info )
{
if (requested_size == 0) {
requested_size = default_stack_size();
@@ -412,15 +416,15 @@
VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC);
check_mmap_float(res, requested_size, "handle_lcmain");
vg_assert(!sr_isError(res));
- *out_stack_start = (vki_uint8_t*)sr_Res(res);
- *out_stack_end = *out_stack_start + requested_size - 1;
+ out_info->stack_start = (vki_uint8_t*)sr_Res(res);
+ out_info->stack_end = out_info->stack_start + requested_size - 1;
Bool need_discard = False;
- res = VG_(am_munmap_client)(&need_discard, (Addr)*out_stack_start, HACK);
+ res = VG_(am_munmap_client)(&need_discard, (Addr)out_info->stack_start, HACK);
if (sr_isError(res)) return -1;
vg_assert(!need_discard); // True == wtf?
- *out_stack_start += HACK;
+ out_info->stack_start += HACK;
return 0;
}
@@ -432,12 +436,21 @@
Processes an LC_LOAD_DYLINKER command.
Returns 0 on success, -1 on any error.
The linker itself is mapped into memory.
- The linker's entry point is returned in *linker_entry.
+ The linker's entry point is returned in out_info->linker_entry.
*/
static int
-load_dylinker(vki_uint8_t **linker_entry, struct dylinker_command *dycmd)
+load_dylinker(struct dylinker_command *dycmd, load_info_t *out_info)
{
const HChar *name;
+ int ret;
+ load_info_t linker_info;
+ linker_info.stack_start = NULL;
+ linker_info.stack_end = NULL;
+ linker_info.text = NULL;
+ linker_info.entry = NULL;
+ linker_info.linker_entry = NULL;
+ linker_info.linker_offset = 0;
+ linker_info.max_addr = out_info->max_addr;
if (dycmd->name.offset >= dycmd->cmdsize) {
print("bad executable (invalid dylinker command)\n");
@@ -447,22 +460,27 @@
name = dycmd->name.offset + (HChar *)dycmd;
// GrP fixme assumes name is terminated somewhere
- return open_dylinker(name, linker_entry);
+ ret = open_dylinker(name, &linker_info);
+ if (linker_info.entry) {
+ out_info->linker_entry = linker_info.entry + linker_info.linker_offset;
+ }
+ out_info->max_addr = linker_info.max_addr;
+ return ret;
}
/*
Process an LC_THREAD command.
Returns 0 on success, -1 on any failure.
- The thread's entry point is returned in *out_entry.
+ The thread's entry point is returned in out_info->entry.
*/
static int
-load_thread(vki_uint8_t **out_entry, struct thread_command *threadcmd)
+load_thread(struct thread_command *threadcmd, load_info_t *out_info)
{
int customstack;
int err;
- err = load_genericthread(NULL, &customstack, out_entry, threadcmd);
+ err = load_genericthread(threadcmd, LC_THREAD, &customstack, out_info);
if (err) return -1;
if (customstack) {
print("bad executable (stackless thread has stack)\n");
@@ -478,17 +496,16 @@
Returns 0 on success, -1 on any failure.
fd[offset..offset+size) is a Mach-O thin file.
filetype is MH_EXECUTE or MH_DYLINKER.
- The mapped but empty stack is returned in *out_stack.
- The executable's Mach headers are returned in *out_text.
- The executable's entry point is returned in *out_entry.
- The dylinker's entry point (if any) is returned in *out_linker_entry.
+ The mapped but empty stack is returned in out_info->stack_start.
+ The executable's Mach headers are returned in out_info->text.
+ The executable's entry point is returned in out_info->entry.
+ The dylinker's entry point (if any) is returned in out_info->linker_entry.
+ The dylinker's offset (macOS 10.12) is returned in out_info->linker_offset.
GrP fixme need to return whether dylinker was found - stack layout is different
*/
static int
load_thin_file(int fd, vki_off_t offset, vki_off_t size, unsigned long filetype,
- const HChar *filename,
- vki_uint8_t **out_stack_start, vki_uint8_t **out_stack_end,
- vki_uint8_t **out_text, vki_uint8_t **out_entry, vki_uint8_t **out_linker_entry)
+ const HChar *filename, load_info_t *out_info)
{
VG_(debugLog)(1, "ume", "load_thin_file: begin: %s\n", filename);
struct MACH_HEADER mh;
@@ -503,12 +520,6 @@
SysRes res;
vki_size_t len;
- vki_uint8_t *stack_start = NULL; // allocated thread stack (hot end)
- vki_uint8_t *stack_end = NULL; // allocated thread stack (cold end)
- vki_uint8_t *entry = NULL; // static entry point
- vki_uint8_t *text = NULL; // start of text segment (i.e. the mach headers)
- vki_uint8_t *linker_entry = NULL; // dylinker entry point
-
// Read Mach-O header
if (sizeof(mh) > size) {
print("bad executable (no Mach-O header)\n");
@@ -570,14 +581,14 @@
case LC_MAIN: { /* New in 10.8 */
struct entry_point_command* epcmd
= (struct entry_point_command*)lc;
- if (stack_start || stack_end) {
+ if (out_info->stack_start || out_info->stack_end) {
print("bad executable (multiple indications of stack)");
return -1;
}
- err = handle_lcmain ( &stack_start, &stack_end, epcmd->stacksize );
+ err = handle_lcmain(epcmd->stacksize, out_info);
if (err) return -1;
VG_(debugLog)(2, "ume", "lc_main: created stack %p-%p\n",
- stack_start, stack_end);
+ out_info->stack_start, out_info->stack_end);
break;
}
# endif
@@ -588,14 +599,19 @@
return -1;
}
segcmd = (struct SEGMENT_COMMAND *)lc;
- err = load_segment(fd, offset, size, &text, &stack_start,
- segcmd, filename);
+#if DARWIN_VERS >= DARWIN_10_12
+ /* dyld text address is relative instead of absolute in 10.12 */
+ if (filetype == MH_DYLINKER && segcmd->vmaddr == 0 && segcmd->fileoff == 0) {
+ out_info->linker_offset = out_info->max_addr;
+ }
+# endif
+ err = load_segment(fd, offset, size, segcmd, filename, out_info);
if (err) return -1;
break;
case LC_UNIXTHREAD:
- if (stack_end || entry) {
+ if (out_info->stack_end || out_info->entry) {
print("bad executable (multiple thread commands)\n");
return -1;
}
@@ -604,7 +620,7 @@
return -1;
}
threadcmd = (struct thread_command *)lc;
- err = load_unixthread(&stack_start, &stack_end, &entry, threadcmd);
+ err = load_unixthread(threadcmd, out_info);
if (err) return -1;
break;
@@ -613,7 +629,7 @@
print("bad executable (dylinker needs a dylinker)\n");
return -1;
}
- if (linker_entry) {
+ if (out_info->linker_entry) {
print("bad executable (multiple dylinker commands)\n");
}
if (lc->cmdsize < sizeof(struct dylinker_command)) {
@@ -621,7 +637,7 @@
return -1;
}
dycmd = (struct dylinker_command *)lc;
- err = load_dylinker(&linker_entry, dycmd);
+ err = load_dylinker(dycmd, out_info);
if (err) return -1;
break;
@@ -630,7 +646,7 @@
print("bad executable (stackless thread)\n");
return -1;
}
- if (stack_end || entry) {
+ if (out_info->stack_end || out_info->entry) {
print("bad executable (multiple thread commands)\n");
return -1;
}
@@ -639,7 +655,7 @@
return -1;
}
threadcmd = (struct thread_command *)lc;
- err = load_thread(&entry, threadcmd);
+ err = load_thread(threadcmd, out_info);
if (err) return -1;
break;
@@ -657,15 +673,15 @@
// a stack
// a text segment
// an entry point (static or linker)
- if (!stack_end || !stack_start) {
+ if (!out_info->stack_end || !out_info->stack_start) {
VG_(printf)("bad executable %s (no stack)\n", filename);
return -1;
}
- if (!text) {
+ if (!out_info->text) {
print("bad executable (no text segment)\n");
return -1;
}
- if (!entry && !linker_entry) {
+ if (!out_info->entry && !out_info->linker_entry) {
print("bad executable (no entry point)\n");
return -1;
}
@@ -673,18 +689,12 @@
else if (filetype == MH_DYLINKER) {
// Verify the necessary pieces for a dylinker:
// an entry point
- if (!entry) {
+ if (!out_info->entry) {
print("bad executable (no entry point)\n");
return -1;
}
}
- if (out_stack_start) *out_stack_start = stack_start;
- if (out_stack_end) *out_stack_end = stack_end;
- if (out_text) *out_text = text;
- if (out_entry) *out_entry = entry;
- if (out_linker_entry) *out_linker_entry = linker_entry;
-
VG_(debugLog)(1, "ume", "load_thin_file: success: %s\n", filename);
return 0;
}
@@ -695,9 +705,7 @@
*/
static int
load_fat_file(int fd, vki_off_t offset, vki_off_t size, unsigned long filetype,
- const HChar *filename,
- vki_uint8_t **out_stack_start, vki_uint8_t **out_stack_end,
- vki_uint8_t **out_text, vki_uint8_t **out_entry, vki_uint8_t **out_linker_entry)
+ const HChar *filename, load_info_t *out_info)
{
struct fat_header fh;
vki_off_t arch_offset;
@@ -760,9 +768,7 @@
print("bad executable (corrupt fat arch 2)\n");
return -1;
}
- return load_mach_file(fd, offset+arch.offset, arch.size, filetype,
- filename, out_stack_start, out_stack_end,
- out_text, out_entry, out_linker_entry);
+ return load_mach_file(fd, offset+arch.offset, arch.size, filetype, filename, out_info);
}
}
@@ -776,9 +782,7 @@
*/
static int
load_mach_file(int fd, vki_off_t offset, vki_off_t size, unsigned long filetype,
- const HChar *filename,
- vki_uint8_t **out_stack_start, vki_uint8_t **out_stack_end,
- vki_uint8_t **out_text, vki_uint8_t **out_entry, vki_uint8_t **out_linker_entry)
+ const HChar *filename, load_info_t *out_info)
{
vki_uint32_t magic;
SysRes res;
@@ -795,14 +799,10 @@
if (magic == MAGIC) {
// thin
- return load_thin_file(fd, offset, size, filetype, filename,
- out_stack_start, out_stack_end,
- out_text, out_entry, out_linker_entry);
+ return load_thin_file(fd, offset, size, filetype, filename, out_info);
} else if (magic == VG_(htonl)(FAT_MAGIC)) {
// fat
- return load_fat_file(fd, offset, size, filetype, filename,
- out_stack_start, out_stack_end,
- out_text, out_entry, out_linker_entry);
+ return load_fat_file(fd, offset, size, filetype, filename, out_info);
} else {
// huh?
print("bad executable (bad Mach-O magic)\n");
@@ -827,11 +827,14 @@
{
int err;
struct vg_stat sb;
- vki_uint8_t *stack_start;
- vki_uint8_t *stack_end;
- vki_uint8_t *text;
- vki_uint8_t *entry;
- vki_uint8_t *linker_entry;
+ load_info_t load_info;
+ load_info.stack_start = NULL;
+ load_info.stack_end = NULL;
+ load_info.text = NULL;
+ load_info.entry = NULL;
+ load_info.linker_entry = NULL;
+ load_info.linker_offset = 0;
+ load_info.max_addr = 0;
err = VG_(fstat)(fd, &sb);
if (err) {
@@ -839,22 +842,20 @@
return VKI_ENOEXEC;
}
- err = load_mach_file(fd, 0, sb.size, MH_EXECUTE, name,
- &stack_start, &stack_end,
- &text, &entry, &linker_entry);
+ err = load_mach_file(fd, 0, sb.size, MH_EXECUTE, name, &load_info);
if (err) return VKI_ENOEXEC;
// GrP fixme exe_base
// GrP fixme exe_end
- info->entry = (Addr)entry;
- info->init_ip = (Addr)(linker_entry ? linker_entry : entry);
+ info->entry = (Addr) load_info.entry;
+ info->init_ip = (Addr)(load_info.linker_entry ? load_info.linker_entry : load_info.entry);
info->brkbase = 0xffffffff; // GrP fixme hack
info->init_toc = 0; // GrP fixme unused
- info->stack_start = (Addr)stack_start;
- info->stack_end = (Addr)stack_end;
- info->text = (Addr)text;
- info->dynamic = linker_entry ? True : False;
+ info->stack_start = (Addr) load_info.stack_start;
+ info->stack_end = (Addr) load_info.stack_end;
+ info->text = (Addr) load_info.text;
+ info->dynamic = load_info.linker_entry ? True : False;
info->executable_path = VG_(strdup)("ume.macho.executable_path", name);
|
|
From: <sv...@va...> - 2017-04-29 19:40:03
|
Author: rhyskidd
Date: Sat Apr 29 20:39:54 2017
New Revision: 16317
Log:
macos: Improve consistency of VG_(printf)() usage in coregrind/m_ume/macho.c. n-i-bz.
Identified in the process of reviewing a proposed fix for bz#365327.
Patch from Louis Brunner.
Modified:
trunk/coregrind/m_ume/macho.c
Modified: trunk/coregrind/m_ume/macho.c
==============================================================================
--- trunk/coregrind/m_ume/macho.c (original)
+++ trunk/coregrind/m_ume/macho.c Sat Apr 29 20:39:54 2017
@@ -138,16 +138,12 @@
res = VG_(open)(filename, VKI_O_RDONLY, 0);
fd = sr_Res(res);
if (sr_isError(res)) {
- print("couldn't open dylinker: ");
- print(filename);
- print("\n");
+ VG_(printf)("couldn't open dylinker: %s\n", filename);
return -1;
}
err = VG_(fstat)(fd, &sb);
if (err) {
- print("couldn't stat dylinker: ");
- print(filename);
- print("\n");
+ VG_(printf)("couldn't stat dylinker: %s\n", filename);
VG_(close)(fd);
return -1;
}
@@ -156,9 +152,7 @@
err = load_mach_file(fd, 0, filesize, MH_DYLINKER, filename,
NULL, NULL, NULL, out_linker_entry, NULL);
if (err) {
- print("...while loading dylinker: ");
- print(filename);
- print("\n");
+ VG_(printf)("...while loading dylinker: %s\n", filename);
}
VG_(close)(fd);
return err;
|
|
From: <sv...@va...> - 2017-04-29 10:56:06
|
Author: iraisr
Date: Sat Apr 29 11:55:56 2017
New Revision: 3357
Log:
An important comment
Modified:
branches/VEX_JIT_HACKS/priv/host_x86_isel.c
Modified: branches/VEX_JIT_HACKS/priv/host_x86_isel.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/host_x86_isel.c (original)
+++ branches/VEX_JIT_HACKS/priv/host_x86_isel.c Sat Apr 29 11:55:56 2017
@@ -3927,6 +3927,8 @@
ite->hint, &n_phis);
X86CondCode cc = iselCondCode(env, ite->cond);
+ /* Note: do not insert any instructions which alter |cc| before it
+ is consumed by the corresponding branch. */
HInstrIfThenElse* hite = newHInstrIfThenElse(cc, phi_nodes, n_phis);
X86Instr* instr = X86Instr_IfThenElse(hite);
addInstr(env, instr);
|