Remove obsolete patches
This commit is contained in:
parent
53f00b17c6
commit
f68a02f93f
129
bz702687.patch
129
bz702687.patch
@ -1,129 +0,0 @@
|
||||
commit fa2e3415185a28542d419a641ecd6cddd52e3cd9
|
||||
Author: Mark Wielaard <mjw@redhat.com>
|
||||
Date: Wed May 11 15:27:48 2011 -0400
|
||||
|
||||
CVE-2011-1781, CVE-2011-1769: correct DW_OP_{mod,div} division-by-zero bug
|
||||
|
||||
Probing a process with corrupted DWARF information, it has been
|
||||
possible to create a kernel-side divison-by-zero. This fixes.
|
||||
|
||||
Handle DW_OP_div/mod divide by zero. DW_OP_mod should work unsigned.
|
||||
|
||||
* loc2c.c (translate): Use helper functions div_op and mod_op for
|
||||
DW_OP_div and DW_OP_mod operands. Set used_deref = true.
|
||||
* translate.cxx (translate_runtime): Emit STAP_MSG_LOC2C_03 define.
|
||||
* runtime/loc2c-runtime.h: Define dwarf_div_op and dwarf_mod_op macros.
|
||||
* runtime/unwind.c (compute_expr): Check for zero before executing
|
||||
DW_OP_mod or DW_OP_div.
|
||||
|
||||
diff --git a/loc2c.c b/loc2c.c
|
||||
index 331090c..5f0dd09 100644
|
||||
--- a/loc2c.c
|
||||
+++ b/loc2c.c
|
||||
@@ -681,7 +681,6 @@ translate (struct location_context *ctx, int indent,
|
||||
UNOP (abs, op_abs);
|
||||
BINOP (and, &);
|
||||
BINOP (minus, -);
|
||||
- BINOP (mod, %);
|
||||
BINOP (mul, *);
|
||||
UNOP (neg, -);
|
||||
UNOP (not, ~);
|
||||
@@ -716,9 +715,21 @@ translate (struct location_context *ctx, int indent,
|
||||
{
|
||||
POP (b);
|
||||
POP (a);
|
||||
- push ("(%s) " STACKFMT " / (%s)" STACKFMT,
|
||||
+ push ("dwarf_div_op((%s) " STACKFMT ", (%s) " STACKFMT ")",
|
||||
stack_slot_type (loc, true), a,
|
||||
stack_slot_type (loc, true), b);
|
||||
+ used_deref = true;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ case DW_OP_mod:
|
||||
+ {
|
||||
+ POP (b);
|
||||
+ POP (a);
|
||||
+ push ("dwarf_mod_op((%s) " STACKFMT ", (%s) " STACKFMT ")",
|
||||
+ stack_slot_type (loc, false), a,
|
||||
+ stack_slot_type (loc, false), b);
|
||||
+ used_deref = true;
|
||||
break;
|
||||
}
|
||||
|
||||
diff --git a/runtime/loc2c-runtime.h b/runtime/loc2c-runtime.h
|
||||
index d511087..968045f 100644
|
||||
--- a/runtime/loc2c-runtime.h
|
||||
+++ b/runtime/loc2c-runtime.h
|
||||
@@ -82,6 +82,28 @@
|
||||
})
|
||||
#endif
|
||||
|
||||
+/* dwarf_div_op and dwarf_mod_op do division and modulo operations catching any
|
||||
+ divide by zero issues. When they detect div_by_zero they "fault"
|
||||
+ by jumping to the (slightly misnamed) deref_fault label. */
|
||||
+#define dwarf_div_op(a,b) ({ \
|
||||
+ if (b == 0) { \
|
||||
+ snprintf(c->error_buffer, sizeof(c->error_buffer), \
|
||||
+ "divide by zero in DWARF operand (%s)", "DW_OP_div"); \
|
||||
+ c->last_error = c->error_buffer; \
|
||||
+ goto deref_fault; \
|
||||
+ } \
|
||||
+ a / b; \
|
||||
+})
|
||||
+#define dwarf_mod_op(a,b) ({ \
|
||||
+ if (b == 0) { \
|
||||
+ snprintf(c->error_buffer, sizeof(c->error_buffer), \
|
||||
+ "divide by zero in DWARF operand (%s)", "DW_OP_mod"); \
|
||||
+ c->last_error = c->error_buffer; \
|
||||
+ goto deref_fault; \
|
||||
+ } \
|
||||
+ a % b; \
|
||||
+})
|
||||
+
|
||||
/* PR 10601: user-space (user_regset) register access. */
|
||||
#if defined(STAPCONF_REGSET)
|
||||
#include <linux/regset.h>
|
||||
diff --git a/runtime/unwind.c b/runtime/unwind.c
|
||||
index 3e56965..810d9eb 100644
|
||||
--- a/runtime/unwind.c
|
||||
+++ b/runtime/unwind.c
|
||||
@@ -856,12 +856,26 @@ static int compute_expr(const u8 *expr, struct unwind_frame_info *frame,
|
||||
BINOP(plus, +);
|
||||
BINOP(minus, -);
|
||||
BINOP(mul, *);
|
||||
- BINOP(div, /);
|
||||
- BINOP(mod, %);
|
||||
BINOP(shl, <<);
|
||||
BINOP(shra, >>);
|
||||
#undef BINOP
|
||||
|
||||
+ case DW_OP_mod: {
|
||||
+ unsigned long b = POP;
|
||||
+ unsigned long a = POP;
|
||||
+ if (b == 0)
|
||||
+ goto divzero;
|
||||
+ PUSH (a % b);
|
||||
+ }
|
||||
+
|
||||
+ case DW_OP_div: {
|
||||
+ long b = POP;
|
||||
+ long a = POP;
|
||||
+ if (b == 0)
|
||||
+ goto divzero;
|
||||
+ PUSH (a / b);
|
||||
+ }
|
||||
+
|
||||
case DW_OP_shr: {
|
||||
unsigned long b = POP;
|
||||
unsigned long a = POP;
|
||||
@@ -944,6 +958,9 @@ overflow:
|
||||
underflow:
|
||||
_stp_warn("DWARF expression stack underflow in CFI\n");
|
||||
return 1;
|
||||
+divzero:
|
||||
+ _stp_warn("DWARF expression stack divide by zero in CFI\n");
|
||||
+ return 1;
|
||||
|
||||
#undef NEED
|
||||
#undef PUSH
|
@ -1,20 +0,0 @@
|
||||
commit b30b7ed14e6734e0b5b216729aad0e465412c4b1
|
||||
Author: Lukas Berk <lberk@redhat.com>
|
||||
Date: Mon Jan 24 12:09:29 2011 -0500
|
||||
|
||||
adding #ifdef CLONE_STOPPED to stop module compilation error
|
||||
|
||||
diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp
|
||||
index e9a9750..25ca345 100644
|
||||
--- a/tapset/aux_syscalls.stp
|
||||
+++ b/tapset/aux_syscalls.stp
|
||||
@@ -1616,7 +1616,9 @@ static const _stp_val_array const _stp_fork_list[] = {
|
||||
V(CLONE_DETACHED),
|
||||
V(CLONE_UNTRACED),
|
||||
V(CLONE_CHILD_SETTID),
|
||||
+#ifdef CLONE_STOPPED
|
||||
V(CLONE_STOPPED),
|
||||
+#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
|
||||
V(CLONE_NEWUTS),
|
||||
V(CLONE_NEWIPC),
|
@ -1,110 +0,0 @@
|
||||
commit 5d8a0aeabbbf3d2e4d0a6c51e6ca9b6d9446c8a0
|
||||
Author: Frank Ch. Eigler <fche@redhat.com>
|
||||
Date: Mon Jan 24 13:30:04 2011 -0500
|
||||
|
||||
GCC 4.6 unused-variable warnings
|
||||
|
||||
We set a couple of variables that later code doesn't use. GCC 4.6
|
||||
warns about them, which our C*FLAGS=-Werror turned into a build failure.
|
||||
Worked around these by adding a (void) var; to add a dummy use.
|
||||
|
||||
diff --git a/grapher/grapher.cxx b/grapher/grapher.cxx
|
||||
index 0111184..87489af 100644
|
||||
--- a/grapher/grapher.cxx
|
||||
+++ b/grapher/grapher.cxx
|
||||
@@ -72,11 +72,13 @@ extern "C"
|
||||
strerror_r(errno, errbuf, sizeof(errbuf));
|
||||
err = write(STDERR_FILENO, errbuf, strlen(errbuf));
|
||||
err = write(STDERR_FILENO, "\n", 1);
|
||||
+ (void) err; /* XXX: notused */
|
||||
return;
|
||||
}
|
||||
else if (childInfo.pid > 0)
|
||||
{
|
||||
err = write(signalPipe[1], &childInfo, sizeof(childInfo));
|
||||
+ (void) err; /* XXX: notused */
|
||||
}
|
||||
else
|
||||
return;
|
||||
diff --git a/runtime/staprun/common.c b/runtime/staprun/common.c
|
||||
index 4fbc9e5..99026fb 100644
|
||||
--- a/runtime/staprun/common.c
|
||||
+++ b/runtime/staprun/common.c
|
||||
@@ -399,6 +399,7 @@ static void fatal_handler (int signum)
|
||||
rc = write (STDERR_FILENO, ERR_MSG, sizeof(ERR_MSG));
|
||||
rc = write (STDERR_FILENO, str, strlen(str));
|
||||
rc = write (STDERR_FILENO, "\n", 1);
|
||||
+ (void) rc; /* notused */
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c
|
||||
index 2733c2e..1514969 100644
|
||||
--- a/runtime/staprun/mainloop.c
|
||||
+++ b/runtime/staprun/mainloop.c
|
||||
@@ -60,6 +60,7 @@ static void chld_proc(int signum)
|
||||
return;
|
||||
// send STP_EXIT
|
||||
rc = write(control_channel, &btype, sizeof(btype));
|
||||
+ (void) rc; /* XXX: notused */
|
||||
}
|
||||
|
||||
#if WORKAROUND_BZ467568
|
||||
@@ -622,6 +623,7 @@ int stp_main_loop(void)
|
||||
dbug(2, "got STP_REQUEST_EXIT\n");
|
||||
int32_t rc, btype = STP_EXIT;
|
||||
rc = write(control_channel, &btype, sizeof(btype));
|
||||
+ (void) rc; /* XXX: notused */
|
||||
break;
|
||||
}
|
||||
case STP_START:
|
||||
diff --git a/tapsets.cxx b/tapsets.cxx
|
||||
index b141921..4daae5e 100644
|
||||
--- a/tapsets.cxx
|
||||
+++ b/tapsets.cxx
|
||||
@@ -5341,7 +5341,6 @@ sdt_query::handle_probe_entry()
|
||||
probe *new_base = convert_location();
|
||||
probe_point *new_location = new_base->locations[0];
|
||||
|
||||
- bool kprobe_found = false;
|
||||
bool need_debug_info = false;
|
||||
|
||||
Dwarf_Addr bias;
|
||||
@@ -5351,7 +5350,6 @@ sdt_query::handle_probe_entry()
|
||||
if (have_kprobe())
|
||||
{
|
||||
convert_probe(new_base);
|
||||
- kprobe_found = true;
|
||||
// Expand the local variables in the probe body
|
||||
sdt_kprobe_var_expanding_visitor svv (module_val,
|
||||
provider_name,
|
||||
@@ -7726,13 +7724,15 @@ hwbkpt_builder::build(systemtap_session & sess,
|
||||
"",len,0,
|
||||
has_write,
|
||||
has_rw));
|
||||
- else // has symbol_str
|
||||
+ else if (has_symbol_str)
|
||||
finished_results.push_back (new hwbkpt_derived_probe (base,
|
||||
location,
|
||||
0,
|
||||
symbol_str_val,len,0,
|
||||
has_write,
|
||||
has_rw));
|
||||
+ else
|
||||
+ assert (0);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
diff --git a/translate.cxx b/translate.cxx
|
||||
index e5038f9..82f3ee4 100644
|
||||
--- a/translate.cxx
|
||||
+++ b/translate.cxx
|
||||
@@ -4447,6 +4447,8 @@ c_unparser::visit_print_format (print_format* e)
|
||||
if (components[i].prectype == print_format::prec_dynamic)
|
||||
prec_ix = arg_ix++;
|
||||
|
||||
+ (void) width_ix; /* XXX: notused */
|
||||
+
|
||||
/* %m and %M need special care for digging into memory. */
|
||||
if (components[i].type == print_format::conv_memory
|
||||
|| components[i].type == print_format::conv_memory_hex)
|
@ -1,365 +0,0 @@
|
||||
commit 46a94997388279d381e38a675411b99a202f339d
|
||||
Author: Stan Cox <scox@redhat.com>
|
||||
Date: Wed Jan 19 07:09:01 2011 -0500
|
||||
|
||||
Switch to using a register width table instead of heuristic code.
|
||||
|
||||
* tapsets.cxx (sdt_uprobe_var_expanding_visitor): Add DRI and regwidths.
|
||||
Change dwarf_regs to be a regname/regwidth pair. Change initializer.
|
||||
* (sdt_uprobe_var_expanding_visitor::visit_target_symbol): Use it.
|
||||
|
||||
|
||||
commit 9920f642a45f6425959bdf857543c90f2fcfd1e3
|
||||
Author: Stan Cox <scox@redhat.com>
|
||||
Date: Wed Jan 19 15:52:14 2011 -0500
|
||||
|
||||
Allow sdt to avoid application defined min/max macros.
|
||||
|
||||
* sdt.h: Surround limits inclusion with push_macro and pop_macro.
|
||||
|
||||
|
||||
commit ae1418f00b0bd242fbf169813be5800609d36892
|
||||
Author: Frank Ch. Eigler <fche@redhat.com>
|
||||
Date: Wed Jan 19 08:20:22 2011 -0500
|
||||
|
||||
PR12411 cont'd: use enum type decl
|
||||
|
||||
* tapsets.cxx (sdt_uprobe_var_expanding_visitor): Make regwidths
|
||||
an enum type decl, not an anonymous-enum-typed variable. Move
|
||||
DRI macro #define/#undef just around its use.
|
||||
|
||||
|
||||
diff --git a/tapsets.cxx b/tapsets.cxx
|
||||
index 23a5df2..b141921 100644
|
||||
--- a/tapsets.cxx
|
||||
+++ b/tapsets.cxx
|
||||
@@ -4650,6 +4650,7 @@ struct sdt_kprobe_var_expanding_visitor: public var_expanding_visitor
|
||||
|
||||
struct sdt_uprobe_var_expanding_visitor: public var_expanding_visitor
|
||||
{
|
||||
+ enum regwidths {QI, QIh, HI, SI, DI};
|
||||
sdt_uprobe_var_expanding_visitor(systemtap_session& s,
|
||||
int elf_machine,
|
||||
const string & process_name,
|
||||
@@ -4665,66 +4666,139 @@ struct sdt_uprobe_var_expanding_visitor: public var_expanding_visitor
|
||||
/* Register name mapping table depends on the elf machine of this particular
|
||||
probe target process/file, not upon the host. So we can't just
|
||||
#ifdef _i686_ etc. */
|
||||
+
|
||||
+#define DRI(name,num,width) dwarf_regs[name]=make_pair(num,width)
|
||||
if (elf_machine == EM_X86_64) {
|
||||
- dwarf_regs["%rax"] = dwarf_regs["%eax"] = dwarf_regs["%ax"] = dwarf_regs["%al"] = dwarf_regs["%ah"] = 0;
|
||||
- dwarf_regs["%rdx"] = dwarf_regs["%edx"] = dwarf_regs["%dx"] = dwarf_regs["%dl"] = dwarf_regs["%dh"] = 1;
|
||||
- dwarf_regs["%rcx"] = dwarf_regs["%ecx"] = dwarf_regs["%cx"] = dwarf_regs["%cl"] = dwarf_regs["%ch"] = 2;
|
||||
- dwarf_regs["%rbx"] = dwarf_regs["%ebx"] = dwarf_regs["%bx"] = dwarf_regs["%bl"] = dwarf_regs["%bh"] = 3;
|
||||
- dwarf_regs["%rsi"] = dwarf_regs["%esi"] = dwarf_regs["%si"] = dwarf_regs["%sil"] = 4;
|
||||
- dwarf_regs["%rdi"] = dwarf_regs["%edi"] = dwarf_regs["%di"] = dwarf_regs["%dil"] = 5;
|
||||
- dwarf_regs["%rbp"] = dwarf_regs["%ebp"] = dwarf_regs["%bp"] = 6;
|
||||
- dwarf_regs["%rsp"] = dwarf_regs["%esp"] = dwarf_regs["%sp"] = 7;
|
||||
- dwarf_regs["%r8"] = dwarf_regs["%r8d"] = dwarf_regs["%r8w"] = dwarf_regs["%r8b"] = 8;
|
||||
- dwarf_regs["%r9"] = dwarf_regs["%r9d"] = dwarf_regs["%r9w"] = dwarf_regs["%r9b"] = 9;
|
||||
- dwarf_regs["%r10"] = dwarf_regs["%r10d"] = dwarf_regs["%r10w"] = dwarf_regs["%r10b"] = 10;
|
||||
- dwarf_regs["%r11"] = dwarf_regs["%r11d"] = dwarf_regs["%r11w"] = dwarf_regs["%r11b"] = 11;
|
||||
- dwarf_regs["%r12"] = dwarf_regs["%r12d"] = dwarf_regs["%r12w"] = dwarf_regs["%r12b"] = 12;
|
||||
- dwarf_regs["%r13"] = dwarf_regs["%r13d"] = dwarf_regs["%r13w"] = dwarf_regs["%r13b"] = 13;
|
||||
- dwarf_regs["%r14"] = dwarf_regs["%r14d"] = dwarf_regs["%r14w"] = dwarf_regs["%r14b"] = 14;
|
||||
- dwarf_regs["%r15"] = dwarf_regs["%r15d"] = dwarf_regs["%r15w"] = dwarf_regs["%r15b"] = 15;
|
||||
+ DRI ("%rax", 0, DI); DRI ("%eax", 0, SI); DRI ("%ax", 0, HI);
|
||||
+ DRI ("%al", 0, QI); DRI ("%ah", 0, QIh);
|
||||
+ DRI ("%rdx", 1, DI); DRI ("%edx", 1, SI); DRI ("%dx", 1, HI);
|
||||
+ DRI ("%dl", 1, QI); DRI ("%dh", 1, QIh);
|
||||
+ DRI ("%rcx", 2, DI); DRI ("%ecx", 2, SI); DRI ("%cx", 2, HI);
|
||||
+ DRI ("%cl", 2, QI); DRI ("%ch", 2, QIh);
|
||||
+ DRI ("%rbx", 3, DI); DRI ("%ebx", 3, SI); DRI ("%bx", 3, HI);
|
||||
+ DRI ("%bl", 3, QI); DRI ("%bh", 3, QIh);
|
||||
+ DRI ("%rsi", 4, DI); DRI ("%esi", 4, SI); DRI ("%si", 4, HI);
|
||||
+ DRI ("%sil", 4, QI);
|
||||
+ DRI ("%rdi", 5, DI); DRI ("%edi", 5, SI); DRI ("%di", 5, HI);
|
||||
+ DRI ("%dil", 5, QI);
|
||||
+ DRI ("%rbp", 6, DI); DRI ("%ebp", 6, SI); DRI ("%bp", 6, HI);
|
||||
+ DRI ("%rsp", 7, DI); DRI ("%esp", 7, SI); DRI ("%sp", 7, HI);
|
||||
+ DRI ("%r8", 8, DI); DRI ("%r8d", 8, SI); DRI ("%r8w", 8, HI);
|
||||
+ DRI ("%r8b", 8, QI);
|
||||
+ DRI ("%r9", 9, DI); DRI ("%r9d", 9, SI); DRI ("%r9w", 9, HI);
|
||||
+ DRI ("%r9b", 9, QI);
|
||||
+ DRI ("%r10", 10, DI); DRI ("%r10d", 10, SI); DRI ("%r10w", 10, HI);
|
||||
+ DRI ("%r10b", 10, QI);
|
||||
+ DRI ("%r11", 11, DI); DRI ("%r11d", 11, SI); DRI ("%r11w", 11, HI);
|
||||
+ DRI ("%r11b", 11, QI);
|
||||
+ DRI ("%r12", 12, DI); DRI ("%r12d", 12, SI); DRI ("%r12w", 12, HI);
|
||||
+ DRI ("%r12b", 12, QI);
|
||||
+ DRI ("%r13", 13, DI); DRI ("%r13d", 13, SI); DRI ("%r13w", 13, HI);
|
||||
+ DRI ("%r13b", 13, QI);
|
||||
+ DRI ("%r14", 14, DI); DRI ("%r14d", 14, SI); DRI ("%r14w", 14, HI);
|
||||
+ DRI ("%r14b", 14, QI);
|
||||
+ DRI ("%r15", 15, DI); DRI ("%r15d", 15, SI); DRI ("%r15w", 15, HI);
|
||||
+ DRI ("%r15b", 15, QI);
|
||||
} else if (elf_machine == EM_386) {
|
||||
- dwarf_regs["%eax"] = dwarf_regs["%ax"] = dwarf_regs["%al"] = dwarf_regs["%ah"] = 0;
|
||||
- dwarf_regs["%ecx"] = dwarf_regs["%cx"] = dwarf_regs["%cl"] = dwarf_regs["%ch"] = 1;
|
||||
- dwarf_regs["%edx"] = dwarf_regs["%dx"] = dwarf_regs["%dl"] = dwarf_regs["%dh"] = 2;
|
||||
- dwarf_regs["%ebx"] = dwarf_regs["%bx"] = dwarf_regs["%bl"] = dwarf_regs["%bh"] = 3;
|
||||
- dwarf_regs["%esp"] = dwarf_regs["%sp"] = 4;
|
||||
- dwarf_regs["%ebp"] = dwarf_regs["%bp"] = 5;
|
||||
- dwarf_regs["%esi"] = dwarf_regs["%si"] = dwarf_regs["%sil"] = 6;
|
||||
- dwarf_regs["%edi"] = dwarf_regs["%di"] = dwarf_regs["%dil"] = 7;
|
||||
+ DRI ("%eax", 0, SI); DRI ("%ax", 0, HI); DRI ("%al", 0, QI);
|
||||
+ DRI ("%ah", 0, QIh);
|
||||
+ DRI ("%ecx", 1, SI); DRI ("%cx", 1, HI); DRI ("%cl", 1, QI);
|
||||
+ DRI ("%ch", 1, QIh);
|
||||
+ DRI ("%edx", 2, SI); DRI ("%dx", 2, HI); DRI ("%dl", 2, QI);
|
||||
+ DRI ("%dh", 2, QIh);
|
||||
+ DRI ("%ebx", 3, SI); DRI ("%bx", 3, HI); DRI ("%bl", 3, QI);
|
||||
+ DRI ("%bh", 3, QIh);
|
||||
+ DRI ("%esp", 4, SI); DRI ("%sp", 4, HI);
|
||||
+ DRI ("%ebp", 5, SI); DRI ("%bp", 5, HI);
|
||||
+ DRI ("%esi", 6, SI); DRI ("%si", 6, HI); DRI ("%sil", 6, QI);
|
||||
+ DRI ("%edi", 7, SI); DRI ("%di", 7, HI); DRI ("%dil", 7, QI);
|
||||
} else if (elf_machine == EM_PPC || elf_machine == EM_PPC64) {
|
||||
- dwarf_regs["%r0"] = 0; dwarf_regs["%r1"] = 1; dwarf_regs["%r2"] = 2;
|
||||
- dwarf_regs["%r3"] = 3; dwarf_regs["%r4"] = 4; dwarf_regs["%r5"] = 5;
|
||||
- dwarf_regs["%r6"] = 6; dwarf_regs["%r7"] = 7; dwarf_regs["%r8"] = 8;
|
||||
- dwarf_regs["%r9"] = 9; dwarf_regs["%r10"] = 10; dwarf_regs["%r11"] = 11;
|
||||
- dwarf_regs["%r12"] = 12; dwarf_regs["%r13"] = 13; dwarf_regs["%r14"] = 14;
|
||||
- dwarf_regs["%r15"] = 15; dwarf_regs["%r16"] = 16; dwarf_regs["%r17"] = 17;
|
||||
- dwarf_regs["%r18"] = 18; dwarf_regs["%r19"] = 19; dwarf_regs["%r20"] = 20;
|
||||
- dwarf_regs["%r21"] = 21; dwarf_regs["%r22"] = 22; dwarf_regs["%r23"] = 23;
|
||||
- dwarf_regs["%r24"] = 24; dwarf_regs["%r25"] = 25; dwarf_regs["%r26"] = 26;
|
||||
- dwarf_regs["%r27"] = 27; dwarf_regs["%r28"] = 28; dwarf_regs["%r29"] = 29;
|
||||
- dwarf_regs["%r30"] = 30; dwarf_regs["%r31"] = 31;
|
||||
+ DRI ("%r0", 0, DI);
|
||||
+ DRI ("%r1", 1, DI);
|
||||
+ DRI ("%r2", 2, DI);
|
||||
+ DRI ("%r3", 3, DI);
|
||||
+ DRI ("%r4", 4, DI);
|
||||
+ DRI ("%r5", 5, DI);
|
||||
+ DRI ("%r6", 6, DI);
|
||||
+ DRI ("%r7", 7, DI);
|
||||
+ DRI ("%r8", 8, DI);
|
||||
+ DRI ("%r9", 9, DI);
|
||||
+ DRI ("%r10", 10, DI);
|
||||
+ DRI ("%r11", 11, DI);
|
||||
+ DRI ("%r12", 12, DI);
|
||||
+ DRI ("%r13", 13, DI);
|
||||
+ DRI ("%r14", 14, DI);
|
||||
+ DRI ("%r15", 15, DI);
|
||||
+ DRI ("%r16", 16, DI);
|
||||
+ DRI ("%r17", 17, DI);
|
||||
+ DRI ("%r18", 18, DI);
|
||||
+ DRI ("%r19", 19, DI);
|
||||
+ DRI ("%r20", 20, DI);
|
||||
+ DRI ("%r21", 21, DI);
|
||||
+ DRI ("%r22", 22, DI);
|
||||
+ DRI ("%r23", 23, DI);
|
||||
+ DRI ("%r24", 24, DI);
|
||||
+ DRI ("%r25", 25, DI);
|
||||
+ DRI ("%r26", 26, DI);
|
||||
+ DRI ("%r27", 27, DI);
|
||||
+ DRI ("%r28", 28, DI);
|
||||
+ DRI ("%r29", 29, DI);
|
||||
+ DRI ("%r30", 30, DI);
|
||||
+ DRI ("%r31", 31, DI);
|
||||
// PR11821: unadorned register "names" without -mregnames
|
||||
- dwarf_regs["0"] = 0; dwarf_regs["1"] = 1; dwarf_regs["2"] = 2;
|
||||
- dwarf_regs["3"] = 3; dwarf_regs["4"] = 4; dwarf_regs["5"] = 5;
|
||||
- dwarf_regs["6"] = 6; dwarf_regs["7"] = 7; dwarf_regs["8"] = 8;
|
||||
- dwarf_regs["9"] = 9; dwarf_regs["10"] = 10; dwarf_regs["11"] = 11;
|
||||
- dwarf_regs["12"] = 12; dwarf_regs["13"] = 13; dwarf_regs["14"] = 14;
|
||||
- dwarf_regs["15"] = 15; dwarf_regs["16"] = 16; dwarf_regs["17"] = 17;
|
||||
- dwarf_regs["18"] = 18; dwarf_regs["19"] = 19; dwarf_regs["20"] = 20;
|
||||
- dwarf_regs["21"] = 21; dwarf_regs["22"] = 22; dwarf_regs["23"] = 23;
|
||||
- dwarf_regs["24"] = 24; dwarf_regs["25"] = 25; dwarf_regs["26"] = 26;
|
||||
- dwarf_regs["27"] = 27; dwarf_regs["28"] = 28; dwarf_regs["29"] = 29;
|
||||
- dwarf_regs["30"] = 30; dwarf_regs["31"] = 31;
|
||||
+ DRI ("0", 0, DI);
|
||||
+ DRI ("1", 1, DI);
|
||||
+ DRI ("2", 2, DI);
|
||||
+ DRI ("3", 3, DI);
|
||||
+ DRI ("4", 4, DI);
|
||||
+ DRI ("5", 5, DI);
|
||||
+ DRI ("6", 6, DI);
|
||||
+ DRI ("7", 7, DI);
|
||||
+ DRI ("8", 8, DI);
|
||||
+ DRI ("9", 9, DI);
|
||||
+ DRI ("10", 10, DI);
|
||||
+ DRI ("11", 11, DI);
|
||||
+ DRI ("12", 12, DI);
|
||||
+ DRI ("13", 13, DI);
|
||||
+ DRI ("14", 14, DI);
|
||||
+ DRI ("15", 15, DI);
|
||||
+ DRI ("16", 16, DI);
|
||||
+ DRI ("17", 17, DI);
|
||||
+ DRI ("18", 18, DI);
|
||||
+ DRI ("19", 19, DI);
|
||||
+ DRI ("20", 20, DI);
|
||||
+ DRI ("21", 21, DI);
|
||||
+ DRI ("22", 22, DI);
|
||||
+ DRI ("23", 23, DI);
|
||||
+ DRI ("24", 24, DI);
|
||||
+ DRI ("25", 25, DI);
|
||||
+ DRI ("26", 26, DI);
|
||||
+ DRI ("27", 27, DI);
|
||||
+ DRI ("28", 28, DI);
|
||||
+ DRI ("29", 29, DI);
|
||||
+ DRI ("30", 30, DI);
|
||||
+ DRI ("31", 31, DI);
|
||||
} else if (elf_machine == EM_S390) {
|
||||
- dwarf_regs["%r0"] = 0; dwarf_regs["%r1"] = 1; dwarf_regs["%r2"] = 2;
|
||||
- dwarf_regs["%r3"] = 3; dwarf_regs["%r4"] = 4; dwarf_regs["%r5"] = 5;
|
||||
- dwarf_regs["%r6"] = 6; dwarf_regs["%r7"] = 7; dwarf_regs["%r8"] = 8;
|
||||
- dwarf_regs["%r9"] = 9; dwarf_regs["%r10"] = 10; dwarf_regs["%r11"] = 11;
|
||||
- dwarf_regs["%r12"] = 12; dwarf_regs["%r13"] = 13; dwarf_regs["%r14"] = 14;
|
||||
- dwarf_regs["%r15"] = 15;
|
||||
+ DRI ("%r0", 0, DI);
|
||||
+ DRI ("%r1", 1, DI);
|
||||
+ DRI ("%r2", 2, DI);
|
||||
+ DRI ("%r3", 3, DI);
|
||||
+ DRI ("%r4", 4, DI);
|
||||
+ DRI ("%r5", 5, DI);
|
||||
+ DRI ("%r6", 6, DI);
|
||||
+ DRI ("%r7", 7, DI);
|
||||
+ DRI ("%r8", 8, DI);
|
||||
+ DRI ("%r9", 9, DI);
|
||||
+ DRI ("%r10", 10, DI);
|
||||
+ DRI ("%r11", 11, DI);
|
||||
+ DRI ("%r12", 12, DI);
|
||||
+ DRI ("%r13", 13, DI);
|
||||
+ DRI ("%r14", 14, DI);
|
||||
+ DRI ("%r15", 15, DI);
|
||||
} else if (arg_count) {
|
||||
/* permit this case; just fall back to dwarf */
|
||||
}
|
||||
+#undef DRI
|
||||
|
||||
need_debug_info = false;
|
||||
tokenize(arg_string, arg_tokens, " ");
|
||||
@@ -4739,11 +4813,10 @@ struct sdt_uprobe_var_expanding_visitor: public var_expanding_visitor
|
||||
stap_sdt_probe_type probe_type;
|
||||
unsigned arg_count;
|
||||
vector<string> arg_tokens;
|
||||
- map<string,int> dwarf_regs;
|
||||
+ map<string, pair<unsigned,int> > dwarf_regs;
|
||||
bool need_debug_info;
|
||||
|
||||
void visit_target_symbol (target_symbol* e);
|
||||
- __uint64_t get_register_width (string);
|
||||
};
|
||||
|
||||
|
||||
@@ -4884,7 +4957,7 @@ sdt_uprobe_var_expanding_visitor::visit_target_symbol (target_symbol *e)
|
||||
// Build regex pieces out of the known dwarf_regs. We keep two separate
|
||||
// lists: ones with the % prefix (and thus unambigiuous even despite PR11821),
|
||||
// and ones with no prefix (and thus only usable in unambiguous contexts).
|
||||
- for (map<string,int>::iterator ri = dwarf_regs.begin(); ri != dwarf_regs.end(); ri++)
|
||||
+ for (map<string,pair<unsigned,int> >::iterator ri = dwarf_regs.begin(); ri != dwarf_regs.end(); ri++)
|
||||
{
|
||||
string regname = ri->first;
|
||||
assert (regname != "");
|
||||
@@ -4905,15 +4978,16 @@ sdt_uprobe_var_expanding_visitor::visit_target_symbol (target_symbol *e)
|
||||
if (! rc)
|
||||
{
|
||||
string regname = matches[1];
|
||||
- if (dwarf_regs.find (regname) != dwarf_regs.end()) // known register
|
||||
+ map<string,pair<unsigned,int> >::iterator ri = dwarf_regs.find (regname);
|
||||
+ if (ri != dwarf_regs.end()) // known register
|
||||
{
|
||||
embedded_expr *get_arg1 = new embedded_expr;
|
||||
string width_adjust;
|
||||
- switch (get_register_width (regname))
|
||||
+ switch (ri->second.second)
|
||||
{
|
||||
- case 0xff: width_adjust = ") & 0xff"; break;
|
||||
- case 0xff00: width_adjust = ">>8) & 0xff"; break;
|
||||
- case 0xffff:
|
||||
+ case QI: width_adjust = ") & 0xff"; break;
|
||||
+ case QIh: width_adjust = ">>8) & 0xff"; break;
|
||||
+ case HI:
|
||||
// preserve 16 bit register signness
|
||||
width_adjust = (precision > 0) ? ") & 0xffff" : ")";
|
||||
break;
|
||||
@@ -4927,7 +5001,7 @@ sdt_uprobe_var_expanding_visitor::visit_target_symbol (target_symbol *e)
|
||||
+ (is_user_module (process_name)
|
||||
? string("u_fetch_register(")
|
||||
: string("k_fetch_register("))
|
||||
- + lex_cast(dwarf_regs[regname]) + string("))")
|
||||
+ + lex_cast(dwarf_regs[regname].first) + string("))")
|
||||
+ width_adjust;
|
||||
argexpr = get_arg1;
|
||||
goto matched;
|
||||
@@ -4968,7 +5042,7 @@ sdt_uprobe_var_expanding_visitor::visit_target_symbol (target_symbol *e)
|
||||
+ (is_user_module (process_name)
|
||||
? string("u_fetch_register(")
|
||||
: string("k_fetch_register("))
|
||||
- + lex_cast(dwarf_regs[regname]) + string(")");
|
||||
+ + lex_cast(dwarf_regs[regname].first) + string(")");
|
||||
// XXX: may we ever need to cast that to a narrower type?
|
||||
|
||||
literal_number* inc = new literal_number(disp);
|
||||
@@ -5051,31 +5125,6 @@ sdt_uprobe_var_expanding_visitor::visit_target_symbol (target_symbol *e)
|
||||
}
|
||||
|
||||
|
||||
-__uint64_t
|
||||
-sdt_uprobe_var_expanding_visitor::get_register_width (string regname)
|
||||
-{
|
||||
- if (elf_machine == EM_X86_64 || elf_machine == EM_386) {
|
||||
- int regno = dwarf_regs.find (regname)->second;
|
||||
- // al,bl,cl,dl
|
||||
- if (regno < 4 && regname[2] == 'l') return 0xff;
|
||||
- // ah,bh,ch,dh
|
||||
- else if (regno < 4 && regname[2] == 'h') return 0xff00;
|
||||
- // ax,bx,cx,dx
|
||||
- else if (regno < 4 && regname[2] == 'x') return 0xffff;
|
||||
- // sil,dil,bpl,spl
|
||||
- else if (regno < 8 && regname.rfind('l') != regname.npos) return 0xff; // sil
|
||||
- // si,di,bp,sp
|
||||
- else if (regno < 8 && regname.length() == 3) return 0xffff; // si
|
||||
- // r8b-r15b
|
||||
- else if (regno < 16 && regname.rfind('b') != regname.npos) return 0xff; // r8b
|
||||
- // r8w-r15w
|
||||
- else if (regno < 16 && regname.rfind('w') != regname.npos) return 0xffff; // r8w
|
||||
- else return 0xffffffff;
|
||||
- }
|
||||
- else return 0xffffffff;
|
||||
-}
|
||||
-
|
||||
-
|
||||
void
|
||||
sdt_kprobe_var_expanding_visitor::visit_target_symbol (target_symbol *e)
|
||||
{
|
||||
diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h
|
||||
index e878e17..d6eff49 100644
|
||||
--- a/includes/sys/sdt.h
|
||||
+++ b/includes/sys/sdt.h
|
||||
@@ -1,5 +1,5 @@
|
||||
/* <sys/sdt.h> - Systemtap static probe definition macros.
|
||||
- Copyright (C) 2010 Red Hat Inc.
|
||||
+ Copyright (C) 2010-2011 Red Hat Inc.
|
||||
|
||||
This file is part of systemtap, and is free software in the public domain.
|
||||
*/
|
||||
@@ -61,9 +61,24 @@
|
||||
? sizeof (void *) : sizeof (x))
|
||||
# define _SDT_ARGVAL(x) (x)
|
||||
|
||||
+/* The C++ <limits> header uses the names 'min' and 'max' and conflicts
|
||||
+ with any application-defined macros by these names. In GCC 4.3 and
|
||||
+ later, we can hack around this problem with new #pragma magic. */
|
||||
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
|
||||
+ #pragma push_macro("min")
|
||||
+ #pragma push_macro("max")
|
||||
+# undef min
|
||||
+# undef max
|
||||
+# endif
|
||||
+
|
||||
# include <cstddef>
|
||||
# include <limits>
|
||||
|
||||
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
|
||||
+ #pragma pop_macro("min")
|
||||
+ #pragma pop_macro("max")
|
||||
+# endif
|
||||
+
|
||||
template<typename __sdt_T>
|
||||
struct __sdt_type
|
||||
{
|
Loading…
Reference in New Issue
Block a user