Bug in regionreturnsegment.c if using compiled with RTEMS_REGION_SHRED_ON_FREE

Paul Whitfield paulw at microsol.iinet.net.au
Wed Nov 13 09:09:25 UTC 2002


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)


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();




More information about the users mailing list