{"id":5862,"date":"2022-03-22T13:48:58","date_gmt":"2022-03-22T11:48:58","guid":{"rendered":"https:\/\/skeletor.org.ua\/?p=5862"},"modified":"2022-03-22T13:48:58","modified_gmt":"2022-03-22T11:48:58","slug":"%d0%bd%d0%b5-%d0%b7%d0%b0%d0%bf%d1%83%d1%81%d0%ba%d0%b0%d0%b5%d1%82%d1%81%d1%8f-ntp-%d0%b4%d0%b5%d0%b1%d0%b0%d0%b6%d0%b8%d0%bc-%d0%b8-%d0%bd%d0%b0%d1%85%d0%be%d0%b4%d0%b8%d0%bc-%d0%bf%d1%80%d0%b8","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=5862","title":{"rendered":"\u041d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f ntp, \u0434\u0435\u0431\u0430\u0436\u0438\u043c \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0443"},"content":{"rendered":"\n<p>\u041d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 <strong>FreeBSD<\/strong> \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f <strong>ntpd<\/strong>. \u0422\u043e \u0435\u0441\u0442\u044c, \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0438 \u0432 \u043e\u0434\u0438\u043d \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b. \u041f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0441\u0442\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0439 <strong>reboot<\/strong> \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0430. \u0421\u0442\u0440\u0430\u043d\u043d\u043e, \u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f. \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e: <strong>ldd<\/strong>, <strong>truss<\/strong>, \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433, \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u0438, \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <strong>debug&#8217;a<\/strong> \u0432 <strong>ntp<\/strong> \u0438 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043d\u0430\u043c\u0451\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u0423\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0438 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u041e\u0421 \u0438 \u0442\u0430\u043c \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442 &#8211; \u0434\u0435\u0431\u0430\u0433\u0433\u0435\u0440 <strong>gdb<\/strong>.<\/p>\n\n\n<p><!--more--><\/p>\n\n\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u0434\u0435\u0431\u0430\u0433\u0433\u0435\u0440 <strong>gdb<\/strong> \u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 start:<\/p>\n\n\n<pre># gdb \/usr\/sbin\/ntpd\nGNU gdb (GDB) 11.2 [GDB v11.2 for FreeBSD]\nCopyright (C) 2022 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later \nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\nType \"show copying\" and \"show warranty\" for details.\nThis GDB was configured as \"x86_64-portbld-freebsd13.0\".\nType \"show configuration\" for configuration details.\nFor bug reporting instructions, please see:\n.\nFind the GDB manual and other documentation resources online at:\n    .\n\nFor help, type \"help\".\nType \"apropos word\" to search for commands related to \"word\"...\nReading symbols from \/usr\/sbin\/ntpd...\nReading symbols from \/usr\/lib\/debug\/\/usr\/sbin\/ntpd.debug...\n(gdb) start\nTemporary breakpoint 1 at 0x272160: file \/usr\/src\/contrib\/ntp\/ntpd\/ntpd.c, line 447.\nStarting program: \/usr\/sbin\/ntpd\n\nTemporary breakpoint 1, main (argc=1, argv=0x7fffffffeb50) at \/usr\/src\/contrib\/ntp\/ntpd\/ntpd.c:447\n447                     int aslr_var = PROC_STACKGAP_DISABLE;\n<\/pre>\n<p>\u0418\u0434\u0451\u043c \u0432 <strong>\/usr\/src\/contrib\/ntp\/ntpd\/ntpd.c<\/strong> \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>447<\/strong> (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043f\u0440\u0438\u0432\u0451\u043b \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430; \u0441\u0430\u043c\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 <strong>447<\/strong> \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 <strong>&#8216;int aslr&#8217;<\/strong>):<\/p>\n<pre>#   ifdef __FreeBSD__                                                                                                                                                                                       \n        {                                                                                                                                                                                                   \n                \/*                                                                                                                                                                                          \n                 * We Must disable ASLR stack gap on FreeBSD to avoid a                                                                                                                                     \n                 * segfault. See PR\/241421 and PR\/241960.                                                                                                                                                   \n                 *\/                                                                                                                                                                                         \n                int aslr_var = PROC_STACKGAP_DISABLE;                                                                                                                                                       \n                                                                                                                                                                                                            \n                pid_t my_pid = getpid();                                                                                                                                                                    \n                procctl(P_PID, my_pid, PROC_STACKGAP_CTL, &amp;aslr_var);                                                                                                                                       \n        }                                                                                                                                                                                                   \n#   endif                          \n<\/pre>\n<p>\u0410\u0433\u0430! \u0412\u043e\u0442 \u0438 \u0432\u0438\u043d\u043e\u0432\u043d\u0438\u043a &#8211; <strong>ASLR<\/strong>. \u041b\u0435\u0437\u0435\u043c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <strong>sysctl<\/strong> \u0438 \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043e\u043d \u0432\u043a\u043b\u044e\u0447\u0451\u043d!<\/p>\n<pre># sysctl -a | grep aslr.enable       \nkern.elf32.aslr.enable: 1\nkern.elf64.aslr.enable: 1\n<\/pre>\n<p>\u0412\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e <strong>ntpd<\/strong> \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f: \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 <strong>ASLR<\/strong> \u0431\u044b\u043b \u0432\u043a\u043b\u044e\u0447\u0451\u043d, \u043d\u043e \u0442\u0430\u043c <strong>ntpd<\/strong> \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0412\u0438\u0434\u043d\u043e \u043f\u043e\u043f\u0430\u043b \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u0433\u0434\u0435 \u0441\u043c\u043e\u0433 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f. \u0422\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0431\u044b\u043b\u043e, \u0432\u0438\u0434\u0438\u043c\u043e, \u0438 \u0434\u043e \u0440\u0435\u0431\u0443\u0442\u0430 \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>","protected":false},"excerpt":{"rendered":"<p>\u041d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 FreeBSD \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f ntpd. \u0422\u043e \u0435\u0441\u0442\u044c, \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0438 \u0432 \u043e\u0434\u0438\u043d \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b. \u041f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0441\u0442\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0439 reboot \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0430. \u0421\u0442\u0440\u0430\u043d\u043d\u043e, \u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f. \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e: ldd, truss, \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433, \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u0438, \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 debug&#8217;a \u0432 ntp \u0438 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043d\u0430\u043c\u0451\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u0423\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,10],"tags":[],"class_list":["post-5862","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-others"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5862","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5862"}],"version-history":[{"count":1,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5862\/revisions"}],"predecessor-version":[{"id":5863,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5862\/revisions\/5863"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5862"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}