Fw: cvs commit: elks/arch/i86/kernel process.c
Al, I happended to see this bug come across the CVS, and just wanted to make sure that you've double checked it. This was the exact area that had to be changed relating to ELK's sys_brk() bug that disallowed data segments 32k... I can't quite remember the original code. Regards, Greg : +/* : + * We only need to do this as long as we support old format binaries : + * that grow stack and heap towards each other : + */ :void stack_check() :{ :register __ptask currentp = current; : - if (currentp-t_regs.sp currentp-t_endbrk) : - { : + if ((currentp-t_begstack currentp-t_enddata) : + (currentp-t_regs.sp currentp-t_endbrk)) { :printk("STACK (%d) ENTERED BSS (%ld) - PROCESS TERMINATING\n", currentp-t_regs.sp, currentp-t_endbrk); :do_exit(SIGSEGV); :} : : :
Re: Fw: cvs commit: elks/arch/i86/kernel process.c
On Thu, Jan 27, 2000 at 11:25:08AM -0700, Greg Haerr wrote: Al, I happended to see this bug come across the CVS, and just wanted to make sure that you've double checked it. This was the exact area that had to be changed relating to ELK's sys_brk() bug that disallowed data segments 32k... I can't quite remember the original code. I have double checked this and I am fairly sure it is right. All I have done is add a consitional so the same checl as before is only done on binaries with the old (current) layout. I think you may be mis-remembering the bug. IIRC the 32K bug was in sys_brk() and was related to the type of the argument being signed instead of unsigned. Thanks for keeping a look out. I am glad someone reads the cvs commit messages. Al int sys_brk(len) __pptr len; { register __ptask currentp = current; if (len currentp-t_enddata || (len (currentp-t_endseg - HEAP_LIMIT))) { return -ENOMEM; } currentp-t_endbrk = len; return 0; } Regards, Greg : +/* : + * We only need to do this as long as we support old format binaries : + * that grow stack and heap towards each other : + */ :void stack_check() :{ :register __ptask currentp = current; : - if (currentp-t_regs.sp currentp-t_endbrk) : - { : + if ((currentp-t_begstack currentp-t_enddata) : + (currentp-t_regs.sp currentp-t_endbrk)) { :printk("STACK (%d) ENTERED BSS (%ld) - PROCESS TERMINATING\n", currentp-t_regs.sp, currentp-t_endbrk); :do_exit(SIGSEGV); :} : : :
RE: Fw: cvs commit: elks/arch/i86/kernel process.c
: I think you may be mis-remembering the bug. IIRC the 32K bug was in sys_brk() : and was related to the type of the argument being signed instead of unsigned. I think you're right. The original bug can be reproduced by having a small ELKS program that malloc's memory. We should be able to malloc almost 64k. The previous version would fail whenever the DS offset 32k. Greg : : Thanks for keeping a look out. I am glad someone reads the cvs commit messages. : : Al : : int sys_brk(len) : __pptr len; : { : register __ptask currentp = current; : : if (len currentp-t_enddata || : (len (currentp-t_endseg - HEAP_LIMIT))) { : return -ENOMEM; : } : : currentp-t_endbrk = len; : return 0; : } : : : : Regards, : : Greg : : : +/* : : + * We only need to do this as long as we support old format binaries : : + * that grow stack and heap towards each other : : + */ : :void stack_check() : :{ : :register __ptask currentp = current; : : - if (currentp-t_regs.sp currentp-t_endbrk) : : - { : : + if ((currentp-t_begstack currentp-t_enddata) : : + (currentp-t_regs.sp currentp-t_endbrk)) { : :printk("STACK (%d) ENTERED BSS (%ld) - PROCESS TERMINATING\n", : currentp-t_regs.sp, currentp-t_endbrk); : :do_exit(SIGSEGV); : :} : : : : : :