-
Notifications
You must be signed in to change notification settings - Fork 868
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds a framework to abstract runtime code patching. Components in the new framework can provide functions for either patching a named function or a function pointer. The later functionality is not being used but may provide a way to allow memory hooks when dlopen functionality is disabled. This commit adds two different flavors of code patching. The first is provided by the overwrite component. This component overwrites the first several instructions of the target function with code to jump to the provided hook function. The hook is expected to provide the full functionality of the hooked function. The linux patcher component is based on the memory hooks in ucx. It only works on linux and operates by overwriting function pointers in the symbol table. In this case the hook is free to call the original function using the function pointer returned by dlsym. Both components restore the original functions when the patcher framework closes. Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
- Loading branch information
Showing
25 changed files
with
1,390 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ opal_show_help_yyleng | |
opal_show_help_yytext | ||
opal_util_keyval_yyleng | ||
opal_util_keyval_yytext | ||
__curbrk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# | ||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana | ||
# University Research and Technology | ||
# Corporation. All rights reserved. | ||
# Copyright (c) 2004-2005 The University of Tennessee and The University | ||
# of Tennessee Research Foundation. All rights | ||
# reserved. | ||
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, | ||
# University of Stuttgart. All rights reserved. | ||
# Copyright (c) 2004-2005 The Regents of the University of California. | ||
# All rights reserved. | ||
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. | ||
# Copyright (c) 2016 Los Alamos National Security, LLC. All rights | ||
# reserved. | ||
# $COPYRIGHT$ | ||
# | ||
# Additional copyrights may follow | ||
# | ||
# $HEADER$ | ||
# | ||
|
||
# main library setup | ||
noinst_LTLIBRARIES = libmca_patcher.la | ||
libmca_patcher_la_SOURCES = | ||
|
||
# local files | ||
headers = patcher.h | ||
libmca_patcher_la_SOURCES += $(headers) | ||
|
||
# Conditionally install the header files | ||
if WANT_INSTALL_HEADERS | ||
opaldir = $(opalincludedir)/$(subdir) | ||
nobase_opal_HEADERS = $(headers) | ||
endif | ||
|
||
include base/Makefile.am | ||
|
||
distclean-local: | ||
rm -f base/static-components.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana | ||
# University Research and Technology | ||
# Corporation. All rights reserved. | ||
# Copyright (c) 2004-2005 The University of Tennessee and The University | ||
# of Tennessee Research Foundation. All rights | ||
# reserved. | ||
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, | ||
# University of Stuttgart. All rights reserved. | ||
# Copyright (c) 2004-2005 The Regents of the University of California. | ||
# All rights reserved. | ||
# Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. | ||
# Copyright (c) 2016 Los Alamos National Security, LLC. All rights | ||
# reserved. | ||
# $COPYRIGHT$ | ||
# | ||
# Additional copyrights may follow | ||
# | ||
# $HEADER$ | ||
# | ||
|
||
headers += base/base.h | ||
|
||
libmca_patcher_la_SOURCES += base/patcher_base_frame.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ | ||
/* | ||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana | ||
* University Research and Technology | ||
* Corporation. All rights reserved. | ||
* Copyright (c) 2004-2006 The University of Tennessee and The University | ||
* of Tennessee Research Foundation. All rights | ||
* reserved. | ||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, | ||
* University of Stuttgart. All rights reserved. | ||
* Copyright (c) 2004-2005 The Regents of the University of California. | ||
* All rights reserved. | ||
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights | ||
* reserved. | ||
* $COPYRIGHT$ | ||
* | ||
* Additional copyrights may follow | ||
* | ||
* $HEADER$ | ||
* | ||
*/ | ||
|
||
#ifndef OPAL_PATCHER_BASE_H | ||
#define OPAL_PATCHER_BASE_H | ||
|
||
#include "opal_config.h" | ||
#include "opal/mca/base/mca_base_framework.h" | ||
#include "opal/mca/patcher/patcher.h" | ||
|
||
|
||
BEGIN_C_DECLS | ||
|
||
/** | ||
* Framework struct declaration for this framework | ||
*/ | ||
OPAL_DECLSPEC extern mca_base_framework_t opal_patcher_base_framework; | ||
OPAL_DECLSPEC int opal_patcher_base_select (void); | ||
|
||
END_C_DECLS | ||
#endif /* OPAL_BASE_PATCHER_H */ |
Oops, something went wrong.