This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
[MXNET-969] Fix buffer overflow in RNNOp #12603
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This fixes an buffer overflow detected by ASAN. Fix is required before we can merge ASAN checks widely into our CI.
Co-authored-by: Sina Md [email protected]
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
ASAN Summary
Buffer overflow in RNNOp::Backward(..)
SUMMARY: AddressSanitizer: heap-buffer-overflow /work/mxnet/src/operator/./rnn-inl.h:555 in mxnet::op::RNNOp::Backward(mxnet::OpContext const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&, std::vector<mxnet::OpReqType, std::allocatormxnet::OpReqType > const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&, std::vector<mxnet::TBlob, std::allocatormxnet::TBlob > const&)
Shadow bytes around the buggy address:
0x0c048001b850: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
0x0c048001b860: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
0x0c048001b870: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
0x0c048001b880: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
0x0c048001b890: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
=>0x0c048001b8a0: fa fa fd fa fa fa 00[04]fa fa fa fa fa fa fa fa
0x0c048001b8b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c048001b8c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c048001b8d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c048001b8e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c048001b8f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==91==ABORTING
Full output will be attached in work log.
Testing Done:
Verified locally this fixes the issue. Will integrate test coverage for this type of error into CI at a future date for all Python tests.