Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755984AbcCUNeG (ORCPT ); Mon, 21 Mar 2016 09:34:06 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:34414 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755409AbcCUNeE (ORCPT ); Mon, 21 Mar 2016 09:34:04 -0400 Subject: Re: [PATCH v11 8/9] arm64: Add kernel return probes support (kretprobes) To: =?UTF-8?B?5bmz5p2+6ZuF5bezIC8gSElSQU1BVFXvvIxNQVNBTUk=?= , "'ltc-kernel@ml.yrl.intra.hitachi.co.jp'" , Catalin Marinas , Will Deacon , Sandeepa Prabhu , William Cohen , Pratyush Anand , Steve Capper , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Marc Zyngier References: <1457501543-24197-1-git-send-email-dave.long@linaro.org> <1457501543-24197-9-git-send-email-dave.long@linaro.org> <50399556C9727B4D88A595C8584AAB37B4E50431@GSjpTKYDCembx32.service.hitachi.net> <50399556C9727B4D88A595C8584AAB37B4E504AA@GSjpTKYDCembx32.service.hitachi.net> Cc: Mark Rutland , Petr Mladek , Viresh Kumar , John Blackwood , Feng Kan , Zi Shen Lim , Dave P Martin , Yang Shi , Vladimir Murzin , Kees Cook , "Suzuki K. Poulose" , Mark Brown , =?UTF-8?Q?Alex_Benn=c3=a9e?= , Ard Biesheuvel , Greg Kroah-Hartman , Mark Salyzyn , James Morse , Christoffer Dall , Andrew Morton , Robin Murphy , Jens Wiklander , Balamurugan Shanmugam , sysp-manager From: David Long Message-ID: <56EFF83F.7040906@linaro.org> Date: Mon, 21 Mar 2016 09:33:51 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <50399556C9727B4D88A595C8584AAB37B4E504AA@GSjpTKYDCembx32.service.hitachi.net> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1730 Lines: 59 On 03/17/2016 08:58 AM, ƽ?????? / HIRAMATU??MASAMI wrote: >> From: ƽ?????? / HIRAMATU??MASAMI [mailto:masami.hiramatsu.pt@hitachi.com] >> >> Hi, >> >>> From: Sandeepa Prabhu >>> >>> The pre-handler of this special 'trampoline' kprobe executes the return >>> probe handler functions and restores original return address in ELR_EL1. >>> This way the saved pt_regs still hold the original register context to be >>> carried back to the probed kernel function. >> >> This patch seems not well separated. >> >>> diff --git a/arch/arm64/kernel/kprobes.c b/arch/arm64/kernel/kprobes.c >>> index bd3f233..13d3333 100644 >>> --- a/arch/arm64/kernel/kprobes.c >>> +++ b/arch/arm64/kernel/kprobes.c >> >> [snip] >> >>> +void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, >>> + struct pt_regs *regs) >>> +{ >>> + ri->ret_addr = (kprobe_opcode_t *)regs->regs[30]; >>> + >>> + /* replace return addr (x30) with trampoline */ >>> + regs->regs[30] = (long)&kretprobe_trampoline; >> >> So, where is the kretprobe_trampoline? It seems that function is >> defined in other patch. >> >>> +} >>> + >>> +int __kprobes arch_trampoline_kprobe(struct kprobe *p) >>> +{ >>> + return 0; >>> } >> >> And what this function is for?? > > Ah, sorry, this was my fault. Yes, this function is required. > But this implementation also means there is an asm-based trampoline > function which should be included in this patch. > > David, could you tell me the repository which I can get the latest > version of this series? I'd like to see the whole code of kprobes/arm64. > > Thank you, > It can be found in: http://git.linaro.org/people/dave.long/linux.git ...in the kprobes64-v11 branch. Thanks, -dl