Messages in this thread Patch in this message | | | Date | Thu, 1 May 1997 03:53:45 +0200 (MET DST) | From | bert hubert <> | Subject | Overrun when dumping core and more than 80 characters of arguments |
| |
On Wed, 30 Apr 1997, bert hubert wrote:
> In my mail from yesterday I mentioned that sometimes it caused an Oops 0 > message, and quoted it, but also said that it sometimes gave VFS errors. > I have now been able to reproduce this one:
Ok, I've sussed it! It turns out that this is a bug relevant to (at least) linux 2.0.27 to 2.1.24, all platforms! That is, unless I'm terribly mistaken, this is only my second attempt at kernel-hacking.
When trying to dump core on an ELF system, it includes the first 80 bytes of arguments which were passed to the program. This is an char arguments[80] kind of string. If more than 80 characters were passed, the string is terminated like this: arguments[80]=0;, which results in an overrun to the inode pointer!
To fix this, use something like this patch, which works on anything I've tried since 2.0.27:
--- binfmt_elf.c Thu May 1 03:27:19 1997 +++ binfmt_elf.c Thu May 1 03:28:05 1997 @@ -1146,7 +1146,7 @@ for(i = 0; i < len; i++) if (psinfo.pr_psargs[i] == 0) psinfo.pr_psargs[i] = ' '; - psinfo.pr_psargs[len] = 0; + psinfo.pr_psargs[len-1] = 0;
set_fs(KERNEL_DS); }
| |