Re: [3/4] Jumper Probes patch to provide function arguments

From: Andi Kleen
Date: Wed Aug 11 2004 - 11:44:44 EST


Prasanna S Panchamukhi <prasanna@xxxxxxxxxx> writes:

+void jprobe_return(void)
+{
+ preempt_enable_no_resched();
+ asm volatile (" xchgl %%ebx,%%esp \n"
+ " int3 \n"::"b"
+ (jprobe_saved_esp):"memory");
+}

whatever the preempt disable is protecting against, why isn't it a
problem during the xchgl ?

> +#define MAX_STACK_SIZE 64
> +#define MIN_STACK_SIZE(ADDR) ((((ADDR) + MAX_STACK_SIZE) < \
> + (((ADDR) & PAGE_MASK) + PAGE_SIZE) ? ((ADDR) + MAX_STACK_SIZE) \
> + : (((ADDR) & PAGE_MASK) + PAGE_SIZE )) - (ADDR))

What is this macro doing exactly?

If it is an attempt to not read beyond the kernel stack top i think
it is wrong. It will also randomly fail on 8k stacks at top-4K

Use something like

max_t(unsigned long,MAX_STACK_SIZE, current_thread_info() + THREAD_SIZE - addr)


The rest looks ok.

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/