From eb0fb17ea512948ea575bbf0d8c8ff89b83936ba Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Thu, 20 Nov 1997 18:24:52 +0000 Subject: [PATCH] Fixed wrong limits for the kernel text in db_numargs(). The interval [VM_MIN_KERNEL_ADDRESS, etext] was used instead of [btext, etext). Added a comment about this being completely wrong for LKMs. This only affects interpreting the instructions after the return to attempt decide the number of args. The attempt usually fails anyway. --- sys/amd64/amd64/db_trace.c | 10 +++++++--- sys/i386/i386/db_trace.c | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c index d4aaaec8026e..7dec82b66557 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_trace.c,v 1.25 1997/08/21 06:32:37 charnier Exp $ + * $Id: db_trace.c,v 1.26 1997/10/27 17:23:18 bde Exp $ */ #include @@ -97,8 +97,12 @@ db_numargs(fp) int args; argp = (int *)db_get_value((int)&fp->f_retaddr, 4, FALSE); - if (argp < (int *)VM_MIN_KERNEL_ADDRESS || - argp > (int *)etext) { + /* + * XXX etext is wrong for LKMs. We should attempt to interpret + * the instruction at the return address in all cases. This + * may require better fault handling. + */ + if (argp < (int *)btext || argp >= (int *)etext) { args = 5; } else { inst = db_get_value((int)argp, 4, FALSE); diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c index d4aaaec8026e..7dec82b66557 100644 --- a/sys/i386/i386/db_trace.c +++ b/sys/i386/i386/db_trace.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_trace.c,v 1.25 1997/08/21 06:32:37 charnier Exp $ + * $Id: db_trace.c,v 1.26 1997/10/27 17:23:18 bde Exp $ */ #include @@ -97,8 +97,12 @@ db_numargs(fp) int args; argp = (int *)db_get_value((int)&fp->f_retaddr, 4, FALSE); - if (argp < (int *)VM_MIN_KERNEL_ADDRESS || - argp > (int *)etext) { + /* + * XXX etext is wrong for LKMs. We should attempt to interpret + * the instruction at the return address in all cases. This + * may require better fault handling. + */ + if (argp < (int *)btext || argp >= (int *)etext) { args = 5; } else { inst = db_get_value((int)argp, 4, FALSE);