TestErasureCodeShec_arguments: fix stack-use-after-scope#57435
TestErasureCodeShec_arguments: fix stack-use-after-scope#57435
Conversation
When sanitizer is enabled, unittest_erasure_code_shec_arguments shows,
```
==412235==ERROR: AddressSanitizer: stack-use-after-scope on address 0xffffca8362c0 at pc 0xaaaab4f1d2b8 bp 0xffffca8356d0 sp 0xffffca8356c8
READ of size 4 at 0xffffca8362c0 thread T0
#0 0xaaaab4f1d2b4 in getint(std::initializer_list<int>) /root/ceph/src/test/erasure-code/TestErasureCodeShec_arguments.cc:46:21
#1 0xaaaab4f25cac in int std::__invoke_impl<int, int (*&)(std::initializer_list<int>), std::initializer_list<int>&>(std::__invoke_other, int (*&)(std::initializer_list<int>), std::initializer_list<int>&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:61:14
#2 0xaaaab4f24e90 in std::__invoke_result<int (*&)(std::initializer_list<int>), std::initializer_list<int>&>::type std::__invoke<int (*&)(std::initializer_list<int>), std::initializer_list<int>&>(int (*&)(std::initializer_list<int>), std::initializer_list<int>&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:96:14
#3 0xaaaab4f248e8 in bool std::ranges::__any_of_fn::operator()<std::initializer_list<int>*, std::initializer_list<int>*, int (*)(std::initializer_list<int>), std::_Bind_front<bool (*)(unsigned int, int) noexcept, unsigned int> >(std::initializer_list<int>*, std::initializer_list<int>*, std::_Bind_front<bool (*)(unsigned int, int) noexcept, unsigned int>, int (*)(std::initializer_list<int>)) const /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/ranges_algo.h:109:30
#4 0xaaaab4f1d72c in bool std::ranges::__any_of_fn::operator()<std::array<std::initializer_list<int>, 27ul>&, int (*)(std::initializer_list<int>), std::_Bind_front<bool (*)(unsigned int, int) noexcept, unsigned int> >(std::array<std::initializer_list<int>, 27ul>&, std::_Bind_front<bool (*)(unsigned int, int) noexcept, unsigned int>, int (*)(std::initializer_list<int>)) const /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/ranges_algo.h:120:9
#5 0xaaaab4f0fca8 in create_table_shec432() /root/ceph/src/test/erasure-code/TestErasureCodeShec_arguments.cc:96:15
#6 0xaaaab4f1b140 in main /root/ceph/src/test/erasure-code/TestErasureCodeShec_arguments.cc:361:3
ceph#7 0xffff9b9673f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
ceph#8 0xffff9b9674c8 in __libc_start_main csu/../csu/libc-start.c:392:3
ceph#9 0xaaaab4e5b8ac in _start (/root/ceph/build/bin/unittest_erasure_code_shec_arguments+0x11b8ac) (BuildId: c1fce44a2cd8b7e33e7f07b2de20b9a2f57c314a)
```
keep a as initializer_list could fix this error.
Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
|
jenkins test windows |
|
jenkins test windows |
|
i will (hopefully) take a look later this week. |
|
ping? @tchaikov |
| } | ||
| if (std::popcount(avails) == 4) { | ||
| auto a = to_array<std::initializer_list<int>>({ | ||
| std::initializer_list<std::initializer_list<int>> a { |
There was a problem hiding this comment.
a is already a std::initializer_list<..> before this change. i don't understand what's the difference between before and after this change. which libstdc++ version are you using?
this example does not match with what we have in |
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
|
This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution! |
|
created #64238 to address the same issue. |




When sanitizer is enabled, unittest_erasure_code_shec_arguments shows,
keep a as initializer_list could fix this error.
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e