Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3744640ybh; Tue, 6 Aug 2019 00:34:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzB0rSK/INK4u5raZcpQKnTP9gi34eD/TcbBJgfBUVJ6Oh1juXu48KrjIoV/gBsVZaLbzrk X-Received: by 2002:a17:902:e306:: with SMTP id cg6mr1792008plb.263.1565076891677; Tue, 06 Aug 2019 00:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565076891; cv=none; d=google.com; s=arc-20160816; b=cSRQz5YWlM0j/kKsHcjTi5w1WYcvgKoJWhpwBZB2TGXvm7GwATkOan+oeDaXS2TrOp VWSa8Rw2/+o6iG1d2HdPMgx2eidn0TcZ07PoyfudGFgt8dtGv5dbmVJeouNd2bvTPTmw tFjt7yt+B2LiJEEs1lfLU/ZFuU7UuOv0zpJJksHKl/bNhdGSXprz9sk5z4eEpRhpOFmp /9Q77gFCAv5FxIIUcHJCDNf68vS0+LxC99qXBkcxwDjgz8J799XO4v66qV9oBc1L16FO uUcc2zWSSRl9lEa3lvecPaSelSc+BT771GeKxEOls3ICmdG8bAea1tdluiRNdJLZ6t7E ywGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=wEEgTxEb8B2sOeAIJCqKfrVLYKmA9T6j2dEcEstzhNw=; b=mreYF7QkxHSmfoU8nDr7caujJOnwcnqy9up3lIv/n5nMtptCJc1jbYBI6vzfOKiSU0 sc5F+s7vlEY4ZxCvax1MqAFXGgi6HzFNv+LvzZk4TW4wf6WJHv0Gl2T0A2+3+Pr9gacW 9oQtCgrpNcTMfIyoY3iLlxE9s9U0pTO0S0KoQiFyccJQ8h9HwamBhWy6E4+4W9z3bbaJ wXDXPhmtuR3rzB27SAQbTQRGNHeQg3CBtGoidgwDK3CNOZXydCT0uerkNivp2KitaFYO BWAUTVqcVbWsWWxv+DRVZcS6FJ4VTH9QPqHH+uxGEe76fbPkBEqFFoWbcip1foSI/Gkc Uk4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t27si44754067pgk.502.2019.08.06.00.34.35; Tue, 06 Aug 2019 00:34:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732088AbfHFHcr (ORCPT + 99 others); Tue, 6 Aug 2019 03:32:47 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3766 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731576AbfHFHcq (ORCPT ); Tue, 6 Aug 2019 03:32:46 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 803F17FA8FB05895B325; Tue, 6 Aug 2019 15:32:44 +0800 (CST) Received: from use12-sp2.huawei.com (10.67.189.177) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Tue, 6 Aug 2019 15:32:38 +0800 From: chenzefeng To: , , , , , , CC: , , , , Subject: [PATCH] arm:unwind: fix backtrace error with unwind_table Date: Tue, 6 Aug 2019 15:32:36 +0800 Message-ID: <1565076756-71682-1-git-send-email-chenzefeng2@huawei.com> X-Mailer: git-send-email 1.8.5.6 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.189.177] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For arm, when load_module success, the mod->init_layout.base would be free in function do_free_init, but do not remove it's unwind table from the unwind_tables' list. And later the above mod->init_layout.base would alloc for another module's text section, and add to the unwind_tables which cause one address can found more than two unwind table in the unwind_tables' list, therefore may get to errror unwind table to backtrace, and get an error backtrace. Signed-off-by: chenzefeng --- arch/arm/kernel/module.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index deef17f..a4eb5f4 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c @@ -403,14 +403,24 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, return 0; } -void -module_arch_cleanup(struct module *mod) -{ + #ifdef CONFIG_ARM_UNWIND +void module_arch_cleanup(struct module *mod) +{ int i; for (i = 0; i < ARM_SEC_MAX; i++) - if (mod->arch.unwind[i]) + if (mod->arch.unwind[i]) { unwind_table_del(mod->arch.unwind[i]); -#endif + mod->arch.unwind[i] = NULL; + } } + +void module_arch_freeing_init(struct module *mod) +{ + if (mod->arch.unwind[ARM_SEC_INIT]) { + unwind_table_del(mod->arch.unwind[ARM_SEC_INIT]); + mod->arch.unwind[ARM_SEC_INIT] = NULL; + } +} +#endif -- 1.8.5.6