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

[Rust]: SIMD implementation of arithmetic kernels reads out of bounds #26844

Closed
asfimport opened this issue Dec 15, 2020 · 1 comment
Closed

Comments

@asfimport
Copy link

The simd arithmetic kernels use the following pattern repeatedly:

    for i in (0..left.len()).step_by(lanes) { ... }

If len is not a multiple of the number of lanes, this would read out of bounds in the last iteration. Currently, all buffers have an additional padding of 64 bytes (equal to the simd width), which masks this problem in most tests. As soon as we use a slice of an array, it should however be reproducible even with this padding.

Even without a crash, the issue is detectable with valgrind:

==31106== Invalid read of size 32
==31106==    at 0x1ECEE1: arrow::compute::kernels::arithmetic::add::hfded8b2c06cf22de (in /home/joernhorstmann/Source/github/apache/arrow/rust/target/release/deps/arrow-205580f93d58d5a9)
==31106==    by 0x2650EF: arrow::compute::kernels::arithmetic::tests::test_arithmetic_kernel_should_not_rely_on_padding::hacb7c7921dc38e6a (in /home/joernhorstmann/Source/github/apache/arrow/rust/target/release/deps/arrow-205580f93d58d5a9)

Reporter: Jörn Horstmann / @jhorstmann
Assignee: Jörn Horstmann / @jhorstmann

PRs and other links:

Note: This issue was originally created as ARROW-10914. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Jorge Leitão / @jorgecarleitao:
Issue resolved by pull request 8929
#8929

@asfimport asfimport added this to the 3.0.0 milestone Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant