{"action":"created","issue":{"url":"https://api.github.com/repos/percona/PerconaFT/issues/412","repository_url":"https://api.github.com/repos/percona/PerconaFT","labels_url":"https://api.github.com/repos/percona/PerconaFT/issues/412/labels{/name}","comments_url":"https://api.github.com/repos/percona/PerconaFT/issues/412/comments","events_url":"https://api.github.com/repos/percona/PerconaFT/issues/412/events","html_url":"https://github.com/percona/PerconaFT/pull/412","id":320346052,"number":412,"title":"variable use out of scope bug in get_last_key test detected by ASAN in clang 6","user":{"login":"prohaska7","id":2814773,"avatar_url":"https://avatars1.githubusercontent.com/u/2814773?v=4","gravatar_id":"","url":"https://api.github.com/users/prohaska7","html_url":"https://github.com/prohaska7","followers_url":"https://api.github.com/users/prohaska7/followers","following_url":"https://api.github.com/users/prohaska7/following{/other_user}","gists_url":"https://api.github.com/users/prohaska7/gists{/gist_id}","starred_url":"https://api.github.com/users/prohaska7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prohaska7/subscriptions","organizations_url":"https://api.github.com/users/prohaska7/orgs","repos_url":"https://api.github.com/users/prohaska7/repos","events_url":"https://api.github.com/users/prohaska7/events{/privacy}","received_events_url":"https://api.github.com/users/prohaska7/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-04T16:47:39Z","updated_at":"2018-05-10T16:40:21Z","closed_at":"2018-05-09T21:05:06Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/percona/PerconaFT/pulls/412","html_url":"https://github.com/percona/PerconaFT/pull/412","diff_url":"https://github.com/percona/PerconaFT/pull/412.diff","patch_url":"https://github.com/percona/PerconaFT/pull/412.patch"},"body":"The address sanitizer detected a \"stack use out of scope\" problem in the get_last_key test when using clang version 5 or 6.  Ths bug is caused by sticking the address of a local variable into a DBT and then not invalidating the DBT when the variable goes out of scope.  The solution is to limit the scope of pointer variables so that this programming bug can not happen.\r\n\r\n==30056==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffe978523d0 at pc 0x0000004b3d2b bp 0x7ffe97850090 sp 0x7ffe9784f840\r\nREAD of size 4 at 0x7ffe978523d0 thread T0\r\n    #0 0x4b3d2a  (/home/rfp/projects/tokuft/tokuft-asan/src/tests/get_last_key.tdb+0x4b3d2a)\r\n    #1 0x7f154bf4d8f9  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x1d78f9)\r\n    #2 0x7f154bf3cf46  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x1c6f46)\r\n    #3 0x7f154be64da9  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0xeeda9)\r\n    #4 0x7f154bee5c83  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x16fc83)\r\n    #5 0x7f154bee5c18  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x16fc18)\r\n    #6 0x7f154bf58339  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x1e2339)\r\n    #7 0x7f154bf58992  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x1e2992)\r\n    #8 0x7f154bf590ad  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x1e30ad)\r\n    #9 0x7f154bf58724  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x1e2724)\r\n    #10 0x7f154bf57b7c  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x1e1b7c)\r\n    #11 0x7f154bf550dc  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x1df0dc)\r\n    #12 0x7f154bf3f413  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x1c9413)\r\n    #13 0x7f154bf3de3e  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x1c7e3e)\r\n    #14 0x7f154bee6199  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x170199)\r\n    #15 0x7f154bee5ea3  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0x16fea3)\r\n    #16 0x7f154be3707c  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0xc107c)\r\n    #17 0x7f154be43267  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0xcd267)\r\n    #18 0x7f154be59620  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0xe3620)\r\n    #19 0x7f154be60f14  (/home/rfp/projects/tokuft/tokuft-asan/src/libtokufractaltree.so+0xeaf14)\r\n    #20 0x51826c  (/home/rfp/projects/tokuft/tokuft-asan/src/tests/get_last_key.tdb+0x51826c)\r\n    #21 0x51721f  (/home/rfp/projects/tokuft/tokuft-asan/src/tests/get_last_key.tdb+0x51721f)\r\n    #22 0x5171d0  (/home/rfp/projects/tokuft/tokuft-asan/src/tests/get_last_key.tdb+0x5171d0)\r\n    #23 0x7f154a5f3b96  (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)\r\n    #24 0x41a949  (/home/rfp/projects/tokuft/tokuft-asan/src/tests/get_last_key.tdb+0x41a949)\r\n\r\nAddress 0x7ffe978523d0 is located in stack of thread T0 at offset 336 in frame\r\n    #0 0x51740f  (/home/rfp/projects/tokuft/tokuft-asan/src/tests/get_last_key.tdb+0x51740f)\r\n\r\n  This frame has 9 object(s):\r\n    [32, 40) 'db' (line 145)\r\n    [64, 72) 'env' (line 146)\r\n    [96, 104) 'txn' (line 147)\r\n    [128, 136) 'txn2' (line 148)\r\n    [160, 168) 'loops_run' (line 149)\r\n    [192, 216) 'key' (line 164)\r\n    [256, 280) 'value' (line 164)\r\n    [320, 324) 'v' (line 166)\r\n    [336, 340) 'k' (line 166) <== Memory access at offset 336 is inside this variable\r\nHINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext\r\n      (longjmp and C++ exceptions *are* supported)\r\nSUMMARY: AddressSanitizer: stack-use-after-scope (/home/rfp/projects/tokuft/tokuft-asan/src/tests/get_last_key.tdb+0x4b3d2a)\r\nShadow bytes around the buggy address:\r\n  0x100052f02420: 00 00 00 00 f1 f1 f1 f1 00 f2 f2 f2 01 f3 f3 f3\r\n  0x100052f02430: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x100052f02440: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x100052f02450: f1 f1 f1 f1 00 f2 f2 f2 00 f2 f2 f2 00 f2 f2 f2\r\n  0x100052f02460: 00 f2 f2 f2 00 f2 f2 f2 00 00 00 f2 f2 f2 f2 f2\r\n=>0x100052f02470: 00 00 00 f2 f2 f2 f2 f2 f8 f2[f8]f3 00 00 00 00\r\n  0x100052f02480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x100052f02490: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x100052f024a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x100052f024b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x100052f024c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\nShadow byte legend (one shadow byte represents 8 application bytes):\r\n  Addressable:           00\r\n  Partially addressable: 01 02 03 04 05 06 07\r\n  Heap left redzone:       fa\r\n  Freed heap region:       fd\r\n  Stack left redzone:      f1\r\n  Stack mid redzone:       f2\r\n  Stack right redzone:     f3\r\n  Stack after return:      f5\r\n  Stack use after scope:   f8\r\n  Global redzone:          f9\r\n  Global init order:       f6\r\n  Poisoned by user:        f7\r\n  Container overflow:      fc\r\n  Array cookie:            ac\r\n  Intra object redzone:    bb\r\n  ASan internal:           fe\r\n  Left alloca redzone:     ca\r\n  Right alloca redzone:    cb\r\n==30056==ABORTING\r\n\r\nCompilation:\r\nCXXFLAGS=-fsanitize=address CC=clang-6.0 CXX=clang++-6.0 cmake -DCMAKE_BUILD_TYPE=Debug ../perconaft && make -j8\r\n\r\nTools:\r\nUbuntu 18.04\r\nClang 6.0.0\r\nCmake 3.10.2\r\n\r\nCopyright (c) 2018, Rik Prohaska\r\nAll rights reserved.\r\n\r\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\r\n\r\nRedistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\r\nRedistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\r\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."},"comment":{"url":"https://api.github.com/repos/percona/PerconaFT/issues/comments/388110630","html_url":"https://github.com/percona/PerconaFT/pull/412#issuecomment-388110630","issue_url":"https://api.github.com/repos/percona/PerconaFT/issues/412","id":388110630,"user":{"login":"prohaska7","id":2814773,"avatar_url":"https://avatars1.githubusercontent.com/u/2814773?v=4","gravatar_id":"","url":"https://api.github.com/users/prohaska7","html_url":"https://github.com/prohaska7","followers_url":"https://api.github.com/users/prohaska7/followers","following_url":"https://api.github.com/users/prohaska7/following{/other_user}","gists_url":"https://api.github.com/users/prohaska7/gists{/gist_id}","starred_url":"https://api.github.com/users/prohaska7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prohaska7/subscriptions","organizations_url":"https://api.github.com/users/prohaska7/orgs","repos_url":"https://api.github.com/users/prohaska7/repos","events_url":"https://api.github.com/users/prohaska7/events{/privacy}","received_events_url":"https://api.github.com/users/prohaska7/received_events","type":"User","site_admin":false},"created_at":"2018-05-10T16:40:21Z","updated_at":"2018-05-10T16:40:21Z","author_association":"CONTRIBUTOR","body":"Perhaps test runs with new versions of clang with ASAN could be added to test matrix."}}
{"actor":{"display_login":"prohaska7"}}