[lkml]   [2003]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [PATCH] Restore module support.
On Fri, Feb 07, 2003 at 10:43:19AM -0800, Luck, Tony wrote:
> > (2) has the disadvantage that its touching non-architecture specific
> > code, but this is the option I'd prefer due to the obvious performance
> > advantage. However, I'm afraid that it isn't worth the effort to fix
> > up vmalloc and /proc/kcore. vmalloc fix appears simple, but /proc/kcore
> > has issues (anyone know what KCORE_BASE is all about?)
> KCORE_BASE is my fault ... it was an attempt to fix the "modules
> below PAGE_OFFSET" problem for the ia64 port. For a few nanoseconds
> the code just here looked like this:
> #else
> #endif

Ah, ok. What I'm thinking of is something like the following (untested
and probably improperly thought out patch...):

--- orig/fs/proc/kcore.c Sat Nov 2 18:58:18 2002
+++ linux/fs/proc/kcore.c Fri Feb 7 19:48:35 2003
@@ -99,7 +99,10 @@

+#ifndef KCORE_BASE
+#define in_vmlist_region(x) ((x) >= VMALLOC_START && (x) < VMALLOC_END)

#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))

@@ -394,7 +397,7 @@
tsz = buflen;

while (buflen) {
- if ((start >= VMALLOC_START) && (start < VMALLOC_END)) {
+ if (in_vmlist_region(start)) {
char * elf_buf;
struct vm_struct *m;
unsigned long curstart = start;
An architecture could then define KCORE_BASE and in_vmlist_region()
alongside their VMALLOC_START definition if they needed to change

> There was some discussion on a better way to do this, by adding the
> kernel itself to the vmlist, and eliminating all the special case code.
> I took a brief look at this, but realised that there were all sorts
> of ugly race conditions with /proc/kcore if a module is loaded/unloaded
> after some process has read the Elf header.

Well, only root can debug using /proc/kcore, and I'd suggest the best
answer to that problem is "if it hurts, don't do that." I don't think
you should prevent modules from being unloaded just because you have
/proc/kcore open.

Russell King ( The developer of ARM Linux

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:33    [W:0.026 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site