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 27A00C433F5 for ; Fri, 25 Mar 2022 09:43:31 +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:Mime-Version:References:In-Reply-To: Message-Id:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=A0KQpNltQ15AeTo+VR3BOhGlSu7WseKc7GVeUMTxf+w=; b=RCOfiP0rLGd1Fk AtTxjlylbX9CZ0jOYsRi21MMtT6nwU/+zGZMDjhVEthvkJP3UnWUSnJF19QYgPLWfuk8Vj7tcmJvS WTVQuG/55a9XWrSGfazE19+z7/21BD/zJaxDZaji/ix5OIn0wRQAflk8pZ5sqypQl3ZUtRWqgNclD 35i/SZuroYQ1JjGWltBhv9g+tYnT0geTYqZHq0BEM2qk9xKDpFQLxX3faL6tkSa+Jkv86/gcIV8he 4j5JpmTHYDgeTizqWGPXnveweoWWpJkRboKi/+hZFW8YeZ32uB7mBOfDkWggN///U8URCaG4mCK1g qXZHtQ5NOvpo3FE9qDXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXgSk-001ZQJ-49; Fri, 25 Mar 2022 09:42:30 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXgSf-001ZOz-PU for linux-arm-kernel@lists.infradead.org; Fri, 25 Mar 2022 09:42:27 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7EAC0B827E8; Fri, 25 Mar 2022 09:42:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93009C340F1; Fri, 25 Mar 2022 09:42:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648201343; bh=0deI25FyYvaIntD5Kt5odc8G8ByXcBd6tgdmjvm7+g0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dKpkcg4eFc93gNN47eza0GqNgHZu1GSOE7O9idMDmI0vhhi190jiAGbIQnO155oSK SVDGt1N0FXV4czKPqcQcP+uUWsOwFqYRu7Z80r+aROifzs5Bdt00bbvHWtnMJG4UTo DAlOJawvqWLvyeNNrVE9y7femOInNY4FQexO48cadlXbvjlBO3A11ojEP+EUJksPew LNvIxaXDgBpk5ZJudf8RJoDVjVcjS10HYoJ+J9WNZd4eH8c7pZVjeo+Ik6oDlhaZdj f7lutKIlBiePxRoEXeEeQdNti7jnK3lQ60mL+1nvRyveuQdrZCCvE8nihKIbPGN6i2 H1FEqvTNKtFZA== Date: Fri, 25 Mar 2022 18:42:19 +0900 From: Masami Hiramatsu To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, Masami Hiramatsu , Steven Rostedt , Nick Desaulniers , kernel test robot Subject: Re: [PATCH] ARM: kretprobes: fix out-of-range literal issue in naked asm routine Message-Id: <20220325184219.c42feefea5d8b26897d35a63@kernel.org> In-Reply-To: <20220325080302.4018956-1-ardb@kernel.org> References: <20220325080302.4018956-1-ardb@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220325_024226_008090_8ED6B9C9 X-CRM114-Status: GOOD ( 24.45 ) 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 Fri, 25 Mar 2022 09:03:02 +0100 Ard Biesheuvel wrote: > __kretprobe_trampoline is a naked C function implemented in asm, and the > first thing it does is take its own address and record it in the frame > record, so that a backtrace will properly traverse its stackframe. > > As it turns out, using 'LDR , =' notation is problematic > here, as it relies on a literal pool to be emitted sufficiently close to > the LDR instruction, and since the compiler is not aware of this need, > this results in assembler errors in some cases. > > Since the address taken is guaranteed to be the address of the > instruction itself, just use ADR instead. Ah, indeed :) This looks good to me. Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Thank you very much! > > Cc: Masami Hiramatsu > Cc: Steven Rostedt > Cc: Nick Desaulniers > Reported-by: kernel test robot > Fixes: 7e9bf33b8124 ("ARM: kprobes: Make a frame pointer on __kretprobe_trampoline") > Signed-off-by: Ard Biesheuvel > --- > arch/arm/probes/kprobes/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm/probes/kprobes/core.c b/arch/arm/probes/kprobes/core.c > index 9090c3a74dcc..068639a777c8 100644 > --- a/arch/arm/probes/kprobes/core.c > +++ b/arch/arm/probes/kprobes/core.c > @@ -377,7 +377,7 @@ void __naked __kprobes __kretprobe_trampoline(void) > { > __asm__ __volatile__ ( > #ifdef CONFIG_FRAME_POINTER > - "ldr lr, =__kretprobe_trampoline \n\t" > + "adr lr, . \n\t" > /* __kretprobe_trampoline makes a framepointer on pt_regs. */ > #ifdef CONFIG_CC_IS_CLANG > "stmdb sp, {sp, lr, pc} \n\t" > -- > 2.30.2 > -- Masami Hiramatsu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel