Skip to content

Commit

Permalink
Workaround potential stalls in OpenSSL (#1099)
Browse files Browse the repository at this point in the history
* Workaround potential stalls in OpenSSL
  • Loading branch information
NiLuJe committed May 12, 2020
1 parent 0c48e7b commit 989d3a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.third
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ $(OPENSSL_LIB) $(OPENSSL_DIR): $(THIRDPARTY_DIR)/openssl/*.*
$(CMAKE) $(CMAKE_FLAGS) \
-DREALCC="$(REALCC) $(if $(DARWIN),$(DYNLIB_CFLAGS),$(CFLAGS))" \
-DCC="$(CC) $(if $(DARWIN),$(DYNLIB_CFLAGS),$(CFLAGS))" \
-DCPPFLAGS="$(CPPFLAGS)" \
-DCFLAGS="$(CFLAGS)" \
-DSHARED_LDFLAGS="$(LDFLAGS)" \
-DLD="$(LD)" \
Expand Down
5 changes: 5 additions & 0 deletions thirdparty/openssl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ assert_var_defined(CONFIG_SCRIPT)
assert_var_defined(CHOST)
assert_var_defined(REALCC)
assert_var_defined(CC)
assert_var_defined(CPPFLAGS)
assert_var_defined(CFLAGS)
assert_var_defined(SHARED_LDFLAGS)
assert_var_defined(LD)
Expand Down Expand Up @@ -65,6 +66,10 @@ if(DEFINED ENV{SONY_PRSTUX} OR DEFINED ENV{ANDROID})
set(PATCH_CMD3 "${KO_PATCH} ${CMAKE_CURRENT_SOURCE_DIR}/openssl-gcc-4.9-stdatomic.patch")
endif()

# NOTE: Disable https://github.com/openssl/openssl/pull/9595 as it's causing stalls long after the early boot on devices without the getrandom() syscall, which is pretty much all of them, because it's a Linux 3.17+ & glibc 2.25+ feature.
# This is most easily reproduced with scp transfers that will block on the initial select on /dev/random. Since those devices are low-power, UP, and mostly idle, it can take a fairly noticeable amount of time for entropy to be generated...
set(CFLAGS "${CPPFLAGS} -DOPENSSL_RAND_SEED_DEVRANDOM_SHM_ID=-1 ${CFLAGS}")

# NOTE: We need to pass $CFLAGS to OpenSSL's Configure script,
# except it balks on a few exotic flags, so, filter those out...
string(REGEX REPLACE "--sysroot [a-zA-Z0-9/_-]*" "" FILTERED_CFLAGS "${CFLAGS}")
Expand Down

0 comments on commit 989d3a9

Please sign in to comment.