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
(3) |
2
(2) |
3
|
4
(1) |
|
5
|
6
(2) |
7
|
8
(1) |
9
|
10
(2) |
11
(8) |
|
12
(2) |
13
(9) |
14
(2) |
15
(6) |
16
(5) |
17
(3) |
18
|
|
19
|
20
(1) |
21
(1) |
22
(6) |
23
(8) |
24
(2) |
25
(1) |
|
26
|
27
(3) |
28
(8) |
29
(17) |
30
(6) |
31
(3) |
|
|
From: Ivo R. <iv...@iv...> - 2017-03-15 22:12:04
|
2017-03-15 22:56 GMT+01:00 Philippe Waroquiers <phi...@sk...>:
> On Wed, 2017-03-15 at 21:28 +0100, Ivo Raisr wrote:
>> 2017-03-15 20:35 GMT+01:00 <sv...@va...>:
>
>> > + info = VG_(malloc)("syswrap.ioctl.1", sizeof(*info));
>> > + info->data = *data;
>> > + info->orig = data;
>> > + ARG3 = (Addr)&info->data;
>> > }
>> > break;
>>
>> Does this create a memory leak if the ioctl fails?
>> I think it does because POST(sys_ioctl) is called only on success.
>>
>> I can think of several approaches here:
>> - have POST(sys_ioctl) called also on failure
>> - convey the required information in some other way
>> - leave it as is and document somewhere this could leak some memory
>
> Good catch, yes, I think it would leak.
>
> I guess we might have to put the flag SfPostOnFail, like
> for ppoll and pselect6?
>
> And then, in the POST, just execute the POST_MEM_WRITE operations
> if success?
> (and always release the memory)
Yes, that's one of the options possible.
Thank you for looking at this.
I.
|
|
From: Philippe W. <phi...@sk...> - 2017-03-15 21:55:10
|
On Wed, 2017-03-15 at 21:28 +0100, Ivo Raisr wrote:
> 2017-03-15 20:35 GMT+01:00 <sv...@va...>:
> > + info = VG_(malloc)("syswrap.ioctl.1", sizeof(*info));
> > + info->data = *data;
> > + info->orig = data;
> > + ARG3 = (Addr)&info->data;
> > }
> > break;
>
> Does this create a memory leak if the ioctl fails?
> I think it does because POST(sys_ioctl) is called only on success.
>
> I can think of several approaches here:
> - have POST(sys_ioctl) called also on failure
> - convey the required information in some other way
> - leave it as is and document somewhere this could leak some memory
Good catch, yes, I think it would leak.
I guess we might have to put the flag SfPostOnFail, like
for ppoll and pselect6 ?
And then, in the POST, just execute the POST_MEM_WRITE operations
if success ?
(and always release the memory)
Philippe
|
|
From: Ivo R. <iv...@iv...> - 2017-03-15 20:36:31
|
2017-03-15 20:35 GMT+01:00 <sv...@va...>:
> Author: philippe
> Date: Wed Mar 15 19:35:29 2017
> New Revision: 16274
>
> Log:
> Fix 376956 syswrap of SNDDRV and DRM_IOCTL_VERSION causing some addresses
> to be wrongly marked as addressable
>
> Patch from Daniel Glöckner, slightly modified.
>
>
> Modified:
> trunk/NEWS
> trunk/coregrind/m_syswrap/syswrap-linux.c
> trunk/include/pub_tool_basics.h
>
> Modified: trunk/NEWS
> ==============================================================================
> --- trunk/NEWS (original)
> +++ trunk/NEWS Wed Mar 15 19:35:29 2017
> @@ -142,6 +142,8 @@
> 376611 ppc64 and arm64 don't know about prlimit64 syscall
> 376729 PPC64, remove R2 from the clobber list
> == 371668
> +376956 syswrap of SNDDRV and DRM_IOCTL_VERSION causing some addresses
> + to be wrongly marked as addressable
> 377427 PPC64, lxv instruction failing on odd destination register
> 377478 PPC64: ISA 3.0 setup fixes
>
>
> Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
> ==============================================================================
> --- trunk/coregrind/m_syswrap/syswrap-linux.c (original)
> +++ trunk/coregrind/m_syswrap/syswrap-linux.c Wed Mar 15 19:35:29 2017
> @@ -6069,6 +6069,11 @@
> ioctl wrappers
> ------------------------------------------------------------------ */
>
> +struct vg_drm_version_info {
> + struct vki_drm_version data;
> + struct vki_drm_version *orig; // Original ARG3 pointer value at syscall entry.
> +};
> +
> PRE(sys_ioctl)
> {
> *flags |= SfMayBlock;
> @@ -7686,7 +7691,8 @@
>
> case VKI_DRM_IOCTL_VERSION:
> if (ARG3) {
> - struct vki_drm_version *data = (struct vki_drm_version *)ARG3;
> + struct vki_drm_version* data = (struct vki_drm_version *)ARG3;
> + struct vg_drm_version_info* info;
> PRE_MEM_WRITE("ioctl(DRM_VERSION).version_major", (Addr)&data->version_major, sizeof(data->version_major));
> PRE_MEM_WRITE("ioctl(DRM_VERSION).version_minor", (Addr)&data->version_minor, sizeof(data->version_minor));
> PRE_MEM_WRITE("ioctl(DRM_VERSION).version_patchlevel", (Addr)&data->version_patchlevel, sizeof(data->version_patchlevel));
> @@ -7699,6 +7705,10 @@
> PRE_MEM_READ("ioctl(DRM_VERSION).desc_len", (Addr)&data->desc_len, sizeof(data->desc_len));
> PRE_MEM_READ("ioctl(DRM_VERSION).desc", (Addr)&data->desc, sizeof(data->desc));
> PRE_MEM_WRITE("ioctl(DRM_VERSION).desc", (Addr)data->desc, data->desc_len);
> + info = VG_(malloc)("syswrap.ioctl.1", sizeof(*info));
> + info->data = *data;
> + info->orig = data;
> + ARG3 = (Addr)&info->data;
> }
> break;
Does this create a memory leak if the ioctl fails?
I think it does because POST(sys_ioctl) is called only on success.
I can think of several approaches here:
- have POST(sys_ioctl) called also on failure
- convey the required information in some other way
- leave it as is and document somewhere this could leak some memory
I.
|
|
From: <sv...@va...> - 2017-03-15 19:35:37
|
Author: philippe
Date: Wed Mar 15 19:35:29 2017
New Revision: 16274
Log:
Fix 376956 syswrap of SNDDRV and DRM_IOCTL_VERSION causing some addresses
to be wrongly marked as addressable
Patch from Daniel Glöckner, slightly modified.
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/syswrap-linux.c
trunk/include/pub_tool_basics.h
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Wed Mar 15 19:35:29 2017
@@ -142,6 +142,8 @@
376611 ppc64 and arm64 don't know about prlimit64 syscall
376729 PPC64, remove R2 from the clobber list
== 371668
+376956 syswrap of SNDDRV and DRM_IOCTL_VERSION causing some addresses
+ to be wrongly marked as addressable
377427 PPC64, lxv instruction failing on odd destination register
377478 PPC64: ISA 3.0 setup fixes
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c Wed Mar 15 19:35:29 2017
@@ -6069,6 +6069,11 @@
ioctl wrappers
------------------------------------------------------------------ */
+struct vg_drm_version_info {
+ struct vki_drm_version data;
+ struct vki_drm_version *orig; // Original ARG3 pointer value at syscall entry.
+};
+
PRE(sys_ioctl)
{
*flags |= SfMayBlock;
@@ -7686,7 +7691,8 @@
case VKI_DRM_IOCTL_VERSION:
if (ARG3) {
- struct vki_drm_version *data = (struct vki_drm_version *)ARG3;
+ struct vki_drm_version* data = (struct vki_drm_version *)ARG3;
+ struct vg_drm_version_info* info;
PRE_MEM_WRITE("ioctl(DRM_VERSION).version_major", (Addr)&data->version_major, sizeof(data->version_major));
PRE_MEM_WRITE("ioctl(DRM_VERSION).version_minor", (Addr)&data->version_minor, sizeof(data->version_minor));
PRE_MEM_WRITE("ioctl(DRM_VERSION).version_patchlevel", (Addr)&data->version_patchlevel, sizeof(data->version_patchlevel));
@@ -7699,6 +7705,10 @@
PRE_MEM_READ("ioctl(DRM_VERSION).desc_len", (Addr)&data->desc_len, sizeof(data->desc_len));
PRE_MEM_READ("ioctl(DRM_VERSION).desc", (Addr)&data->desc, sizeof(data->desc));
PRE_MEM_WRITE("ioctl(DRM_VERSION).desc", (Addr)data->desc, data->desc_len);
+ info = VG_(malloc)("syswrap.ioctl.1", sizeof(*info));
+ info->data = *data;
+ info->orig = data;
+ ARG3 = (Addr)&info->data;
}
break;
case VKI_DRM_IOCTL_GET_UNIQUE:
@@ -10174,16 +10184,24 @@
case VKI_DRM_IOCTL_VERSION:
if (ARG3) {
- struct vki_drm_version *data = (struct vki_drm_version *)ARG3;
+ struct vki_drm_version* data = (struct vki_drm_version *)ARG3;
+ struct vg_drm_version_info* info = container_of(data, struct vg_drm_version_info, data);
+ const vki_size_t orig_name_len = info->orig->name_len;
+ const vki_size_t orig_date_len = info->orig->date_len;
+ const vki_size_t orig_desc_len = info->orig->desc_len;
+ *info->orig = info->data;
+ ARG3 = (Addr)info->orig;
+ data = info->orig;
+ VG_(free)(info);
POST_MEM_WRITE((Addr)&data->version_major, sizeof(data->version_major));
POST_MEM_WRITE((Addr)&data->version_minor, sizeof(data->version_minor));
POST_MEM_WRITE((Addr)&data->version_patchlevel, sizeof(data->version_patchlevel));
POST_MEM_WRITE((Addr)&data->name_len, sizeof(data->name_len));
- POST_MEM_WRITE((Addr)data->name, data->name_len);
+ POST_MEM_WRITE((Addr)data->name, VG_MIN(data->name_len, orig_name_len));
POST_MEM_WRITE((Addr)&data->date_len, sizeof(data->date_len));
- POST_MEM_WRITE((Addr)data->date, data->date_len);
+ POST_MEM_WRITE((Addr)data->date, VG_MIN(data->date_len, orig_date_len));
POST_MEM_WRITE((Addr)&data->desc_len, sizeof(data->desc_len));
- POST_MEM_WRITE((Addr)data->desc, data->desc_len);
+ POST_MEM_WRITE((Addr)data->desc, VG_MIN(data->desc_len, orig_desc_len));
}
break;
case VKI_DRM_IOCTL_GET_UNIQUE:
Modified: trunk/include/pub_tool_basics.h
==============================================================================
--- trunk/include/pub_tool_basics.h (original)
+++ trunk/include/pub_tool_basics.h Wed Mar 15 19:35:29 2017
@@ -396,6 +396,10 @@
# define offsetof(type,memb) ((SizeT)(HWord)&((type*)0)->memb)
#endif
+#if !defined(container_of)
+# define container_of(ptr, type, member) ((type *)((char *)(ptr) - offsetof(type, member)))
+#endif
+
/* Alignment */
/* We use a prefix vg_ for vg_alignof as its behaviour slightly
differs from the standard alignof/gcc defined __alignof__
|
|
From: <sv...@va...> - 2017-03-15 15:23:35
|
Author: petarj
Date: Wed Mar 15 15:23:27 2017
New Revision: 16273
Log:
Add support for syscall ptrace(traceme)
It fixes Bug 377376.
Patch by Aleksandra Karadzic.
Modified:
trunk/coregrind/m_signals.c
trunk/coregrind/m_syswrap/priv_syswrap-linux.h
trunk/coregrind/m_syswrap/syswrap-amd64-linux.c
trunk/coregrind/m_syswrap/syswrap-arm-linux.c
trunk/coregrind/m_syswrap/syswrap-linux.c
trunk/coregrind/m_syswrap/syswrap-mips32-linux.c
trunk/coregrind/m_syswrap/syswrap-mips64-linux.c
trunk/coregrind/m_syswrap/syswrap-s390x-linux.c
trunk/coregrind/m_syswrap/syswrap-x86-linux.c
trunk/coregrind/pub_core_threadstate.h
trunk/include/vki/vki-linux.h
Modified: trunk/coregrind/m_signals.c
==============================================================================
--- trunk/coregrind/m_signals.c (original)
+++ trunk/coregrind/m_signals.c Wed Mar 15 15:23:27 2017
@@ -1667,6 +1667,7 @@
Bool core = False; /* kills process w/ core */
struct vki_rlimit corelim;
Bool could_core;
+ ThreadState* tst = VG_(get_ThreadState)(tid);
vg_assert(VG_(is_running_thread)(tid));
@@ -1728,6 +1729,12 @@
if (!terminate)
return; /* nothing to do */
+ if (terminate && (tst->ptrace & VKI_PT_PTRACED)
+ && (sigNo != VKI_SIGKILL)) {
+ VG_(kill)(VG_(getpid)(), VKI_SIGSTOP);
+ return;
+ }
+
could_core = core;
if (core) {
@@ -1746,7 +1753,6 @@
if (VG_(clo_xml)) {
VG_(printf_xml)("<fatal_signal>\n");
VG_(printf_xml)(" <tid>%d</tid>\n", tid);
- ThreadState* tst = VG_(get_ThreadState)(tid);
if (tst->thread_name) {
VG_(printf_xml)(" <threadname>%s</threadname>\n",
tst->thread_name);
Modified: trunk/coregrind/m_syswrap/priv_syswrap-linux.h
==============================================================================
--- trunk/coregrind/m_syswrap/priv_syswrap-linux.h (original)
+++ trunk/coregrind/m_syswrap/priv_syswrap-linux.h Wed Mar 15 15:23:27 2017
@@ -318,6 +318,7 @@
// Linux-specific (but non-arch-specific) ptrace wrapper helpers
extern void ML_(linux_PRE_getregset) ( ThreadId, long, long );
extern void ML_(linux_PRE_setregset) ( ThreadId, long, long );
+extern void ML_(linux_POST_traceme) ( ThreadId );
extern void ML_(linux_POST_getregset)( ThreadId, long, long );
#undef TId
Modified: trunk/coregrind/m_syswrap/syswrap-amd64-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-amd64-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-amd64-linux.c Wed Mar 15 15:23:27 2017
@@ -349,6 +349,9 @@
POST(sys_ptrace)
{
switch (ARG1) {
+ case VKI_PTRACE_TRACEME:
+ ML_(linux_POST_traceme)(tid);
+ break;
case VKI_PTRACE_PEEKTEXT:
case VKI_PTRACE_PEEKDATA:
case VKI_PTRACE_PEEKUSR:
Modified: trunk/coregrind/m_syswrap/syswrap-arm-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-arm-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-arm-linux.c Wed Mar 15 15:23:27 2017
@@ -482,6 +482,9 @@
POST(sys_ptrace)
{
switch (ARG1) {
+ case VKI_PTRACE_TRACEME:
+ ML_(linux_POST_traceme)(tid);
+ break;
case VKI_PTRACE_PEEKTEXT:
case VKI_PTRACE_PEEKDATA:
case VKI_PTRACE_PEEKUSR:
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c Wed Mar 15 15:23:27 2017
@@ -11101,6 +11101,13 @@
------------------------------------------------------------------ */
void
+ML_(linux_POST_traceme) ( ThreadId tid )
+{
+ ThreadState *tst = VG_(get_ThreadState)(tid);
+ tst->ptrace = VKI_PT_PTRACED;
+}
+
+void
ML_(linux_PRE_getregset) ( ThreadId tid, long arg3, long arg4 )
{
struct vki_iovec *iov = (struct vki_iovec *) arg4;
Modified: trunk/coregrind/m_syswrap/syswrap-mips32-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-mips32-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-mips32-linux.c Wed Mar 15 15:23:27 2017
@@ -471,6 +471,9 @@
POST(sys_ptrace)
{
switch (ARG1) {
+ case VKI_PTRACE_TRACEME:
+ ML_(linux_POST_traceme)(tid);
+ break;
case VKI_PTRACE_PEEKTEXT:
case VKI_PTRACE_PEEKDATA:
case VKI_PTRACE_PEEKUSR:
Modified: trunk/coregrind/m_syswrap/syswrap-mips64-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-mips64-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-mips64-linux.c Wed Mar 15 15:23:27 2017
@@ -365,6 +365,9 @@
POST(sys_ptrace)
{
switch (ARG1) {
+ case VKI_PTRACE_TRACEME:
+ ML_(linux_POST_traceme)(tid);
+ break;
case VKI_PTRACE_PEEKTEXT:
case VKI_PTRACE_PEEKDATA:
case VKI_PTRACE_PEEKUSR:
Modified: trunk/coregrind/m_syswrap/syswrap-s390x-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-s390x-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-s390x-linux.c Wed Mar 15 15:23:27 2017
@@ -271,6 +271,9 @@
POST(sys_ptrace)
{
switch (ARG1) {
+ case VKI_PTRACE_TRACEME:
+ ML_(linux_POST_traceme)(tid);
+ break;
case VKI_PTRACE_PEEKTEXT:
case VKI_PTRACE_PEEKDATA:
case VKI_PTRACE_PEEKUSR:
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 Wed Mar 15 15:23:27 2017
@@ -900,6 +900,9 @@
POST(sys_ptrace)
{
switch (ARG1) {
+ case VKI_PTRACE_TRACEME:
+ ML_(linux_POST_traceme)(tid);
+ break;
case VKI_PTRACE_PEEKTEXT:
case VKI_PTRACE_PEEKDATA:
case VKI_PTRACE_PEEKUSR:
Modified: trunk/coregrind/pub_core_threadstate.h
==============================================================================
--- trunk/coregrind/pub_core_threadstate.h (original)
+++ trunk/coregrind/pub_core_threadstate.h Wed Mar 15 15:23:27 2017
@@ -407,6 +407,7 @@
/* This thread's name. NULL, if no name. */
HChar *thread_name;
+ UInt ptrace;
}
ThreadState;
Modified: trunk/include/vki/vki-linux.h
==============================================================================
--- trunk/include/vki/vki-linux.h (original)
+++ trunk/include/vki/vki-linux.h Wed Mar 15 15:23:27 2017
@@ -2324,6 +2324,8 @@
#define VKI_PTRACE_GETREGSET 0x4204
#define VKI_PTRACE_SETREGSET 0x4205
+#define VKI_PT_PTRACED 0x00000001
+
//----------------------------------------------------------------------
// From linux-2.6.14/include/sound/asound.h
//----------------------------------------------------------------------
|
|
From: <sv...@va...> - 2017-03-15 06:54:18
|
Author: iraisr
Date: Wed Mar 15 06:54:05 2017
New Revision: 3320
Log:
Provide a function to deconstruct phi nodes
Modified:
branches/VEX_JIT_HACKS/priv/ir_defs.c
branches/VEX_JIT_HACKS/priv/ir_opt.c
branches/VEX_JIT_HACKS/priv/ir_opt.h
branches/VEX_JIT_HACKS/priv/main_main.c
Modified: branches/VEX_JIT_HACKS/priv/ir_defs.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/ir_defs.c (original)
+++ branches/VEX_JIT_HACKS/priv/ir_defs.c Wed Mar 15 06:54:05 2017
@@ -3678,7 +3678,8 @@
void addIRPhiToIRPhiVec(IRPhiVec* phi_nodes, IRPhi* phi)
{
if (phi_nodes->phis_used == phi_nodes->phis_size) {
- IRPhi** phis2 = LibVEX_Alloc_inline(2 * phi_nodes->phis_size * sizeof(IRPhi*));
+ IRPhi** phis2
+ = LibVEX_Alloc_inline(2 * phi_nodes->phis_size * sizeof(IRPhi*));
for (UInt i = 0; i < phi_nodes->phis_size; i++)
phis2[i] = phi_nodes->phis[i];
phi_nodes->phis = phis2;
@@ -3698,7 +3699,8 @@
void addStmtToIRStmtVec(IRStmtVec* stmts, IRStmt* st)
{
if (stmts->stmts_used == stmts->stmts_size) {
- IRStmt** stmts2 = LibVEX_Alloc_inline(2 * stmts->stmts_size * sizeof(IRStmt*));
+ IRStmt** stmts2
+ = LibVEX_Alloc_inline(2 * stmts->stmts_size * sizeof(IRStmt*));
for (UInt i = 0; i < stmts->stmts_size; i++)
stmts2[i] = stmts->stmts[i];
stmts->stmts = stmts2;
Modified: branches/VEX_JIT_HACKS/priv/ir_opt.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/ir_opt.c (original)
+++ branches/VEX_JIT_HACKS/priv/ir_opt.c Wed Mar 15 06:54:05 2017
@@ -6151,6 +6151,54 @@
/*---------------------------------------------------------------*/
+/*--- The phi nodes deconstruction ---*/
+/*---------------------------------------------------------------*/
+
+/* This isn't part of IR optimisation however this pass is needed before IRSB
+ is handed to instruction selection phase. Deconstructs all phi nodes.
+ Consider this example:
+ t0:2 = phi(t1:0,t2:1)
+ which gets trivially deconstructed into statements appended to:
+ - then leg:
+ t0:2 = t1:0
+ - else leg:
+ t0:2 = t2:1
+
+ Such an IRSB no longer holds SSA property after this pass but subsequent
+ phases do no require it. */
+static void deconstruct_phi_nodes_IRStmtVec(IRStmtVec* stmts)
+{
+ for (UInt i = 0; i < stmts->stmts_used; i++) {
+ IRStmt* st = stmts->stmts[i];
+ if (st->tag != Ist_IfThenElse) {
+ continue;
+ }
+
+ IRStmtVec* then_leg = st->Ist.IfThenElse.then_leg;
+ IRStmtVec* else_leg = st->Ist.IfThenElse.else_leg;
+ IRPhiVec* phi_nodes = st->Ist.IfThenElse.phi_nodes;
+ if (phi_nodes != NULL) {
+ for (UInt j = 0; j < phi_nodes->phis_used; j++) {
+ IRPhi* phi = phi_nodes->phis[j];
+ addStmtToIRStmtVec(then_leg, IRStmt_WrTmp(phi->dst,
+ IRExpr_RdTmp(phi->srcThen)));
+ addStmtToIRStmtVec(else_leg, IRStmt_WrTmp(phi->dst,
+ IRExpr_RdTmp(phi->srcElse)));
+ }
+ }
+
+ deconstruct_phi_nodes_IRStmtVec(then_leg);
+ deconstruct_phi_nodes_IRStmtVec(else_leg);
+ }
+}
+
+void deconstruct_phi_nodes(IRSB *irsb)
+{
+ deconstruct_phi_nodes_IRStmtVec(irsb->stmts);
+}
+
+
+/*---------------------------------------------------------------*/
/*--- MSVC specific transformation hacks ---*/
/*---------------------------------------------------------------*/
Modified: branches/VEX_JIT_HACKS/priv/ir_opt.h
==============================================================================
--- branches/VEX_JIT_HACKS/priv/ir_opt.h (original)
+++ branches/VEX_JIT_HACKS/priv/ir_opt.h Wed Mar 15 06:54:05 2017
@@ -72,6 +72,9 @@
VexRegisterUpdates pxControl
);
+/* Deconstructs phi nodes. IRSB is modified and no longer holds SSA propery. */
+extern void deconstruct_phi_nodes(IRSB* bb);
+
#endif /* ndef __VEX_IR_OPT_H */
/*---------------------------------------------------------------*/
Modified: branches/VEX_JIT_HACKS/priv/main_main.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/main_main.c (original)
+++ branches/VEX_JIT_HACKS/priv/main_main.c Wed Mar 15 06:54:05 2017
@@ -1009,6 +1009,14 @@
}
/* end HACK */
+ if (irsb->id_seq > 1) {
+ /* We have some IfThenElse statements. Deconstruct phi nodes. */
+ deconstruct_phi_nodes(irsb);
+ }
+
+ /* Now the IRSB no longer holds SSA. However there is no need to because
+ instruction selection pass does not rely on SSA property. */
+
if (vex_traceflags & VEX_TRACE_VCODE)
vex_printf("\n------------------------"
" Instruction selection "
|