Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4066419ybi; Mon, 3 Jun 2019 05:15:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4MIPg4+YB0L9UU+2VXzJMfvVRECCLW64XKAUSiMbPvHpNE+1nddwD+h2si/RnDhbClCm0 X-Received: by 2002:a17:90a:b00c:: with SMTP id x12mr29109339pjq.64.1559564117909; Mon, 03 Jun 2019 05:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559564117; cv=none; d=google.com; s=arc-20160816; b=CbuFZKVWQLQ6Tyz536NUzm5mwo0jxMYKgonxFWw8CDtaseuXuvisDIwZzE+4CeQKkM ShUYOGo5gcU62AFDQHU+TfcFXHY2DOjIaGZREy1zgkkEVdmxv4w+qNbxg2ThtRs6+deA FS3DAYycJIdWUkYBhLrcQBDij7HYmZD6LDt6bxSf8Quuz5qRPUh1/ugFrcF0QGD9wJvt B5xV8Kg9n7axSaXeOoc7eArkrnaj5rZqhRZLBrVGlmGyYuNSUO97OAiVWs9eV7Mwlgax bdONobPxrIMM3HIsYZ9PV6pdITJ2otyOxTZJ6IozICt7iOXDEWfkT3K2ZzWVr3udbLFj wjqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=AI8E6UYbmX5CfeilWJGXEmVzZnZTdUgOFI1Ra+jA1b0=; b=uKPnO7VB9gURUVwZftyJ8r+EE/jZ2FJQDy06H3vblU40cDm4WWuAehnpgcH87o/BkO fbcsdcMOy0ECX7UHR5n0/Mcab+gTG8Rldlho22wozRgwfoHem3VAnPAgj2jiPuSsoklb O3059jg4V8bH1ybvLgVVYpU8ffQlSBOnbQEbpwnKsd1ePHEMPZZgSS+nKRuUFu6y3kjl Fk7Okl/x7B8LQBy6BC+t9tSRGA+45AVs+zEOYb5DKm7bY1zdKZ+CnSFKu5sgGEuzIuPz Dfi02GCC+8ALldN/+vFp0huRX5MvCMnOtTPyPcmc0o4P9rdKDdN931qlanpvclsZpBZk zVtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@tq-group.com header.s=key1 header.b=juhs5Wdz; 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 w10si17539063pgs.50.2019.06.03.05.14.58; Mon, 03 Jun 2019 05:15:17 -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; dkim=fail header.i=@tq-group.com header.s=key1 header.b=juhs5Wdz; 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 S1727834AbfFCLIJ (ORCPT + 99 others); Mon, 3 Jun 2019 07:08:09 -0400 Received: from mx1.tq-group.com ([62.157.118.193]:21981 "EHLO mx1.tq-group.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726587AbfFCLII (ORCPT ); Mon, 3 Jun 2019 07:08:08 -0400 X-Greylist: delayed 587 seconds by postgrey-1.27 at vger.kernel.org; Mon, 03 Jun 2019 07:08:00 EDT X-IronPort-AV: E=Sophos;i="5.60,546,1549926000"; d="scan'208";a="7665934" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 03 Jun 2019 12:58:11 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Mon, 03 Jun 2019 12:58:12 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Mon, 03 Jun 2019 12:58:12 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1559559491; x=1591095491; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=ZLG5fX7UU9AzbSEEnsbZKEWE/R7gaNCrk+0uE58Tc7U=; b=juhs5WdzDM2DBEOm5b2EiUWdwABpa2u190ZtJk0AJaYgwkmMFUoagyLb nIenGCdGGIsEIOnls41TMpRKSzzsTlbwAQAECSOPkkweWxhP0AA5jKTgz L1JkD36A1oCeKC8Hqo9+RliSfb/JL/voucNluCyaeieWb8dBNvEvmAn3y 9Bwxq2+godqdd72MLGjTE0krX2KjEqQmACYi58KAX/2u1jmeABp1kl2c5 It2a4JBE0yKvS1OLpp60s0hPo+ldTVibgtQDrY2JMRPsK32NBN/0mZesT PcoMs29Z+YJXxpK0H0kLV8OLc1APOwtKprYpEV1rrZW9DzIv7bnqwqrkT g==; X-IronPort-AV: E=Sophos;i="5.60,546,1549926000"; d="scan'208";a="7665933" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 03 Jun 2019 12:58:11 +0200 Received: from schifferm-ubuntu4.tq-net.de (schifferm-ubuntu4.tq-net.de [10.117.49.26]) by vtuxmail01.tq-net.de (Postfix) with ESMTPA id A18CA280077; Mon, 3 Jun 2019 12:58:15 +0200 (CEST) From: Matthias Schiffer To: Russell King , Jessica Yu Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, Matthias Schiffer Subject: [PATCH modules 2/2] ARM: module: recognize unwind exit sections Date: Mon, 3 Jun 2019 12:57:26 +0200 Message-Id: <20190603105726.22436-3-matthias.schiffer@ew.tq-group.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190603105726.22436-1-matthias.schiffer@ew.tq-group.com> References: <20190603105726.22436-1-matthias.schiffer@ew.tq-group.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In addition to the prefix ".exit", ".ARM.extab.exit" and ".ARM.exidx.exit" must be recognizes as exit sections as well. Otherwise, loading modules can fail without CONFIG_MODULE_UNLOAD depending on the memory layout, when relocations for the unwind sections refer to the .exit.text section: imx_sdma: section 16 reloc 0 sym '': relocation 42 out of range (0x7f015260 -> 0xc0f5a5e8) where 0x7F000000 is the module load area and 0xC0000000 is the vmalloc area. Relocation 42 refers to R_ARM_PREL31, which is limited to signed 31bit offsets. Signed-off-by: Matthias Schiffer --- arch/arm/include/asm/module.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/include/asm/module.h b/arch/arm/include/asm/module.h index 182163b55546..f3401758d711 100644 --- a/arch/arm/include/asm/module.h +++ b/arch/arm/include/asm/module.h @@ -4,6 +4,8 @@ #include +#include + struct unwind_table; #ifdef CONFIG_ARM_UNWIND @@ -72,4 +74,13 @@ static inline unsigned long kallsyms_symbol_value(const Elf_Sym *sym) } #endif +#define HAVE_ARCH_MODULE_EXIT_SECTION +static inline bool module_exit_section(const char *name) +{ + return strstarts(name, ".exit") || + strstarts(name, ".ARM.extab.exit") || + strstarts(name, ".ARM.exidx.exit"); + +} + #endif /* _ASM_ARM_MODULE_H */ -- 2.17.1