From patchwork Sun Jun 3 18:48:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 162593 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2E158B6FA9 for ; Mon, 4 Jun 2012 05:26:51 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754309Ab2FCT0u (ORCPT ); Sun, 3 Jun 2012 15:26:50 -0400 Received: from Chamillionaire.breakpoint.cc ([80.244.247.6]:47048 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754217Ab2FCT0t (ORCPT ); Sun, 3 Jun 2012 15:26:49 -0400 Received: from localhost ([127.0.0.1] helo=bazinga.HH.breakpoint.cc ident=410d493183e3c5611c03d88e6b900be8) by Chamillionaire.breakpoint.cc with esmtp (Exim 4.72) (envelope-from ) id 1SbFqo-0002L8-Hj; Sun, 03 Jun 2012 20:48:30 +0200 From: Sebastian Andrzej Siewior To: linux-pci@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, Bjorn Helgaas , Michal Marek , Sebastian Andrzej Siewior , Rusty Russell Subject: [PATCH 1/9] scripts/modpost: check for bad refernces in .pci.fixups area Date: Sun, 3 Jun 2012 20:48:17 +0200 Message-Id: <1338749305-22558-2-git-send-email-sebastian@breakpoint.cc> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1338749305-22558-1-git-send-email-sebastian@breakpoint.cc> References: <1338749305-22558-1-git-send-email-sebastian@breakpoint.cc> X-Breakpoint-Spam-Score: -1.0 X-Breakpoint-Spam-Level: - X-Breakpoint-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Functions used for PCI fixups (like DECLARE_PCI_FIXUP_HEADER) are often marked __init. This is okay as long as nobody is using PCI hotplug. However if one does execute | echo 1 > /sys/bus/pci/rescan and we hit a module which is marked __init istead of __devinit then we go boom because the code is removed after the kernel booted. This patch help to see those section miss-matches. Acked-By: Bjorn Helgaas Cc: Michal Marek Cc: linux-kbuild@vger.kernel.org Cc: Rusty Russell Signed-off-by: Sebastian Andrzej Siewior --- scripts/mod/modpost.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 0f84bb3..68e9f5e 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -865,6 +865,11 @@ static void check_section(const char *modname, struct elf_info *elf, #define ALL_EXIT_TEXT_SECTIONS \ ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" +#define ALL_PCI_INIT_SECTIONS \ + ".pci_fixup_early$", ".pci_fixup_header$", ".pci_fixup_final$", \ + ".pci_fixup_enable$", ".pci_fixup_resume$", \ + ".pci_fixup_resume_early$", ".pci_fixup_suspend$" + #define ALL_XXXINIT_SECTIONS DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, \ MEM_INIT_SECTIONS #define ALL_XXXEXIT_SECTIONS DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, \ @@ -1027,6 +1032,12 @@ const struct sectioncheck sectioncheck[] = { .mismatch = ANY_EXIT_TO_ANY_INIT, .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, +{ + .fromsec = { ALL_PCI_INIT_SECTIONS, NULL }, + .tosec = { INIT_SECTIONS, NULL }, + .mismatch = ANY_INIT_TO_ANY_EXIT, + .symbol_white_list = { NULL }, +}, /* Do not export init/exit functions or data */ { .fromsec = { "__ksymtab*", NULL },