linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
To: linux-pci@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
	Michal Marek <mmarek@suse.cz>,
	Sebastian Andrzej Siewior <sebastian@breakpoint.cc>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: [PATCH 1/9] scripts/modpost: check for bad refernces in .pci.fixups area
Date: Sun,  3 Jun 2012 20:48:17 +0200	[thread overview]
Message-ID: <1338749305-22558-2-git-send-email-sebastian@breakpoint.cc> (raw)
In-Reply-To: <1338749305-22558-1-git-send-email-sebastian@breakpoint.cc>

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 <bhelgaas@google.com>
Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
---
 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 },
-- 
1.7.10


  reply	other threads:[~2012-06-03 19:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-03 18:48 Annotate PCI fixups with __devinit instead of __init Sebastian Andrzej Siewior
2012-06-03 18:48 ` Sebastian Andrzej Siewior [this message]
2012-06-03 18:48 ` [PATCH 2/9] x86/quirks: move PCI fixup hooks from __init to __devinit Sebastian Andrzej Siewior
2012-06-03 18:48 ` [PATCH 3/9] pci/quirks: " Sebastian Andrzej Siewior
2012-06-03 18:48 ` [PATCH 4/9] alpha: " Sebastian Andrzej Siewior
2012-06-03 18:48 ` [PATCH 5/9] arm: " Sebastian Andrzej Siewior
2012-06-03 18:48 ` [PATCH 6/9] frv: " Sebastian Andrzej Siewior
2012-06-03 18:48 ` [PATCH 7/9] mips: " Sebastian Andrzej Siewior
2012-06-14 16:39   ` Myron Stowe
2012-06-15 16:33     ` Bjorn Helgaas
2012-06-15 16:38       ` Ralf Baechle
2012-06-15 21:13         ` Bjorn Helgaas
2012-06-16  8:50           ` Sebastian Andrzej Siewior
2012-06-16 18:45             ` Bjorn Helgaas
2012-06-03 18:48 ` [PATCH 8/9] powerpc: " Sebastian Andrzej Siewior
2012-06-06  5:28   ` Benjamin Herrenschmidt
2012-06-03 18:48 ` [PATCH 9/9] sh: " Sebastian Andrzej Siewior
2012-06-04  1:12 ` Annotate PCI fixups with __devinit instead of __init Bjorn Helgaas
2012-06-12  1:27   ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1338749305-22558-2-git-send-email-sebastian@breakpoint.cc \
    --to=sebastian@breakpoint.cc \
    --cc=bhelgaas@google.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).