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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3800ECAAA1 for ; Tue, 6 Sep 2022 01:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232478AbiIFBaa (ORCPT ); Mon, 5 Sep 2022 21:30:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbiIFBa1 (ORCPT ); Mon, 5 Sep 2022 21:30:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06FF8647C6 for ; Mon, 5 Sep 2022 18:30:26 -0700 (PDT) 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 B4FBAB815AE for ; Tue, 6 Sep 2022 01:30:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 775E5C433C1; Tue, 6 Sep 2022 01:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662427823; bh=2k5Cf0hW3tgV+89sebcqyCh1W3nfzEd+bh/IzTIAxbw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kzihkAXHcCDK0QFtMnv3oRGa65bDVQGbIW11SiWsBVaHQtcZQb5xQZZ4yN9LOnf6f fY2shsKIB9m+RZokDSLSbddDf+2uc4ygODww5Pcqx/2GWcpw6e440vNNWlVlmFCzW/ CLBlXjgjdEP0nlU4aWrOoqxVvRMPyLB+Bc0IXMtCrnwxXNyhUssakBjjlQDkCRpxWX hIl7QvnrAzln+7094yOG0IsMnkkOFqw1TLE4jS0zp4UNBKZDepimuICbXiS97WbHH+ i8b+wyZP7nB0b2oraymdKBJsVb9TXWRQh7XcSQczS37JFBs3fW1GG7dkxUNEzENAI4 ZzGXWiWQ+tQPA== Date: Tue, 6 Sep 2022 10:30:18 +0900 From: Masami Hiramatsu (Google) To: Peter Zijlstra Cc: Steven Rostedt , "Masami Hiramatsu (Google)" , Borislav Petkov , Josh Poimboeuf , linux-kernel@vger.kernel.org, Ingo Molnar Subject: Re: CONFIG_RETHUNK int3 filling prevents kprobes in function body Message-Id: <20220906103018.50f46e8c21c4a40b2d635c75@kernel.org> In-Reply-To: References: <20220904230713.a461f8fe85329663226c755f@kernel.org> <20220905105758.176734eb@gandalf.local.home> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 5 Sep 2022 17:20:30 +0200 Peter Zijlstra wrote: > On Mon, Sep 05, 2022 at 05:10:27PM +0200, Peter Zijlstra wrote: > > On Mon, Sep 05, 2022 at 10:57:58AM -0400, Steven Rostedt wrote: > > > On Sun, 4 Sep 2022 23:07:13 +0900 > > > Masami Hiramatsu (Google) wrote: > > > > > > > Can we use another instruction for padding instead of INT3? (e.g. NOP or UD2) > > > > > > > > Or, can I expect the instruction length in __return_sites[] are always 5? > > > > If so, I can just skip 5 bytes if the address is in __return_sites[]. > > > > > > Perhaps another option is to have a table of where the padding is placed > > > (tagged), and that kprobes could check to see if the int3 is due to this > > > padding or not? > > > > I don't see need for that. If you want to be strict you can simply > > follow the branches found earlier, if you want to be lazy, you can > > decode until you run out of the symbol size. > > Another lazy option is to teach the thing that 'ret' is followed by 0,1 > or 4 'int3' instructions depending on CONFIG_SLS, CONFIG_RETHUNK, but > that'll get you into trouble with future SLS compiler options, like the > aforementioned JMP-SLS option. Yes, I agree... OK, let me try to decode branches to find the nearest earlier target instruction. Thank you! -- Masami Hiramatsu (Google)