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 7780BC433F5 for ; Wed, 18 May 2022 19:59:17 +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=szJ5iBfGPmpIeYa9KhLBIpmkqekueFgAgyDZYDSmIT8=; b=2FEIfbbdGej+Oc g4IU/H1ThP/7xjO9Xvz0TqhjbioFgRuenOLzM9njdLYBF26oXrrwDdWe/TGdTbcA4jMBhXqnp8gsn O0mGrFnJ1Ce5dEWsOof54Tu5P5JQnxK6fip1NARzPO6XrRJyLd2E4yWQQ+3oWj5/tEjmQQmgjOKPM p2sMmPJPag2FOMltOhfdQzU//nq+5EL7xllACKogEtbstGf2+dc8npckz6KMMPQQh9Vx6PEzh+334 AdVsCH/mf0OUT9gEU4aKlvql/eqklYQC3rSkjPTLkI5l44iJWuIJ9JWPiJVCU3U6QzipJLg0Kgt2T lcnxyPcABAz35Zuvyv4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrPoA-003i4v-68; Wed, 18 May 2022 19:58:10 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrPo6-003i3e-I9 for linux-arm-kernel@lists.infradead.org; Wed, 18 May 2022 19:58:08 +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 dfw.source.kernel.org (Postfix) with ESMTPS id CC81E6199C; Wed, 18 May 2022 19:58:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21195C34113; Wed, 18 May 2022 19:58:01 +0000 (UTC) Date: Wed, 18 May 2022 15:57:59 -0400 From: Steven Rostedt To: Xu Kuohai Cc: , , , , , Catalin Marinas , Will Deacon , Ingo Molnar , Daniel Borkmann , Alexei Starovoitov , Zi Shen Lim , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "David S . Miller" , Hideaki YOSHIFUJI , David Ahern , Thomas Gleixner , Borislav Petkov , Dave Hansen , , , Shuah Khan , Jakub Kicinski , Jesper Dangaard Brouer , Mark Rutland , Pasha Tatashin , Ard Biesheuvel , Daniel Kiss , Steven Price , Sudeep Holla , Marc Zyngier , Peter Collingbourne , Mark Brown , Delyan Kratunov , Kumar Kartikeya Dwivedi Subject: Re: [PATCH bpf-next v4 2/6] ftrace: Fix deadloop caused by direct call in ftrace selftest Message-ID: <20220518155759.4054d9a2@gandalf.local.home> In-Reply-To: <20220517071838.3366093-3-xukuohai@huawei.com> References: <20220517071838.3366093-1-xukuohai@huawei.com> <20220517071838.3366093-3-xukuohai@huawei.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; 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-20220518_125806_680854_B6AB3DC2 X-CRM114-Status: GOOD ( 15.10 ) 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 Tue, 17 May 2022 03:18:34 -0400 Xu Kuohai wrote: > After direct call is enabled for arm64, ftrace selftest enters a > dead loop: > > : > 00 bti c > 01 mov x9, x30 : > 02 bl ----------> ret > | > lr/x30 is 03, return to 03 > | > 03 mov w0, #0x0 <-----------------------------| > | | > | dead loop! | > | | > 04 ret ---- lr/x30 is still 03, go back to 03 ----| > > The reason is that when the direct caller trace_direct_tramp() returns > to the patched function trace_selftest_dynamic_test_func(), lr is still > the address after the instrumented instruction in the patched function, > so when the patched function exits, it returns to itself! > > To fix this issue, we need to restore lr before trace_direct_tramp() > exits, so rewrite a dedicated trace_direct_tramp() for arm64. > > Reported-by: Li Huafei > Signed-off-by: Xu Kuohai > --- Acked-by: Steven Rostedt (Google) -- Steve _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel