diff options
author | bde <bde@FreeBSD.org> | 1997-11-20 18:24:52 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-11-20 18:24:52 +0000 |
commit | 40314588fdac7b80fa6600cd653032493c4503a3 (patch) | |
tree | e84c49d931780f8afbb90f0f9100a91f659d93f6 | |
parent | dfbf1ec5a96e49d821416565e5196af4a3be0882 (diff) | |
download | FreeBSD-src-40314588fdac7b80fa6600cd653032493c4503a3.zip FreeBSD-src-40314588fdac7b80fa6600cd653032493c4503a3.tar.gz |
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.
-rw-r--r-- | sys/amd64/amd64/db_trace.c | 10 | ||||
-rw-r--r-- | 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 d4aaaec..7dec82b 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 <sys/param.h> @@ -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 d4aaaec..7dec82b 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 <sys/param.h> @@ -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); |