-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
build: fix build with Boost 1.85 and remove instances of viewkey logging #9450
Conversation
5259d00
to
e80e71f
Compare
This was a correct compile-time check, POD implied standard layout and trivial. Now you have to check for multiple things as you do here. One thing I noticed is that I didn't check for trivial copyable in The |
You're right, it's just that its probably too tight of property for what we need. namely, to do blob serialization, we don't care if the class is trivial as long as it is trivially copyable.
We might want to change it here in this PR because Boost 1.85 also broke static assertions in other parts of the codebase: https://github.com/monero-project/monero/actions/runs/10529735156/job/29178145531?pr=9450. |
e80e71f
to
f4ff8b1
Compare
64d5655
to
75f1810
Compare
Okay so sorry for the spam, but it should be ready now |
Side note: we use a variable time algorithm for converting some of these secrets into hex which opens us up to cache timing attacks. Not a huge deal since we usually only hexify tx ephemeral privkeys (except in the wallet save code), and/or it can't be trivially triggered repeatedly. However, this is far from ideal. |
can confrim this solves compilation issues for me, please squash |
8eec319
to
4d6a3c0
Compare
Squashed and implemented @vtnerd's suggestions for epee byte span functions |
@@ -1091,6 +1091,7 @@ endif() | |||
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS}) | |||
add_definitions(-DBOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION) | |||
add_definitions(-DBOOST_NO_AUTO_PTR) | |||
add_definitions(-DBOOST_UUID_DISABLE_ALIGNMENT) # This restores UUID's std::has_unique_object_representations property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this target dependent instead of universal definition?
Roughly:
target_compile_definitions(boost::uuid PUBLIC -DBOOST_UUID_DISABLE_ALIGNMENT)
Or something like this:
set_property(TARGET boost::uuid APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS -DBOOST_UUID_DISABLE_ALIGNMENT)
The main objective is preventing polluting the global flag namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need this flag for all translation units which include boost/uuid/uuid.hpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also open against release-v0.18
This PR requires C++17, which is not yet supported on the release branch |
…ing [RELEASE] 1. Use `std::is_standard_layout` and `std::is_trivially_copyable` instead of `std::is_pod` for KV byte-wise serialization, which fixes compile issue for Boost UUIDs 2. Removed reimplementation of `std::hash` for `boost::uuids::uuid` 3. Removed `<<` operator overload for `crypto::secret_key` 4. Removed instances in code where private view key was dumped to the log in plaintext Release version of monero-project#9450
@@ -484,7 +484,7 @@ namespace cryptonote | |||
crypto::generate_ring_signature(tx_prefix_hash, boost::get<txin_to_key>(tx.vin[i]).k_image, keys_ptrs, in_contexts[i].in_ephemeral.sec, src_entr.real_output, sigs.data()); | |||
ss_ring_s << "signatures:" << ENDL; | |||
std::for_each(sigs.begin(), sigs.end(), [&](const crypto::signature& s){ss_ring_s << s << ENDL;}); | |||
ss_ring_s << "prefix_hash:" << tx_prefix_hash << ENDL << "in_ephemeral_key: " << in_contexts[i].in_ephemeral.sec << ENDL << "real_output: " << src_entr.real_output << ENDL; | |||
ss_ring_s << "prefix_hash:" << tx_prefix_hash << ENDL << "in_ephemeral_key: " << rct::sk2rct(in_contexts[i].in_ephemeral.sec) << ENDL << "real_output: " << src_entr.real_output << ENDL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are unwrap functions to expose the inner type without copy - unwrap(unwrap(txkey.sec)). This occurs several times throughout this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function rct::sk2rct
also doesn't copy, but unwrap
is a definitely a lot cleaner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function does a return by value - so it is definitely triggering the copy constructor in this situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind I missed the &
by the function name. Yikes! This violates the aliasing rule, too bad I missed this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay newest force push drops usage of rct::sk2rct
to convert secret keys to rct::key
and uses unwrap
or a wrapper called crypto::secret_key_explicit_print_ref
. I can look into making a PR to fix the strict aliasing later
Builds for me as well (on the release branch). Thanks. |
Is this generally stable enough to be used / trusted with funds? I'm not able to build on macOS otherwise, so I'm stuck without it. From vtnerd's last review, it looks like we're awaiting a couple more changes. |
It's probably safe for funds, but I'm going to push a commit very soon that makes it better (i.e. still copyless) in the scenario where we fix the strict aliasing violations with the |
1. Use `std::is_standard_layout` and `std::is_trivially_copyable` instead of `std::is_pod` for KV byte-wise serialization, which fixes compile issue for Boost UUIDs 2. Use `std::has_unique_object_representations` instead of `alignof(T) == 1` for epee byte spans and epee hex functions 3. Removed reimplementation of `std::hash` for `boost::uuids::uuid 4. Removed `<<` operator overload for `crypto::secret_key` 5. Removed instances in code where private view key was dumped to the log in plaintext
4d6a3c0
to
ed955bf
Compare
Windows build failure is unrelated to this PR |
…ing [RELEASE] 1. Use std::is_standard_layout and std::is_trivially_copyable instead of std::is_pod for KV byte-wise serialization, which fixes compile issue for Boost UUIDs 2. Removed reimplementation of std::hash for boost::uuids::uuid 3. Removed << operator overload for crypto::secret_key 4. Removed instances in code where private view key was dumped to the log in plaintext Release version of monero-project#9450, containing C++14 modified assertions
…ing [RELEASE] 1. Use std::is_standard_layout and std::is_trivially_copyable instead of std::is_pod for KV byte-wise serialization, which fixes compile issue for Boost UUIDs 2. Removed reimplementation of std::hash for boost::uuids::uuid 3. Removed << operator overload for crypto::secret_key 4. Removed instances in code where private view key was dumped to the log in plaintext Release version of monero-project#9450, containing C++14 modified assertions
…ing [RELEASE] 1. Use std::is_standard_layout and std::is_trivially_copyable instead of std::is_pod for KV byte-wise serialization, which fixes compile issue for Boost UUIDs 2. Removed reimplementation of std::hash for boost::uuids::uuid 3. Removed << operator overload for crypto::secret_key 4. Removed instances in code where private view key was dumped to the log in plaintext Release version of monero-project#9450, containing C++14 modified assertions
It would be great if there could be a new release with this feature to get Monero back into FreeBSD ports. It's currently marked as broken: https://cgit.freebsd.org/ports/commit/?id=3da4573eecd73a44684a43970822cac66177a70c |
std::is_standard_layout
andstd::is_trivially_copyable
instead ofstd::is_pod
for KV byte-wise serialization, which fixes compile issue for Boost UUIDsstd::has_unique_object_representations
instead ofalignof(T) == 1
for epee byte spans and epee hex functionsstd::hash
forboost::uuids::uuid
<<
operator overload forcrypto::secret_key