From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB43EC32771 for ; Mon, 26 Sep 2022 18:50:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Yxw0EakMFCjOR5on5CJQ77NwEAiOF+7dwVvqxoXfMhs=; b=FLinNySgpJRUHS /qMWNsDwb4jTq2OXupfXLVzFJzK3rCxxRRyzHqURUvWCdvP/Zo4wvRqZt1e5oTHeSLvj7c1KIlmr7 x83YIF4fi9DUdp9UoaJVJppygOCaVUopH99dH8K7musUxLGmZYQyv7qodW8dvMul7x1/7iGUj7Jne rgOnYn76wkFsGTZfryJ8gZ3u/6dUOpOJtdFVkuzxC+fTAEJRIvII6jkQVWvMxD049p5knAxyX7Ejo no7JwCcM6LJOi2Qn/Ooo8V1n2QeslGJVsGmUB7Fvov9Wc/ctmnO6ZUNIzmjT+paeurMfmORL6SKzb +s/u0i8S3/NVP1Y9IqSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1octAY-006QfP-8D; Mon, 26 Sep 2022 18:49:30 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oct3x-006MlS-78 for linux-arm-kernel@lists.infradead.org; Mon, 26 Sep 2022 18:42:42 +0000 Received: by mail-pf1-x42b.google.com with SMTP id d10so6453131pfh.6 for ; Mon, 26 Sep 2022 11:42:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=/jJOs5JF7f5yYPOwficF4lSvd23WgsEKpbpbM5Pm4Kw=; b=W5iKjXkdq+vjFAuJhfIquPMYOB1QAeC8wZRs/aWH4VdIcZKs4NpaYNHb4u4MM47DZM HwYyfkCsoCGKhPd42a0f1/hR30s12dsys71NztHk2fi5Xe6JIraawfigeU73lt7SbYOO XpTkKHP9UkUw2gTaiXiGI+InMbnGDa25kJDqUp+qXu7ydbWwwnd7c/fjfemDjAbcJX3p 5tJM48EW9ije9/KRUw9l5CRo8CpQHSn1FmdP7adpNM97pU983b2+RR4hiyqy+LDQcqcy GNcDiOb65jJ9hyT0xh/c7OlHu+/MxeRfrx+DU4zsUwP9clWmrU2Zdbc+3OoeM0b2hcp4 Ichg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=/jJOs5JF7f5yYPOwficF4lSvd23WgsEKpbpbM5Pm4Kw=; b=CDMHzSzZD6k2ay22BB5BAaOqrjiB8sCLe+XLtlfqCm0O+G79PhZe8+vaC4IW/wh/3G 7xoA2lMqJTkY5Y+J01GkIsqLozakwcFNk3OuTeQxOXZdvr3VDhlQSpCwp3pZUCTX3fjA NCuLA8CG9hycvB005WdhiLjPXDiRa8M9AHW7/xf1Y6/FtWOtbzL2xOLvEcgJXoV7ZXJD sBQHbNOR3CNAvcsyfWYzcrDztXKKh6FzvgSXUn9oNgzwiQaTQHJvE4qy7FU7gGB3F3yZ inqPWsNwq4pzZc0rX8qXLDdUAkUm6iW1WX31qFDolo6MqPv2T/rfC/JMLMNyoME+vPSr uQjw== X-Gm-Message-State: ACrzQf2A/M1CzvMKwaQbGfmASFbxnlflLc9WPAx7YM2HFEGFqC8agLRo izMDkDrtCMIFDW+73e5z5ZzV7/xM6LMyT5FjN2jIJQ== X-Google-Smtp-Source: AMsMyM6q/VixjsGTQyMlF4X/GU+qUATxeGOMtlYKVrEPK3hg8GJKv2iltmmq5s4T0UDcUhysW5PKwt/cE8rE9qbJ0DM= X-Received: by 2002:a05:6a02:205:b0:420:8b7e:3ff with SMTP id bh5-20020a056a02020500b004208b7e03ffmr20363372pgb.427.1664217758945; Mon, 26 Sep 2022 11:42:38 -0700 (PDT) MIME-Version: 1.0 References: <20220926183725.1112298-1-ndesaulniers@google.com> In-Reply-To: <20220926183725.1112298-1-ndesaulniers@google.com> From: Nick Desaulniers Date: Mon, 26 Sep 2022 11:42:27 -0700 Message-ID: Subject: Re: [PATCH] ARM: kprobes: move __kretprobe_trampoline to out of line assembler To: Russell King , Masami Hiramatsu Cc: "Naveen N . Rao" , Anil S Keshavamurthy , "David S . Miller" , Arnd Bergmann , Nathan Chancellor , Tom Rix , sparkhuang , Ard Biesheuvel , Steven Rostedt , Linus Walleij , Chen Zhongjin , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, llvm@lists.linux.dev, Naresh Kamboju , regressions@lists.linux.dev, lkft-triage@lists.linaro.org, Linux Kernel Functional Testing , Logan Chien X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220926_114241_303132_B1A8C8CA X-CRM114-Status: GOOD ( 17.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 26, 2022 at 11:37 AM Nick Desaulniers wrote: > > diff --git a/arch/arm/probes/kprobes/core.c b/arch/arm/probes/kprobes/core.c > index 1435b508aa36..17d7e0259e63 100644 > --- a/arch/arm/probes/kprobes/core.c > +++ b/arch/arm/probes/kprobes/core.c > @@ -375,58 +375,10 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, > return NOTIFY_DONE; > } > > -/* > - * When a retprobed function returns, trampoline_handler() is called, > - * calling the kretprobe's handler. We construct a struct pt_regs to > - * give a view of registers r0-r11, sp, lr, and pc to the user > - * return-handler. This is not a complete pt_regs structure, but that > - * should be enough for stacktrace from the return handler with or > - * without pt_regs. > - */ > -void __naked __kprobes __kretprobe_trampoline(void) > -{ > - __asm__ __volatile__ ( > - "ldr lr, =__kretprobe_trampoline \n\t" > -#ifdef CONFIG_FRAME_POINTER > - /* __kretprobe_trampoline makes a framepointer on pt_regs. */ > -#ifdef CONFIG_CC_IS_CLANG > - "stmdb sp, {sp, lr, pc} \n\t" > - "sub sp, sp, #12 \n\t" > - /* In clang case, pt_regs->ip = lr. */ > - "stmdb sp!, {r0 - r11, lr} \n\t" > - /* fp points regs->r11 (fp) */ > - "add fp, sp, #44 \n\t" > -#else /* !CONFIG_CC_IS_CLANG */ > - /* In gcc case, pt_regs->ip = fp. */ > - "stmdb sp, {fp, sp, lr, pc} \n\t" > - "sub sp, sp, #16 \n\t" > - "stmdb sp!, {r0 - r11} \n\t" > - /* fp points regs->r15 (pc) */ > - "add fp, sp, #60 \n\t" > -#endif /* CONFIG_CC_IS_CLANG */ > -#else /* !CONFIG_FRAME_POINTER */ > - /* store SP, LR on stack and add EABI unwind hint */ > - "stmdb sp, {sp, lr, pc} \n\t" > - ".save {sp, lr, pc} \n\t" > - "sub sp, sp, #16 \n\t" > - "stmdb sp!, {r0 - r11} \n\t" > - ".pad #52 \n\t" > -#endif /* CONFIG_FRAME_POINTER */ > - "mov r0, sp \n\t" > - "bl trampoline_handler \n\t" > - "mov lr, r0 \n\t" > - "ldmia sp!, {r0 - r11} \n\t" > - "add sp, sp, #16 \n\t" > -#ifdef CONFIG_THUMB2_KERNEL > - "bx lr \n\t" > -#else > - "mov pc, lr \n\t" > -#endif > - : : : "memory"); > -} > +/*void __kretprobe_trampoline(void);*/ ^ d'oh, that commented out declaration should have been removed. Will wait for feedback wrt. usage of UNWIND and Fixes tag to see if a v2 is necessary, vs what can be modified if/when applied by maintainers. -- Thanks, ~Nick Desaulniers _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel