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

test-mok-mirror: minor bug fix #715

Merged
merged 1 commit into from
Jan 18, 2025

Conversation

vathpela
Copy link
Contributor

In 70366a2, I introduced a test case for test-mok-mirror to test the behavior when SetVariable() gives EFI_OUT_OF_RESOURCES. Unfortunately this includes a memory error in its cleanup functions:

==1972634== Invalid read of size 8
==1972634== at 0x4032F3: mock_sv_adjust_usage_data (mock-variables.c:468)
==1972634== by 0x40387B: mock_delete_variable (mock-variables.c:541)
==1972634== by 0x4014E8: mock_reset_variables (mock-variables.c:1353)
==1972634== by 0x401348: mock_finalize_vars_and_configs (mock-variables.c:1405)
==1972634== by 0x401731: main (test-mok-mirror.c:688)
==1972634== Address 0x1ffeffc4f8 is on thread 1's stack
==1972634== 6784 bytes below stack pointer

This is caused because the test data uses a linked-list data structure in an array in the test data, and we try to iterate the list to free the data, but of course the list pointers aren't initialized because it's an array.

Whoops.

This patch makes it so we don't try to clean up that list, because we don't need to.

In 70366a2, I introduced a test case
for test-mok-mirror to test the behavior when SetVariable() gives
EFI_OUT_OF_RESOURCES.  Unfortunately this includes a memory error in its
cleanup functions:

==1972634== Invalid read of size 8
==1972634==    at 0x4032F3: mock_sv_adjust_usage_data (mock-variables.c:468)
==1972634==    by 0x40387B: mock_delete_variable (mock-variables.c:541)
==1972634==    by 0x4014E8: mock_reset_variables (mock-variables.c:1353)
==1972634==    by 0x401348: mock_finalize_vars_and_configs (mock-variables.c:1405)
==1972634==    by 0x401731: main (test-mok-mirror.c:688)
==1972634==  Address 0x1ffeffc4f8 is on thread 1's stack
==1972634==  6784 bytes below stack pointer

This is caused because the test data uses a linked-list data structure
in an array in the test data, and we try to iterate the list to free the
data, but of course the list pointers aren't initialized because it's an
array.

Whoops.

This patch makes it so we don't try to clean up that list, because we
don't need to.

Signed-off-by: Peter Jones <[email protected]>
@vathpela vathpela marked this pull request as ready for review January 18, 2025 19:26
@vathpela vathpela merged commit 3caa75e into rhboot:main Jan 18, 2025
20 checks passed
@vathpela vathpela deleted the test-mok-mirror-data-error-fix branch January 18, 2025 19:30
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

Successfully merging this pull request may close these issues.

1 participant