[lkml]   [2012]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [PATCH] uprobes/core: handle breakpoint and signal step exception.
> > 
> > #include <linux/kdebug.h>
> > #include <asm/insn.h>
> >
> > +#ifdef CONFIG_X86_32
> > +#define is_32bit_app(tsk) 1
> > +#else
> > +#define is_32bit_app(tsk) (test_tsk_thread_flag(tsk, TIF_IA32))
> > +#endif
> Small detail, we prefer to use this variant:
> #ifdef X
> # define foo()
> #else
> # define bar()
> #endif
> to give the construct more visual structure.
> Also, please put it into asm/compat.h and use it at other places
> within arch/x86/ as well, there's half a dozen similar patterns
> of TIP_IA32 tests in arch/x86/. Please make this a separate
> patch, preceding this patch.

I am facing a problem doing the above.
I did some changes in arch/x86/kernel/signal.c and included compat.h
and compilation fails on tip tree that the commit

In file included from ../arch/x86/kernel/signal.c:42:
../arch/x86/include/asm/compat.h: In function ‘arch_compat_alloc_user_space’:
../arch/x86/include/asm/compat.h:238: error: ‘old_rsp’ undeclared (first use in this function)
../arch/x86/include/asm/compat.h:238: error: (Each undeclared identifier is reported only once
../arch/x86/include/asm/compat.h:238: error: for each function it appears in.)
../arch/x86/include/asm/compat.h:238: warning: type defaults to ‘int’ in declaration of ‘pfo_ret__’

I see old_rsp declared only under CONFIG_X86_64 in asm/processor.h

The below helps resolve the problem.
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index 9c9b6dc..147e790 100644
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -233,9 +233,11 @@ static inline void __user *arch_compat_alloc_user_space(long len)

if (test_thread_flag(TIF_IA32)) {
sp = task_pt_regs(current)->sp;
+#ifdef CONFIG_X86_64
} else {
/* -128 for the x32 ABI redzone */
sp = __this_cpu_read(old_rsp) - 128;

return (void __user *)round_down(sp - len, 16);

But I wanted to check if there is any reason why we cant include asm/compat.h in arch/x86/kernel/signal.c.

Thanks and Regards

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2012-03-08 14:23    [from the cache]
©2003-2011 Jasper Spaans