summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2007-09-17 21:55:28 +0000
committerpeter <peter@FreeBSD.org>2007-09-17 21:55:28 +0000
commit4e0e5f8feeeb06cfd82f8d93d667eeb4876790ec (patch)
tree4c6cd8e4d460788dd4c13cc6c2565cd2feb97523
parentd2e6b6eac7970920eccfe2d65f03d9ca3c6542ae (diff)
downloadFreeBSD-src-4e0e5f8feeeb06cfd82f8d93d667eeb4876790ec.zip
FreeBSD-src-4e0e5f8feeeb06cfd82f8d93d667eeb4876790ec.tar.gz
Fix an undefined symbol that as/ld neglected to flag as a problem. It
was used in assembler code in such a way that no unresolved relocation records were generated, so ld didn't flag the problem. You can see this with an 'nm' of the kernel. There will be 'U MAXCPU' on SMP systems. The impact of this is that the intrcount/intrnames arrays do not have the intended amount of space reserved. This could lead to interesting problems due to the arrays being present in the middle of kernel code. An overflow would be rather interesting as executable code would be used as per-cpu incrementing interrupt counters. This fixes it for now by exporting MAXCPU to the assembler. A better fix might be to define these data structures in C - they're only referenced in the kernel from C code these days anyway. Approved by: re (kensmith)
-rw-r--r--sys/amd64/amd64/genassym.c1
-rw-r--r--sys/i386/i386/genassym.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
index 10ad5a3..6a5056f 100644
--- a/sys/amd64/amd64/genassym.c
+++ b/sys/amd64/amd64/genassym.c
@@ -180,6 +180,7 @@ ASSYM(UC_EFLAGS, offsetof(ucontext_t, uc_mcontext.mc_rflags));
ASSYM(ENOENT, ENOENT);
ASSYM(EFAULT, EFAULT);
ASSYM(ENAMETOOLONG, ENAMETOOLONG);
+ASSYM(MAXCPU, MAXCPU);
ASSYM(MAXCOMLEN, MAXCOMLEN);
ASSYM(MAXPATHLEN, MAXPATHLEN);
ASSYM(PC_SIZEOF, sizeof(struct pcpu));
diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c
index 9169431..dba5c50 100644
--- a/sys/i386/i386/genassym.c
+++ b/sys/i386/i386/genassym.c
@@ -173,6 +173,7 @@ ASSYM(UC_GS, offsetof(ucontext_t, uc_mcontext.mc_gs));
ASSYM(ENOENT, ENOENT);
ASSYM(EFAULT, EFAULT);
ASSYM(ENAMETOOLONG, ENAMETOOLONG);
+ASSYM(MAXCPU, MAXCPU);
ASSYM(MAXCOMLEN, MAXCOMLEN);
ASSYM(MAXPATHLEN, MAXPATHLEN);
ASSYM(BOOTINFO_SIZE, sizeof(struct bootinfo));
OpenPOWER on IntegriCloud