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 BE3D6C6FA82 for ; Wed, 21 Sep 2022 03:17:48 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=P7ZkPKBEgVP5AfTWw4AMETqccEUtaFrFync7FJ5AvpI=; b=OpkE8qYIp4ILzO YFRU/rXfgAmAsS902HAbvo7sQ/+1gtTzAnqlQ9YXEjErvcNfsH3I8Gni+nCBTiX70yt2Hap/wxtbT C4djXaRKgo89xoETGddR+fPYzE27BHP8oV7S9xLRHOldqFAJUh0suy2sfvbEfMyhoPTGavhuwYoeo 1/bMfGLgk2FgpNG/JQ7AdKIHK1JHuSSvoRn0M5ZpvnGx7WcXi8tznPWEsau6eR2LwQWvCKpz9orUp obbU8wnCBHP+nbQ0mHEuHIRYqMeO9uLsgfXWc0Comvg+JBoy3I+W6tzQsPWhSJrWWXjQ+yGSt2Cr1 uSuLHo1yS2dLz4oThvJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaqE9-008To4-VD; Wed, 21 Sep 2022 03:16:46 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaqDZ-008TQl-7w for linux-arm-kernel@lists.infradead.org; Wed, 21 Sep 2022 03:16:11 +0000 Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MXNk65L9gzlWhP; Wed, 21 Sep 2022 11:11:58 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 21 Sep 2022 11:16:05 +0800 Received: from [10.67.108.67] (10.67.108.67) by dggpemm500013.china.huawei.com (7.185.36.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 21 Sep 2022 11:16:05 +0800 Message-ID: Date: Wed, 21 Sep 2022 11:16:04 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.0 Subject: Re: [RFC] Objtool toolchain proposal: -fannotate-{jump-table,noreturn} Content-Language: en-US To: Ard Biesheuvel , Peter Zijlstra CC: Michael Matz , Borislav Petkov , "Josh Poimboeuf" , , "Indu Bhagat" , Nick Desaulniers , , "Jose E. Marchesi" , Miroslav Benes , Mark Rutland , "Will Deacon" , , , , , Sathvika Vasireddy , Christophe Leroy , Mark Brown References: <20220909180704.jwwed4zhwvin7uyi@treble> <6a61aa57-141f-039c-5a2d-b2d79fecb8c2@huawei.com> From: Chen Zhongjin In-Reply-To: X-Originating-IP: [10.67.108.67] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500013.china.huawei.com (7.185.36.172) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220920_201609_680537_2FAAA4AD X-CRM114-Status: GOOD ( 13.18 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On 2022/9/21 0:49, Ard Biesheuvel wrote: > 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. Maybe not enough, I guess. For switch jump tables we need to know its *own* jump targets so that we can go through all its branches. If there are more than one indirect jump inside one function, only marks targets with BTI J can't help matching the entry and its targets. Anyway I think this job is more for compiler. Switch jump tables is different from other indirect jump/call. It have fixed control flow just as if/else flow and the indirect jump table is just a compiler optimization which hide this. Best, Chen _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel