Changeset e0cc9e0 for libcfa


Ignore:
Timestamp:
Jan 4, 2024, 12:05:02 PM (4 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
e7eb1f0
Parents:
4aae2bd
Message:

first attempt to interpose dl_iterate_phdr with disable/enable interrupt protection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/interpose.cfa

    r4aae2bd re0cc9e0  
    1010// Created On       : Wed Mar 29 16:10:31 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar 27 21:09:03 2023
    13 // Update Count     : 196
     12// Last Modified On : Thu Jan  4 11:04:06 2024
     13// Update Count     : 215
    1414//
    1515
     
    1818extern "C" {
    1919#include <dlfcn.h>                                                                              // dlopen, dlsym
     20//#include <link.h>                                                                             // dl_iterate_phdr
     21struct dl_phdr_info;
     22int dl_iterate_phdr( int (*)( struct dl_phdr_info *, size_t, void * ), void * );
    2023#include <execinfo.h>                                                                   // backtrace, messages
    2124}
     
    2326#include "bits/defs.hfa"
    2427#include "bits/signal.hfa"                                                              // sigHandler_?
     28#include "concurrency/kernel/fwd.hfa"                                   // disable_interrupts, enable_interrupts
    2529#include "startup.hfa"                                                                  // STARTUP_PRIORITY_CORE
    2630#include <assert.h>
     
    8791        void (* exit)( int ) __attribute__(( __noreturn__ ));
    8892        void (* abort)( void ) __attribute__(( __noreturn__ ));
     93        int (* dl_iterate_phdr)( int (*)( struct dl_phdr_info *, size_t, void * ), void * );
    8994} __cabi_libc;
    9095
     
    102107                #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
    103108                INTERPOSE_LIBC( abort, version );
    104                 INTERPOSE_LIBC( exit , version );
     109                INTERPOSE_LIBC( exit, version );
     110                INTERPOSE_LIBC( dl_iterate_phdr, version );
    105111                #pragma GCC diagnostic pop
    106112
     
    150156        }
    151157}
     158
     159extern "C" int dl_iterate_phdr( int (* callback)( struct dl_phdr_info *, size_t, void * ), void * data ) {
     160        // assert( RealRtn::dl_iterate_phdr != nullptr );
     161        disable_interrupts();
     162        int ret = __cabi_libc.dl_iterate_phdr( callback, data );
     163        enable_interrupts( false );
     164        return ret;
     165} // dl_iterate_phdr
    152166
    153167//=============================================================================================
Note: See TracChangeset for help on using the changeset viewer.