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: <sv...@va...> - 2017-03-22 20:21:43
|
Author: iraisr
Date: Wed Mar 22 20:21:34 2017
New Revision: 3322
Log:
Fix sanity checking of phi nodes when traversing IRStmtVec.
Modified:
branches/VEX_JIT_HACKS/priv/ir_defs.c
branches/VEX_JIT_HACKS/pub/libvex_ir.h
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 22 20:21:34 2017
@@ -3755,6 +3755,7 @@
inline
IRType typeOfIRTemp ( const IRTypeEnv* env, IRTemp tmp )
{
+ vassert(tmp.id == env->id);
vassert(tmp.index >= 0);
vassert(tmp.index < env->types_used);
return env->types[tmp.index];
@@ -4214,32 +4215,31 @@
}
}
-static
-void useBeforeDef_PhiNodes(const IRSB* bb, const IRStmtVec* stmts,
- const IRStmt* stmt, const IRPhiVec* phi_nodes,
- UInt* def_counts[])
+static void useBeforeDef_IRPhi(const IRSB* bb, const IRStmtVec* stmts,
+ const IRStmt* stmt, const IRPhi* phi,
+ UInt* def_counts[])
{
vassert(stmt->tag == Ist_IfThenElse);
- for (UInt i = 0; i < phi_nodes->phis_used; i++) {
- const IRPhi* phi = phi_nodes->phis[i];
- useBeforeDef_Temp(bb, stmts, stmt, phi->srcThen, def_counts);
- useBeforeDef_Temp(bb, stmts, stmt, phi->srcElse, def_counts);
+ IRStmtVec* then_leg = stmt->Ist.IfThenElse.then_leg;
+ IRStmtVec* else_leg = stmt->Ist.IfThenElse.else_leg;
- /* Check also that referenced IRStmtVec's actually exist and belong to
- "parent", "then", and "else", respectively. */
- if (phi->dst.id != stmts->tyenv->id) {
- sanityCheckFail(bb,stmt,"Istmt.IfThenElse.Phi.dst does not "
- "reference parent IRStmtVec");
- }
- if (phi->srcThen.id != stmt->Ist.IfThenElse.then_leg->tyenv->id) {
- sanityCheckFail(bb,stmt,"Istmt.IfThenElse.Phi.srcThen does not "
- "reference \"then\" IRStmtVec leg");
- }
- if (phi->srcElse.id != stmt->Ist.IfThenElse.else_leg->tyenv->id) {
- sanityCheckFail(bb,stmt,"Istmt.IfThenElse.Phi.srcElse does not "
- "reference \"else\" IRStmtVec leg");
- }
+ useBeforeDef_Temp(bb, then_leg, stmt, phi->srcThen, def_counts);
+ useBeforeDef_Temp(bb, else_leg, stmt, phi->srcElse, def_counts);
+
+ /* Check also that referenced IRStmtVec's actually exist and belong to
+ "parent", "then", and "else", respectively. */
+ if (phi->dst.id != stmts->tyenv->id) {
+ sanityCheckFail(bb, stmt, "Istmt.IfThenElse.Phi.dst does not "
+ "reference parent IRStmtVec");
+ }
+ if (phi->srcThen.id != then_leg->tyenv->id) {
+ sanityCheckFail(bb, stmt, "Istmt.IfThenElse.Phi.srcThen does not "
+ "reference \"then\" IRStmtVec leg");
+ }
+ if (phi->srcElse.id != else_leg->tyenv->id) {
+ sanityCheckFail(bb, stmt, "Istmt.IfThenElse.Phi.srcElse does not "
+ "reference \"else\" IRStmtVec leg");
}
}
@@ -4326,11 +4326,8 @@
case Ist_IfThenElse:
useBeforeDef_Expr(bb, stmts, stmt, stmt->Ist.IfThenElse.cond,
def_counts);
- /* Traversing into legs driven from sanityCheckIRStmtVec(). */
- if (stmt->Ist.IfThenElse.phi_nodes != NULL) {
- useBeforeDef_PhiNodes(bb, stmts, stmt,
- stmt->Ist.IfThenElse.phi_nodes, def_counts);
- }
+ /* Traversing into legs and phi nodes driven from
+ sanityCheckIRStmtVec(). */
break;
default:
vpanic("useBeforeDef_Stmt");
@@ -4387,17 +4384,8 @@
"IRStmt.LLSC: destination tmp is assigned more than once");
break;
case Ist_IfThenElse: {
- /* Traversing into legs driven from sanityCheckIRStmtVec(). */
- const IRPhiVec* phi_nodes = stmt->Ist.IfThenElse.phi_nodes;
- if (phi_nodes != NULL) {
- for (UInt i = 0; i < phi_nodes->phis_used; i++) {
- assignedOnce_Temp(
- bb, stmts, stmt, phi_nodes->phis[i]->dst, def_counts,
- "IRStmt.IfThenElse.Phi: destination tmp is out of range",
- "IRStmt.IfThenElse.Phi: destination tmp is out of scope",
- "IRStmt.IfThenElse: destination tmp is assigned more than once");
- }
- }
+ /* Traversing into legs and phi nodes driven from
+ sanityCheckIRStmtVec(). */
break;
}
// Ignore all other cases
@@ -4409,6 +4397,16 @@
}
}
+static void assignedOnce_IRPhi(const IRSB* bb, const IRStmtVec* stmts,
+ const IRStmt* stmt, const IRPhi* phi,
+ UInt* def_counts[])
+{
+ assignedOnce_Temp(bb, stmts, stmt, phi->dst, def_counts,
+ "IRStmt.IfThenElse.Phi: destination tmp is out of range",
+ "IRStmt.IfThenElse.Phi: destination tmp is out of scope",
+ "IRStmt.IfThenElse: destination tmp is assigned more than once");
+}
+
static
void tcExpr(const IRSB* bb, const IRStmtVec* stmts, const IRStmt* stmt,
const IRExpr* expr, IRType gWordTy)
@@ -4918,19 +4916,25 @@
tcExpr(bb, stmts, stmt, stmt->Ist.IfThenElse.cond, gWordTy);
if (typeOfIRExpr(tyenv, stmt->Ist.IfThenElse.cond) != Ity_I1)
sanityCheckFail(bb,stmt,"IRStmt.IfThenElse.cond: not :: Ity_I1");
- /* Traversing into legs driven from sanityCheckIRStmtVec(). */
- const IRPhiVec* phi_nodes = stmt->Ist.IfThenElse.phi_nodes;
- if (phi_nodes != NULL) {
- for (UInt i = 0; i < phi_nodes->phis_used; i++) {
- tcPhi(bb, stmts, stmt, phi_nodes->phis[i]);
- }
- }
+ /* Traversing into legs and phi nodes driven from
+ sanityCheckIRStmtVec(). */
break;
default:
vpanic("tcStmt");
}
}
+static void sanityCheckIRPhiNodes(const IRSB* bb, const IRStmtVec* stmts,
+ const IRStmt* stmt, const IRPhiVec* phi_nodes, UInt *def_counts[])
+{
+ for (UInt i = 0; i < phi_nodes->phis_used; i++) {
+ const IRPhi* phi = phi_nodes->phis[i];
+ useBeforeDef_IRPhi(bb, stmts, stmt, phi, def_counts);
+ assignedOnce_IRPhi(bb, stmts, stmt, phi, def_counts);
+ tcPhi(bb, stmts, stmt, phi);
+ }
+}
+
static
void sanityCheckIRStmtVec(const IRSB* bb, const IRStmtVec* stmts,
Bool require_flat, UInt* def_counts[],
@@ -4997,10 +5001,32 @@
tcStmt(bb, stmts, stmt, require_flat, gWordTy);
if (stmt->tag == Ist_IfThenElse) {
- sanityCheckIRStmtVec(bb, stmt->Ist.IfThenElse.then_leg, require_flat,
- def_counts, n_stmt_vecs, id_counts, gWordTy);
- sanityCheckIRStmtVec(bb, stmt->Ist.IfThenElse.else_leg, require_flat,
- def_counts, n_stmt_vecs, id_counts, gWordTy);
+ const IRStmtVec* then_leg = stmt->Ist.IfThenElse.then_leg;
+ const IRStmtVec* else_leg = stmt->Ist.IfThenElse.else_leg;
+
+ if (then_leg->parent == NULL) {
+ sanityCheckFail(bb, stmt, "IfThenElse.then.parent is NULL");
+ }
+ if (else_leg->parent == NULL) {
+ sanityCheckFail(bb, stmt, "IfThenElse.else.parent is NULL");
+ }
+ if (then_leg->parent != stmts) {
+ sanityCheckFail(bb, stmt, "IfThenElse.then.parent does not point "
+ "to its parent");
+ }
+ if (else_leg->parent != stmts) {
+ sanityCheckFail(bb, stmt, "IfThenElse.else.parent does not point "
+ "to its parent");
+ }
+
+ sanityCheckIRStmtVec(bb, then_leg, require_flat, def_counts,
+ n_stmt_vecs, id_counts, gWordTy);
+ sanityCheckIRStmtVec(bb, else_leg, require_flat, def_counts,
+ n_stmt_vecs, id_counts, gWordTy);
+ if (stmt->Ist.IfThenElse.phi_nodes != NULL) {
+ sanityCheckIRPhiNodes(bb, stmts, stmt,
+ stmt->Ist.IfThenElse.phi_nodes, def_counts);
+ }
}
}
}
Modified: branches/VEX_JIT_HACKS/pub/libvex_ir.h
==============================================================================
--- branches/VEX_JIT_HACKS/pub/libvex_ir.h (original)
+++ branches/VEX_JIT_HACKS/pub/libvex_ir.h Wed Mar 22 20:21:34 2017
@@ -2826,7 +2826,8 @@
/* Allocates an empty IRStmtVec with an invalid IRTyEnvID.
Such an IRStmtVec needs to have a valid IRTyEnvId - get it from
nextIRTyEnvID(). Only after this is done, then such an IRStmtVec is ready
- for newIRTemp() to give out new temporaries. */
+ for newIRTemp() to give out new temporaries.
+ Nested IRStmtVec also needs to have correctly set its parent. */
extern IRStmtVec* emptyIRStmtVec(void);
extern IRStmtVec* deepCopyIRStmtVec(const IRStmtVec* src, IRStmtVec* parent);
|
|
From: Ivo R. <iv...@iv...> - 2017-03-22 16:40:08
|
Dear Valgrind developers,
Please let me know if you have any objections to a small fix for Linux
fcntl syscall wrapper
which was missing checks on flock structure of some fcntl commands.
Bug 377930 fcntl syscall wrapper is missing flock structure check:
https://bugs.kde.org/show_bug.cgi?id=377930
Patch:
https://bugsfiles.kde.org/attachment.cgi?id=104688
Thank you,
I.
|
|
From: Diane M. <Dia...@or...> - 2017-03-21 18:04:18
|
Hi valgrind developers, Please review my patch, which is attached to the bug, for Bug 377698 - Missing memory check for futex() uaddr arg for FUTEX_WAKE and FUTEX_WAKE_BITSET, check only 4 args for FUTEX_WAKE_BITSET, and 2 args for FUTEX_TRYLOCK_PI https://bugs.kde.org/show_bug.cgi?id=377698 Syscall wrapper for futex() was incorrectly checked: 1. Memcheck does not do a memory check on the uaddr argument for futex for FUTEX_WAKE and FUTEX_WAKE_BITSET cases. 2. FUTEX_WAKE_BITSET should not do scalar read check on all 6 arguments; it should check uaddr, op, val, and val3 only. 3. FUTEX_TRYLOCK_PI should check only uaddr and op I have tested this on sparc linux and x86 linux. Thanks in advance… Diane |
|
From: <sv...@va...> - 2017-03-20 21:34:16
|
Author: sewardj
Date: Mon Mar 20 21:34:02 2017
New Revision: 16279
Log:
Bug 377717 - Fix massive space leak when reading compressed debuginfo sections.
This makes reading of compressed debuginfo usable for very large object files.
It also adds a bunch extra documentation about a tricky invariant in the
compressed debuginfo handling (a recursive cache refill path!) and adds a
whole bunch of assertions.
Modified:
trunk/coregrind/m_debuginfo/image.c
Modified: trunk/coregrind/m_debuginfo/image.c
==============================================================================
--- trunk/coregrind/m_debuginfo/image.c (original)
+++ trunk/coregrind/m_debuginfo/image.c Mon Mar 20 21:34:02 2017
@@ -55,11 +55,12 @@
#define CACHE_ENTRY_SIZE (1 << CACHE_ENTRY_SIZE_BITS)
-#define COMMPRESSED_SLICE_ARRAY_GROW_SIZE 64
+#define COMPRESSED_SLICE_ARRAY_GROW_SIZE 64
/* An entry in the cache. */
typedef
struct {
+ Bool fromC; // True === contains decompressed data
DiOffT off; // file offset for data[0]
SizeT size; // sizeof(data)
SizeT used; // 1 .. sizeof(data), or 0 to denote not-in-use
@@ -117,6 +118,44 @@
UInt cslc_size;
};
+
+/* Sanity check code for CEnts. */
+static void pp_CEnt(const HChar* msg, CEnt* ce)
+{
+ VG_(printf)("%s: fromC %s, used %llu, size %llu, offset %llu\n",
+ msg, ce->fromC ? "True" : "False",
+ (ULong)ce->used, (ULong)ce->size, (ULong)ce->off);
+}
+
+static Bool is_sane_CEnt ( const HChar* who, const DiImage* img, UInt i )
+{
+ vg_assert(img);
+ vg_assert(i <= CACHE_N_ENTRIES);
+
+ CEnt* ce = img->ces[i];
+ if (!(ce->used <= ce->size)) goto fail;
+ if (ce->fromC) {
+ // ce->size can be anything, but ce->used must be either the
+ // same or zero, in the case that it hasn't been set yet.
+ // Similarly, ce->off must either be above the real_size
+ // threshold, or zero if it hasn't been set yet.
+ if (!(ce->off >= img->real_size || ce->off == 0)) goto fail;
+ if (!(ce->off + ce->used <= img->size)) goto fail;
+ if (!(ce->used == ce->size || ce->used == 0)) goto fail;
+ } else {
+ if (!(ce->size == CACHE_ENTRY_SIZE)) goto fail;
+ if (!(ce->off >= 0)) goto fail;
+ if (!(ce->off + ce->used <= img->real_size)) goto fail;
+ }
+ return True;
+
+ fail:
+ VG_(printf)("is_sane_CEnt[%u]: fail: %s\n", i, who);
+ pp_CEnt("failing CEnt", ce);
+ return False;
+}
+
+
/* A frame. The first 4 bytes of |data| give the kind of the frame,
and the rest of it is kind-specific data. */
typedef struct { UChar* data; SizeT n_data; } Frame;
@@ -452,23 +491,31 @@
}
/* Allocate a new CEnt, connect it to |img|, and return its index. */
-static UInt alloc_CEnt ( DiImage* img, SizeT szB )
+static UInt alloc_CEnt ( DiImage* img, SizeT szB, Bool fromC )
{
vg_assert(img != NULL);
vg_assert(img->ces_used < CACHE_N_ENTRIES);
- vg_assert(szB >= CACHE_ENTRY_SIZE);
+ if (fromC) {
+ // szB can be arbitrary
+ } else {
+ vg_assert(szB == CACHE_ENTRY_SIZE);
+ }
UInt entNo = img->ces_used;
img->ces_used++;
vg_assert(img->ces[entNo] == NULL);
img->ces[entNo] = ML_(dinfo_zalloc)("di.alloc_CEnt.1",
offsetof(CEnt, data) + szB);
img->ces[entNo]->size = szB;
+ img->ces[entNo]->fromC = fromC;
+ vg_assert(is_sane_CEnt("alloc_CEnt", img, entNo));
return entNo;
}
-static void realloc_CEnt ( DiImage* img, UInt entNo, SizeT szB ) {
+static void realloc_CEnt ( DiImage* img, UInt entNo, SizeT szB )
+{
vg_assert(img != NULL);
vg_assert(szB >= CACHE_ENTRY_SIZE);
+ vg_assert(is_sane_CEnt("realloc_CEnt-pre", img, entNo));
img->ces[entNo] = ML_(dinfo_realloc)("di.realloc_CEnt.1",
img->ces[entNo],
offsetof(CEnt, data) + szB);
@@ -594,7 +641,9 @@
ce->off = off;
ce->used = len;
- vg_assert(ce->used > 0 && ce->used <= ce->size);
+ ce->fromC = False;
+ vg_assert(ce == img->ces[entNo]);
+ vg_assert(is_sane_CEnt("set_CEnt", img, entNo));
}
__attribute__((noinline))
@@ -611,58 +660,144 @@
if (is_in_CEnt(img->ces[i], off))
break;
}
+ vg_assert(i >= 1);
+
+ if (LIKELY(i < img->ces_used)) {
+ // Found it. Move to the top and stop.
+ move_CEnt_to_top(img, i);
+ vg_assert(is_in_CEnt(img->ces[0], off));
+ return img->ces[0]->data[ off - img->ces[0]->off ];
+ }
+
vg_assert(i <= img->ces_used);
- if (i == img->ces_used) {
- /* It's not in any entry. Either allocate a new entry or
- recycle the LRU one. */
-
- CSlc* cslc = find_cslc(img, off);
- UChar* buf = NULL;
- if (cslc != NULL) {
- SizeT len = 0;
- buf = ML_(dinfo_zalloc)("di.image.get_slowcase.1", cslc->szC);
- // get compressed data
- while (len < cslc->szC)
- len += ML_(img_get_some)(buf + len, img, cslc->offC + len,
- cslc->szC - len);
- }
- if (img->ces_used == CACHE_N_ENTRIES) {
- /* All entries in use. Recycle the (ostensibly) LRU one. */
- i = CACHE_N_ENTRIES-1;
- if ((cslc != NULL) && (cslc->szD > img->ces[i]->size))
- realloc_CEnt(img, i, cslc->szD);
+ // It's not in any entry. Either allocate a new one or recycle the LRU
+ // one. This is where the presence of compressed sections makes things
+ // tricky. There are 4 cases to consider:
+ //
+ // (1) not from a compressed slice, we can allocate a new entry
+ // (2) not from a compressed slice, we have to recycle the LRU entry
+ // (3) from a compressed slice, we can allocate a new entry
+ // (4) from a compressed slice, we have to recycle the LRU entry
+ //
+ // Cases (3) and (4) are complex because we will have to call
+ // ML_(img_get_some) to get the compressed data. But this function is
+ // reachable from ML_(img_get_some), so we may re-enter get_slowcase a
+ // second time as a result. Given that the compressed data will be cause
+ // only cases (1) and (2) to happen, this guarantees no infinite recursion.
+ // It does however mean that we can't carry (in this function invokation)
+ // any local copies of the overall cache state across the ML_(img_get_some)
+ // call, since it may become invalidated by the recursive call to
+ // get_slowcase.
+
+ // First of all, see if it is in a compressed slice, and if so, pull the
+ // compressed data into an intermediate buffer. Given the preceding
+ // comment, this is a safe place to do it, since we are not carrying any
+ // cache state here apart from the knowledge that the requested offset is
+ // not in the cache at all, and the recursive call won't change that fact.
+
+ CSlc* cslc = find_cslc(img, off);
+ UChar* cbuf = NULL;
+ if (cslc != NULL) {
+ SizeT len = 0;
+ cbuf = ML_(dinfo_zalloc)("di.image.get_slowcase.cbuf-1", cslc->szC);
+ // get compressed data
+ while (len < cslc->szC)
+ len += ML_(img_get_some)(cbuf + len, img, cslc->offC + len,
+ cslc->szC - len);
+ }
+
+ // Now we can do what we like.
+ vg_assert((cslc == NULL && cbuf == NULL) || (cslc != NULL && cbuf != NULL));
+
+ // Note, we can't capture this earlier, for exactly the reasons detailed
+ // above.
+ UInt ces_used_at_entry = img->ces_used;
+
+ // This is the size of the CEnt that we want to have after allocation or
+ // recycling.
+ SizeT size = (cslc == NULL) ? CACHE_ENTRY_SIZE : cslc->szD;
+
+ // Cases (1) and (3)
+ if (img->ces_used < CACHE_N_ENTRIES) {
+ /* Allocate a new cache entry, and fill it in. */
+ i = alloc_CEnt(img, size, /*fromC?*/cslc != NULL);
+ if (cslc == NULL) {
+ set_CEnt(img, i, off);
+ img->ces[i]->fromC = False;
+ vg_assert(is_sane_CEnt("get_slowcase-case-1", img, i));
+ vg_assert(img->ces_used == ces_used_at_entry + 1);
} else {
- /* Allocate a new one, and fill it in. */
- SizeT size = CACHE_ENTRY_SIZE;
- if ((cslc != NULL) && (cslc->szD > CACHE_ENTRY_SIZE))
- size = cslc->szD;
- i = alloc_CEnt(img, size);
- }
-
- if (cslc != NULL) {
SizeT len = tinfl_decompress_mem_to_mem(
img->ces[i]->data, cslc->szD,
- buf, cslc->szC,
+ cbuf, cslc->szC,
TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF
| TINFL_FLAG_PARSE_ZLIB_HEADER);
- vg_assert(len == cslc->szD);
+ vg_assert(len == cslc->szD); // sanity check on data, FIXME
+ vg_assert(cslc->szD == size);
img->ces[i]->used = cslc->szD;
img->ces[i]->off = cslc->offD;
- ML_(dinfo_free)(buf);
- } else {
- set_CEnt(img, i, off);
+ img->ces[i]->fromC = True;
+ vg_assert(is_sane_CEnt("get_slowcase-case-3", img, i));
+ vg_assert(img->ces_used == ces_used_at_entry + 1);
}
+ vg_assert(img->ces_used == ces_used_at_entry + 1);
+ if (i > 0) {
+ move_CEnt_to_top(img, i);
+ i = 0;
+ }
+ vg_assert(is_in_CEnt(img->ces[i], off));
+ if (cbuf != NULL) {
+ ML_(dinfo_free)(cbuf);
+ }
+ return img->ces[i]->data[ off - img->ces[i]->off ];
+ }
+ // Cases (2) and (4)
+ /* All entries in use. Recycle the (ostensibly) LRU one. But try to find
+ a non-fromC entry to recycle, though, since discarding and reloading
+ fromC entries is very expensive. The result is that -- unless all
+ CACHE_N_ENTRIES wind up being used by decompressed slices, which is
+ highly unlikely -- we'll wind up keeping all the decompressed data in
+ the cache for its entire remaining life. We could probably do better
+ but it would make the cache management even more complex. */
+ vg_assert(img->ces_used == CACHE_N_ENTRIES);
+
+ // Select entry to recycle.
+ for (i = CACHE_N_ENTRIES-1; i > 0; i--) {
+ if (!img->ces[i]->fromC)
+ break;
+ }
+ vg_assert(i >= 0 && i < CACHE_N_ENTRIES);
+
+ realloc_CEnt(img, i, size);
+ img->ces[i]->size = size;
+ img->ces[i]->used = 0;
+ if (cslc == NULL) {
+ set_CEnt(img, i, off);
+ img->ces[i]->fromC = False;
+ vg_assert(is_sane_CEnt("get_slowcase-case-2", img, i));
} else {
- /* We found it at position 'i'. */
- vg_assert(i > 0);
+ SizeT len = tinfl_decompress_mem_to_mem(
+ img->ces[i]->data, cslc->szD,
+ cbuf, cslc->szC,
+ TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF
+ | TINFL_FLAG_PARSE_ZLIB_HEADER);
+ vg_assert(len == size);
+ img->ces[i]->used = size;
+ img->ces[i]->off = cslc->offD;
+ img->ces[i]->fromC = True;
+ vg_assert(is_sane_CEnt("get_slowcase-case-4", img, i));
}
+ vg_assert(img->ces_used == ces_used_at_entry);
if (i > 0) {
move_CEnt_to_top(img, i);
i = 0;
}
vg_assert(is_in_CEnt(img->ces[i], off));
+ if (cbuf != NULL) {
+ ML_(dinfo_free)(cbuf);
+ }
return img->ces[i]->data[ off - img->ces[i]->off ];
}
@@ -724,7 +859,7 @@
loading it at this point forcing img->cent[0] to always be
non-empty, thereby saving us an is-it-empty check on the fast
path in get(). */
- UInt entNo = alloc_CEnt(img, CACHE_ENTRY_SIZE);
+ UInt entNo = alloc_CEnt(img, CACHE_ENTRY_SIZE, False/*!fromC*/);
vg_assert(entNo == 0);
set_CEnt(img, 0, 0);
@@ -815,7 +950,7 @@
/* See comment on equivalent bit in ML_(img_from_local_file) for
rationale. */
- UInt entNo = alloc_CEnt(img, CACHE_ENTRY_SIZE);
+ UInt entNo = alloc_CEnt(img, CACHE_ENTRY_SIZE, False/*!fromC*/);
vg_assert(entNo == 0);
set_CEnt(img, 0, 0);
@@ -849,7 +984,7 @@
vg_assert(offset + szC <= img->size);
if (img->cslc_used == img->cslc_size) {
- img->cslc_size += COMMPRESSED_SLICE_ARRAY_GROW_SIZE;
+ img->cslc_size += COMPRESSED_SLICE_ARRAY_GROW_SIZE;
img->cslc = ML_(dinfo_realloc)("di.image.ML_img_mark_compressed_part.1",
img->cslc, img->cslc_size * sizeof(CSlc));
}
|
|
From: <sv...@va...> - 2017-03-17 19:50:22
|
Author: iraisr
Date: Fri Mar 17 19:50:14 2017
New Revision: 3321
Log:
Make useful/test_main.c compilable
Modified:
branches/VEX_JIT_HACKS/useful/test_main.c
Modified: branches/VEX_JIT_HACKS/useful/test_main.c
==============================================================================
--- branches/VEX_JIT_HACKS/useful/test_main.c (original)
+++ branches/VEX_JIT_HACKS/useful/test_main.c Fri Mar 17 19:50:14 2017
@@ -609,13 +609,13 @@
so far exists, allocate one. */
static IRTemp findShadowTmp ( MCEnv* mce, IRTemp orig )
{
- tl_assert(orig < mce->n_originalTmps);
- if (mce->tmpMap[orig] == IRTemp_INVALID) {
- mce->tmpMap[orig]
- = newIRTemp(mce->bb->tyenv,
- shadowType(mce->bb->tyenv->types[orig]));
+ tl_assert(orig.index < mce->n_originalTmps);
+ if (isIRTempInvalid(mce->tmpMap[orig.index])) {
+ mce->tmpMap[orig.index]
+ = newIRTemp(mce->bb->stmts->tyenv,
+ shadowType(mce->bb->stmts->tyenv->types[orig.index]));
}
- return mce->tmpMap[orig];
+ return mce->tmpMap[orig.index];
}
/* Allocate a new shadow for the given original tmp. This means any
@@ -626,10 +626,10 @@
and use that instead. */
static void newShadowTmp ( MCEnv* mce, IRTemp orig )
{
- tl_assert(orig < mce->n_originalTmps);
- mce->tmpMap[orig]
- = newIRTemp(mce->bb->tyenv,
- shadowType(mce->bb->tyenv->types[orig]));
+ tl_assert(orig.index < mce->n_originalTmps);
+ mce->tmpMap[orig.index]
+ = newIRTemp(mce->bb->stmts->tyenv,
+ shadowType(mce->bb->stmts->tyenv->types[orig.index]));
}
@@ -652,7 +652,7 @@
{
if (a1->tag == Iex_Const)
return True;
- if (a1->tag == Iex_RdTmp && a1->Iex.RdTmp.tmp < mce->n_originalTmps)
+ if (a1->tag == Iex_RdTmp && a1->Iex.RdTmp.tmp.index < mce->n_originalTmps)
return True;
return False;
}
@@ -663,7 +663,7 @@
{
if (a1->tag == Iex_Const)
return True;
- if (a1->tag == Iex_RdTmp && a1->Iex.RdTmp.tmp >= mce->n_originalTmps)
+ if (a1->tag == Iex_RdTmp && a1->Iex.RdTmp.tmp.index >= mce->n_originalTmps)
return True;
return False;
}
@@ -725,12 +725,12 @@
/*------------------------------------------------------------*/
/* assign value to tmp */
-#define assign(_bb,_tmp,_expr) \
- addStmtToIRSB((_bb), IRStmt_WrTmp((_tmp),(_expr)))
+#define assign(_stmts,_tmp,_expr) \
+ addStmtToIRStmtVec((_stmts), IRStmt_WrTmp((_tmp),(_expr)))
/* add stmt to a bb */
-#define stmt(_bb,_stmt) \
- addStmtToIRSB((_bb), (_stmt))
+#define stmt(_stmts,_stmt) \
+ addStmtToIRStmtVec((_stmts), (_stmt))
/* build various kinds of expressions */
#define binop(_op, _arg1, _arg2) IRExpr_Binop((_op),(_arg1),(_arg2))
@@ -746,8 +746,8 @@
temporary. This effectively converts an arbitrary expression into
an atom. */
static IRAtom* assignNew ( MCEnv* mce, IRType ty, IRExpr* e ) {
- IRTemp t = newIRTemp(mce->bb->tyenv, ty);
- assign(mce->bb, t, e);
+ IRTemp t = newIRTemp(mce->bb->stmts->tyenv, ty);
+ assign(mce->bb->stmts, t, e);
return mkexpr(t);
}
@@ -982,7 +982,7 @@
/* Note, dst_ty is a shadow type, not an original type. */
/* First of all, collapse vbits down to a single bit. */
tl_assert(isShadowAtom(mce,vbits));
- ty = typeOfIRExpr(mce->bb->tyenv, vbits);
+ ty = typeOfIRExpr(mce->bb->stmts->tyenv, vbits);
tmp1 = NULL;
switch (ty) {
case Ity_I1:
@@ -1074,7 +1074,7 @@
tl_assert(isShadowAtom(mce, vatom));
tl_assert(sameKindedAtoms(atom, vatom));
- ty = typeOfIRExpr(mce->bb->tyenv, vatom);
+ ty = typeOfIRExpr(mce->bb->stmts->tyenv, vatom);
/* sz is only used for constructing the error message */
sz = ty==Ity_I1 ? 0 : sizeofIRType(ty);
@@ -1114,7 +1114,7 @@
}
di->guard = cond;
setHelperAnns( mce, di );
- stmt( mce->bb, IRStmt_Dirty(di));
+ stmt( mce->bb->stmts, IRStmt_Dirty(di));
/* Set the shadow tmp to be defined. First, update the
orig->shadow tmp mapping to reflect the fact that this shadow is
@@ -1124,8 +1124,8 @@
if (vatom->tag == Iex_RdTmp) {
tl_assert(atom->tag == Iex_RdTmp);
newShadowTmp(mce, atom->Iex.RdTmp.tmp);
- assign(mce->bb, findShadowTmp(mce, atom->Iex.RdTmp.tmp),
- definedOfType(ty));
+ assign(mce->bb->stmts, findShadowTmp(mce, atom->Iex.RdTmp.tmp),
+ definedOfType(ty));
}
}
@@ -1184,7 +1184,7 @@
tl_assert(isShadowAtom(mce, vatom));
}
- ty = typeOfIRExpr(mce->bb->tyenv, vatom);
+ ty = typeOfIRExpr(mce->bb->stmts->tyenv, vatom);
tl_assert(ty != Ity_I1);
if (isAlwaysDefd(mce, offset, sizeofIRType(ty))) {
/* later: no ... */
@@ -1192,7 +1192,7 @@
/* complainIfUndefined(mce, atom); */
} else {
/* Do a plain shadow Put. */
- stmt( mce->bb, IRStmt_Put( offset + mce->layout->total_sizeB, vatom ) );
+ stmt(mce->bb->stmts, IRStmt_Put(offset + mce->layout->total_sizeB, vatom));
}
}
@@ -1227,7 +1227,7 @@
IRRegArray* new_descr
= mkIRRegArray( descr->base + mce->layout->total_sizeB,
tyS, descr->nElems);
- stmt( mce->bb, IRStmt_PutI( mkIRPutI( new_descr, ix, bias, vatom ) ));
+ stmt(mce->bb->stmts, IRStmt_PutI(mkIRPutI(new_descr, ix, bias, vatom)));
}
}
@@ -2096,12 +2096,12 @@
/* We need to have a place to park the V bits we're just about to
read. */
- datavbits = newIRTemp(mce->bb->tyenv, ty);
+ datavbits = newIRTemp(mce->bb->stmts->tyenv, ty);
di = unsafeIRDirty_1_N( datavbits,
1/*regparms*/, hname, helper,
mkIRExprVec_1( addrAct ));
setHelperAnns( mce, di );
- stmt( mce->bb, IRStmt_Dirty(di) );
+ stmt(mce->bb->stmts, IRStmt_Dirty(di));
return mkexpr(datavbits);
}
@@ -2147,7 +2147,7 @@
vbitsC = expr2vbits(mce, cond);
vbits0 = expr2vbits(mce, iffalse);
vbits1 = expr2vbits(mce, iftrue);
- ty = typeOfIRExpr(mce->bb->tyenv, vbits0);
+ ty = typeOfIRExpr(mce->bb->stmts->tyenv, vbits0);
return
mkUifU(mce, ty, assignNew(mce, ty, IRExpr_ITE(cond, vbits1, vbits0)),
@@ -2172,7 +2172,7 @@
return IRExpr_RdTmp( findShadowTmp(mce, e->Iex.RdTmp.tmp) );
case Iex_Const:
- return definedOfType(shadowType(typeOfIRExpr(mce->bb->tyenv, e)));
+ return definedOfType(shadowType(typeOfIRExpr(mce->bb->stmts->tyenv, e)));
case Iex_Binop:
return expr2vbits_Binop(
@@ -2219,7 +2219,7 @@
/* vatom is vbits-value and as such can only have a shadow type. */
tl_assert(isShadowAtom(mce,vatom));
- ty = typeOfIRExpr(mce->bb->tyenv, vatom);
+ ty = typeOfIRExpr(mce->bb->stmts->tyenv, vatom);
tyH = mce->hWordTy;
if (tyH == Ity_I32) {
@@ -2277,7 +2277,7 @@
tl_assert(isOriginalAtom(mce,addr));
tl_assert(isShadowAtom(mce,vdata));
- ty = typeOfIRExpr(mce->bb->tyenv, vdata);
+ ty = typeOfIRExpr(mce->bb->stmts->tyenv, vdata);
/* First, emit a definedness test for the address. This also sets
the address (shadow) to 'defined' following the test. */
@@ -2322,8 +2322,8 @@
setHelperAnns( mce, diLo64 );
setHelperAnns( mce, diHi64 );
- stmt( mce->bb, IRStmt_Dirty(diLo64) );
- stmt( mce->bb, IRStmt_Dirty(diHi64) );
+ stmt(mce->bb->stmts, IRStmt_Dirty(diLo64));
+ stmt(mce->bb->stmts, IRStmt_Dirty(diHi64));
} else {
@@ -2350,7 +2350,7 @@
zwidenToHostWord( mce, vdata )));
}
setHelperAnns( mce, di );
- stmt( mce->bb, IRStmt_Dirty(di) );
+ stmt(mce->bb->stmts, IRStmt_Dirty(di));
}
}
@@ -2443,7 +2443,7 @@
tl_assert(d->mAddr);
complainIfUndefined(mce, d->mAddr);
- tyAddr = typeOfIRExpr(mce->bb->tyenv, d->mAddr);
+ tyAddr = typeOfIRExpr(mce->bb->stmts->tyenv, d->mAddr);
tl_assert(tyAddr == Ity_I32 || tyAddr == Ity_I64);
tl_assert(tyAddr == mce->hWordTy); /* not really right */
}
@@ -2480,10 +2480,10 @@
results to all destinations. */
/* Outputs: the destination temporary, if there is one. */
- if (d->tmp != IRTemp_INVALID) {
+ if (!isIRTempInvalid(d->tmp)) {
dst = findShadowTmp(mce, d->tmp);
- tyDst = typeOfIRTemp(mce->bb->tyenv, d->tmp);
- assign( mce->bb, dst, mkPCastTo( mce, tyDst, curr) );
+ tyDst = typeOfIRTemp(mce->bb->stmts->tyenv, d->tmp);
+ assign(mce->bb->stmts, dst, mkPCastTo(mce, tyDst, curr));
}
/* Outputs: guest state that we write or modify. */
@@ -2619,34 +2619,34 @@
/* Bool hasBogusLiterals = False; */
- Int i, j, first_stmt;
- IRStmt* st;
+ Int first_stmt;
MCEnv mce;
/* Set up BB */
- IRSB* bb = emptyIRSB();
- bb->tyenv = deepCopyIRTypeEnv(bb_in->tyenv);
- bb->next = deepCopyIRExpr(bb_in->next);
- bb->jumpkind = bb_in->jumpkind;
+ IRSB* bb = emptyIRSB();
+ bb->id_seq = bb_in->id_seq;
+ bb->stmts->tyenv = deepCopyIRTypeEnv(bb_in->stmts->tyenv);
+ bb->next = deepCopyIRExpr(bb_in->next);
+ bb->jumpkind = bb_in->jumpkind;
/* Set up the running environment. Only .bb is modified as we go
along. */
mce.bb = bb;
mce.layout = layout;
- mce.n_originalTmps = bb->tyenv->types_used;
+ mce.n_originalTmps = bb->stmts->tyenv->types_used;
mce.hWordTy = hWordTy;
mce.tmpMap = LibVEX_Alloc(mce.n_originalTmps * sizeof(IRTemp));
- for (i = 0; i < mce.n_originalTmps; i++)
- mce.tmpMap[i] = IRTemp_INVALID;
+ for (UInt i = 0; i < mce.n_originalTmps; i++)
+ mce.tmpMap[i] = IRTemp_INVALID();
+
+ tl_assert(isFlatIRSB(bb_in));
/* Iterate over the stmts. */
- for (i = 0; i < bb_in->stmts_used; i++) {
- st = bb_in->stmts[i];
+ for (UInt i = 0; i < bb_in->stmts->stmts_used; i++) {
+ IRStmt* st = bb_in->stmts->stmts[i];
if (!st) continue;
- tl_assert(isFlatIRStmt(st));
-
/*
if (!hasBogusLiterals) {
hasBogusLiterals = checkForBogusLiterals(st);
@@ -2657,7 +2657,7 @@
}
}
*/
- first_stmt = bb->stmts_used;
+ first_stmt = bb->stmts->stmts_used;
if (verboze) {
ppIRStmt(st);
@@ -2667,8 +2667,8 @@
switch (st->tag) {
case Ist_WrTmp:
- assign( bb, findShadowTmp(&mce, st->Ist.WrTmp.tmp),
- expr2vbits( &mce, st->Ist.WrTmp.data) );
+ assign(bb->stmts, findShadowTmp(&mce, st->Ist.WrTmp.tmp),
+ expr2vbits( &mce, st->Ist.WrTmp.data));
break;
case Ist_Put:
@@ -2714,20 +2714,20 @@
} /* switch (st->tag) */
if (verboze) {
- for (j = first_stmt; j < bb->stmts_used; j++) {
+ for (UInt j = first_stmt; j < bb->stmts->stmts_used; j++) {
VG_(printf)(" ");
- ppIRStmt(bb->stmts[j]);
+ ppIRStmt(bb->stmts->stmts[j]);
VG_(printf)("\n");
}
VG_(printf)("\n");
}
- addStmtToIRSB(bb, st);
+ addStmtToIRStmtVec(bb->stmts, st);
}
/* Now we need to complain if the jump target is undefined. */
- first_stmt = bb->stmts_used;
+ first_stmt = bb->stmts->stmts_used;
if (verboze) {
VG_(printf)("bb->next = ");
@@ -2738,9 +2738,9 @@
complainIfUndefined( &mce, bb->next );
if (verboze) {
- for (j = first_stmt; j < bb->stmts_used; j++) {
+ for (UInt j = first_stmt; j < bb->stmts->stmts_used; j++) {
VG_(printf)(" ");
- ppIRStmt(bb->stmts[j]);
+ ppIRStmt(bb->stmts->stmts[j]);
VG_(printf)("\n");
}
VG_(printf)("\n");
|
|
From: <sv...@va...> - 2017-03-17 18:45:30
|
Author: philippe
Date: Fri Mar 17 18:45:23 2017
New Revision: 16278
Log:
And some more follow up for 376956 syswrap of SNDDRV and DRM_IOCTL_VERSION
causing some addresses to be wrongly marked as addressable
Just in case, do the assert after ARG2 has been truncated to 32 bits,
to avoid comparing sign extended requests on 64 bits.
Modified:
trunk/coregrind/m_syswrap/syswrap-linux.c
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c Fri Mar 17 18:45:23 2017
@@ -9013,10 +9013,10 @@
POST(sys_ioctl)
{
- vg_assert(SUCCESS || (FAILURE && VKI_DRM_IOCTL_VERSION == ARG2));
-
ARG2 = (UInt)ARG2;
+ vg_assert(SUCCESS || (FAILURE && VKI_DRM_IOCTL_VERSION == ARG2));
+
/* --- BEGIN special IOCTL handlers for specific Android hardware --- */
/* BEGIN undocumented ioctls for PowerVR SGX 540 (the GPU on Nexus S) */
|
|
From: <sv...@va...> - 2017-03-17 18:38:50
|
Author: philippe
Date: Fri Mar 17 18:38:42 2017
New Revision: 16277
Log:
Follow up to fix 376956 syswrap of SNDDRV and DRM_IOCTL_VERSION causing some
addresses to be wrongly marked as addressable
As noted by Ivo, if the syscall fails, then we have a leak.
So, enable the flag SfPostOnFail if we allocate memory.
In the POST ioctl, check that FAILURE only happens for this drm ioctl,
and free the memory for both SUCCESS and FAILURE.
Do the POST_MEM_WRITE only if SUCCESS
Modified:
trunk/coregrind/m_syswrap/syswrap-linux.c
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c Fri Mar 17 18:38:42 2017
@@ -7706,6 +7706,8 @@
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));
+ // To ensure we VG_(free) info even when syscall fails:
+ *flags |= SfPostOnFail;
info->data = *data;
info->orig = data;
ARG3 = (Addr)&info->data;
@@ -9011,7 +9013,7 @@
POST(sys_ioctl)
{
- vg_assert(SUCCESS);
+ vg_assert(SUCCESS || (FAILURE && VKI_DRM_IOCTL_VERSION == ARG2));
ARG2 = (UInt)ARG2;
@@ -10193,15 +10195,17 @@
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, 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, 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, VG_MIN(data->desc_len, orig_desc_len));
+ if (SUCCESS) {
+ 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, 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, 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, VG_MIN(data->desc_len, orig_desc_len));
+ }
}
break;
case VKI_DRM_IOCTL_GET_UNIQUE:
|
|
From: <sv...@va...> - 2017-03-16 15:07:19
|
Author: petarj
Date: Thu Mar 16 15:07:12 2017
New Revision: 16276
Log:
Update the list of fixed issues
The bug 377376 has been fixed with r16273 and r16275.
Modified:
trunk/NEWS
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Thu Mar 16 15:07:12 2017
@@ -144,6 +144,7 @@
== 371668
376956 syswrap of SNDDRV and DRM_IOCTL_VERSION causing some addresses
to be wrongly marked as addressable
+377376 memcheck/tests/linux/getregset fails with glibc2.24
377427 PPC64, lxv instruction failing on odd destination register
377478 PPC64: ISA 3.0 setup fixes
|
|
From: Rhys K. <rhy...@gm...> - 2017-03-16 13:23:06
|
On 16 March 2017 at 09:12, Petar Jovanovic <mip...@gm...> wrote: > On Thu, Mar 16, 2017 at 6:30 AM, Rhys Kidd <rhy...@gm...> wrote: > > This patch is causing regression test failures on a number of systems, > > including Solaris and macOS (i.e. non GNU/Linux). > > > > Refer to the valgrind mailing list for reports similar to: > > > > m_signals.c: In function 'default_action': > > m_signals.c:1732:36: error: 'VKI_PT_PTRACED' undeclared (first use in > this > > function) > > if (terminate && (tst->ptrace & VKI_PT_PTRACED) > > ^ > > Hopefully, this is now fixed with r16275. > A quick build test on macOS compiles again after r16275. Thanks. > > Let me know. Thanks. > > Regards, > Petar > |
|
From: Petar J. <mip...@gm...> - 2017-03-16 13:12:41
|
On Thu, Mar 16, 2017 at 6:30 AM, Rhys Kidd <rhy...@gm...> wrote: > This patch is causing regression test failures on a number of systems, > including Solaris and macOS (i.e. non GNU/Linux). > > Refer to the valgrind mailing list for reports similar to: > > m_signals.c: In function 'default_action': > m_signals.c:1732:36: error: 'VKI_PT_PTRACED' undeclared (first use in this > function) > if (terminate && (tst->ptrace & VKI_PT_PTRACED) > ^ Hopefully, this is now fixed with r16275. Let me know. Thanks. Regards, Petar |
|
From: <sv...@va...> - 2017-03-16 13:10:29
|
Author: petarj
Date: Thu Mar 16 13:10:16 2017
New Revision: 16275
Log:
Fix broken build on non-Linux systems
After r16273, non-Linux Valgrind builds report:
m_signals.c:1732:36:
error: 'VKI_PT_PTRACED' undeclared (first use in this function)
Fix the issue with #if defined(VGO_linux) for the reported code.
Modified:
trunk/coregrind/m_signals.c
Modified: trunk/coregrind/m_signals.c
==============================================================================
--- trunk/coregrind/m_signals.c (original)
+++ trunk/coregrind/m_signals.c Thu Mar 16 13:10:16 2017
@@ -1729,11 +1729,13 @@
if (!terminate)
return; /* nothing to do */
+#if defined(VGO_linux)
if (terminate && (tst->ptrace & VKI_PT_PTRACED)
&& (sigNo != VKI_SIGKILL)) {
VG_(kill)(VG_(getpid)(), VKI_SIGSTOP);
return;
}
+#endif
could_core = core;
|
|
From: Rhys K. <rhy...@gm...> - 2017-03-16 05:30:56
|
On 15 March 2017 at 11:23, <sv...@va...> wrote:
> 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;
> + }
> +
>
This patch is causing regression test failures on a number of systems,
including Solaris and macOS (i.e. non GNU/Linux).
Refer to the valgrind mailing list for reports similar to:
m_signals.c: In function 'default_action':
m_signals.c:1732:36: error: 'VKI_PT_PTRACED' undeclared (first use in this
function)
if (terminate && (tst->ptrace & VKI_PT_PTRACED)
^
m_signals.c:1732:36: note: each undeclared identifier is reported only once
for each function it appears in
make[3]: *** [libcoregrind_amd64_solaris_a-m_signals.o] Error 1
make[3]: *** Waiting for unfinished jobs....
mv -f .deps/libcoregrind_amd64_solaris_a-m_redir.Tpo
.deps/libcoregrind_amd64_solaris_a-m_redir.Po
make[3]: Leaving directory
`/export/home/tester1/nightly/valgrind-new/coregrind'
make[2]: *** [all] Error 2
make[2]: Leaving directory
`/export/home/tester1/nightly/valgrind-new/coregrind'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/export/home/tester1/nightly/valgrind-new'
make: *** [all] Error 2
> 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
> //----------------------------------------------------------------------
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
>
|
|
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 "
|
|
From: <sv...@va...> - 2017-03-14 17:12:01
|
Author: petarj
Date: Tue Mar 14 17:11:51 2017
New Revision: 16272
Log:
Update the list of fixed bugs
The following issues have been fixed:
341481 MIPS64: Iop_CmpNE32 triggers false warning on MIPS64 platforms
(VEX r3304)
344524 store conditional of guest applications always fail - observed
on Octeon3(MIPS)
(Valgrind r16269, VEX r3316)
376142 Segfaults on MIPS Cavium Octeon boards
(Valgrind r16261)
Modified:
trunk/NEWS
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Tue Mar 14 17:11:51 2017
@@ -93,9 +93,12 @@
where XXXXXX is the bug number as listed below.
162848 --log-file output isn't split when a program forks
+341481 MIPS64: Iop_CmpNE32 triggers false warning on MIPS64 platforms
342040 Valgrind mishandles clone with CLONE_VFORK | CLONE_VM that clones
to a different stack.
344139 x86 stack-seg overrides, needed by the Wine people
+344524 store conditional of guest applications always fail - observed on
+ Octeon3(MIPS)
348616 Wine/valgrind: noted but unhandled ioctl 0x5390 [..] (DVD_READ_STRUCT)
352395 Please provide SVN revision info in --version -v
352767 Wine/valgrind: noted but unhandled ioctl 0x5307 [..] (CDROMSTOP)
@@ -133,6 +136,7 @@
375772 +1 error in get_elf_symbol_info() when computing value of 'hi' address
for ML_(find_rx_mapping)()
375806 Test helgrind/tests/tc22_exit_w_lock fails with glibc 2.24
+376142 Segfaults on MIPS Cavium Octeon boards
376455 Solaris: unhandled syscall lgrpsys(180)
376518 Solaris: unhandled fast trap getlgrp(6)
376611 ppc64 and arm64 don't know about prlimit64 syscall
|
|
From: <sv...@va...> - 2017-03-14 00:47:52
|
Author: iraisr
Date: Tue Mar 14 00:47:45 2017
New Revision: 3319
Log:
Fix type of t_inc to correct IRTemp.
No functional change.
n-i-bz
Modified:
trunk/priv/guest_x86_toIR.c
Modified: trunk/priv/guest_x86_toIR.c
==============================================================================
--- trunk/priv/guest_x86_toIR.c (original)
+++ trunk/priv/guest_x86_toIR.c Tue Mar 14 00:47:45 2017
@@ -3172,7 +3172,7 @@
/* Code shared by all the string ops */
static
-void dis_string_op_increment(Int sz, Int t_inc)
+void dis_string_op_increment(Int sz, IRTemp t_inc)
{
if (sz == 4 || sz == 2) {
assign( t_inc,
|
|
From: <sv...@va...> - 2017-03-13 23:34:58
|
Author: iraisr
Date: Mon Mar 13 23:34:51 2017
New Revision: 16271
Log:
Fix initialization of MCEnv in Memcheck.
At this point, also all tests under 'memcheck' pass as in trunk.
Modified:
branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c
Modified: branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c
==============================================================================
--- branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c (original)
+++ branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c Mon Mar 13 23:34:51 2017
@@ -332,7 +332,7 @@
{
IRStmtVec* stmts_out = emptyIRStmtVec();
stmts_out->tyenv = deepCopyIRTypeEnv(stmts_in->tyenv);
- stmts_out->parent = parent_mce->stmts;
+ stmts_out->parent = (parent_mce != NULL) ? parent_mce->stmts : NULL;
mce->stmts = stmts_out;
mce->tyenv = stmts_out->tyenv;
@@ -6670,6 +6670,7 @@
MCEnv mce;
initMCEnv(sb_in->stmts, &mce, NULL);
mce.settings = &settings;
+ sb_out->stmts = mce.stmts;
tl_assert(isFlatIRSB(sb_in));
|
|
From: <sv...@va...> - 2017-03-13 23:12:34
|
Author: iraisr
Date: Mon Mar 13 23:12:27 2017
New Revision: 3318
Log:
Fix uninitialised IRTemp.id in CSE pass.
Fix backwards loops in ir_opt.c.
At this point, all tests under 'none' pass as in trunk.
Modified:
branches/VEX_JIT_HACKS/priv/ir_opt.c
branches/VEX_JIT_HACKS/pub/libvex_ir.h
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 Mon Mar 13 23:12:27 2017
@@ -916,7 +916,7 @@
HashHW* env)
{
/* And now scan backwards through the statements. */
- for (UInt i = stmts->stmts_used - 1; i >= 0; i--) {
+ for (Int i = stmts->stmts_used - 1; i >= 0; i--) {
IRStmt* st = stmts->stmts[i];
Bool isPut;
UInt key;
@@ -3226,7 +3226,7 @@
*i_unconditional_exit = -1;
/* Work backwards through the stmts */
- for (UInt i = stmts->stmts_used - 1; i >= 0; i--) {
+ for (Int i = stmts->stmts_used - 1; i >= 0; i--) {
IRStmt* st = stmts->stmts[i];
if (st->tag == Ist_NoOp)
continue;
@@ -3301,7 +3301,7 @@
{
IRExpr* ex;
- for (UInt i = stmts->stmts_used - 1; i >= 0; i--) {
+ for (Int i = stmts->stmts_used - 1; i >= 0; i--) {
IRStmt* st = stmts->stmts[i];
if (st->tag == Ist_IfThenElse) {
@@ -3790,7 +3790,7 @@
{
HWord res;
/* env :: IRTemp -> IRTemp */
- if (lookupHHW(env, &res, (HWord)tmp.index)) {
+ if (lookupHHW(env, &res, (HWord) tmp.index)) {
return mkIRTemp(tmp.id, res);
} else {
return tmp;
@@ -4005,7 +4005,6 @@
static Bool do_cse_IRStmtVec(IRStmtVec* stmts, Bool allowLoadsToBeCSEd)
{
Int j, paranoia;
- IRTemp t, q;
AvailExpr* eprime;
AvailExpr* ae;
Bool invalidate;
@@ -4059,7 +4058,7 @@
allowLoadsToBeCSEd);
paranoia = 0; break;
default:
- vpanic("do_cse_BB(1)");
+ vpanic("do_cse_IRStmtVec(1)");
}
if (paranoia > 0) {
@@ -4105,7 +4104,7 @@
invalidate = True;
}
else
- vpanic("do_cse_BB(2)");
+ vpanic("do_cse_IRStmtVec(2)");
}
if (invalidate) {
@@ -4121,7 +4120,7 @@
if (st->tag != Ist_WrTmp)
continue;
- t = st->Ist.WrTmp.tmp;
+ IRTemp t = st->Ist.WrTmp.tmp;
eprime = irExpr_to_AvailExpr(st->Ist.WrTmp.data, allowLoadsToBeCSEd);
/* ignore if not of AvailExpr form */
if (!eprime)
@@ -4141,7 +4140,7 @@
/* A binding E' -> q was found. Replace stmt by "t = q" and
note the t->q binding in tenv. */
/* (this is the core of the CSE action) */
- q.index = (IRTyEnvIndex) aenv->val[j];
+ IRTemp q = mkIRTemp(stmts->tyenv->id, (IRTyEnvIndex) aenv->val[j]);
stmts->stmts[i] = IRStmt_WrTmp(t, IRExpr_RdTmp(q));
addToHHW(tenv, (HWord) t.index, (HWord) q.index);
anyDone = True;
@@ -4258,7 +4257,7 @@
IRTemp var, var2;
Int con, con2;
- for (UInt i = stmts->stmts_used - 1; i >= 0; i--) {
+ for (Int i = stmts->stmts_used - 1; i >= 0; i--) {
IRStmt* st = stmts->stmts[i];
if (st->tag == Ist_NoOp)
continue;
@@ -4386,7 +4385,7 @@
/* Scan backwards in bb from startHere to find a suitable PutI
binding for (descrG, ixG, biasG), if any. */
- for (UInt j = startHere; j >= 0; j--) {
+ for (Int j = startHere; j >= 0; j--) {
IRStmt* st = stmts->stmts[j];
if (st->tag == Ist_NoOp)
continue;
@@ -4598,7 +4597,7 @@
static
void do_redundant_GetI_elimination(IRStmtVec* stmts)
{
- for (UInt i = stmts->stmts_used - 1; i >= 0; i--) {
+ for (Int i = stmts->stmts_used - 1; i >= 0; i--) {
IRStmt* st = stmts->stmts[i];
if (st->tag == Ist_NoOp)
continue;
Modified: branches/VEX_JIT_HACKS/pub/libvex_ir.h
==============================================================================
--- branches/VEX_JIT_HACKS/pub/libvex_ir.h (original)
+++ branches/VEX_JIT_HACKS/pub/libvex_ir.h Mon Mar 13 23:12:27 2017
@@ -3102,11 +3102,13 @@
} Exit;
/* If-Then-Else control flow diamond. It contains:
+ - Guard controling whether "then" or "else" leg is taken
- "then" and "else" legs with vectors of statements, together
with their associated type environments
At the moment, nested "if-then-else" statements are not supported.
- Phi nodes, which are used to merge temporaries from "then" and
"else" legs
+ - TODO-JIT: A hint which leg is more likely to be taken (hot path)
A leg can either end with an unconditional exit or join the main
flow.
|
|
From: <sv...@va...> - 2017-03-13 20:14:22
|
Author: carll
Date: Mon Mar 13 20:14:08 2017
New Revision: 16270
Log:
There is a typo in the configure.ac file that causes the HAS_ISA_3_00
variable to not be set.
The mask64 value, in file VEX/priv/guest_ppc_toIR.c is missing the
HWCAPS bit for ISA3.0.
vex commit 3317.
bugzilla 377478
Modified:
trunk/NEWS
trunk/configure.ac
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Mon Mar 13 20:14:08 2017
@@ -139,6 +139,7 @@
376729 PPC64, remove R2 from the clobber list
== 371668
377427 PPC64, lxv instruction failing on odd destination register
+377478 PPC64: ISA 3.0 setup fixes
Release 3.12.0 (20 October 2016)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Mon Mar 13 20:14:08 2017
@@ -1537,7 +1537,7 @@
AC_MSG_RESULT([no])
])
-AM_CONDITIONAL(HAS_ISA_3_00, test x$ac_asm_have_isa_3_00 = xyes \
+AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
-a x$HWCAP_HAS_ISA_3_00 = xyes])
# Check for pthread_create@GLIBC2.0
|
|
From: <sv...@va...> - 2017-03-13 20:10:47
|
Author: carll
Date: Mon Mar 13 20:10:40 2017
New Revision: 3317
Log:
The mask64 value, in file VEX/priv/guest_ppc_toIR.c is missing the
HWCAPS bit for ISA3.0.
bugzilla 377478
Modified:
trunk/priv/guest_ppc_toIR.c
Modified: trunk/priv/guest_ppc_toIR.c
==============================================================================
--- trunk/priv/guest_ppc_toIR.c (original)
+++ trunk/priv/guest_ppc_toIR.c Mon Mar 13 20:10:40 2017
@@ -29122,7 +29122,7 @@
mask64 = VEX_HWCAPS_PPC64_V | VEX_HWCAPS_PPC64_FX
| VEX_HWCAPS_PPC64_GX | VEX_HWCAPS_PPC64_VX | VEX_HWCAPS_PPC64_DFP
- | VEX_HWCAPS_PPC64_ISA2_07;
+ | VEX_HWCAPS_PPC64_ISA2_07 | VEX_HWCAPS_PPC64_ISA3_0;
if (mode64) {
vassert((hwcaps_guest & mask32) == 0);
|
|
From: <sv...@va...> - 2017-03-13 17:55:14
|
Author: petarj
Date: Mon Mar 13 17:55:07 2017
New Revision: 16269
Log:
mips: improve emulation of LL/SC
Follow up to VEX r3316.
Related issue KDE #344524.
Patch by Maran Pakkirisamy.
Modified:
trunk/coregrind/m_scheduler/scheduler.c
trunk/memcheck/mc_machine.c
Modified: trunk/coregrind/m_scheduler/scheduler.c
==============================================================================
--- trunk/coregrind/m_scheduler/scheduler.c (original)
+++ trunk/coregrind/m_scheduler/scheduler.c Mon Mar 13 17:55:07 2017
@@ -957,6 +957,10 @@
vg_assert(VG_(in_generated_code) == True);
VG_(in_generated_code) = False;
+#if defined(VGA_mips32) || defined(VGA_mips64)
+ tst->arch.vex.guest_LLaddr = (HWord)(-1);
+#endif
+
if (jumped != (HWord)0) {
/* We get here if the client took a fault that caused our signal
handler to longjmp. */
Modified: trunk/memcheck/mc_machine.c
==============================================================================
--- trunk/memcheck/mc_machine.c (original)
+++ trunk/memcheck/mc_machine.c Mon Mar 13 17:55:07 2017
@@ -1159,6 +1159,9 @@
if (o == GOF(ac2) && sz == 8) return o;
if (o == GOF(ac3) && sz == 8) return o;
+ if (o == GOF(LLaddr) && sz == 4) return -1; /* slot unused */
+ if (o == GOF(LLdata) && sz == 4) return -1; /* slot unused */
+
VG_(printf)("MC_(get_otrack_shadow_offset)(mips)(off=%d,sz=%d)\n",
offset,szB);
tl_assert(0);
@@ -1238,6 +1241,9 @@
if ((o > GOF(NRADDR)) && (o <= GOF(NRADDR) +12 )) return -1;
+ if (o == GOF(LLaddr) && sz == 8) return -1; /* slot unused */
+ if (o == GOF(LLdata) && sz == 8) return -1; /* slot unused */
+
VG_(printf)("MC_(get_otrack_shadow_offset)(mips)(off=%d,sz=%d)\n",
offset,szB);
tl_assert(0);
|