uti: Hook system calls by binary-patching glibc

(1) Add --enable-uti option. The binary-patch library is
    preloaded with this option.
(2) Binary-patching is done by syscall_intercept developed by Intel

This commit includes the following fixes:

(1) Fix do_exit() and terminate() handling
(2) Fix timing of killing mcexec threads when McKernel thread calls terminate()

Change-Id: Iad885e1e5540ed79f0808debd372463e3b8fecea
This commit is contained in:
Masamichi Takagi
2018-09-04 09:29:54 +09:00
parent e613483bee
commit e42c414454
15 changed files with 608 additions and 500 deletions

131
configure vendored
View File

@@ -631,6 +631,8 @@ IHK_VERSION
ENABLE_QLMPI
ENABLE_RUSAGE
ENABLE_MCOVERLAYFS
LDFLAGS_SYSCALL_INTERCEPT
CPPFLAGS_SYSCALL_INTERCEPT
MANDIR
KERNDIR
KMODDIR
@@ -702,6 +704,9 @@ enable_option_checking
with_mpi
with_mpi_include
with_mpi_lib
with_syscall_intercept
with_syscall_intercept_include
with_syscall_intercept_lib
with_kernelsrc
with_target
with_system_map
@@ -1346,6 +1351,15 @@ Optional Packages:
--with-mpi-include=PATH specify path where mpi include directory can be
found
--with-mpi-lib=PATH specify path where mpi lib directory can be found
--with-syscall_intercept=PATH
specify path where syscall_intercept include
directory and lib directory can be found
--with-syscall_intercept-include=PATH
specify path where syscall_intercept include
directory can be found
--with-syscall_intercept-lib=PATH
specify path where syscall_intercept lib directory
can be found
--with-kernelsrc=path Path to 'kernel src', default is
/lib/modules/uname_r/build
--with-target={attached-mic | builtin-mic | builtin-x86 | smp-x86}
@@ -2082,6 +2096,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
IHK_VERSION=1.5.0
MCKERNEL_VERSION=1.5.0
DCFA_VERSION=DCFA_VERSION_m4
@@ -3513,6 +3529,119 @@ fi
# Check whether --with-syscall_intercept was given.
if test "${with_syscall_intercept+set}" = set; then :
withval=$with_syscall_intercept; case "$withval" in #(
yes|no|'') :
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --without-syscall_intercept=PATH expects a valid PATH" >&5
$as_echo "$as_me: WARNING: --without-syscall_intercept=PATH expects a valid PATH" >&2;}
with_syscall_intercept="" ;; #(
*) :
;;
esac
else
with_syscall_intercept=
fi
# Check whether --with-syscall_intercept-include was given.
if test "${with_syscall_intercept_include+set}" = set; then :
withval=$with_syscall_intercept_include; case "$withval" in #(
yes|no|'') :
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --without-syscall_intercept-include=PATH expects a valid PATH" >&5
$as_echo "$as_me: WARNING: --without-syscall_intercept-include=PATH expects a valid PATH" >&2;}
with_syscall_intercept_include="" ;; #(
*) :
;;
esac
fi
# Check whether --with-syscall_intercept-lib was given.
if test "${with_syscall_intercept_lib+set}" = set; then :
withval=$with_syscall_intercept_lib; case "$withval" in #(
yes|no|'') :
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --without-syscall_intercept-lib=PATH expects a valid PATH" >&5
$as_echo "$as_me: WARNING: --without-syscall_intercept-lib=PATH expects a valid PATH" >&2;}
with_syscall_intercept_lib="" ;; #(
*) :
;;
esac
fi
# The args have been sanitized into empty/non-empty values above.
# Now append -I/-L args to CPPFLAGS/LDFLAGS, with more specific options
# taking priority
if test -n "${with_syscall_intercept_include}"; then :
if echo "$CPPFLAGS_SYSCALL_INTERCEPT" | $FGREP -e "\<-I${with_syscall_intercept_include}\>" >/dev/null 2>&1; then :
echo "CPPFLAGS_SYSCALL_INTERCEPT(='$CPPFLAGS_SYSCALL_INTERCEPT') contains '-I${with_syscall_intercept_include}', not appending" >&5
else
echo "CPPFLAGS_SYSCALL_INTERCEPT(='$CPPFLAGS_SYSCALL_INTERCEPT') does not contain '-I${with_syscall_intercept_include}', appending" >&5
CPPFLAGS_SYSCALL_INTERCEPT="$CPPFLAGS_SYSCALL_INTERCEPT -I${with_syscall_intercept_include}"
fi
else
if test -n "${with_syscall_intercept}"; then :
if echo "$CPPFLAGS_SYSCALL_INTERCEPT" | $FGREP -e "\<-I${with_syscall_intercept}/include\>" >/dev/null 2>&1; then :
echo "CPPFLAGS_SYSCALL_INTERCEPT(='$CPPFLAGS_SYSCALL_INTERCEPT') contains '-I${with_syscall_intercept}/include', not appending" >&5
else
echo "CPPFLAGS_SYSCALL_INTERCEPT(='$CPPFLAGS_SYSCALL_INTERCEPT') does not contain '-I${with_syscall_intercept}/include', appending" >&5
CPPFLAGS_SYSCALL_INTERCEPT="$CPPFLAGS_SYSCALL_INTERCEPT -I${with_syscall_intercept}/include"
fi
fi
fi
if test -n "${with_syscall_intercept_lib}"; then :
if echo "$LDFLAGS_SYSCALL_INTERCEPT" | $FGREP -e "\<-L${with_syscall_intercept_lib} -Wl,-rpath,${with_syscall_intercept_lib}\>" >/dev/null 2>&1; then :
echo "LDFLAGS_SYSCALL_INTERCEPT(='$LDFLAGS_SYSCALL_INTERCEPT') contains '-L${with_syscall_intercept_lib} -Wl,-rpath,${with_syscall_intercept_lib}', not appending" >&5
else
echo "LDFLAGS_SYSCALL_INTERCEPT(='$LDFLAGS_SYSCALL_INTERCEPT') does not contain '-L${with_syscall_intercept_lib} -Wl,-rpath,${with_syscall_intercept_lib}', appending" >&5
LDFLAGS_SYSCALL_INTERCEPT="$LDFLAGS_SYSCALL_INTERCEPT -L${with_syscall_intercept_lib} -Wl,-rpath,${with_syscall_intercept_lib}"
fi
else
if test -n "${with_syscall_intercept}"; then :
if echo "$LDFLAGS_SYSCALL_INTERCEPT" | $FGREP -e "\<-L${with_syscall_intercept}/lib -Wl,-rpath,${with_syscall_intercept}/lib\>" >/dev/null 2>&1; then :
echo "LDFLAGS_SYSCALL_INTERCEPT(='$LDFLAGS_SYSCALL_INTERCEPT') contains '-L${with_syscall_intercept}/lib -Wl,-rpath,${with_syscall_intercept}/lib', not appending" >&5
else
echo "LDFLAGS_SYSCALL_INTERCEPT(='$LDFLAGS_SYSCALL_INTERCEPT') does not contain '-L${with_syscall_intercept}/lib -Wl,-rpath,${with_syscall_intercept}/lib', appending" >&5
LDFLAGS_SYSCALL_INTERCEPT="$LDFLAGS_SYSCALL_INTERCEPT -L${with_syscall_intercept}/lib -Wl,-rpath,${with_syscall_intercept}/lib"
fi
if test -d "${with_syscall_intercept}/lib64"; then :
if echo "$LDFLAGS_SYSCALL_INTERCEPT" | $FGREP -e "\<-L${with_syscall_intercept}/lib64 -Wl,-rpath,${with_syscall_intercept}/lib64\>" >/dev/null 2>&1; then :
echo "LDFLAGS_SYSCALL_INTERCEPT(='$LDFLAGS_SYSCALL_INTERCEPT') contains '-L${with_syscall_intercept}/lib64 -Wl,-rpath,${with_syscall_intercept}/lib64', not appending" >&5
else
echo "LDFLAGS_SYSCALL_INTERCEPT(='$LDFLAGS_SYSCALL_INTERCEPT') does not contain '-L${with_syscall_intercept}/lib64 -Wl,-rpath,${with_syscall_intercept}/lib64', appending" >&5
LDFLAGS_SYSCALL_INTERCEPT="$LDFLAGS_SYSCALL_INTERCEPT -L${with_syscall_intercept}/lib64 -Wl,-rpath,${with_syscall_intercept}/lib64"
fi
fi
fi
fi
# Check whether --with-kernelsrc was given.
if test "${with_kernelsrc+set}" = set; then :
withval=$with_kernelsrc; WITH_KERNELSRC=$withval
@@ -4660,6 +4789,8 @@ fi