Skip to content

Commit c9c84bc

Browse files
authored
Address issues with latest AWS-LC and OpenBSD (awslabs#569)
**Issue:** The latest AWS-LC was crashing on OpenBSD 7.4, when running test `test.test_http_client.TestClient.test_connect_pq_tlsv1_0_2021_05` **Investigation:** AWS-LC added [OpenBSD 7.4 and 7.5 Support](aws/aws-lc#1437) in [v1.26.0](https://github.com/aws/aws-lc/releases/tag/v1.26.0). [Ironically](https://www.youtube.com/watch?v=Jne9t8sHpUc), these changes broke our existing OpenBSD 7.4 CI. My understanding is: "support OpenBSD" means "support fancy assembly math, instead of using vanilla C code math" on OpenBSD. This fancy assembly math currently reads from the .text section of the library, which is forbidden if a library is linked with the `--execute-only` flag, which OpenBSD 7.4+ uses by default. **Description of changes:** - Update to AWS-LC v1.24.0 -> v1.28.0 - Set '-Wl,--no-execute-only' flag when building for OpenBSD and using AWS-LC - Add OpenBSD 7.4 and 7.5 to CI (OpenBSD supports its two most recent releases)
1 parent 4a4fd22 commit c9c84bc

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,21 +192,28 @@ jobs:
192192
193193
openbsd:
194194
runs-on: ubuntu-22.04 # latest
195+
strategy:
196+
fail-fast: false
197+
matrix:
198+
# OpenBSD only supports the two most recent releases
199+
version: ['7.4', '7.5']
195200
steps:
196201
# Cannot use builder to checkout as OpenBSD doesn't ship git in the base install
197202
- uses: actions/checkout@v3
198203
with:
199204
submodules: true
200205
- name: Build ${{ env.PACKAGE_NAME }} + consumers
201-
uses: cross-platform-actions/action@v0.23.0
206+
uses: cross-platform-actions/action@v0.24.0
202207
with:
203208
operating_system: openbsd
204-
version: '7.4'
209+
version: ${{ matrix.version }}
205210
cpu_count: 4
206211
shell: bash
207212
environment_variables: AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_DEFAULT_REGION AWS_REGION
208213
run: |
209214
sudo pkg_add awscli py3-pip py3-urllib3
215+
python3 -m venv .venv
216+
source .venv/bin/activate
210217
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz', 'builder')"
211218
chmod a+x builder
212219
./builder build -p ${{ env.PACKAGE_NAME }}

crt/aws-lc

setup.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,17 +334,23 @@ def awscrt_ext():
334334

335335
if using_system_libcrypto():
336336
libraries += ['crypto']
337+
else:
338+
# hide the symbols from libcrypto.a
339+
# this prevents weird crashes if an application also ends up using
340+
# libcrypto.so from the system's OpenSSL installation.
341+
extra_link_args += ['-Wl,--exclude-libs,libcrypto.a']
342+
343+
# OpenBSD 7.4+ defaults to linking with --execute-only, which is bad for AWS-LC.
344+
# See: https://github.com/aws/aws-lc/blob/4b07805bddc55f68e5ce8c42f215da51c7a4e099/CMakeLists.txt#L44-L53
345+
# (If AWS-LC's CMakeLists.txt removes these lines in the future, we can remove this hack here as well)
346+
if sys.platform.startswith('openbsd'):
347+
extra_link_args += ['-Wl,--no-execute-only']
337348

338349
# FreeBSD doesn't have execinfo as a part of libc like other Unix variant.
339350
# Passing linker flag to link execinfo properly
340351
if sys.platform.startswith('freebsd'):
341352
extra_link_args += ['-lexecinfo']
342353

343-
# hide the symbols from libcrypto.a
344-
# this prevents weird crashes if an application also ends up using
345-
# libcrypto.so from the system's OpenSSL installation.
346-
extra_link_args += ['-Wl,--exclude-libs,libcrypto.a']
347-
348354
# python usually adds -pthread automatically, but we've observed
349355
# rare cases where that didn't happen, so let's be explicit.
350356
extra_link_args += ['-pthread']

0 commit comments

Comments
 (0)