-
Notifications
You must be signed in to change notification settings - Fork 203
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
index: Fix volk_get_index #519
Conversation
af09827
to
4fb8f70
Compare
Don't we need to handle -1 in the calling functions to avoid calling into random memory? |
+1 from me on this: looks like that's just in tmpl/volk.tmpl.c : 191 |
I fixed the "file local comments". Thus, we need to discuss how to deal with the
Both functions in We could treat I know this is an unsatisfactory but we could ignore this problem for now and add it to the list of issues to fix for our next major release. Would that be a viable option? |
I reverted the change where |
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.
LGTM; this change will be an API change (returning -1), so do we want to just have it in a 3.0-beta branch & not related to 2.X at all?
interesting ... I wonder why? Anyway, |
This PR fixes the direct issue, which is important. It does change the API unfortunately by now returning -1 where it didn't before. I guess as an interim we could instead have it return the first entry (if there is one) & print a warning noting as such. Of course if there is no entry then we'd want to return -1 ... so, does this help? Hmmm ... |
It sounds like every solution somehow breaks the API. However, at the moment the broken API won't work at all. After this change, it will. If we'd do another 2.x release, I'd argue this fix should go in there. Besides, it might be time to add a Debian test. However, Debian 'bullseye' ships GCC 10. We already have a test with GCC 10. The question would be: Is this distro specific? |
} else { | ||
fprintf(stderr, "Volk ERROR: no arch found. generic impl missing!\n"); | ||
} | ||
return idx; |
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.
we're just bubbling up the -1 here in case of error, but we need to handle that. Otherwise, we'll jump into some random memory location when the consumer program actually calls the kernel. That's worse than an infinite loop.
So, this is half the fix so far.
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.
at the very least, __init_${kern.name}
needs to check for -1 and abort
in that case. Failing early instead of wandering into random memory, where we become a stability or security issue, is necessary. Otherwise, we're just making bad code worse!
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.
also note that __init_..
casts the int
that volk_rank_archs
returns into a size_t
, which is unsigned, and potentially of a different size!
By the way, how do we figure out what breaks finding that |
Updated the initial PR description.
I couldn't find Besides, I can't reproduce the issue in my minimal container with the current |
liborc-dev should only be a build-time dependency, right? |
I converted this PR to a draft. At the moment I doubt it really fixes the issue it is supposed to fix. We need a better understanding of the issue here. |
This function results in an infinite loop on Debian 11 for some impls. This is a first step to fix it. Fix gnuradio#516 Signed-off-by: Johannes Demel <[email protected]>
Instead of recursively calling `volk_get_index`, a new function is introduced to walk through the list of impls. Then, we introduce a three step process: 1. Search for the requested impl. Return index if found. 2. Search for the generic impl. Return index if found. 3. Return `-1` and put the burden on the caller. Signed-off-by: Johannes Demel <[email protected]>
This fix is a bit of a guess. aarch64, MacOS, and Win CI tests all fail after I changed the comparison from `!` to `!= 0`. Signed-off-by: Johannes Demel <[email protected]>
82dfe81
to
c1ed567
Compare
This draft PR was introduced because of a bug that turned out to be outside of VOLK. I'm closing this PR now. |
This function results in an infinite loop on Debian 11 for some impls.
This is a first step to fix it.
@mbr0wn , @marcusmueller does that fix the reported issue? If you could point me to a CI script for Debian 11 that we can integrate here, that'd be very helpful.
Fix #516
EDIT
This is a minimal Debian 11 Container to test things.
GNU Radio CI container for Debian 11 where
volk_profile
hangs onvolk_32f_8u_polarbutterflypuppet_32f
.The corresponding Dockerfile: Dockerfile.