[go: nahoru, domu]

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

How can I deal with the error "free(): invalid next size (fast)"? #1446

Open
AliceNCsyuk opened this issue Jul 5, 2024 · 2 comments
Open

Comments

@AliceNCsyuk
Copy link
AliceNCsyuk commented Jul 5, 2024

I implemented a TOP-K protocol in a virtual machine by adding an topk instruction. However, after I ran the protocol and successfully obtained the result, the program reported an error and did not show the total communication overhead. It seems that this is caused by resource recycling, but I don't know where to fix this error.
Secure_top_k.mpc
batch_size=6
topk_rate=0.9
#k=int(topk_rate*batch_size)
k=4
v=sfix.get_input_from(0, size=6)
ans=cint(size=k)
secure_topk(ans,v.pre_mul(),k,batch_size)
print_ln("%s",ans)
print_ln("%s",ans)
print_ln("%s",ans)
ans1=cint(size=k)
secure_topk(ans1,v.pre_mul(),k,batch_size)
print_ln("%s",ans1)
print_ln("%s",ans1)
print_ln("%s",ans1)

library.py
def secure_topk(ans,v,k,batch_size):
secure_top_k(ans,v,k,batch_size)

instruction.py
class secure_top_k(base.VarArgsInstruction):
slots = []
code = base.opcodes['TOPK']
arg_format = tools.cycle(['cw','s','int','int'])

Input-P0-0
10.1 3.2 2.3 10.4 4.5 6.6

The output:
P0:
Using security parameter 40
Trying to run 64-bit computation
[0, 3, 5, 4]
[0, 3, 5, 4]
[0, 3, 5, 4]
[0, 3, 5, 4]
[0, 3, 5, 4]
[0, 3, 5, 4]
free(): invalid next size (fast)
Aborted (core dumped)
P1:
Using security parameter 40
Trying to run 64-bit computation
The following benchmarks are including preprocessing (offline phase).
Time = 0.00978447 seconds
Data sent = 0.006804 MB in ~36 rounds (party 1)
terminate called after throwing an instance of 'boost::wrapexceptboost::system::system_error'
what(): read_some: stream truncated [asio.ssl.stream:1]
Aborted (core dumped)
P2:
Using security parameter 40
Trying to run 64-bit computation
The following benchmarks are including preprocessing (offline phase).
Time = 0.00951865 seconds
Data sent = 0.000216 MB in ~73 rounds (party 2)
terminate called after throwing an instance of 'boost::wrapexceptboost::system::system_error'
what(): read_some: stream truncated [asio.ssl.stream:1]
Aborted (core dumped)

@AliceNCsyuk
Copy link
Author

tiok
This is the topk protocol and it is from https://eprint.iacr.org/2023/1147.pdf

@mkskeller
Copy link
Member

You can debug memory allocation and overflow errors using valgrind with prefix=valgrind Scripts/<protocol>.sh.

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