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

fix segfault in debug mode #2794

Merged
merged 1 commit into from
Jan 17, 2020
Merged

fix segfault in debug mode #2794

merged 1 commit into from
Jan 17, 2020

Conversation

szoyj
Copy link
Contributor

@szoyj szoyj commented Jan 16, 2020

Pdnsd generated segmentation fault in debug mode(-g or debug=on), it calls pthread_getspecific() through DEBUG_MSG()
before pthread_key_create() has been called yet. This works on glibc and
uclibc but segfaults on musl because motion is relying on undefined
behaviour here.

References:
openwrt/packages#1847

中文:
pdnsd 在debug模式(启动时加-g或conf里加debug=on)下一启动就直接coredump,用gdb发现最后调用函数是c库函数pthread_getspecific(),google了一圈,最后发现跟 openwrt/packages#1847 是同一个问题,所以就把pthread_key_create提到了main函数的开头。

@coolsnowwolf coolsnowwolf merged commit a6fb452 into coolsnowwolf:master Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants