Skip to content
  • David Johnson's avatar
    libloadall: LD_PRELOAD override of __libc_start_main to mlockall/munlockall(). · ee3411d8
    David Johnson authored
    This is a best-effort, least-intrusion attempt to force all of the process's
    virtual address space to be loaded before main().  They may later be
    *unloaded*, but now main() should begin with all pages loaded into RAM
    and in the page table.  Well, of course it's not guaranteed; but it should
    work on any reasonable kernel that is not experiencing memory pressure.  And
    of course we munlockall() immediately afterward because we don't want to
    interfere with the process down the road.
    
    Note that this is *NOT* included in libvmilib.so -- it is only available in
    libloadall.so -- we don't want __libc_start_main overridden by default.
    
    I suppose this might not work on some older platforms; don't really know
    how long __libc_start_main has been standardized.  Probably a long, long
    time.
    ee3411d8