From: Helge Deller <deller@gmx.de>
To: linux-parisc@vger.kernel.org,
Linux Kernel Development <linux-kernel@vger.kernel.org>,
Kyle McMartin <kyle@mcmartin.ca>,
Randolph Chung <randolph@tausq.org>, Moritz Muehlenhoff <jmm@
Cc: Helge Deller <deller@gmx.de>
Subject: [PATCH 1/2] module.c: fix module loading failure of large modules
Date: Mon, 29 Dec 2008 15:09:12 +0100 [thread overview]
Message-ID: <4958DA08.1080008@gmx.de> (raw)
In-Reply-To: <4958D99E.4010201@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 426 bytes --]
[PATCH 1/2] module.c: fix module loading failure of large modules
When creating the final layout of a kernel module in memory, allow the
module loader to reserve some additional memory behind a given section.
This is currently only needed for the parisc port which needs to put the
stub entries there to fulfill the 17/22bit PCREL relocations with large
kernel modules like xfs.
Signed-off-by: Helge Deller <deller@gmx.de>
[-- Attachment #2: modules.patch1 --]
[-- Type: text/plain, Size: 1894 bytes --]
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index eb10339..65fb34c 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -13,6 +13,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
char *secstrings,
struct module *mod);
+unsigned long module_additional_section_size(struct module *mod,
+ unsigned int section);
+
/* Allocator used for allocating struct module, core sections and init
sections. Returns NULL on failure. */
void *module_alloc(unsigned long size);
diff --git a/kernel/module.c b/kernel/module.c
index 1f4cc00..c7662da 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1579,12 +1579,16 @@ static int simplify_symbols(Elf_Shdr *sechdrs,
}
/* Update size with this section: return offset. */
-static long get_offset(unsigned int *size, Elf_Shdr *sechdr)
+static long get_offset(struct module *mod, unsigned int *size,
+ Elf_Shdr *sechdr, unsigned int section)
{
long ret;
ret = ALIGN(*size, sechdr->sh_addralign ?: 1);
*size = ret + sechdr->sh_size;
+#ifdef CONFIG_ARCH_WANTS_STUBS_BEHIND_SECTIONS
+ *size += module_additional_section_size(mod, section);
+#endif
return ret;
}
@@ -1622,7 +1626,7 @@ static void layout_sections(struct module *mod,
|| strncmp(secstrings + s->sh_name,
".init", 5) == 0)
continue;
- s->sh_entsize = get_offset(&mod->core_size, s);
+ s->sh_entsize = get_offset(mod, &mod->core_size, s, i);
DEBUGP("\t%s\n", secstrings + s->sh_name);
}
if (m == 0)
@@ -1640,7 +1644,7 @@ static void layout_sections(struct module *mod,
|| strncmp(secstrings + s->sh_name,
".init", 5) != 0)
continue;
- s->sh_entsize = (get_offset(&mod->init_size, s)
+ s->sh_entsize = (get_offset(mod, &mod->init_size, s, i)
| INIT_OFFSET_MASK);
DEBUGP("\t%s\n", secstrings + s->sh_name);
}
WARNING: multiple messages have this Message-ID (diff)
From: Helge Deller <deller@gmx.de>
To: linux-parisc@vger.kernel.org,
Linux Kernel Development <linux-kernel@vger.kernel.org>,
Kyle McMartin <kyle@mcmartin.ca>,
Randolph Chung <randolph@tausq.org>,
Moritz Muehlenhoff <jmm@inutil.org>,
Linus <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Helge Deller <deller@gmx.de>
Subject: [PATCH 1/2] module.c: fix module loading failure of large modules
Date: Mon, 29 Dec 2008 15:09:12 +0100 [thread overview]
Message-ID: <4958DA08.1080008@gmx.de> (raw)
In-Reply-To: <4958D99E.4010201@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 426 bytes --]
[PATCH 1/2] module.c: fix module loading failure of large modules
When creating the final layout of a kernel module in memory, allow the
module loader to reserve some additional memory behind a given section.
This is currently only needed for the parisc port which needs to put the
stub entries there to fulfill the 17/22bit PCREL relocations with large
kernel modules like xfs.
Signed-off-by: Helge Deller <deller@gmx.de>
[-- Attachment #2: modules.patch1 --]
[-- Type: text/plain, Size: 1894 bytes --]
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index eb10339..65fb34c 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -13,6 +13,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
char *secstrings,
struct module *mod);
+unsigned long module_additional_section_size(struct module *mod,
+ unsigned int section);
+
/* Allocator used for allocating struct module, core sections and init
sections. Returns NULL on failure. */
void *module_alloc(unsigned long size);
diff --git a/kernel/module.c b/kernel/module.c
index 1f4cc00..c7662da 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1579,12 +1579,16 @@ static int simplify_symbols(Elf_Shdr *sechdrs,
}
/* Update size with this section: return offset. */
-static long get_offset(unsigned int *size, Elf_Shdr *sechdr)
+static long get_offset(struct module *mod, unsigned int *size,
+ Elf_Shdr *sechdr, unsigned int section)
{
long ret;
ret = ALIGN(*size, sechdr->sh_addralign ?: 1);
*size = ret + sechdr->sh_size;
+#ifdef CONFIG_ARCH_WANTS_STUBS_BEHIND_SECTIONS
+ *size += module_additional_section_size(mod, section);
+#endif
return ret;
}
@@ -1622,7 +1626,7 @@ static void layout_sections(struct module *mod,
|| strncmp(secstrings + s->sh_name,
".init", 5) == 0)
continue;
- s->sh_entsize = get_offset(&mod->core_size, s);
+ s->sh_entsize = get_offset(mod, &mod->core_size, s, i);
DEBUGP("\t%s\n", secstrings + s->sh_name);
}
if (m == 0)
@@ -1640,7 +1644,7 @@ static void layout_sections(struct module *mod,
|| strncmp(secstrings + s->sh_name,
".init", 5) != 0)
continue;
- s->sh_entsize = (get_offset(&mod->init_size, s)
+ s->sh_entsize = (get_offset(mod, &mod->init_size, s, i)
| INIT_OFFSET_MASK);
DEBUGP("\t%s\n", secstrings + s->sh_name);
}
next prev parent reply other threads:[~2008-12-29 14:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-29 14:07 [PATCH] parisc: fix module loading failure of large kernel modules Helge Deller
2008-12-29 14:07 ` Helge Deller
2008-12-29 14:09 ` Helge Deller [this message]
2008-12-29 14:09 ` [PATCH 1/2] module.c: fix module loading failure of large modules Helge Deller
2008-12-29 14:10 ` [PATCH 2/2] parisc: " Helge Deller
2008-12-29 14:10 ` Helge Deller
2008-12-29 15:46 ` Sam Ravnborg
2008-12-29 16:09 ` Helge Deller
2008-12-29 16:14 ` John David Anglin
2008-12-29 17:56 ` Helge Deller
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=4958DA08.1080008@gmx.de \
--to=deller@gmx.de \
--cc=kyle@mcmartin.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=randolph@tausq.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.