Skip to content

Commit 6198526

Browse files
committed
818* dtrace.c: dtrace_probe: When checking for Xen probes with
interrupts disabled, be careful of deref of null ptr.
1 parent 4e3dbfa commit 6198526

10 files changed

Lines changed: 80 additions & 28 deletions

File tree

.release

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
date=Fri Mar 1 21:53:37 GMT 2013
2-
release=dtrace-20130301
3-
build=448
1+
date=Wed Mar 6 22:49:59 GMT 2013
2+
release=dtrace-20130306
3+
build=449

Changes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Wed Mar 6 22:49:14 2013 fox
2+
3+
818* dtrace.c: dtrace_probe: When checking for Xen probes with
4+
interrupts disabled, be careful of deref of null ptr.
5+
16
Fri Mar 1 21:53:13 2013 fox
27

38
817* linux/sys/regset.h: Fix for i386 build after rearranging for

driver/Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,17 @@ EXTRA_CFLAGS += -g \
8787
# 20110415 We are moving this to tools/mkport.pl and build/port.h #
8888
# since OpenSuse is proving challenging to keep nice and simple. #
8989
######################################################################
90-
EXTRA_CFLAGS += $(shell test -f include/asm/kdebug.h && echo -DHAVE_INCLUDE_ASM_KDEBUG_H)
91-
EXTRA_CFLAGS += $(shell test -f include/linux/kdebug.h && echo -DHAVE_INCLUDE_LINUX_KDEBUG_H)
92-
EXTRA_CFLAGS += $(shell test -f include/linux/hrtimer.h && echo -DHAVE_INCLUDE_LINUX_HRTIMER_H)
93-
EXTRA_CFLAGS += $(shell test -f include/linux/mutex.h && echo -DHAVE_INCLUDE_LINUX_MUTEX_H)
94-
EXTRA_CFLAGS += $(shell test -f include/asm/mutex.h && echo -DHAVE_INCLUDE_ASM_MUTEX_H)
95-
EXTRA_CFLAGS += $(shell test -f include/linux/stacktrace.h && echo -DHAVE_INCLUDE_LINUX_STACKTRACE_H)
96-
EXTRA_CFLAGS += $(shell test -f include/asm/stacktrace.h && echo -DHAVE_INCLUDE_ASM_STACKTRACE_H)
97-
EXTRA_CFLAGS += $(shell test -f include/linux/semaphore.h && echo -DHAVE_INCLUDE_LINUX_SEMAPHORE_H)
98-
EXTRA_CFLAGS += $(shell test -f include/asm/semaphore.h && echo -DHAVE_INCLUDE_ASM_SEMAPHORE_H)
99-
EXTRA_CFLAGS += $(shell test -f include/asm/msr-index.h && echo -DHAVE_INCLUDE_ASM_MSR_INDEX_H)
100-
EXTRA_CFLAGS += $(shell grep -s atomic.*count include/*/semaphore*.h >/dev/null && echo -DHAVE_SEMAPHORE_ATOMIC_COUNT)
90+
#EXTRA_CFLAGS += $(shell test -f include/asm/kdebug.h && echo -DHAVE_INCLUDE_ASM_KDEBUG_H)
91+
#EXTRA_CFLAGS += $(shell test -f include/linux/kdebug.h && echo -DHAVE_INCLUDE_LINUX_KDEBUG_H)
92+
#EXTRA_CFLAGS += $(shell test -f include/linux/hrtimer.h && echo -DHAVE_INCLUDE_LINUX_HRTIMER_H)
93+
#EXTRA_CFLAGS += $(shell test -f include/linux/mutex.h && echo -DHAVE_INCLUDE_LINUX_MUTEX_H)
94+
#EXTRA_CFLAGS += $(shell test -f include/asm/mutex.h && echo -DHAVE_INCLUDE_ASM_MUTEX_H)
95+
#EXTRA_CFLAGS += $(shell test -f include/linux/stacktrace.h && echo -DHAVE_INCLUDE_LINUX_STACKTRACE_H)
96+
#EXTRA_CFLAGS += $(shell test -f include/asm/stacktrace.h && echo -DHAVE_INCLUDE_ASM_STACKTRACE_H)
97+
#EXTRA_CFLAGS += $(shell test -f include/linux/semaphore.h && echo -DHAVE_INCLUDE_LINUX_SEMAPHORE_H)
98+
#EXTRA_CFLAGS += $(shell test -f include/asm/semaphore.h && echo -DHAVE_INCLUDE_ASM_SEMAPHORE_H)
99+
#EXTRA_CFLAGS += $(shell test -f include/asm/msr-index.h && echo -DHAVE_INCLUDE_ASM_MSR_INDEX_H)
100+
#EXTRA_CFLAGS += $(shell grep -s atomic.*count include/*/semaphore*.h >/dev/null && echo -DHAVE_SEMAPHORE_ATOMIC_COUNT)
101101

102102
clean:
103103
rm -rf .tmp_versions *.a *.o *.ko *.bak .*.d .*.cmd *.mod.c Module.* modules.order

driver/dcpc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static void
662662
dcpc_block_interrupts(void)
663663
{
664664
cpu_t *c = cpu_list;
665-
uint8_t *state;
665+
uint32_t *state;
666666

667667
ASSERT(cpu_core[c->cpu_id].cpuc_dcpc_intr_state != DCPC_INTR_INACTIVE);
668668

@@ -1045,7 +1045,7 @@ dcpc_cpu_setup(cpu_setup_t what, processorid_t cpu, void *arg)
10451045
TODO();
10461046
#else
10471047
cpu_t *c;
1048-
uint8_t *state;
1048+
uint32_t *state;
10491049

10501050
ASSERT(MUTEX_HELD(&cpu_lock));
10511051

driver/divmod64.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,37 @@
1717
# define printk printf
1818
# endif
1919

20+
# if defined(__arm__)
21+
/**********************************************************************/
22+
/* Not sure if these two functions are correct, but we can debug */
23+
/* when our printk() invokes this. */
24+
/**********************************************************************/
25+
long long
26+
__wrap___aeabi_ldivmod(long long a, long long b)
27+
{ long long a1 = a;
28+
long long b1 = b;
29+
30+
a1 = do_div(a1, b1);
31+
32+
# if DEBUG
33+
printk("__wrap___aeabi_ldivmod: %lld / %lld = %lld\n", a, b, a1);
34+
# endif
35+
return a1;
36+
}
37+
long long
38+
__wrap___aeabi_uldivmod(unsigned long long a, unsigned long long b)
39+
{ unsigned long long a1 = a;
40+
unsigned long long b1 = b;
41+
42+
a1 = do_div(a1, b1);
43+
44+
# if DEBUG
45+
printk("__wrap___aeabi_uldivmod: %llu / %llu = %llu\n", a, b, a1);
46+
# endif
47+
return a1;
48+
}
49+
# endif /* defined(__arm__) */
50+
2051
long long
2152
__wrap___divdi3(long long a, long long b)
2253
{ long long a1 = a;

driver/dtrace_linux.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,19 @@ typedef enum {
270270
/* Macro to create a function (like ENTRY()) inside an __asm block */
271271
/* in a C function. */
272272
/**********************************************************************/
273-
# define FUNCTION(x) \
274-
".text\n" \
275-
".globl " #x "\n" \
276-
".type " #x ", @function\n" \
277-
#x ":\n"
273+
# if defined(__i386) || defined(__amd64)
274+
# define FUNCTION(x) \
275+
".text\n" \
276+
".globl " #x "\n" \
277+
".type " #x ", @function\n" \
278+
#x ":\n"
279+
# elif defined(__arm__)
280+
# define FUNCTION(x) \
281+
".text\n" \
282+
".global " #x "\n" \
283+
".type " #x ", %function\n" \
284+
#x ":\n"
285+
#endif
278286
# define END_FUNCTION(x) \
279287
".size " #x ", .-" #x "\n"
280288

driver/printf.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ hrtime_str(hrtime_t s)
4242
{ int s1 = s / (1000 * 1000 * 1000);
4343
int s2 = s % (1000 * 1000 * 1000);
4444
int i;
45-
static char buf[32];
46-
static char tmp[32];
45+
static char buf[44];
46+
static char tmp[44];
4747
char *bp = buf;
4848

4949
for (i = 0; ; ) {
@@ -98,7 +98,8 @@ dtrace_kernel_panic(struct notifier_block *this, unsigned long event, void *ptr)
9898
/**********************************************************************/
9999
volatile int dtrace_printf_lock = -1;
100100
# define ADDCH(ch) {dtrace_buf[dbuf_i] = ch; dbuf_i = (dbuf_i + 1) % LOG_BUFSIZ;}
101-
static char tmp[40];
101+
#define MAX_DIGITS 40 /* In case of buggy divmod64.c */
102+
static char tmp[48];
102103

103104
void
104105
dtrace_printf(const char *fmt, ...)
@@ -268,7 +269,7 @@ static hrtime_t hrt0;
268269
ADDCH('-');
269270
n = -n;
270271
}
271-
for (i = 0; i < 40; i++) {
272+
for (i = 0; i < MAX_DIGITS; i++) {
272273
tmp[i] = '0' + (n % 10);
273274
n /= 10;
274275
if (n == 0)
@@ -278,7 +279,7 @@ static hrtime_t hrt0;
278279
ADDCH(tmp[i--]);
279280
break;
280281
case 'p':
281-
#if defined(__i386)
282+
#if defined(__i386) || defined(__arm__)
282283
width = 8;
283284
#else
284285
width = 16;

driver/taskq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
/* come under the CDDL. */
3030
/**********************************************************************/
3131

32+
# if !defined(__arm__)
3233
#define __alloc_workqueue_key local__alloc_workqueue_key
34+
# endif
3335
#define lockdep_init_map local_lockdep_init_map
3436

3537
#include <dtrace_linux.h>

linux/sys/cpuvar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ typedef struct cpu_trap_t {
116116

117117
typedef struct cpu_core {
118118
uint16_t cpuc_dtrace_flags; /* DTrace flags */
119-
uint8_t cpuc_dcpc_intr_state; /* DCPC provider intr state */
119+
uint32_t cpuc_dcpc_intr_state; /* DCPC provider intr state */
120120
uint8_t cpuc_probe_level; /* Avoid reentrancy issues in dtrace_probe */
121121
uint32_t cpuc_this_probe; /* Current probe. */
122122
// spinlock_t cpuc_spinlock;

tools/load.pl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,13 @@ sub main
211211
if ($fh) {
212212
while (<$fh>) {
213213
chomp;
214+
###############################################
215+
# Be careful in case /boot/System file #
216+
# doesnt agree with /proc/kallsyms; only #
217+
# on my hacked system. #
218+
###############################################
214219
my $s = (split(" ", $_))[2];
215-
$syms{$s} = $_;
220+
$syms{$s} = $_ if !defined($syms{$s});
216221
}
217222
}
218223
###############################################

0 commit comments

Comments
 (0)