Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8214102ybi; Thu, 6 Jun 2019 08:28:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhuFiv/rZCzq/XxUrHgIDqIF/YV1O1yjG7jJIv8NumrmlmpTa5XMpl0bA/oMvGCy9tQwec X-Received: by 2002:a17:902:694b:: with SMTP id k11mr36730649plt.307.1559834935503; Thu, 06 Jun 2019 08:28:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559834935; cv=none; d=google.com; s=arc-20160816; b=gwQzPfMBxOLuU1ExRGGhqselLWEZHiTBCx4Kie0SmMpG8mJ4XJWwUScTREWScMyIc2 7bC8RberBbc2egF3L1dHuL/L4s3deADQuAT8uFigDBlGJiJfFqwyZbSDiZYCKs1oov4B WJ61UEeeKoK0APyRO7O/viozaMhirPMTyrN9Ksl4v4j2a8JIQuOvP/Id36Ula1kJUfLB vVSRuFf1bQPv//5M6AXEhNrVW6jjKyjgYTlAosEI/FVR88PPbDUCInOW8Q5nmVWYebPS rpOK9aJactHgY6ZZt0QosNZkZ7pyZ9WE8fjhfT1EHXJgY3NMUa/ZhneCxw/IPPjx250N gJ2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=f/zAlV3jtf9WXDvJ+KRzHZ3GwY9pgCBRlGEunjFmitM=; b=IHhFtzliG6xxAOE05NVSSp3yUqlw/yinji+FBP/37Us4j+wPmiQ7VGCts+0xoXshOh A5r+bGOA1rLdb6d1RFzcDn3MF9SZzux2feBwiyiFW43mWn9m6JVVJymrwuics3RQchm6 WTvVTMBqGfhigq/HEb0IsWWdinfh+8rzgwLU3r737V6xnj/JhiG8Qn5NO6ym6LzNKXCY CSSXcd0uRBaIwZUlpqIbNqfHrItCob7uw/jtsXDEPHb8zpaLrJg45Zo4fITcm7fJcnuF 4ZBjylDGezAZBujIuhLC573sWs2+SMjN/2gx5SJEVjMqUs5/p3pZDi4p6Llw0//DPUck CIgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@tq-group.com header.s=key1 header.b=ZChRgcFw; 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 z12si1930076pln.207.2019.06.06.08.28.39; Thu, 06 Jun 2019 08:28:55 -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=ZChRgcFw; 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 S1729337AbfFFP1R (ORCPT + 99 others); Thu, 6 Jun 2019 11:27:17 -0400 Received: from mx1.tq-group.com ([62.157.118.193]:47512 "EHLO mx1.tq-group.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729077AbfFFP1R (ORCPT ); Thu, 6 Jun 2019 11:27:17 -0400 X-IronPort-AV: E=Sophos;i="5.60,559,1549926000"; d="scan'208";a="7729995" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 06 Jun 2019 17:27:15 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 06 Jun 2019 17:27:15 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 06 Jun 2019 17:27:15 +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=1559834835; x=1591370835; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=umqEwzb8oK5WtqI9yBT0F9jXzaGIhXB44Au/hCBtBs8=; b=ZChRgcFw7UzOc9rbXEfwLchuZ0/ellpXnHkPlHEpklCREXdKLBLabKEJ 6t03FegynYm2nVJvI1eJchD58VDBuWvCbkSps4rny6tMGvV3smC2c4kTc T/Xk2gl1hHt6Vfq8QDWvPjVuitT5wrIhHAb8PNnFwNcNHsv+uHFSBLCQm 2pGrVHlkP7xLYCtdsLYyjyzRyeGg/iJALy6AQWF8YUfnZ5cm89GLrT0cz KI6iZn00QI0TB1ENhJ0ELOEgnGbQgw95evctYzDh/mXEglNaDYT1LFHSN SZjzC34zR2d40ERgt+0T8AWC7V1C9MPX2St3MlmiVfEr+dCSWUIEltyB2 w==; X-IronPort-AV: E=Sophos;i="5.60,559,1549926000"; d="scan'208";a="7729994" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 06 Jun 2019 17:27:15 +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 7FB7C280074; Thu, 6 Jun 2019 17:27:21 +0200 (CEST) Message-ID: <004bda07469769f8a6e0609efd0327f184307493.camel@ew.tq-group.com> Subject: Re: [PATCH modules 1/2] module: allow arch overrides for .exit section names From: Matthias Schiffer To: Jessica Yu Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org Date: Thu, 06 Jun 2019 17:27:12 +0200 In-Reply-To: <20190606150946.GA27669@linux-8ccs> References: <20190603105726.22436-1-matthias.schiffer@ew.tq-group.com> <20190603105726.22436-2-matthias.schiffer@ew.tq-group.com> <20190606150946.GA27669@linux-8ccs> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2019-06-06 at 17:09 +0200, Jessica Yu wrote: > +++ Matthias Schiffer [03/06/19 12:57 +0200]: > > Some archs like ARM store unwind information for .exit.text in > > sections > > with unusual names. As this unwind information refers to > > .exit.text, it > > must not be loaded when .exit.text is not loaded (when > > CONFIG_MODULE_UNLOAD > > is unset); otherwise, loading a module can fail due to relocation > > failures. > > > > Signed-off-by: Matthias Schiffer > > > > --- > > include/linux/moduleloader.h | 8 ++++++++ > > kernel/module.c | 2 +- > > 2 files changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/include/linux/moduleloader.h > > b/include/linux/moduleloader.h > > index 31013c2effd3..cddbd85fb659 100644 > > --- a/include/linux/moduleloader.h > > +++ b/include/linux/moduleloader.h > > @@ -5,6 +5,7 @@ > > > > #include > > #include > > +#include > > > > /* These may be implemented by architectures that need to hook into > > the > > * module loader code. Architectures that don't need to do > > anything special > > @@ -93,4 +94,11 @@ void module_arch_freeing_init(struct module > > *mod); > > #define MODULE_ALIGN PAGE_SIZE > > #endif > > > > +#ifndef HAVE_ARCH_MODULE_EXIT_SECTION > > +static inline bool module_exit_section(const char *name) > > +{ > > + return strstarts(name, ".exit"); > > +} > > +#endif > > + > > Hi Matthias, > > For sake of consistency, could we implement this as an arch- > overridable > __weak symbol like the rest of the module arch-overrides in > moduleloader.h? Fine with me - making such a tiny function inlineable just seemed more appropriate to me. I can send a v2 tomorrow. > > > #endif > > diff --git a/kernel/module.c b/kernel/module.c > > index 6e6712b3aaf5..e8e4cd0a471f 100644 > > --- a/kernel/module.c > > +++ b/kernel/module.c > > @@ -2924,7 +2924,7 @@ static int rewrite_section_headers(struct > > load_info *info, int flags) > > > > #ifndef CONFIG_MODULE_UNLOAD > > /* Don't load .exit sections */ > > - if (strstarts(info->secstrings+shdr->sh_name, ".exit")) > > + if (module_exit_section(info->secstrings+shdr- > > >sh_name)) > > shdr->sh_flags &= ~(unsigned long)SHF_ALLOC; > > #endif > > } > > -- > > 2.17.1 > >