Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running CCF on Azure Linux #6588

Open
3 tasks done
maxtropets opened this issue Oct 23, 2024 · 8 comments
Open
3 tasks done

Support running CCF on Azure Linux #6588

maxtropets opened this issue Oct 23, 2024 · 8 comments
Assignees

Comments

@maxtropets
Copy link
Collaborator

maxtropets commented Oct 23, 2024

In this issue have to support building and testing CCF on Azure Linux.

The major obstacle so far - openssl.

On Azure Linux, we shall use OpenSSL of (major) version 3. It is to be determined in this ticket which exact version is supported by Azure Linux.

Ticket for reference: #5291

Subtasks to track the progress

  • Try fix ./crypto_test (patched, see discussions in comments)
  • What backend is used in Azure Linux? SymCrypt? Prove by tracking the lib we link against
  • breakdown initial issues
@maxtropets maxtropets self-assigned this Oct 23, 2024
@achamayou
Copy link
Member

achamayou commented Oct 23, 2024

@maxtropets current is 3.3.2, so that one :)

@maxtropets maxtropets changed the title Upgrade OpenSSL to v.3+ Solve OpenSSL on Azure Linux Oct 25, 2024
@maxtropets
Copy link
Collaborator Author

Currently removed the SECP256K1 curve from crypto_test, fails on EVP_PKEY_CTX_set_ec_paramgen_curve_nid with err = 0.

Checked OpenSSL source, same NID for 3.1 and 3.3 impl, NID matches.

#define NID_secp256k1           714

Needs investigation.

@maxtropets
Copy link
Collaborator Author

maxtropets commented Oct 25, 2024

Tried all other unit tests (crypto test patched with #6591)

 ./tests.sh -VV -L unit
...
The following tests FAILED:
	 11 - crypto_test (Failed)
	 13 - key_exchange_test (SEGFAULT)
	 18 - endorsements_test (Failed)
	 19 - historical_queries_test (SEGFAULT)
	 21 - snapshotter_test (SEGFAULT)
	 27 - channels_test (SEGFAULT)
	 28 - http_test (Failed)
	 37 - csr_test (Failed)

@achamayou
Copy link
Member

256k1 is not a NIST standard, which is likely why SymCrypt rejects it - it would be good to confirm and document though

@maxtropets
Copy link
Collaborator Author

What backend is used in Azure Linux? SymCrypt? Prove by tracking the lib we link against

Figured out it's not explicitly linked, but rather being loaded during runtime

openat(AT_FDCWD, "/usr/lib/libsymcrypt.so.103", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=778048, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 557528, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2af8423000
mmap(0x7f2af842f000, 380928, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xc000) = 0x7f2af842f000
mmap(0x7f2af848c000, 118784, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x69000) = 0x7f2af848c000
mmap(0x7f2af84a9000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x86000) = 0x7f2af84a9000

Confirmed dependency chain ccf -> librypto -> libsymcrypt (monolithic lib):

root [ /workspace/build ]# ldd /usr/lib/libsymcrypt.so.103
	statically linked

@maxtropets
Copy link
Collaborator Author

maxtropets commented Oct 28, 2024

Tried all other unit tests (crypto test patched with #6591)

 ./tests.sh -VV -L unit
...
The following tests FAILED:
	 11 - crypto_test (Failed)
	 13 - key_exchange_test (SEGFAULT)
	 18 - endorsements_test (Failed)
	 19 - historical_queries_test (SEGFAULT)
	 21 - snapshotter_test (SEGFAULT)
	 27 - channels_test (SEGFAULT)
	 28 - http_test (Failed)
	 37 - csr_test (Failed)

Split into smaller sub-issues except http_test, doesn't look openssl related, looking into it

UPD: Fixed in #6598

@maxtropets
Copy link
Collaborator Author

Got to the bottom of UVM endorsements test failure, filed a ticket (#6600)

So far, all the known issues are filed in sub-issues or solved.

Next steps

@maxtropets maxtropets changed the title Solve OpenSSL on Azure Linux Support CCF testing&running on Azure Linux Nov 15, 2024
@maxtropets maxtropets changed the title Support CCF testing&running on Azure Linux Support Azure Linux in CCF Nov 15, 2024
@maxtropets maxtropets changed the title Support Azure Linux in CCF Support running CCF on Azure Linux Nov 15, 2024
@maxtropets
Copy link
Collaborator Author

maxtropets commented Dec 20, 2024

Dumping to not lose, how to run the container + tests

docker run -ti --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $(pwd):/workspace mcr.microsoft.com/azurelinux/base/core:3.0 /bin/bash

gpg --import /etc/pki/rpm-gpg/MICROSOFT-RPM-GPG-KEY && tdnf -y update && tdnf -y install ca-certificates git && tdnf -y install build-essential clang cmake ninja-build which && tdnf -y install openssl-devel libuv-devel perl && tdnf -y install libarrow-devel parquet-libs-devel && tdnf -y install lldb strace npm

git config --global --add safe.directory /workspace

CC=`which clang` CXX=`which clang++` cmake -GNinja -DCOMPILE_TARGET=virtual -DCMAKE_BUILD_TYPE=Debug -DLVI_MITIGATIONS=OFF -DUSE_LIBCXX=OFF ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants