EnglishУкраїнськаmRussian
Login/New
Unanswered topic

[BugFixed] FSArch. Segfault с null при вызове closedir()


Author Message
Written on: 28. 04. 2023 [10:31]
dudanov
Sergey Dudanov
registered since: 14.08.2013
Posts: 26
Здравствуйте, Роман.

При сборке системы под musl вместо glibc вскрылась ошибка в модуле FSArch, которая заключается в виде вызова closedir() с NULL при отсутствии каталога архива.

JAVASCRIPT
Thread 1 (LWP 39):
#0  0x00007ff0e135b38e in closedir (dir=0x0) at src/dirent/closedir.c:8
#1  0x00007ff0dfa4abc2 in FSArch::ModVArch::start (this=0x7ff0deaaacf0) at val.cpp:123
#2  0x00007ff0e10ec4ab in OSCADA::TVArchivator::cntrCmdProc (this=0x7ff0deaaacf0, opt=0x7ff0de6edb10) at tarchval.cpp:2483
#3  0x00007ff0dfa56f70 in FSArch::ModVArch::cntrCmdProc (this=0x7ff0deaaacf0, opt=0x7ff0de6edb10) at val.cpp:718
#4  0x00007ff0e12642e1 in OSCADA::TCntrNode::cntrCmd (this=0x7ff0deaaacf0, opt=0x7ff0de6edb10, lev=0, ipath=..., off=47) at tcntrnode.cpp:212
#5  0x00007ff0e1263e93 in OSCADA::TCntrNode::cntrCmd (this=0x7ff0dfc7c250, opt=0x7ff0de6edb10, lev=0, ipath=..., off=30) at tcntrnode.cpp:198
#6  0x00007ff0e1263e93 in OSCADA::TCntrNode::cntrCmd (this=0x7ff0e096a430, opt=0x7ff0de6edb10, lev=0, ipath=..., off=23) at tcntrnode.cpp:198
#7  0x00007ff0e1263e93 in OSCADA::TCntrNode::cntrCmd (this=0x7ff0e13d90c0, opt=0x7ff0de6edb10, lev=0, ipath=..., off=12) at tcntrnode.cpp:198
#8  0x00007ff0e014f81d in SelfPr::TProtIn::mess (this=0x7ff0df0c4780, request=..., answer=...) at self.cpp:444
#9  0x00007ff0dfcd24b2 in Sockets::TSocketIn::messPut (this=0x7ff0df11d6f0, sock=10, request=..., answer=..., sender=..., prot_in=...) at socket.cpp:926
#10 0x00007ff0dfccf8ba in Sockets::TSocketIn::ClTask (s_inf=0x7ff0de789390) at socket.cpp:814
#11 0x00007ff0e10501c5 in OSCADA::TSYS::taskWrap (stas=0x7ff0de9faa30) at tsys.cpp:2428
#12 0x00007ff0e139508b in start (p=0x7ff0de6f0ad8) at src/thread/pthread_create.c:203
#13 0x00007ff0e139738e in __clone () at src/thread/x86_64/clone.s:22


Если в реализации glibc разработчкики все же предусмотрели внутреннюю проверку на NULL, то в musl - нет, что и приводит к segfault. При просмотре другого кода OpenSCADA подобного поведения не обнаружил.

Прикрепил патч для версии 1+r2884. Также в него включил исправления для компиляции с gcc-12.2 + musl на Ваше усмотрение.

Благодарю.

[This article was edited 9 times, at last 28.04.2023 at 12:35.]

# rm -rf /bin/laden
Attachment

closedir_fix_musl_build.patch (File type: application/octet-stream, Size: 3.29 kilobytes) — 427 downloads



12090