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 0DA9AC433F5 for ; Tue, 24 May 2022 13:46:53 +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:In-Reply-To:From:References:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rryS2StEVxuWPwbanjlDpM7xNaqMQd2YZqgWqI/ZcaE=; b=Z+f2HujMNvZQoQ Bna0TiuCWmCRgLnlJqp7FkI0xthWMfCwmHVJBSGfsQKsmZgmIO9cGn2FFVO0cvtcdP4j4dp0XNYbt W/zQmmiYWOIBlO4diD68VRRn4kI+3A7A4lBYIuelYHsZUoF256fd9OvIVwayLuwGSwFur9WItAi2K WsbjwGYdHSilQu38/wLWJdx3mQbjvStT2j0E9sE0HPA6Aja1HlN9ws8DCMszXMT2zWgfh8dd1bwDM jJZ0xoNyGm/G2O+My+cGecYaqeeCjBdBRHABVCcDb0YxMi4LGNt5+Yzqb9yPu0H5CyommsB53R4nZ wXORknGaYnPaOmUZHLsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntUqw-0089hL-Ht; Tue, 24 May 2022 13:45:38 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntUqs-0089eZ-J7 for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2022 13:45:36 +0000 Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4L6wRD2HmyzjX5j; Tue, 24 May 2022 21:44:24 +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.24; Tue, 24 May 2022 21:45:22 +0800 Received: from [127.0.0.1] (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.24; Tue, 24 May 2022 21:45:22 +0800 Message-ID: <767e814c-b3cc-73a1-d283-82dbc0287cde@huawei.com> Date: Tue, 24 May 2022 21:45:19 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [RFC PATCH v2 11/20] objtool: arm64: Walk instructions and compute CFI for each instruction Content-Language: en-US To: , , , , , , , , , , , , References: <20220524001637.1707472-1-madvenka@linux.microsoft.com> <20220524001637.1707472-12-madvenka@linux.microsoft.com> From: Chen Zhongjin In-Reply-To: <20220524001637.1707472-12-madvenka@linux.microsoft.com> 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-20220524_064534_872881_C53BB787 X-CRM114-Status: GOOD ( 11.59 ) 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 Hi, On 2022/5/24 8:16, madvenka@linux.microsoft.com wrote: > From: "Madhavan T. Venkataraman" > > Implement arch_initial_func_cfi_state() to initialize the CFI for a > function. > > Add code to fpv_decode() to walk the instructions in every function and > compute the CFI information for each instruction. > > Implement special handling for cases like jump tables. > > Signed-off-by: Madhavan T. Venkataraman > --- > tools/objtool/arch/arm64/decode.c | 15 +++ > tools/objtool/fpv.c | 204 ++++++++++++++++++++++++++++++ > 2 files changed, 219 insertions(+) ... > +static void update_cfi_state(struct cfi_state *cfi, struct stack_op *op) > +{ > + struct cfi_reg *cfa = &cfi->cfa; > + struct cfi_reg *regs = cfi->regs; > + > + if (op->src.reg == CFI_SP) { > + if (op->dest.reg == CFI_SP) > + cfa->offset -= op->src.offset; > + else > + regs[CFI_FP].offset = -cfa->offset + op->src.offset; Seems wrong here, we don't have any op->src.offset for [mov x29, sp] so here we get: fp->offset = -cfa->offset. The dumped info also proves this. > + case UNWIND_HINT_TYPE_CALL: > + /* Normal call */ > + frame->cfa += orc->sp_offset; > + fp = frame->cfa + orc->fp_offset; > + break; Obviously this is not conform to the reliability check because we get frame->cfa == fp here. IIUC your sp_offset equals to stack length, and fp_offset is offset from next x29 to next CFA. So maybe here we should have regs[CFI_FP].offset = regs[CFI_SP].offset for [mov x29, sp]. Anyway, in original objtool sp_offset and fp_offset both represents the offset from CFA to REGs. I think it's better not spoiling their original meaning and just extending. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel