Bug in regionreturnsegment.c if using compiled with RTEMS_REGION_SHRED_ON_FREE

Joel Sherrill joel.sherrill at OARcorp.com
Wed Nov 13 15:20:06 UTC 2002



Paul Whitfield wrote:
> 
> Hi All,
> 
> In the process of trying to determine where a nasty bug in my
> own code exists I compiled regionreturnsegment.c with the
> RTEMS_REGION_SHRED_ON_FREE #define set.
> 
> However, much to my surprise this did nasty things, trashing
> the whole memory of my system rather comprehensively.
> 
> The I have a attached a patch the fixes the problem
> (value of a size passed rather than the address of size).
> 
> (The problem still exists in snapshot rtems-ss-20021004 which is
> the lastest I have access to)

But not in the next one. :)  THanks.

FYI you can always check on CVS and file PRs if you like:

http://www.oarcorp.com/cgi-bin/cvsweb.cgi
http://www.oarcorp.com/cgi-bin/gnatsweb.pl

> Regards
> 
> Paul
> 
> Index: regionreturnsegment.c
> ===================================================================
> RCS file: /usr/cvs/rtems/c/src/exec/rtems/src/regionreturnsegment.c,v
> retrieving revision 1.1.1.1
> diff -c -r1.1.1.1 regionreturnsegment.c
> *** regionreturnsegment.c       8 Jul 2002 02:31:54 -0000       1.1.1.1
> --- regionreturnsegment.c       13 Nov 2002 09:02:37 -0000
> ***************
> *** 72,78 ****
>          _Region_Debug_Walk( the_region, 3 );
> 
>    #ifdef RTEMS_REGION_FREE_SHRED_PATTERN
> !       if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size
> ) ) {
>            memset(segment, (RTEMS_REGION_FREE_SHRED_PATTERN & 0xFF), size);
>          } else {
>            _Thread_Enable_dispatch();
> --- 72,78 ----
>          _Region_Debug_Walk( the_region, 3 );
> 
>    #ifdef RTEMS_REGION_FREE_SHRED_PATTERN
> !       if ( _Heap_Size_of_user_area( &the_region->Memory, segment,
> &size ) ) {
>            memset(segment, (RTEMS_REGION_FREE_SHRED_PATTERN & 0xFF), size);
>          } else {
>            _Thread_Enable_dispatch();

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the users mailing list