Bug 1633930
Summary: | ASan (address sanitizer) fixes - Blanket bug | |||
---|---|---|---|---|
Product: | [Community] GlusterFS | Reporter: | Amar Tumballi <atumball> | |
Component: | core | Assignee: | bugs <bugs> | |
Status: | CLOSED CURRENTRELEASE | QA Contact: | ||
Severity: | high | Docs Contact: | ||
Priority: | urgent | |||
Version: | mainline | CC: | amukherj, bugs, srangana | |
Target Milestone: | --- | |||
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | glusterfs-6.0 | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1635373 (view as bug list) | Environment: | ||
Last Closed: | 2019-03-25 16:30:59 UTC | Type: | Bug | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | ||||
Bug Blocks: | 1635373 |
Description
Amar Tumballi
2018-09-28 06:57:27 UTC
Marking priority as 'Urgent' and severity as 'High' for this, as any issue reported in asan job should be treated with highest focus, as in most of the cases, it would mean there is a memory corruption/leak, which is critical for stability of the product! REVIEW: https://review.gluster.org/21299 (mdcache: Fix asan reported potential heap buffer overflow) posted (#1) for review on master by Shyamsundar Ranganathan REVIEW: https://review.gluster.org/21300 (configure: add more options to asan section) posted (#1) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21301 (cli: fix the clang warnings) posted (#1) for review on master by Amar Tumballi COMMIT: https://review.gluster.org/21299 committed in master by "Shyamsundar Ranganathan" <srangana> with a commit message- mdcache: Fix asan reported potential heap buffer overflow The char pointer mdc_xattr_str in function mdc_xattr_list_populate is malloc'd and doing a strcat into a malloc'd region can overflow content allocated based on prior contents of the memory region. Added a NULL terimation to the malloc'd region to prevent the overflow, and treat it as an empty string. Change-Id: If0decab669551581230a8ede4c44c319ff04bac9 Updates: bz#1633930 Signed-off-by: ShyamsundarR <srangana> COMMIT: https://review.gluster.org/21301 committed in master by "Shyamsundar Ranganathan" <srangana> with a commit message- cli: memory leak issues reported by asan With this fix, a run on 'rpc-coverage.t' passes properly. This should help to get started with other fixes soon! Change-Id: I257ae4e28b9974998a451d3b490cc18c02650ba2 updates: bz#1633930 Signed-off-by: Amar Tumballi <amarts> REVIEW: https://review.gluster.org/21378 (glusterfsd: fix the asan leak message) posted (#1) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21383 (cli: Fix memory leaks reported by asan) posted (#1) for review on master by Kotresh HR COMMIT: https://review.gluster.org/21383 committed in master by "Amar Tumballi" <amarts> with a commit message- cli: Fix memory leaks reported by ASAN 'gf_cli_rsp' structure has 'op_errstr' and 'dict.dict_val' which could get allocated by xdr and should be freed. This patch takes care of all instances of the same. Updates: bz#1633930 Change-Id: I2a5d129ffe85cfca743c89edb45b658f3ce688cb Signed-off-by: Kotresh HR <khiremat> REVIEW: https://review.gluster.org/21397 (cli: Fix memory leaks reported by ASAN) posted (#1) for review on master by Kotresh HR REVIEW: https://review.gluster.org/21399 (glusterd/geo-rep: Fix memory corruption) posted (#1) for review on master by Kotresh HR REVIEW: https://review.gluster.org/21400 (run-tests.sh: add another option to have failure count configurable) posted (#1) for review on master by Amar Tumballi COMMIT: https://review.gluster.org/21397 committed in master by "Amar Tumballi" <amarts> with a commit message- cli: Fix memory leaks reported by ASAN This patch addresses memory leaks other than 'gf_cli_rsp' response structure. Updates: bz#1633930 Change-Id: Idc5940dca623e33bc01004a9324bc435fc60b006 Signed-off-by: Kotresh HR <khiremat> COMMIT: https://review.gluster.org/21399 committed in master by "Amar Tumballi" <amarts> with a commit message- glusterd/geo-rep: Fix memory corruption Problem and Analysis: The length of canonical format of uuid is 36 but 'GF_UUID_BUF_SIZE 50' was being used everywhere. glusterd/geo-rep code was earlier using strncpy, but recently changes to memcpy with the drive to avoid strncpys. This leads to memory corruption and glusterd is crashing without a core with geo-rep creation with ASAN build. Fix: 'GF_UUID_BUF_SIZE 37' (+ 1 for NULL byte) And change geo-rep to use UUID_CANONICAL_FORM_LEN instead Updates: bz#1633930 Change-Id: Ibd347d542b92e64a96ce06780cda643557233bc7 Signed-off-by: Kotresh HR <khiremat> REVIEW: https://review.gluster.org/21406 (cli: Fix heap-buffer-overflow issue reported by ASAN) posted (#1) for review on master by Kotresh HR REVIEW: https://review.gluster.org/21407 (cli: memory leak issue reported by asan) posted (#1) for review on master by Harpreet Kaur Lalwani REVIEW: https://review.gluster.org/21408 (libglusterfs: memory leak issue reported by asan) posted (#1) for review on master by Iraj Jamali COMMIT: https://review.gluster.org/21378 committed in master by "Amar Tumballi" <amarts> with a commit message- glusterfsd: fix the asan leak message Fixes below trace of ASan: Direct leak of 130 byte(s) in 1 object(s) allocated from: #0 0x7fa794bb5850 in malloc (/lib64/libasan.so.4+0xde850) #1 0x7fa7944e5de9 in __gf_malloc ../../../libglusterfs/src/mem-pool.c:136 #2 0x40b85c in gf_strndup ../../../libglusterfs/src/mem-pool.h:166 #3 0x40b85c in gf_strdup ../../../libglusterfs/src/mem-pool.h:183 #4 0x40b85c in parse_opts ../../../glusterfsd/src/glusterfsd.c:1049 #5 0x7fa792a98720 in argp_parse (/lib64/libc.so.6+0x101720) #6 0x40d89f in parse_cmdline ../../../glusterfsd/src/glusterfsd.c:2041 #7 0x406d07 in main ../../../glusterfsd/src/glusterfsd.c:2625 updates: bz#1633930 Change-Id: I394b3fc24b7a994c1b03635cb5e973e7290491d3 Signed-off-by: Amar Tumballi <amarts> COMMIT: https://review.gluster.org/21406 committed in master by "Amar Tumballi" <amarts> with a commit message- cli: Fix heap-buffer-overflow issue reported by ASAN GF_MALLOC was being used to allocate memory which is not initialized. strcat is used on it which could result in buffer overflow if it contains garbage before '\0'. So changed it to GF_CALLOC. Traceback: ==23427==ERROR: AddressSanitizer: heap-buffer-overflow ... WRITE of size 5 at 0x6080000083fe thread T3 #0 0x7fb60966991c in __interceptor_strcat ... #1 0x48adc0 in config_parse ... #2 0x48cde8 in cli_cmd_gsync_set_parse ... ... Updates: bz#1633930 Change-Id: I3710f011d8139984b1898265d84d150c9bdc962b Signed-off-by: Kotresh HR <khiremat> Need Fix: ----- ==24676==ERROR: LeakSanitizer: detected memory leaks Direct leak of 256 byte(s) in 1 object(s) allocated from: #0 0x7fdac7d25848 in __interceptor_malloc (/lib64/libasan.so.5+0xef848) #1 0x7fdac79dfbba in mem_get_from_pool ../../../libglusterfs/src/mem-pool.c:817 #2 0x7fdac79dfd19 in mem_get ../../../libglusterfs/src/mem-pool.c:843 #3 0x7fdac79df601 in mem_get0 ../../../libglusterfs/src/mem-pool.c:742 #4 0x7fdac7927755 in get_new_dict_full ../../../libglusterfs/src/dict.c:75 #5 0x7fdac792798c in dict_new ../../../libglusterfs/src/dict.c:124 #6 0x7fdab352cbe5 in changelog_rpc_server_init ../../../../../xlators/features/changelog/src/changelog-rpc-common.c:302 #7 0x7fdab3529a44 in changelog_init_rpc_listener ../../../../../xlators/features/changelog/src/changelog-rpc.c:210 #8 0x7fdab35190b7 in changelog_init_rpc ../../../../../xlators/features/changelog/src/changelog.c:2657 #9 0x7fdab3519a36 in init ../../../../../xlators/features/changelog/src/changelog.c:2734 #10 0x7fdac793feb3 in __xlator_init ../../../libglusterfs/src/xlator.c:718 #11 0x7fdac7940167 in xlator_init ../../../libglusterfs/src/xlator.c:745 #12 0x7fdac7a071ca in glusterfs_graph_init ../../../libglusterfs/src/graph.c:359 #13 0x7fdac7a089b0 in glusterfs_graph_activate ../../../libglusterfs/src/graph.c:722 #14 0x412a7d in glusterfs_process_volfp ../../../glusterfsd/src/glusterfsd.c:2592 #15 0x420cff in mgmt_getspec_cbk ../../../glusterfsd/src/glusterfsd-mgmt.c:2085 #16 0x7fdac788928a in rpc_clnt_handle_reply ../../../../rpc/rpc-lib/src/rpc-clnt.c:755 #17 0x7fdac7889c79 in rpc_clnt_notify ../../../../rpc/rpc-lib/src/rpc-clnt.c:922 #18 0x7fdac787faa2 in rpc_transport_notify ../../../../rpc/rpc-lib/src/rpc-transport.c:525 #19 0x7fdac45aedf2 in socket_event_poll_in ../../../../../rpc/rpc-transport/socket/src/socket.c:2530 #20 0x7fdac45b13cc in socket_event_handler ../../../../../rpc/rpc-transport/socket/src/socket.c:2931 #21 0x7fdac7a7f6a3 in event_dispatch_epoll_handler ../../../libglusterfs/src/event-epoll.c:591 #22 0x7fdac7a7fd60 in event_dispatch_epoll_worker ../../../libglusterfs/src/event-epoll.c:668 #23 0x7fdac762458d in start_thread (/lib64/libpthread.so.0+0x858d) --- Direct leak of 256 byte(s) in 1 object(s) allocated from: #0 0x7fa044c06848 in __interceptor_malloc (/lib64/libasan.so.5+0xef848) #1 0x7fa0448c0bba in mem_get_from_pool ../../../libglusterfs/src/mem-pool.c:817 #2 0x7fa0448c0d19 in mem_get ../../../libglusterfs/src/mem-pool.c:843 #3 0x7fa0448c0601 in mem_get0 ../../../libglusterfs/src/mem-pool.c:742 #4 0x7fa044826c7e in log_buf_new ../../../libglusterfs/src/logging.c:304 #5 0x7fa04482fc20 in _gf_msg_internal ../../../libglusterfs/src/logging.c:2014 #6 0x7fa044830606 in _gf_msg ../../../libglusterfs/src/logging.c:2124 #7 0x7fa0309ec040 in init ../../../../../xlators/mgmt/glusterd/src/glusterd.c:1484 #8 0x7fa044820eb3 in __xlator_init ../../../libglusterfs/src/xlator.c:718 #9 0x7fa044821167 in xlator_init ../../../libglusterfs/src/xlator.c:745 #10 0x7fa0448e81ca in glusterfs_graph_init ../../../libglusterfs/src/graph.c:359 #11 0x7fa0448e99b0 in glusterfs_graph_activate ../../../libglusterfs/src/graph.c:722 #12 0x412a7d in glusterfs_process_volfp ../../../glusterfsd/src/glusterfsd.c:2592 #13 0x412c52 in glusterfs_volumes_init ../../../glusterfsd/src/glusterfsd.c:2645 #14 0x413553 in main ../../../glusterfsd/src/glusterfsd.c:2798 #15 0x7fa04407f412 in __libc_start_main (/lib64/libc.so.6+0x24412) Direct leak of 56 byte(s) in 1 object(s) allocated from: #0 0x7fa044c06848 in __interceptor_malloc (/lib64/libasan.so.5+0xef848) #1 0x7fa03047eef7 (<unknown module>) ---- Direct leak of 624 byte(s) in 1 object(s) allocated from: #0 0x7ff924fc5a50 in __interceptor_calloc (/lib64/libasan.so.5+0xefa50) #1 0x7ff924ce2f0f in __gf_calloc ../../../libglusterfs/src/mem-pool.c:111 #2 0x7ff921b8f6b4 in fuse_thread_proc ../../../../../xlators/mount/fuse/src/fuse-bridge.c:5639 #3 0x7ff92498a58d in start_thread (/lib64/libpthread.so.0+0x858d) ---- REVIEW: https://review.gluster.org/21716 (posix: fix memory leak) posted (#1) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21716 (posix: fix memory leak) posted (#2) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21764 (cli : Memeory leak fix reported by ASAN) posted (#1) for review on master by Sunny Kumar REVIEW: https://review.gluster.org/21766 (cli : Memeory leak fix reported by ASAN) posted (#1) for review on master by Sunny Kumar REVIEW: https://review.gluster.org/21764 (cli : Memeory leak fix reported by ASAN) posted (#2) for review on master by Atin Mukherjee REVIEW: https://review.gluster.org/21407 (cli: memory leak issue reported by asan) posted (#3) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21766 (cli : Memeory leak fix reported by ASAN) posted (#3) for review on master by Atin Mukherjee REVIEW: https://review.gluster.org/21788 (cli: fix memory leak in cli-cmd-system.c) posted (#1) for review on master by Sunny Kumar REVIEW: https://review.gluster.org/21793 (cli: memory leak issue reported by asan) posted (#1) for review on master by Harpreet Kaur Lalwani REVIEW: https://review.gluster.org/21796 (cli: memory leak issue reported by asan) posted (#1) for review on master by Harpreet Kaur Lalwani REVIEW: https://review.gluster.org/21798 (cli: memory leak issue reported by asan) posted (#1) for review on master by None REVIEW: https://review.gluster.org/21788 (cli: fix memory leak in cli-cmd-system.c) posted (#3) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21802 (cli: fix memory leak in cli/src/cli-rpc-ops.c) posted (#1) for review on master by Sunny Kumar REVIEW: https://review.gluster.org/21803 (cli: Fix mem-leaks reported by ASAN) posted (#1) for review on master by Kotresh HR REVIEW: https://review.gluster.org/21804 (cli: Fix memory leaks reported by ASAN) posted (#1) for review on master by Kotresh HR REVIEW: https://review.gluster.org/21805 (cluster/afr: Fix mem leak reported by ASAN) posted (#1) for review on master by Kotresh HR REVIEW: https://review.gluster.org/21806 (This patch fixes options leak in cli_cmd_volume_remove_brick_cbk. SUMMARY: AddressSanitizer: 1152 byte(s) leaked in 8 allocation(s)) posted (#1) for review on master by None REVIEW: https://review.gluster.org/21808 (cli: memory leak issue reported by asan This patch fixes xdata leak in cli_cmd_quota_handle_list_all and options leak in cli_cmd_quota_cbk.) posted (#1) for review on master by None REVIEW: https://review.gluster.org/21796 (cli: memory leak issue reported by asan) posted (#2) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21802 (cli: fix memory leak in cli/src/cli-rpc-ops.c) posted (#3) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21798 (cli: memory leak issue reported by asan) posted (#8) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21803 (cli: Fix mem-leaks reported by ASAN) posted (#5) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21806 (cli: fix a memory leak reported by ASan.) posted (#6) for review on master by Rinku Kothiya REVIEW: https://review.gluster.org/21818 (cli: fix memory leak in cli rpc ops) posted (#1) for review on master by MOHIT AGRAWAL REVIEW: https://review.gluster.org/21818 (cli: fix memory leak in cli rpc ops) posted (#2) for review on master by Atin Mukherjee REVIEW: https://review.gluster.org/21821 (cli : fix memory leak in cli-cmd-volume.c) posted (#1) for review on master by Sunny Kumar REVIEW: https://review.gluster.org/21823 (glusterd: Resolve memory leak in some gluster functions) posted (#1) for review on master by MOHIT AGRAWAL REVIEW: https://review.gluster.org/21823 (glusterd: Resolve memory leak in some glusterd functions) posted (#4) for review on master by Atin Mukherjee REVIEW: https://review.gluster.org/21844 (tools: stack-buffer-overflow reported by asan) posted (#1) for review on master by Harpreet Kaur Lalwani REVIEW: https://review.gluster.org/21839 (nfs: memory leak issue reported by asan) posted (#2) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21844 (tools: stack-buffer-overflow reported by asan) posted (#2) for review on master by Kotresh HR REVIEW: https://review.gluster.org/21805 (cluster/afr: Fix mem leak reported by ASAN) posted (#9) for review on master by Pranith Kumar Karampuri REVIEW: https://review.gluster.org/21894 (cli: fix memory leak) posted (#1) for review on master by Sunny Kumar REVIEW: https://review.gluster.org/21858 (posix: stack-buffer-overflow reported by asan) posted (#4) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21894 (cli: fix memory leak) posted (#5) for review on master by Amar Tumballi REVIEW: https://review.gluster.org/21300 (configure: add a message about asan option) posted (#5) for review on master by Niels de Vos REVIEW: https://review.gluster.org/22002 (afr : fix memory leak) posted (#1) for review on master by Sunny Kumar REVIEW: https://review.gluster.org/22002 (afr : fix memory leak) posted (#4) for review on master by Pranith Kumar Karampuri REVIEW: https://review.gluster.org/22089 (cli : fix mem leak during cli_cmd_volume_gsync_set_cbk) posted (#1) for review on master by Sunny Kumar REVIEW: https://review.gluster.org/22089 (cli : fix mem leak during cli_cmd_volume_gsync_set_cbk) merged (#4) on master by Amar Tumballi REVIEW: https://review.gluster.org/22239 (fuse : fix memory leak) posted (#1) for review on master by Sunny Kumar REVIEW: https://review.gluster.org/22239 (fuse : fix memory leak) merged (#4) on master by Amar Tumballi This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-6.0, please open a new bug report. glusterfs-6.0 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution. [1] https://lists.gluster.org/pipermail/announce/2019-March/000120.html [2] https://www.gluster.org/pipermail/gluster-users/ |