Ignore:
Timestamp:
Oct 12, 2022, 6:13:11 PM (21 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
38cc59f, 5951956
Parents:
e5256bd
Message:

make heap executable for thunks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/heap.cfa

    re5256bd r7671c6d  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Oct 11 15:08:33 2022
    13 // Update Count     : 1525
     12// Last Modified On : Wed Oct 12 18:06:01 2022
     13// Update Count     : 1528
    1414//
    1515
     
    453453
    454454
    455 #define NO_MEMORY_MSG "insufficient heap memory available to allocate %zd new bytes."
     455#define NO_MEMORY_MSG "**** Error **** insufficient heap memory available to allocate %zd new bytes."
    456456
    457457Heap * getHeap() with( heapMaster ) {
     
    477477                                if ( errno == ENOMEM ) abort( NO_MEMORY_MSG, size ); // no memory
    478478                                // Do not call strerror( errno ) as it may call malloc.
    479                                 abort( "attempt to allocate block of heaps of size %zu bytes and mmap failed with errno %d.", size, errno );
     479                                abort( "**** Error **** attempt to allocate block of heaps of size %zu bytes and mmap failed with errno %d.", size, errno );
    480480                        } // if
    481481                        heapManagersStorageEnd = &heapManagersStorage[HeapDim]; // outside array
     
    835835                if ( unlikely( sbrk( increase ) == (void *)-1 ) ) {     // failed, no memory ?
    836836                        unlock( extLock );
    837                         __cfaabi_bits_print_nolock( STDERR_FILENO, NO_MEMORY_MSG, size );
    838                         _exit( EXIT_FAILURE );                                          // give up
    839                 } // if
     837                        abort( NO_MEMORY_MSG, size );                           // no memory
     838                } // if
     839
     840                // Make storage executable for thunks.
     841                if ( mprotect( (char *)heapEnd + heapRemaining, increase, __map_prot ) ) {
     842                        unlock( extLock );
     843                        abort( "**** Error **** attempt to make heap storage executable for thunks and mprotect failed with errno %d.", errno );
     844                } // if
     845
    840846                rem = heapRemaining + increase - size;
    841847
Note: See TracChangeset for help on using the changeset viewer.