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

Remoted crashes with segmentation fault #10387

Closed
vikman90 opened this issue Oct 4, 2021 · 0 comments · Fixed by #10388
Closed

Remoted crashes with segmentation fault #10387

vikman90 opened this issue Oct 4, 2021 · 0 comments · Fixed by #10388
Assignees
Labels
module/remote type/bug/crash type/bug/regression Breaks functionality known to work in previous releases type/bug Something isn't working

Comments

@vikman90
Copy link
Member

vikman90 commented Oct 4, 2021

Wazuh version Component Install type Regression
4.2.2 Remoted Manager #9088

Backtrace

#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
#1  0x00007ffff76f6503 in __GI___strdup (s=0x0) at strdup.c:41
#2  0x000055555556a89e in wait_for_msgs (none=0x0) at remoted/manager.c:1306
#3  0x00007ffff784f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#4  0x00007ffff7776293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

ThreadSanitizer report

WARNING: ThreadSanitizer: data race (pid=10921)
  Read of size 8 at 0x55c590d9d6c8 by thread T18 (mutexes: write M34):
    #0 lookfor_agent_group remoted/manager.c:1051 (wazuh-remoted.thread+0x17aa9)
    #1 save_controlmsg remoted/manager.c:247 (wazuh-remoted.thread+0x1328f)
    #2 HandleSecureMessage remoted/secure.c:536 (wazuh-remoted.thread+0x21b0d)
    #3 rem_handler_main remoted/secure.c:296 (wazuh-remoted.thread+0x20a1b)

  Previous write of size 8 at 0x55c590d9d6c8 by thread T1 (mutexes: write M11):
    #0 c_files remoted/manager.c:710 (wazuh-remoted.thread+0x15e94)
    #1 update_shared_files remoted/manager.c:1370 (wazuh-remoted.thread+0x195c8)

  Location is global 'groups' of size 8 at 0x55c590d9d6c8 (wazuh-remoted.thread+0x0000002196c8)

  Mutex M34 (0x55c590d9d700) created at:
    #0 pthread_mutex_lock ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4165 (libtsan.so.0+0x526fc)
    #1 save_controlmsg remoted/manager.c:166 (wazuh-remoted.thread+0x12804)
    #2 HandleSecureMessage remoted/secure.c:536 (wazuh-remoted.thread+0x21b0d)
    #3 rem_handler_main remoted/secure.c:296 (wazuh-remoted.thread+0x20a1b)

  Mutex M11 (0x55c590d9d740) created at:
    #0 pthread_mutex_lock ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4165 (libtsan.so.0+0x526fc)
    #1 c_files remoted/manager.c:680 (wazuh-remoted.thread+0x15bf0)
    #2 manager_init remoted/manager.c:1474 (wazuh-remoted.thread+0x19d2f)
    #3 HandleSecure remoted/secure.c:83 (wazuh-remoted.thread+0x1fb2c)
    #4 HandleRemote remoted/remoted.c:143 (wazuh-remoted.thread+0x22e54)
    #5 main remoted/main.c:213 (wazuh-remoted.thread+0x248dc)

  Thread T18 (tid=10941, running) created by main thread at:
    #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:962 (libtsan.so.0+0x5ea79)
    #1 CreateThreadJoinable shared/pthreads_op.c:47 (wazuh-remoted.thread+0x125d9e)
    #2 CreateThread shared/pthreads_op.c:62 (wazuh-remoted.thread+0x125e62)
    #3 HandleSecure remoted/secure.c:136 (wazuh-remoted.thread+0x1fe34)
    #4 HandleRemote remoted/remoted.c:143 (wazuh-remoted.thread+0x22e54)
    #5 main remoted/main.c:213 (wazuh-remoted.thread+0x248dc)

  Thread T1 (tid=10924, running) created by main thread at:
    #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:962 (libtsan.so.0+0x5ea79)
    #1 CreateThreadJoinable shared/pthreads_op.c:47 (wazuh-remoted.thread+0x125d9e)
    #2 CreateThread shared/pthreads_op.c:62 (wazuh-remoted.thread+0x125e62)
    #3 HandleSecure remoted/secure.c:92 (wazuh-remoted.thread+0x1fb60)
    #4 HandleRemote remoted/remoted.c:143 (wazuh-remoted.thread+0x22e54)
    #5 main remoted/main.c:213 (wazuh-remoted.thread+0x248dc)

SUMMARY: ThreadSanitizer: data race remoted/manager.c:1051 in lookfor_agent_group
ThreadSanitizer:DEADLYSIGNAL
==10921==ERROR: ThreadSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fe5ba523675 bp 0x000000000000 sp 0x7fe5b3ebf228 T10931)
==10921==The signal is caused by a READ memory access.
==10921==Hint: address points to the zero page.
    #0 <null> <null> (libc.so.6+0x18b675)
    #1 strdup <null> (libc.so.6+0xa2502)
    #2 __interceptor_strdup ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:746 (libtsan.so.0+0x306f6)
    #3 wait_for_msgs remoted/manager.c:1306 (wazuh-remoted.thread+0x1913d)
    #4 __tsan_thread_start_func ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:952 (libtsan.so.0+0x2d1af)
    #5 start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477 (libpthread.so.0+0x9608)
    #6 __clone <null> (libc.so.6+0x122292)

ThreadSanitizer can not provide additional info.
SUMMARY: ThreadSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0x18b675)
@vikman90 vikman90 self-assigned this Oct 4, 2021
@vikman90 vikman90 added type/bug Something isn't working type/bug/regression Breaks functionality known to work in previous releases module/remote labels Oct 4, 2021
@vikman90 vikman90 linked a pull request Oct 4, 2021 that will close this issue
3 tasks
@vikman90 vikman90 closed this as completed Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/remote type/bug/crash type/bug/regression Breaks functionality known to work in previous releases type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant