Skip to content

Commit 289b6a2

Browse files
committed
testing testing
Signed-off-by: Ted Poole <[email protected]>
1 parent ccf246c commit 289b6a2

File tree

4 files changed

+55
-8
lines changed

4 files changed

+55
-8
lines changed

bssl-compat/prefixer/prefixer.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ void MyFrontendAction::EndSourceFileAction() {
470470
std::ofstream cstr (opt::cfile());
471471

472472
cstr << "//" << std::endl << "// THIS FILE IS GENERATED BY THE PREFIXER TOOL DO NOT EDIT" << std::endl << "//" << std::endl
473+
<< "#define _GNU_SOURCE" << std::endl
474+
<< "#include <link.h>" << std::endl
473475
<< "#include <dlfcn.h>" << std::endl
474476
<< "#include <errno.h>" << std::endl
475477
<< "#include <assert.h>" << std::endl
@@ -491,8 +493,6 @@ void MyFrontendAction::EndSourceFileAction() {
491493
<< " const char *s = symbol + " << opt::prefix.size() + 1 << ";" << std::endl
492494
<< " if ((result = dlsym(libcrypto, s)) != NULL) return result;" << std::endl
493495
<< " if((result = dlsym(libssl, s)) != NULL) return result;" << std::endl
494-
<< "//fprintf(stderr, \"dlsym(%s) : %s\\n\", s, dlerror());" << std::endl
495-
<< "//exit(ELIBACC);" << std::endl
496496
<< " return NULL;" << std::endl
497497
<< "}" << std::endl
498498
<< std::endl
@@ -507,6 +507,17 @@ void MyFrontendAction::EndSourceFileAction() {
507507
<< " exit(ELIBACC);" << std::endl
508508
<< " }" << std::endl
509509
<< std::endl
510+
<< " if(getenv(\"BSSL_COMPAT_DEBUG_DLINFO\")) {" << std::endl
511+
<< " char libcryptoorigin[PATH_MAX];" << std::endl
512+
<< " if (dlinfo(libcrypto, RTLD_DI_ORIGIN, libcryptoorigin) == 0) {" << std::endl
513+
<< " fprintf(stderr, \"bssl-compat: Loaded %s from %s\\n\", LIBCRYPTO_SO, libcryptoorigin);" << std::endl
514+
<< " }" << std::endl
515+
<< " char libsslorigin[PATH_MAX];" << std::endl
516+
<< " if (dlinfo(libssl, RTLD_DI_ORIGIN, libsslorigin) == 0) {" << std::endl
517+
<< " fprintf(stderr, \"bssl-compat: Loaded %s from %s\\n\", LIBSSL_SO, libsslorigin);" << std::endl
518+
<< " }" << std::endl
519+
<< " }" << std::endl
520+
<< std::endl
510521
<< " ossl.ossl_OpenSSL_version_num = (ossl_OpenSSL_version_num_t)lookup(\"ossl_OpenSSL_version_num\");" << std::endl
511522
<< " if (ossl.ossl_OpenSSL_version_num == NULL) {" << std::endl
512523
<< " fprintf(stderr, \"Failed to load OpenSSL_version_num()\\n\");" << std::endl

openssl/bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ build:ppc --//source/extensions/filters/common/lua:luajit2=1 --linkopt=-fuse-ld=
2323

2424
common --action_env=Clang_DIR=/opt/llvm
2525
common --action_env=LLVM_DIR=/opt/llvm
26+
27+
build --verbose_failures
28+
build --keep_going

test/common/router/BUILD

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,6 @@ sh_binary(
257257
envoy_directory_genrule(
258258
name = "corpus_from_config_impl",
259259
testonly = 1,
260-
srcs = [
261-
# This is deliberately in srcs, since we run into host/target confusion
262-
# otherwise in oss-fuzz builds.
263-
":config_impl_test_static",
264-
],
265260
cmd = " ".join([
266261
"$(location corpus_from_config_impl_sh)",
267262
"$(location //test/common/router:config_impl_test_static)",
@@ -270,7 +265,10 @@ envoy_directory_genrule(
270265
"//bazel:engflow_rbe_x86_64": {"Pool": "6gig"},
271266
"//conditions:default": {},
272267
}),
273-
tools = [":corpus_from_config_impl_sh"],
268+
tools = [
269+
":config_impl_test_static",
270+
":corpus_from_config_impl_sh",
271+
],
274272
)
275273

276274
filegroup(

test/common/router/corpus_from_config_impl.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
#!/bin/sh
22

3+
set +x
4+
5+
echo "TED: \$0 = '$0'"
6+
echo "TED: \$@ = '$@'"
7+
8+
echo "TED:"
9+
echo "TED: readelf -d \"$1\" ...."
10+
readelf -d "$1" | sed 's/^/TED: /g'
11+
12+
echo "TED:"
13+
echo "TED: ldd \"$1\" ...."
14+
ldd "$1" | sed 's/^/TED: /g'
15+
16+
ORIGIN="$(dirname "$(readlink -f "$1")")"
17+
18+
readelf -d "$1" | awk '/RUNPATH/ {match($0, /Library runpath: \[(.*)\]/, a); print a[1]}' | \
19+
tr ':' '\n' | while IFS= read -r RUNPATH; do
20+
echo "TED:"
21+
echo "TED: RUNPATH : $RUNPATH"
22+
ABSRUNPATH="$(readlink -f "$(echo "$RUNPATH" | sed "s|\$ORIGIN|$ORIGIN|g")")"
23+
if [ -d "${ABSRUNPATH}" ]; then
24+
echo "TED: ABSRUNPATH : $ABSRUNPATH"
25+
find "$ABSRUNPATH" -name "*.so*" | while IFS= read -r SOFILE; do
26+
echo "TED: SOFILE : $SOFILE"
27+
ls -l "$SOFILE" | sed 's/^/TED: : /g'
28+
file "$SOFILE" | sed 's/^/TED: : /g'
29+
file --dereference "$SOFILE" | sed 's/^/TED: : /g'
30+
ldd "$SOFILE" | sed 's/^/TED: : /g'
31+
done
32+
else
33+
echo "TED: ABSRUNPATH not found: $ABSRUNPATH"
34+
fi
35+
done
36+
37+
338
# Helper shell script for :corpus_from_config_impl genrule in BUILD.
439

540
# Set NORUNFILES so test/main doesn't fail when runfiles manifest is not found.

0 commit comments

Comments
 (0)