On 12/08, Ananth N Mavinakayanahalli wrote: > > On Mon, Dec 07, 2009 at 07:05:40PM +0100, Oleg Nesterov wrote: > > On 12/07, Oleg Nesterov wrote: > > > > > > On 12/07, Jan Kratochvil wrote: > > > > > > > > On Mon, 07 Dec 2009 15:24:51 +0100, Oleg Nesterov wrote: > > > > > But. &raise_sigusr2 is not equal to the "actual" address of > > > > > &raise_sigusr2(), > > > > > this value points to the "thunk" (I do not know the correct English > > > > > term) > > > > > > > > ppc64 calls it "function descriptor" (GDB > > > > ppc64_linux_convert_from_func_ptr_addr): > > > > For PPC64, a function descriptor is a TOC entry, > > > > > > Thanks Jan. > > > > > > > in a data section, > > > > > > Yes! > > > > > > Now I can't understand how this test-case could ever work on ppc. > > > step-jump-cont does: > > > > > > regs->nip = raise_sigusr2; <--- points to data section > > > ptrace(PTRACE_CONT); > > > > > > of course, the tracee gets SIGSEGV, this section is not executable. > > > > Hmm. Looks like, "powerpc" means a lot of different hardware, and > > _PAGE_EXEC may be 0. I didn't notice this when I quickly grepped > > arch/powerpc/ > > > > IOW, perhaps on some machines r implies x ? > > > > Is yes, this can explain why the results differ on different > > machines. > > Well, powerpc 32-bit adheres to the SVR4 ABI, while powerpc 64-bit uses > the PPC64-ELF ABI (http://refspecs.linuxfoundation.org/ELF/ppc64/). The > 64bit ABI uses function descriptors and the 'func_name' is the data > address,
Cai, Ananth, thank you. So. I think we can forget about the possible kernel problems (and in any case we can rule out utrace). The test-case just wrong and should be fixed. The tracee can't execute the function descriptor in data section, that is why it gets SIGSEGV. > while the '.func_name' is the text address. tried to change the code to REGS_ACCESS (regs, nip) = (unsigned long) .raise_sigusr2 but gcc doesn't like this ;) > (See > handle_rt_signal64 in arch/powerpc/kernel/signal_64.c and > kprobe_lookup_name in arch/powerpc/include/asm/kprobes.h. Thanks... looking at handle_rt_signal64(), looks like we should also set regs->gpr[2] = funct_desc_ptr->toc if we change regs->nip I hope someone who understand powerpc could fix the test-case ;) Oleg.