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 failure on 32-bit #641

Closed
heftig opened this issue Jul 2, 2024 · 1 comment · Fixed by #642
Closed

Test failure on 32-bit #641

heftig opened this issue Jul 2, 2024 · 1 comment · Fixed by #642

Comments

@heftig
Copy link
Contributor

heftig commented Jul 2, 2024

Since 0.25.4, a build using gcc -m32 (on x86_64) fails the test-enumerate test:

1..17
ok 1 /extract/test_file_name_for_label
ok 2 /extract/test_file_name_for_class
ok 3 /extract/test_comment_for_label
ok 4 /extract/test_comment_not_enabled
ok 5 /extract/test_info_simple_certificate
ok 6 /extract/test_info_limit_purposes
ok 7 /extract/test_info_invalid_purposes
p11-kit: 'templ[i].ulValueLen != 0' not true at prepare_recursive_attribute

backtrace:

#0  0xf7ddc579 in __kernel_vsyscall ()
#1  0xf7a5a88f in __pthread_kill_implementation (threadid=threadid@entry=4154181888, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:43
#2  0xf7a5a91f in __pthread_kill_internal (threadid=4154181888, signo=6) at pthread_kill.c:78
#3  0xf7a00287 in __GI_raise (sig=6) at ../sysdeps/posix/raise.c:26
#4  0xf79e7121 in __GI_abort () at abort.c:79
#5  0xf7d461e6 in p11_debug_precond (format=0xf7d4900d "p11-kit: '%s' not true at %s\n") at ../common/debug.c:190
#6  0xf7c4eaa5 in prepare_recursive_attribute (iter=0x5f020530, attr=0x5f022310, templ=0x92395010, templ_len=1700946284) at ../p11-kit/iter.c:1045
#7  0xf7c4ebd1 in prepare_recursive_attribute (iter=0x5f020530, attr=0x5f022310, templ=0x5f025cb0, templ_len=13) at ../p11-kit/iter.c:1052
#8  0xf7c4ebd1 in prepare_recursive_attribute (iter=0x5f020530, attr=0x5f022310, templ=0x5f027800, templ_len=36) at ../p11-kit/iter.c:1052
#9  0xf7c4f05d in p11_kit_iter_load_attributes (iter=0x5f020530, templ=0x5f021f20, count=149) at ../p11-kit/iter.c:1141
#10 0x5e1882e7 in extract_info (ex=0x5e1b4d7c <test+284>) at ../trust/enumerate.c:309
#11 0x5e188511 in on_iterate_load_filter (iter=0x5f020530, matches=0xff8ddc5b "\001\325|\031^", data=0x5e1b4d7c <test+284>) at ../trust/enumerate.c:375
#12 0xf7c4d48e in call_all_filters (iter=0x5f020530, matches=0xff8ddc5b "\001\325|\031^") at ../p11-kit/iter.c:534
#13 0xf7c4deba in p11_kit_iter_next (iter=0x5f020530) at ../p11-kit/iter.c:743
#14 0xf7c4e353 in p11_kit_iter_next (iter=0x5f020530) at ../p11-kit/iter.c:831
#15 0x5e186665 in test_info_skip_non_certificate () at ../trust/test-enumerate.c:339
#16 0x5e19d0de in p11_test_run (argc=0, argv=0xff8dde58) at ../common/test.c:377
#17 0x5e18778c in main (argc=1, argv=0xff8dde54) at ../trust/test-enumerate.c:570

A bisect points at 6529b54.

@heftig
Copy link
Contributor Author

heftig commented Jul 2, 2024

@ZoltanFridrich I think there's a problem with the recursive allocation during attribute loading. It should only recurse further if the current attribute is an array, not if the base attribute we're trying to load is an array, which it always is.

diff --git c/p11-kit/iter.c i/p11-kit/iter.c
index d423b06..955d098 100644
--- c/p11-kit/iter.c
+++ i/p11-kit/iter.c
@@ -1048,7 +1048,7 @@ prepare_recursive_attribute (P11KitIter *iter,
                templ[i].pValue = malloc (templ[i].ulValueLen);
                return_val_if_fail (templ[i].pValue != NULL, CKR_HOST_MEMORY);
 
-               if (IS_ATTRIBUTE_ARRAY (attr)) {
+               if (IS_ATTRIBUTE_ARRAY (templ + i)) {
                         rv = prepare_recursive_attribute (iter, attr, templ[i].pValue,
                                                          templ[i].ulValueLen);
                        return_val_if_fail (rv == CKR_OK, rv);

heftig added a commit to heftig/p11-kit that referenced this issue Jul 2, 2024
Fixes: p11-glue#641
Signed-off-by: Jan Alexander Steffens (heftig) <[email protected]>
@ZoltanFridrich ZoltanFridrich added this to the 0.25.5 milestone Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants