Repository navigation
Fix assertion failure after a binary MAC check failure - #1815
Merged
mkskeller merged 1 commit intoNov 20, 2026
Merged
Conversation
mac_fail_remove() asserted that unlinking the secrets file succeeds. For Tinier shares the file name was never registered on the share type that runs the MAC check, so the name was derived from the wrong type (B-8 instead of the B-64 file written by key generation) and the file never exists. The same happens with any share type when the MAC key comes from files without a matching secrets file. The party then aborts on the assertion instead of reporting the MAC check failure, and with live preprocessing the actual binary key material is kept. Register the secrets file name on the Tinier part type as well, and report a failed unlink without aborting so that mac_fail is always thrown. This also keeps the unlink when compiled with NDEBUG.
Member
|
Thank you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1814. Related: #1789 / e0ee046, which fixed the arithmetic-share case.
When a MAC check on Tinier (binary) shares failed in
mascot-party.xortinier-party.x, every party aborted withAssertion failed: (unlink(filename.c_str()) == 0), function mac_fail_removeinstead of stopping withMacCheck Failure. With on-demand preprocessing, the binary MAC key secrets file was also left on disk.Cause:
TinierSecret'sset_secrets_filename()(inherited fromVectorSecret) only registers the file name onShare<T>, not onTinierShare<T>.mac_fail_remove<TinierShare<T>>()therefore falls back toget_ot_secrets_filename<TinierShare<T>>(). That givesMascot-Secrets-B-8-..., while key generation writesMascot-Secrets-B-64-....unlink()result was asserted, so the missing file aborted the process beforethrow mac_fail().Changes:
GC/TinierSecret.h:set_secrets_filename()also registers the name on the part type (TinierShare<T>). With on-demand preprocessing, a failed binary MAC check now removes the B-64 file that holds the key.Protocols/MAC_Check.hpp:mac_fail_remove()callsunlink()outsideassert(). If it fails, it printsCould not remove <file>: <strerror>and still throwsmac_fail. This also covers file-based preprocessing without a matching secrets file. Builds with-DNDEBUGno longer skip the removal.The MAC check itself is unchanged. A failed check always ends in
mac_fail, and the secrets file is still removed wherever it exists.Tested on macOS arm64 with Apple clang 17. Built
mascot-party.x mascot-offline.x tinier-party.x tiny-party.x spdz2k-party.x semi-offline.xwith the default-Werror. Ran two parties on localhost with the program from the issue (sbitsXOR + reveal):mascot-party.x -o mac_fail(on-demand prep)Mascot-Secrets-B-64-*keptMacCheck Failure(exit 1),Mascot-Secrets-B-64-*removedmascot-offline.x, thenmascot-party.x -F -o mac_failCould not remove ...B-8...: No such file or directory, thenMacCheck Failure(exit 1)tinier-party.x -o mac_failMacCheck Failure, B-64 file removed-o mac_fail(fails in the input check)MacCheck Failuresintmultiplication,-o mac_failMacCheck Failure,Mascot-Secrets-p-*removed-FNot changed here: with
-F, the key file the online phase actually reads (Player-MAC-Keys-*in the preprocessing directory) is still not removed. See the open question in the issue.