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
sockets: fix incorrect malloc size #1220
sockets: fix incorrect malloc size #1220
Conversation
Can the reproducer you linked also be included in CRIU's test suite? Or is this something that the github version of CRIU cannot handle yet? |
I have written reproduce in form of zdtm test. I don't think that the reproduce is valuable since it is basically a copy of socket_filter zdtm test with different filter (e.g. any filter with length 4). |
criu/sockets.c
Outdated
if (!sfp.filter) | ||
return -1; | ||
|
||
decode_filter(soe->so_filter, sfp.filter, sfp.len); | ||
ret = restore_opt(sk, SOL_SOCKET, SO_ATTACH_FILTER, &sfp); | ||
if (ret) | ||
pr_perror("Can't restore filter"); |
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.
you should use pr_err in this case, because there is no guarantee that restore_opt returns a correct errno.
You can modify the exiting test. |
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
A little rework of sock_filter test to be able to use it with different filters Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
ddfe975
to
7b246dc
Compare
Changed pr_perror to pr_err
|
Applied. Thanks a lot! |
Fix malloc size: use size * filter_size instead of typo size * size.
In case when there are filter with 4 commands this would corrupt malloc chunk (reproduce)