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 E1E54C54EE9 for ; Tue, 20 Sep 2022 16:49:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230422AbiITQty (ORCPT ); Tue, 20 Sep 2022 12:49:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229779AbiITQtu (ORCPT ); Tue, 20 Sep 2022 12:49:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEF2D13DDD; Tue, 20 Sep 2022 09:49:48 -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 B0502B828D3; Tue, 20 Sep 2022 16:49:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6318CC43470; Tue, 20 Sep 2022 16:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663692586; bh=vmyvq1aUOmre0E18ZlTOn9QV1cEhyDcjVLUmO5iK2lI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FbjFfJIq2m+Nxif0jMsvbr+hIADfvpyb6qNxQyAL08pZxUZKDCbA79J+mtyY5g/L0 t1SqU6AVg158djYCu+OA6imNwsP5D2zDP8o003yhguUxX6U27NuGHF8HifmAqWAEWV WGXjT/bFl0zznSVGUFuCFsWx94Vt2ETGBFw6dN1x2aMh28I1Fb/NafyKdlmFeLSgum kJI805UmX5jj/hOjpnzuqJM0dg1Z5KUdcNnqiAQJ41gYMI/uv9j3U21bEr9W/wY6Qq Xcs98+Qndy5g/1+UNaHl/qGv2oou1rP9wL4xFBg0RusYn2XdCXXKa2kmK4BRbD4rY5 En9G5F62vNbFQ== Received: by mail-lj1-f175.google.com with SMTP id b6so3699104ljr.10; Tue, 20 Sep 2022 09:49:46 -0700 (PDT) X-Gm-Message-State: ACrzQf05mPrlWk8wn3VsIcjkUeOnYefeF27nuy7ghOlS9y8Sm3F/jYpc 7Bc01TrN2ThFzm7r0Mx/Exxl4v13GqVcOqegIG4= X-Google-Smtp-Source: AMsMyM5uPplRBbNk8KwaMSLyjriPjQasS2fkIsUEtjL7XSBKzzbCRhdfBYv0bnsu6GsemWK7B38+lm296jjp7PBFcjA= X-Received: by 2002:a2e:9115:0:b0:26a:c086:5138 with SMTP id m21-20020a2e9115000000b0026ac0865138mr6796874ljg.189.1663692584393; Tue, 20 Sep 2022 09:49:44 -0700 (PDT) MIME-Version: 1.0 References: <20220909180704.jwwed4zhwvin7uyi@treble> <6a61aa57-141f-039c-5a2d-b2d79fecb8c2@huawei.com> In-Reply-To: From: Ard Biesheuvel Date: Tue, 20 Sep 2022 18:49:33 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC] Objtool toolchain proposal: -fannotate-{jump-table,noreturn} To: Peter Zijlstra Cc: Chen Zhongjin , Michael Matz , Borislav Petkov , Josh Poimboeuf , linux-toolchains@vger.kernel.org, Indu Bhagat , Nick Desaulniers , linux-kernel@vger.kernel.org, "Jose E. Marchesi" , Miroslav Benes , Mark Rutland , Will Deacon , x86@kernel.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Sathvika Vasireddy , Christophe Leroy , Mark Brown Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Sept 2022 at 10:47, Peter Zijlstra wrote: > > On Thu, Sep 15, 2022 at 10:56:58AM +0800, Chen Zhongjin wrote: > > > We have found some anonymous information on x86 in .rodata. > > Well yes, but that's still a bunch of heuristics on our side. > > > I'm not sure if those are *all* of Josh wanted on x86, however for arm64 we > > did not found that in the same section so it is a problem on arm64 now. > > Nick found Bolt managed the ARM64 jumptables: > > https://github.com/llvm/llvm-project/blob/main/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp#L484 > > But that does look like a less than ideal solution too. > > > Does the compiler will emit these for all arches? At lease I tried and > > didn't find anything meaningful (maybe I omitted it). > > That's the question; can we get the compiler to help us here in a well > defined manner. Do BTI landing pads help at all here? I.e., I assume that objtool just treats any indirect call as a dangling edge in the control flow graph, and the problem is identifying the valid targets. In the BTI case, those will all start with a 'BTI J' instruction. 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 D2E88C54EE9 for ; Tue, 20 Sep 2022 16:50:30 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MX6x110dFz3bvd for ; Wed, 21 Sep 2022 02:50:29 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=FbjFfJIq; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:4641:c500::1; helo=dfw.source.kernel.org; envelope-from=ardb@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=FbjFfJIq; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4MX6wH3Gdwz2xJ8 for ; Wed, 21 Sep 2022 02:49:51 +1000 (AEST) 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 E87F462B3E for ; Tue, 20 Sep 2022 16:49:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B32AC433B5 for ; Tue, 20 Sep 2022 16:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663692586; bh=vmyvq1aUOmre0E18ZlTOn9QV1cEhyDcjVLUmO5iK2lI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FbjFfJIq2m+Nxif0jMsvbr+hIADfvpyb6qNxQyAL08pZxUZKDCbA79J+mtyY5g/L0 t1SqU6AVg158djYCu+OA6imNwsP5D2zDP8o003yhguUxX6U27NuGHF8HifmAqWAEWV WGXjT/bFl0zznSVGUFuCFsWx94Vt2ETGBFw6dN1x2aMh28I1Fb/NafyKdlmFeLSgum kJI805UmX5jj/hOjpnzuqJM0dg1Z5KUdcNnqiAQJ41gYMI/uv9j3U21bEr9W/wY6Qq Xcs98+Qndy5g/1+UNaHl/qGv2oou1rP9wL4xFBg0RusYn2XdCXXKa2kmK4BRbD4rY5 En9G5F62vNbFQ== Received: by mail-lj1-f170.google.com with SMTP id q17so3698779lji.11 for ; Tue, 20 Sep 2022 09:49:46 -0700 (PDT) X-Gm-Message-State: ACrzQf1nigpnH7cbK6k4Gm7h5HGd0USz28DF929j4DWBCXFEkMX5FS1H tzRQ8SE2yToIRmS2PvI4aIf3bGbONcqJeIFAVrk= X-Google-Smtp-Source: AMsMyM5uPplRBbNk8KwaMSLyjriPjQasS2fkIsUEtjL7XSBKzzbCRhdfBYv0bnsu6GsemWK7B38+lm296jjp7PBFcjA= X-Received: by 2002:a2e:9115:0:b0:26a:c086:5138 with SMTP id m21-20020a2e9115000000b0026ac0865138mr6796874ljg.189.1663692584393; Tue, 20 Sep 2022 09:49:44 -0700 (PDT) MIME-Version: 1.0 References: <20220909180704.jwwed4zhwvin7uyi@treble> <6a61aa57-141f-039c-5a2d-b2d79fecb8c2@huawei.com> In-Reply-To: From: Ard Biesheuvel Date: Tue, 20 Sep 2022 18:49:33 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC] Objtool toolchain proposal: -fannotate-{jump-table,noreturn} To: Peter Zijlstra Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , x86@kernel.org, Sathvika Vasireddy , Will Deacon , Michael Matz , Nick Desaulniers , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Mark Brown , Borislav Petkov , linux-toolchains@vger.kernel.org, Indu Bhagat , live-patching@vger.kernel.org, Miroslav Benes , Chen Zhongjin , Josh Poimboeuf , linux-arm-kernel@lists.infradead.org, "Jose E. Marchesi" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, 15 Sept 2022 at 10:47, Peter Zijlstra wrote: > > On Thu, Sep 15, 2022 at 10:56:58AM +0800, Chen Zhongjin wrote: > > > We have found some anonymous information on x86 in .rodata. > > Well yes, but that's still a bunch of heuristics on our side. > > > I'm not sure if those are *all* of Josh wanted on x86, however for arm64 we > > did not found that in the same section so it is a problem on arm64 now. > > Nick found Bolt managed the ARM64 jumptables: > > https://github.com/llvm/llvm-project/blob/main/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp#L484 > > But that does look like a less than ideal solution too. > > > Does the compiler will emit these for all arches? At lease I tried and > > didn't find anything meaningful (maybe I omitted it). > > That's the question; can we get the compiler to help us here in a well > defined manner. Do BTI landing pads help at all here? I.e., I assume that objtool just treats any indirect call as a dangling edge in the control flow graph, and the problem is identifying the valid targets. In the BTI case, those will all start with a 'BTI J' instruction. 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 25EDCC54EE9 for ; Tue, 20 Sep 2022 16:50:55 +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=mUyZ3+7u6XAyxtTs0capqaxkAds/Ojk9Pz6z1qCf49E=; b=VtrZU0g0658Mil XjstAb1FEJldRcusOZsCCaYcn4CLi4g92AJsoS0F7qn+V7XDfpHWKhQNejfq8yJbSHYPhWtwLDVD3 8QICGC3aC4E6qPJ7rw8z4oYrgBAZ74I2+ul5c+opZqXkDObxyIVH1/Lq2xLuqPoFxGjYJBQ2vzZGl vxPFGTKEVURrTB3kE0Ee2wVYgyNUjIBPdKMtQR7sXLZVDvhM9csFlfNxhUqtcS73j6Z9ezRWq8DNR yGof7ZP0DXEpkTI2irrGdenCULAfOWPea1L528hxheJQ+SW5P6ZI9V3xILSEFaZ3TNO6v9r+hIhRb 4PaFnPtqvWvJumqVQfZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oagRS-005FMi-T7; Tue, 20 Sep 2022 16:49:51 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oagRP-005FL7-M6 for linux-arm-kernel@lists.infradead.org; Tue, 20 Sep 2022 16:49:49 +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 E87D862545 for ; Tue, 20 Sep 2022 16:49:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F19BC433D6 for ; Tue, 20 Sep 2022 16:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663692586; bh=vmyvq1aUOmre0E18ZlTOn9QV1cEhyDcjVLUmO5iK2lI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FbjFfJIq2m+Nxif0jMsvbr+hIADfvpyb6qNxQyAL08pZxUZKDCbA79J+mtyY5g/L0 t1SqU6AVg158djYCu+OA6imNwsP5D2zDP8o003yhguUxX6U27NuGHF8HifmAqWAEWV WGXjT/bFl0zznSVGUFuCFsWx94Vt2ETGBFw6dN1x2aMh28I1Fb/NafyKdlmFeLSgum kJI805UmX5jj/hOjpnzuqJM0dg1Z5KUdcNnqiAQJ41gYMI/uv9j3U21bEr9W/wY6Qq Xcs98+Qndy5g/1+UNaHl/qGv2oou1rP9wL4xFBg0RusYn2XdCXXKa2kmK4BRbD4rY5 En9G5F62vNbFQ== Received: by mail-lj1-f175.google.com with SMTP id j24so3223685lja.4 for ; Tue, 20 Sep 2022 09:49:46 -0700 (PDT) X-Gm-Message-State: ACrzQf2vlJCjS4WK7xluNhLJCjxnKQPyPlhhDqMeszkivXsk1k92+6zY L0NYrfOp75/5gWgmuXzEEZEugzzdoFJu5TFpY+4= X-Google-Smtp-Source: AMsMyM5uPplRBbNk8KwaMSLyjriPjQasS2fkIsUEtjL7XSBKzzbCRhdfBYv0bnsu6GsemWK7B38+lm296jjp7PBFcjA= X-Received: by 2002:a2e:9115:0:b0:26a:c086:5138 with SMTP id m21-20020a2e9115000000b0026ac0865138mr6796874ljg.189.1663692584393; Tue, 20 Sep 2022 09:49:44 -0700 (PDT) MIME-Version: 1.0 References: <20220909180704.jwwed4zhwvin7uyi@treble> <6a61aa57-141f-039c-5a2d-b2d79fecb8c2@huawei.com> In-Reply-To: From: Ard Biesheuvel Date: Tue, 20 Sep 2022 18:49:33 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC] Objtool toolchain proposal: -fannotate-{jump-table,noreturn} To: Peter Zijlstra Cc: Chen Zhongjin , Michael Matz , Borislav Petkov , Josh Poimboeuf , linux-toolchains@vger.kernel.org, Indu Bhagat , Nick Desaulniers , linux-kernel@vger.kernel.org, "Jose E. Marchesi" , Miroslav Benes , Mark Rutland , Will Deacon , x86@kernel.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Sathvika Vasireddy , Christophe Leroy , Mark Brown X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220920_094947_816182_260F9C75 X-CRM114-Status: GOOD ( 21.84 ) 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 Thu, 15 Sept 2022 at 10:47, Peter Zijlstra wrote: > > On Thu, Sep 15, 2022 at 10:56:58AM +0800, Chen Zhongjin wrote: > > > We have found some anonymous information on x86 in .rodata. > > Well yes, but that's still a bunch of heuristics on our side. > > > I'm not sure if those are *all* of Josh wanted on x86, however for arm64 we > > did not found that in the same section so it is a problem on arm64 now. > > Nick found Bolt managed the ARM64 jumptables: > > https://github.com/llvm/llvm-project/blob/main/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp#L484 > > But that does look like a less than ideal solution too. > > > Does the compiler will emit these for all arches? At lease I tried and > > didn't find anything meaningful (maybe I omitted it). > > That's the question; can we get the compiler to help us here in a well > defined manner. Do BTI landing pads help at all here? I.e., I assume that objtool just treats any indirect call as a dangling edge in the control flow graph, and the problem is identifying the valid targets. In the BTI case, those will all start with a 'BTI J' instruction. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel