{"id":351713,"date":"2024-05-20T21:53:57","date_gmt":"2024-05-20T21:53:57","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=351713"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=351713","title":{"rendered":"<span>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0448\u044c \u00abHello World\u00bb \u0432 Linux<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/companies\/ruvds\/articles\/753506\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sq\/v3\/58\/sqv358sbar5osudzalgqz4ax2ae.png\" data-src=\"https:\/\/habrastorage.org\/webt\/sq\/v3\/58\/sqv358sbar5osudzalgqz4ax2ae.png\"\/><\/div>\n<p><\/a><br \/>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0430\u0441\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0448\u044c \u0432 Linux \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u00abHello World\u00bb \u043d\u0430 Python.<\/p>\n<pre><code class=\"python\">print(\"hello world\")<\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435:<\/p>\n<pre><code class=\"bash\">$ python3 hello.py hello world<\/code><\/pre>\n<p>  \u041d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435. \u042f \u043e\u0431\u044a\u044f\u0441\u043d\u044e, \u0447\u0442\u043e \u0442\u0430\u043c \u0442\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0438, \u0447\u0442\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0432\u0430\u0436\u043d\u0435\u0435, \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b \u0441\u0430\u043c\u0438 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0435. \u041c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <code>readelf<\/code>, <code>strace<\/code>, <code>ldd<\/code>, <code>debugfs<\/code>, <code>\/proc<\/code>, <code>ltrace<\/code>, <code>dd<\/code> \u0438 <code>stat<\/code>. \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a Python \u0447\u0430\u0441\u0442\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0443\u0435\u043c\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2><font color=\"#3AC1EF\">\u0414\u043e execve<\/font><\/h2>\n<p>  \u0414\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 Python, \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e\u0435. \u041a\u0430\u043a\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b \u043c\u044b \u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c? \u0413\u0434\u0435 \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f?<\/p>\n<h3><font color=\"#3AC1EF\">\u258d 1: \u041e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 \u043f\u0430\u0440\u0441\u0438\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 python3 hello.py \u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0438 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432: python3 \u0438 [&#8216;hello.py&#8217;]<\/font><\/h3>\n<p>  \u0422\u0443\u0442 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043f\u043e\u0438\u0441\u043a\u0430. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 <code>python3 *.py<\/code>, \u0442\u043e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0451\u0442 \u044d\u0442\u043e \u0432 <code>python3 hello.py<\/code><\/p>\n<h3><font color=\"#3AC1EF\">\u258d 2: \u041e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0434\u043e python3<\/font><\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <code>python3<\/code>. \u041d\u043e \u043a\u0430\u043a\u043e\u0432 \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443? \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u0440\u0435\u0434\u044b <code>PATH<\/code>.<\/p>\n<p>  <strong><font color=\"#3AC1EF\">\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0430\u043c\u0438<\/font><\/strong>: \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435 <code>echo $PATH<\/code>. \u0423 \u043c\u0435\u043d\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">$ echo $PATH \/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin<\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0432 \u044d\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 (\u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443), \u043f\u044b\u0442\u0430\u044f\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0412 <code>fish<\/code> (\u043c\u043e\u0435\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435) \u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0443\u0442\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/github.com\/fish-shell\/fish-shell\/blob\/900a0487443f10caa6539634ca8c49fb6e3ce5ba\/src\/path.cpp#L31-L45\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0412 \u043d\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>stat<\/code> \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430.<\/p>\n<p>  <strong><font color=\"#3AC1EF\">\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0430\u043c\u0438<\/font><\/strong>: \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 <code>strace -e stat bash<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432\u0438\u0434\u0430 <code>python3<\/code>. \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"bash\">stat(\"\/usr\/local\/sbin\/python3\", 0x7ffcdd871f40) = -1 ENOENT (No such file or directory) stat(\"\/usr\/local\/bin\/python3\", 0x7ffcdd871f40) = -1 ENOENT (No such file or directory) stat(\"\/usr\/sbin\/python3\", 0x7ffcdd871f40) = -1 ENOENT (No such file or directory) stat(\"\/usr\/bin\/python3\", {st_mode=S_IFREG|0755, st_size=5479736, ...}) = 0<\/code><\/pre>\n<p>  \u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u043d\u0430\u0448\u043b\u0430 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u043e \u043f\u0443\u0442\u0438 <code>\/usr\/bin\/python3<\/code> \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435: \u043e\u043d\u0430 \u043d\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0432 <code>\/sbin<\/code> \u0438\u043b\u0438 \u0432 <code>\/bin<\/code>.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d 2.1: \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u043e\u0431 execvp<\/font><\/h3>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0443 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e PATH, \u0447\u0442\u043e \u0438 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430, \u043d\u043e \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0451 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 libc <code>execvp<\/code> (\u0438\u043b\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <code>exec*<\/code> \u0441 <code>p<\/code> \u0432 \u0438\u043c\u0435\u043d\u0438).<\/p>\n<h3><font color=\"#3AC1EF\">\u258d 3: \u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 stat<\/font><\/h3>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0437\u0430\u0434\u0430\u0434\u0438\u0442\u0435\u0441\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u0447\u0442\u043e \u0436\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 <code>stat<\/code>? \u041a\u043e\u0433\u0434\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0444\u0430\u0439\u043b, \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0430 \u044d\u0442\u0430\u043f\u0430.<\/p>\n<ol>\n<li>\u041e\u043d\u0430 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <strong><font color=\"#3AC1EF\">\u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430<\/font><\/strong> \u0441 <strong><font color=\"#3AC1EF\">inode<\/font><\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0444\u0430\u0439\u043b\u0435.<\/li>\n<li>\u041e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <strong><font color=\"#3AC1EF\">inode<\/font><\/strong> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.<\/li>\n<\/ol>\n<p>  \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>stat<\/code> \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432\u0441\u0435\u0445 inode \u0444\u0430\u0439\u043b\u0430, \u043e\u043d \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043c \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u044d\u043a\u0441\u043a\u0443\u0440\u0441 \u0432 inode. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u043c \u043f\u043e\u0441\u0442\u0435 <a href=\"https:\/\/habr.com\/ru\/companies\/ruvds\/articles\/750370\/\">\u00ab\u0414\u0438\u0441\u043a \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0443\u0447\u0430 \u0431\u0438\u0442\u043e\u0432\u00bb<\/a>.<\/p>\n<pre><code class=\"bash\">$ stat \/usr\/bin\/python3   File: \/usr\/bin\/python3 -> python3.9   Size: 9         Blocks: 0          IO Block: 4096   symbolic link Device: fe01h\/65025dInode: 6206        Links: 1 Access: (0777\/lrwxrwxrwx)  Uid: (    0\/    root)   Gid: (    0\/    root) Access: 2023-08-03 14:17:28.890364214 +0000 Modify: 2021-04-05 12:00:48.000000000 +0000 Change: 2021-06-22 04:22:50.936969560 +0000  Birth: 2021-06-22 04:22:50.924969237 +0000<\/code><\/pre>\n<p>  <strong><font color=\"#3AC1EF\">\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0430\u043c\u0438<\/font><\/strong>: \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0433\u0434\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u044d\u0442\u043e\u0442 inode \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0436\u0451\u0441\u0442\u043a\u043e\u043c \u0434\u0438\u0441\u043a\u0435.<\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0438\u043c\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0436\u0451\u0441\u0442\u043a\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430.<\/p>\n<pre><code class=\"bash\">$ df ... tmpfs             100016      604     99412   1% \/run \/dev\/vda1       25630792 14488736  10062712  60% \/ ...<\/code><\/pre>\n<p>  \u041f\u043e\u0445\u043e\u0436\u0435, \u044d\u0442\u043e <code>\/dev\/vda1<\/code>. \u0414\u0430\u043b\u0435\u0435 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0437\u043d\u0430\u0435\u043c, \u0433\u0434\u0435 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0436\u0451\u0441\u0442\u043a\u043e\u043c \u0434\u0438\u0441\u043a\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f inode \u0434\u043b\u044f <code>\/usr\/bin\/python3<\/code>:<\/p>\n<pre><code class=\"bash\">$ sudo debugfs \/dev\/vda1 debugfs 1.46.2 (28-Feb-2021) debugfs:  imap \/usr\/bin\/python3 Inode 6206 is part of block group 0 located at block 658, offset 0x0d00<\/code><\/pre>\n<p>  \u041f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u044e, \u043a\u0430\u043a <code>debugfs<\/code> \u0443\u0437\u043d\u0430\u0451\u0442 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 inode \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430, \u043d\u043e \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0432 \u044d\u0442\u043e \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c, \u043d\u0430 \u043a\u0430\u043a\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u0435 \u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0431\u0430\u0439\u0442\u043e\u0432 \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u0438\u0441\u043a\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u00ab\u0431\u043b\u043e\u043a 658, \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 0x0d00\u00bb. \u041a\u0430\u0436\u0434\u044b\u0439 \u0431\u043b\u043e\u043a \u2014 \u044d\u0442\u043e 4096 \u0431\u0430\u0439\u0442\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u043d\u0430 <code>4096 * 658 + 0x0d00<\/code> \u0431\u0430\u0439\u0442\u043e\u0432. \u041a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043c\u043d\u0435, \u0447\u0442\u043e \u044d\u0442\u043e <code>2698496<\/code>.<\/p>\n<pre><code class=\"bash\">$ sudo dd if=\/dev\/vda1 bs=1 skip=2698496 count=256 2>\/dev\/null | hexdump -C 00000000  ff a1 00 00 09 00 00 00  f8 b6 cb 64 9a 65 d1 60  |...........d.e.`| 00000010  f0 fb 6a 60 00 00 00 00  00 00 01 00 00 00 00 00  |..j`............| 00000020  00 00 00 00 01 00 00 00  70 79 74 68 6f 6e 33 2e  |........python3.| 00000030  39 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |9...............| 00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................| * 00000060  00 00 00 00 12 4a 95 8c  00 00 00 00 00 00 00 00  |.....J..........| 00000070  00 00 00 00 00 00 00 00  00 00 00 00 2d cb 00 00  |............-...| 00000080  20 00 bd e7 60 15 64 df  00 00 00 00 d8 84 47 d4  | ...`.d.......G.| 00000090  9a 65 d1 60 54 a4 87 dc  00 00 00 00 00 00 00 00  |.e.`T...........| 000000a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|<\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u0412\u043e\u0442 \u043d\u0430\u0448 inode! \u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0432 \u043d\u0451\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <code>python3<\/code>, \u0438 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0437\u043d\u0430\u043a. \u041c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0432\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0435\u0442\u0430\u043b\u0438, \u043d\u043e <a href=\"https:\/\/github.com\/torvalds\/linux\/blob\/fdf0eaf11452d72945af31804e2a1048ee1b574c\/fs\/ext4\/ext4.h#L769\">struct inode ext4 \u0438\u0437 \u044f\u0434\u0440\u0430 Linux<\/a> \u0434\u0430\u0451\u0442 \u043d\u0430\u043c \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0435 16 \u0431\u0430\u0439\u0442\u043e\u0432 \u2014 \u044d\u0442\u043e \u00ab\u0440\u0435\u0436\u0438\u043c\u00bb, \u0438\u043b\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043a\u0430\u043a <code>ffa1<\/code> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<ul>\n<li>\u0411\u0430\u0439\u0442\u044b <code>ffa1<\/code> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0447\u0438\u0441\u043b\u0443 <code>0xa1ff<\/code>, \u0438\u043b\u0438 41471 (\u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e x86 \u0438\u043c\u0435\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 little endian).<\/li>\n<li>41471 \u0432 \u0432\u043e\u0441\u044c\u043c\u0435\u0440\u0438\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u2014 \u044d\u0442\u043e <code>0120777<\/code>.<\/li>\n<li>\u042d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e \u2014 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c <code>777<\/code>, \u043d\u043e \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u0435\u0440\u0432\u044b\u0435 \u0442\u0440\u0438 \u0446\u0438\u0444\u0440\u044b? \u042f \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b\u0430! \u0423\u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 <code>012<\/code>, \u043c\u043e\u0436\u043d\u043e \u0438\u0437 <a href=\"https:\/\/man7.org\/linux\/man-pages\/man7\/inode.7.html\">man inode<\/a> (\u0434\u043e\u0439\u0434\u0438\u0442\u0435 \u0434\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u00abThe file type and mode\u00bb). \u0422\u0430\u043c \u0435\u0441\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0433\u043b\u0430\u0441\u044f\u0449\u0430\u044f, \u0447\u0442\u043e <code>012<\/code> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u00ab\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430\u00bb.<\/li>\n<\/ul>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0444\u0430\u0439\u043b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 list \u0438 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u044d\u0442\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438 <code>777<\/code>:<\/p>\n<pre><code class=\"bash\">$ ls -l \/usr\/bin\/python3 lrwxrwxrwx 1 root root 9 Apr  5  2021 \/usr\/bin\/python3 -> python3.9<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0442\u0430\u043a! \u0423\u0440\u0430, \u043c\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0435\u0433\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043b\u0438.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d 4: \u0412\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0444\u043e\u0440\u043a\u0430<\/font><\/h3>\n<p>  \u041d\u043e \u043c\u044b \u0432\u0441\u0451 \u0435\u0449\u0451 \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 <code>python3<\/code>. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430. \u0421\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0432 Unix \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u0430\u043d\u0435\u043d: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u0441\u0435\u0431\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442 <code>execve<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u043e\u0432\u044b\u043c.<\/p>\n<p>  *<strong><font color=\"#3AC1EF\">\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0430\u043c\u0438:<\/font><\/strong> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 <code>strace -e clone bash<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c <code>python3<\/code>. \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435:<\/p>\n<pre><code class=\"bash\">clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f03788f1a10) = 3708100<\/code><\/pre>\n<p>  <code>3708100<\/code> \u2014 \u044d\u0442\u043e PID \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438.<\/p>\n<p>  \u0412\u043e\u0442 \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438:<\/p>\n<ul>\n<li><code>pstree<\/code> \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0435\u0440\u0435\u0432\u043e \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435;<\/li>\n<li><code>cat \/proc\/PID\/stat<\/code> \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0432 <code>man proc<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0435\u0442\u0432\u0451\u0440\u0442\u043e\u0435 \u043f\u043e\u043b\u0435 \u2014 \u044d\u0442\u043e PID \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3><font color=\"#3AC1EF\">\u258d 4.1: \u0427\u0442\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441<\/font><\/h3>\n<p>  \u041d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043d\u0435\u0442 <code>python3<\/code>) \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b \u0443 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u043c\u043d\u043e\u0433\u043e\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043d \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b:<\/p>\n<ol>\n<li><i>\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b<\/i>: \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>cat \/proc\/PID\/environ | tr '\\0' '\\n'<\/code>;<\/li>\n<li><i>\u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b \u0444\u0430\u0439\u043b\u043e\u0432<\/i> \u0434\u043b\u044f stdout \u0438 stderr: \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>ls -l \/proc\/PID\/fd<\/code>;<\/li>\n<li><i>\u0440\u0430\u0431\u043e\u0447\u0443\u044e \u043f\u0430\u043f\u043a\u0443<\/i> (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439);<\/li>\n<li><i>\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0451\u043d \u0438 cgroups<\/i> (\u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435);<\/li>\n<li><i>\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/i> \u0438 <i>\u0433\u0440\u0443\u043f\u043f\u0443<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438;<\/li>\n<li>\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0451, \u0447\u0435\u0433\u043e \u044f \u043d\u0435 \u043c\u043e\u0433\u0443 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c.<\/li>\n<\/ol>\n<p>  <\/p>\n<h3><font color=\"#3AC1EF\">\u258d 5: \u041e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 execve<\/font><\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 Python!<\/p>\n<p>  <strong><font color=\"#3AC1EF\">\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0430\u043c\u0438<\/font><\/strong>: \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 <code>strace -e -f execve bash<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 <code>python3<\/code>. \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>-f<\/code> \u0432\u0430\u0436\u0435\u043d, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0437\u0430 \u0432\u0441\u0435\u043c\u0438 \u0444\u043e\u0440\u043a\u043d\u0443\u0442\u044b\u043c\u0438 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c\u0438 \u043f\u043e\u0434\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438. \u0412\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435:<\/p>\n<pre><code class=\"bash\">[pid 3708381] execve(\"\/usr\/bin\/python3\", [\"python3\"], 0x560397748300 \/* 21 vars *\/) = 0<\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u2014 \u044d\u0442\u043e \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u044d\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0441\u043e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043e\u043d\u0430 \u043c\u043e\u0433\u043b\u0430 \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0438\u043c.<\/p>\n<p>  \u0410 \u0447\u0442\u043e \u0436\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 <code>execve<\/code>?<\/p>\n<h3><font color=\"#3AC1EF\">\u258d 6: \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/font><\/h3>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b <code>python3<\/code> \u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435. \u041f\u043e\u043a\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>stat<\/code> \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043d\u043e\u0432\u0430 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f <code>stat<\/code>:<\/p>\n<pre><code class=\"bash\">$ stat \/usr\/bin\/python3   File: \/usr\/bin\/python3 -> python3.9   Size: 9         Blocks: 0          IO Block: 4096   symbolic link Device: fe01h\/65025dInode: 6206        Links: 1 ...<\/code><\/pre>\n<p>  \u041e\u043d \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 0 \u0431\u043b\u043e\u043a\u043e\u0432 \u043c\u0435\u0441\u0442\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438 (<code>python3.9<\/code>) \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c inode: \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0435\u0433\u043e \u0437\u0434\u0435\u0441\u044c (\u0438\u0437 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 inode \u043e\u043d \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d \u043d\u0430 \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 hexdump):<\/p>\n<pre><code class=\"bash\">00000020  00 00 00 00 01 00 00 00  70 79 74 68 6f 6e 33 2e  |........python3.| 00000030  39 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |9...............|<\/code><\/pre>\n<p>  \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u044c <code>\/usr\/bin\/python3.9<\/code>. \u0412\u0441\u0451 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u044f\u0434\u0440\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u043c \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430.<\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0444\u0430\u0439\u043b \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0438\u0437 <strong><font color=\"#3AC1EF\">\u0431\u043b\u043e\u043a\u043e\u0432<\/font><\/strong> \u043d\u0430 \u0436\u0451\u0441\u0442\u043a\u043e\u043c \u0434\u0438\u0441\u043a\u0435. \u0414\u0443\u043c\u0430\u044e, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 \u0432 \u043c\u043e\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 4096 \u0431\u0430\u0439\u0442\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 4096 \u0431\u0430\u0439\u0442\u043e\u0432 \u2014 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 \u0432\u0441\u0435\u0433\u043e 5 \u0431\u0430\u0439\u0442\u043e\u0432, \u043e\u043d \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 4 \u041a\u0411.<\/p>\n<p>  <strong><font color=\"#3AC1EF\">\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0430\u043c\u0438<\/font><\/strong>: \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u043d\u043e\u043c\u0435\u0440\u0430 \u0431\u043b\u043e\u043a\u043e\u0432 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>debugfs<\/code>: (\u044f \u0432\u0437\u044f\u043b\u0430 \u044d\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u0437 \u043f\u043e\u0441\u0442\u0430 <a href=\"https:\/\/habr.com\/ru\/companies\/ruvds\/articles\/750370\/\">\u00ab\u0414\u0438\u0441\u043a \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0443\u0447\u0430 \u0431\u0438\u0442\u043e\u0432\u00bb<\/a>).<\/p>\n<pre><code class=\"bash\">$ debugfs \/dev\/vda1 debugfs:  blocks \/usr\/bin\/python3.9 145408 145409 145410 145411 145412 145413 145414 145415 145416 145417 145418 145419 145420 145421 145422 145423 145424 145425 145426 145427 145428 145429 145430 145431 145432 145433 145434 145435 145436 145437<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <code>dd<\/code>, \u0447\u0442\u043e\u0431\u044b \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u043b\u043e\u043a \u0444\u0430\u0439\u043b\u0430. \u041c\u044b \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430 4096 \u0431\u0430\u0439\u0442\u043e\u0432, \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c <code>145408<\/code> \u0431\u043b\u043e\u043a\u043e\u0432 \u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0434\u0438\u043d \u0431\u043b\u043e\u043a.<\/p>\n<pre><code class=\"bash\">$ dd if=\/dev\/vda1 bs=4096 skip=145408 count=1 2>\/dev\/null | hexdump -C | head 00000000  7f 45 4c 46 02 01 01 00  00 00 00 00 00 00 00 00  |.ELF............| 00000010  02 00 3e 00 01 00 00 00  c0 a5 5e 00 00 00 00 00  |..>.......^.....| 00000020  40 00 00 00 00 00 00 00  b8 95 53 00 00 00 00 00  |@.........S.....| 00000030  00 00 00 00 40 00 38 00  0b 00 40 00 1e 00 1d 00  |....@.8...@.....| 00000040  06 00 00 00 04 00 00 00  40 00 00 00 00 00 00 00  |........@.......| 00000050  40 00 40 00 00 00 00 00  40 00 40 00 00 00 00 00  |@.@.....@.@.....| 00000060  68 02 00 00 00 00 00 00  68 02 00 00 00 00 00 00  |h.......h.......| 00000070  08 00 00 00 00 00 00 00  03 00 00 00 04 00 00 00  |................| 00000080  a8 02 00 00 00 00 00 00  a8 02 40 00 00 00 00 00  |..........@.....| 00000090  a8 02 40 00 00 00 00 00  1c 00 00 00 00 00 00 00  |..@.............|<\/code><\/pre>\n<p>  \u0412\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0447\u0438\u0442\u0430\u043b\u0438 \u0444\u0430\u0439\u043b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>cat<\/code>:<\/p>\n<pre><code class=\"bash\">$ cat \/usr\/bin\/python3.9 | hexdump -C | head 00000000  7f 45 4c 46 02 01 01 00  00 00 00 00 00 00 00 00  |.ELF............| 00000010  02 00 3e 00 01 00 00 00  c0 a5 5e 00 00 00 00 00  |..>.......^.....| 00000020  40 00 00 00 00 00 00 00  b8 95 53 00 00 00 00 00  |@.........S.....| 00000030  00 00 00 00 40 00 38 00  0b 00 40 00 1e 00 1d 00  |....@.8...@.....| 00000040  06 00 00 00 04 00 00 00  40 00 00 00 00 00 00 00  |........@.......| 00000050  40 00 40 00 00 00 00 00  40 00 40 00 00 00 00 00  |@.@.....@.@.....| 00000060  68 02 00 00 00 00 00 00  68 02 00 00 00 00 00 00  |h.......h.......| 00000070  08 00 00 00 00 00 00 00  03 00 00 00 04 00 00 00  |................| 00000080  a8 02 00 00 00 00 00 00  a8 02 40 00 00 00 00 00  |..........@.....| 00000090  a8 02 40 00 00 00 00 00  1c 00 00 00 00 00 00 00  |..@.............|<\/code><\/pre>\n<p>  <\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u043e \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u0445 \u0447\u0438\u0441\u043b\u0430\u0445<\/font><\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 <code>ELF<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c \u00ab\u0432\u043e\u043b\u0448\u0435\u0431\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430\u00bb, \u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0430\u0439\u0442\u043e\u0432, \u0441\u043e\u043e\u0431\u0449\u0430\u044e\u0449\u0435\u0439 \u043d\u0430\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0444\u0430\u0439\u043b ELF. \u042d\u0442\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 Linux.<\/p>\n<p>  \u0420\u0430\u0437\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f gzip \u044d\u0442\u043e <code>1f8b<\/code>. \u0418\u043c\u0435\u043d\u043d\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 <code>file blah.gz<\/code> \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u0442\u043e \u0444\u0430\u0439\u043b gzip.<\/p>\n<p>  \u0414\u0443\u043c\u0430\u044e, <code>file<\/code> \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u044d\u0432\u0440\u0438\u0441\u0442\u0438\u043a \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u0444\u0430\u0439\u043b\u0430, \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u043d\u043e \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u2014 \u044d\u0442\u043e \u0432\u0430\u0436\u043d\u0430\u044f \u044d\u0432\u0440\u0438\u0441\u0442\u0438\u043a\u0430.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d 7: \u041f\u043e\u0438\u0441\u043a \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430<\/font><\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043f\u0430\u0440\u0441\u0438\u043c \u0444\u0430\u0439\u043b ELF, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438.<\/p>\n<p>  <strong><font color=\"#3AC1EF\">\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0430\u043c\u0438:<\/font><\/strong> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 <code>readelf -a \/usr\/bin\/python3.9<\/code>. \u0412\u043e\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0443 \u043c\u0435\u043d\u044f (\u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043c\u043d\u043e\u0433\u043e\u0435 \u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c):<\/p>\n<pre><code class=\"bash\">$ readelf -a \/usr\/bin\/python3.9 ELF Header:     Class:                             ELF64     Machine:                           Advanced Micro Devices X86-64 ... ->  Entry point address:               0x5ea5c0 ... Program Headers:   Type           Offset             VirtAddr           PhysAddr   INTERP         0x00000000000002a8 0x00000000004002a8 0x00000000004002a8                  0x000000000000001c 0x000000000000001c  R      0x1 ->      [Requesting program interpreter: \/lib64\/ld-linux-x86-64.so.2]         ... ->        1238: 00000000005ea5c0    43 FUNC    GLOBAL DEFAULT   13 _start<\/code><\/pre>\n<p>  \u0412\u043e\u0442, \u0447\u0442\u043e \u044f \u043f\u043e\u043d\u044f\u043b\u0430 \u0438\u0437 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0437\u0434\u0435\u0441\u044c:<\/p>\n<ol>\n<li>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u0440\u0438\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u044f\u0434\u0440\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c <code>\/lib64\/ld-linux-x86-64.so.2<\/code>, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443. \u042d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong><font color=\"#3AC1EF\">\u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u043e\u043c<\/font><\/strong> (dynamic linker), \u043e \u043d\u0451\u043c \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043d\u0438\u0436\u0435.<\/li>\n<li>\u041e\u043d\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u0447\u043a\u0443 \u0432\u0445\u043e\u0434\u0430 (<code>0x5ea5c0<\/code>, \u0433\u0434\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b).<\/li>\n<\/ol>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0435.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d 8: \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430<\/font><\/h3>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043c\u044b \u0441\u0447\u0438\u0442\u0430\u043b\u0438 \u0431\u0430\u0439\u0442\u044b \u0441 \u0434\u0438\u0441\u043a\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u044d\u0442\u0443 \u0448\u0442\u0443\u043a\u0443 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u00ab\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u00bb. \u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435? \u0415\u0441\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c <code>strace -o out.strace python3<\/code>, \u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <code>execve<\/code> \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043a\u0443\u0447\u0443 \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"bash\">execve(\"\/usr\/bin\/python3\", [\"python3\"], 0x560af13472f0 \/* 21 vars *\/) = 0 brk(NULL)                       = 0xfcc000 access(\"\/etc\/ld.so.preload\", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, \"\/etc\/ld.so.cache\", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=32091, ...}) = 0 mmap(NULL, 32091, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f718a1e3000 close(3)                        = 0 openat(AT_FDCWD, \"\/lib\/x86_64-linux-gnu\/libpthread.so.0\", O_RDONLY|O_CLOEXEC) = 3 read(3, \"\\177ELF\\2\\1\\1\\0\\0\\0\\0\\0\\0\\0\\0\\0\\3\\0>\\0\\1\\0\\0\\0 l\\0\\0\\0\\0\\0\\0\"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=149520, ...}) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f718a1e1000 ... close(3)                        = 0 openat(AT_FDCWD, \"\/lib\/x86_64-linux-gnu\/libdl.so.2\", O_RDONLY|O_CLOEXEC) = 3<\/code><\/pre>\n<p>  \u041f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u0432\u0441\u0451 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0443\u0433\u0430\u044e\u0449\u0435, \u043d\u043e \u043d\u0430\u043c \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 <code>openat(AT_FDCWD, \"\/lib\/x86_64-linux-gnu\/libpthread.so.0\"<\/code>. \u0417\u0434\u0435\u0441\u044c \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 C \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <code>pthread<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 Python.<\/p>\n<p>  <strong><font color=\"#3AC1EF\">\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0430\u043c\u0438:<\/font><\/strong> \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <code>ldd<\/code>. \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435:<\/p>\n<pre><code class=\"bash\">$ ldd \/usr\/bin\/python3.9 linux-vdso.so.1 (0x00007ffc2aad7000) libpthread.so.0 => \/lib\/x86_64-linux-gnu\/libpthread.so.0 (0x00007f2fd6554000) libdl.so.2 => \/lib\/x86_64-linux-gnu\/libdl.so.2 (0x00007f2fd654e000) libutil.so.1 => \/lib\/x86_64-linux-gnu\/libutil.so.1 (0x00007f2fd6549000) libm.so.6 => \/lib\/x86_64-linux-gnu\/libm.so.6 (0x00007f2fd6405000) libexpat.so.1 => \/lib\/x86_64-linux-gnu\/libexpat.so.1 (0x00007f2fd63d6000) libz.so.1 => \/lib\/x86_64-linux-gnu\/libz.so.1 (0x00007f2fd63b9000) libc.so.6 => \/lib\/x86_64-linux-gnu\/libc.so.6 (0x00007f2fd61e3000) \/lib64\/ld-linux-x86-64.so.2 (0x00007f2fd6580000)<\/code><\/pre>\n<p>  \u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u2014 \u044d\u0442\u043e <code>\/lib\/x86_64-linux-gnu\/libpthread.so.0<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0430 \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0439.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041f\u0440\u043e LD_LIBRARY_PATH<\/font><\/h3>\n<p>  \u0427\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u044f \u0432\u0441\u0451 \u0435\u0449\u0451 \u043d\u0435 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0430\u0441\u044c \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u043e\u0439. \u0412\u043e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043c\u043d\u0435 \u0444\u0430\u043a\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u0430 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u0432 \u043c\u043e\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e \u043f\u0443\u0442\u0438 <code>\/lib64\/ld-linux-x86-64.so.2<\/code>. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430, \u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c\u0438 \u0431\u0430\u0433\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 <a href=\"https:\/\/jvns.ca\/blog\/2021\/11\/17\/debugging-a-weird--file-not-found--error\/\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u00abfile not found\u00bb<\/a>.<\/li>\n<li>\u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u044b <code>LD_LIBRARY_PATH<\/code>.<\/li>\n<li>\u0422\u0430\u043a\u0436\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u044b <code>LD_PRELOAD<\/code> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043b\u044e\u0431\u043e\u0439 \u043d\u0443\u0436\u043d\u043e\u0439 \u0432\u0430\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0443\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0434\u043b\u044f <a href=\"https:\/\/jvns.ca\/blog\/2014\/11\/27\/ld-preload-is-super-fun-and-easy\/\">\u0437\u0430\u0431\u0430\u0432\u043d\u044b\u0445 \u0445\u0430\u043a\u043e\u0432<\/a> \u0438\u043b\u0438 \u0434\u043b\u044f \u0437\u0430\u043c\u0435\u043d\u044b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, jemalloc).<\/li>\n<li>\u0412 \u0432\u044b\u0432\u043e\u0434\u0435 strace \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e <code>mprotect<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043c\u0435\u0447\u0430\u044e\u0442 \u043a\u043e\u0434 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<\/li>\n<li>\u041d\u0430 Mac \u0432\u043c\u0435\u0441\u0442\u043e <code>LD_LIBRARY_PATH<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>DYLD_LIBRARY_PATH<\/code>.<\/li>\n<\/ul>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443 \u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a \u0432\u043e\u043f\u0440\u043e\u0441: \u0435\u0441\u043b\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u043d\u0435 \u0432\u0438\u0434\u0438\u043c \u043a\u0443\u0447\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 <code>stat<\/code> \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432 <code>LD_LIBRARY_PATH<\/code>, \u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 bash \u0438\u0441\u043a\u0430\u043b \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>PATH<\/code>?<\/p>\n<p>  \u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0443 <code>ld<\/code> \u0435\u0441\u0442\u044c \u043a\u044d\u0448 \u0432 <code>\/etc\/ld.so.cache<\/code>, \u0438 \u0432\u0441\u0435 \u044d\u0442\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u044b \u0440\u0430\u043d\u0435\u0435. \u041e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u043a\u044d\u0448\u0430 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 strace \u2014 <code>openat(AT_FDCWD, \"\/etc\/ld.so.cache\", O_RDONLY|O_CLOEXEC) = 3<\/code>.<\/p>\n<p>  \u0412 <a href=\"https:\/\/gist.github.com\/jvns\/4254251bea219568df9f43a2efd8d0f5\">\u043f\u043e\u043b\u043d\u043e\u043c \u0432\u044b\u0432\u043e\u0434\u0435 strace<\/a> \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043f\u043e\u043a\u0430 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u043e\u043d\u0438\u043c\u0430\u044e. \u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 <code>prlimit64<\/code>? \u041e\u0442\u043a\u0443\u0434\u0430 \u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0432\u0441\u0451, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0435 \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u044e? \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <code>gconv-modules.cache<\/code>? \u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 <code>rt_sigaction<\/code>? \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <code>arch_prctl<\/code>? \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <code>set_tid_address<\/code> \u0438 <code>set_robust_list<\/code>? \u041d\u043e \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043d\u0430\u0447\u0430\u043b\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0435.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, ldd \u2014 \u044d\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438!<\/font><\/h3>\n<p>  \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c mastodon <a href=\"https:\/\/octodon.social\/@lkundrak\/110832640058459399\">\u0441\u043e\u043e\u0431\u0449\u0438\u043b<\/a>, \u0447\u0442\u043e <code>ldd<\/code> \u2014 \u044d\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u0451\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u044b <code>LD_TRACE_LOADED_OBJECTS=1<\/code> \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443. \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"bash\">$ LD_TRACE_LOADED_OBJECTS=1 python3 linux-vdso.so.1 (0x00007ffe13b0a000) libpthread.so.0 => \/lib\/x86_64-linux-gnu\/libpthread.so.0 (0x00007f01a5a47000) libdl.so.2 => \/lib\/x86_64-linux-gnu\/libdl.so.2 (0x00007f01a5a41000) libutil.so.1 => \/lib\/x86_64-linux-gnu\/libutil.so.1 (0x00007f2fd6549000) libm.so.6 => \/lib\/x86_64-linux-gnu\/libm.so.6 (0x00007f2fd6405000) libexpat.so.1 => \/lib\/x86_64-linux-gnu\/libexpat.so.1 (0x00007f2fd63d6000) libz.so.1 => \/lib\/x86_64-linux-gnu\/libz.so.1 (0x00007f2fd63b9000) libc.so.6 => \/lib\/x86_64-linux-gnu\/libc.so.6 (0x00007f2fd61e3000) \/lib64\/ld-linux-x86-64.so.2 (0x00007f2fd6580000)<\/code><\/pre>\n<p>  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, <code>ld<\/code> \u2014 \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 <code>\/lib64\/ld-linux-x86-64.so.2 --list \/usr\/bin\/python3.9<\/code> \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041f\u0440\u043e init \u0438 fini<\/font><\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e\u0431 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 <code>strace<\/code>:<\/p>\n<pre><code class=\"bash\">set_tid_address(0x7f58880dca10)         = 3709103<\/code><\/pre>\n<p>  \u041f\u043e\u0445\u043e\u0436\u0435, \u044d\u0442\u043e \u043a\u0430\u043a-\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438, \u0438 \u044f \u0434\u0443\u043c\u0430\u043b\u0430, \u0447\u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <code>pthread<\/code> (\u0438 \u043a\u0430\u0436\u0434\u0430\u044f \u0434\u0440\u0443\u0433\u0430\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u0430\u044f) \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041a\u043e\u0434, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <code>init<\/code> (\u0430 \u043c\u043e\u0436\u0435\u0442, \u0442\u0430\u043a\u0436\u0435 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <code>.ctors<\/code>).<\/p>\n<p>  <strong><font color=\"#3AC1EF\">\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0430\u043c\u0438:<\/font><\/strong> \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 readelf:<\/p>\n<pre><code class=\"bash\">$ readelf -a \/lib\/x86_64-linux-gnu\/libpthread.so.0 ...   [10] .rela.plt         RELA             00000000000051f0  000051f0        00000000000007f8  0000000000000018  AI       4    26     8   [11] .init             PROGBITS         0000000000006000  00006000        000000000000000e  0000000000000000  AX       0     0     4   [12] .plt              PROGBITS         0000000000006010  00006010        0000000000000560  0000000000000010  AX       0     0     16 ...<\/code><\/pre>\n<p>  \u0423 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u0430 <code>.ctors<\/code>, \u0442\u043e\u043b\u044c\u043a\u043e <code>.init<\/code>. \u041d\u043e \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <code>.init<\/code>? \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <code>objdump<\/code> \u0434\u043b\u044f \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"bash\">$ objdump -d \/lib\/x86_64-linux-gnu\/libpthread.so.0 Disassembly of section .init:  0000000000006000 &lt;_init>:     6000:       48 83 ec 08             sub    $0x8,%rsp     6004:       e8 57 08 00 00          callq  6860 &lt;__pthread_initialize_minimal>     6009:       48 83 c4 08             add    $0x8,%rsp     600d:       c3<\/code><\/pre>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c \u043e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>__pthread_initialize_minimal<\/code>. \u042f \u043d\u0430\u0448\u043b\u0430 <a href=\"https:\/\/github.com\/bminor\/glibc\/blob\/a78e5979a92c7985eadad7246740f3874271303f\/nptl\/nptl-init.c#L100\">\u043a\u043e\u0434 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 glibc<\/a>, \u0445\u043e\u0442\u044c \u043c\u043d\u0435 \u0438 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0441\u043a\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u0440\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e glibc, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u0432 \u0431\u043e\u043b\u0435\u0435 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 <a href=\"https:\/\/developers.redhat.com\/articles\/2021\/12\/17\/why-glibc-234-removed-libpthread\">libpthread \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439<\/a>.<\/p>\n<p>  \u041d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d\u0430, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u044d\u0442\u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>set_tid_address<\/code> \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043e\u0442 <code>__pthread_initialize_minimal<\/code>, \u043d\u043e, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u043c\u044b \u0443\u0437\u043d\u0430\u043b\u0438, \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u0434 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0437\u0434\u0435\u043b\u0430 <code>.init<\/code>.<\/p>\n<p>  \u0412\u043e\u0442 \u0437\u0430\u043c\u0435\u0442\u043a\u0430 \u0438\u0437 <code>man elf<\/code> \u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <code>.init<\/code>:<\/p>\n<pre><code class=\"bash\">$ man elf  .init  \u042d\u0442\u043e\u0442 \u0440\u0430\u0437\u0434\u0435\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432 \u043a\u043e\u0434\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u0434 \u0432 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0432\u0445\u043e\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 ELF \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b <code>.fini<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0446\u0435, \u0430 \u0435\u0449\u0451 \u043c\u043e\u0433\u0443\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u044b <code>.ctors<\/code> \/ <code>.dtors<\/code> (\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u0438 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b).<\/p>\n<p>  \u041d\u0443 \u043b\u0430\u0434\u043d\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0435.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d 9: \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a _start<\/font><\/h3>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a <code>_start<\/code> \u0432 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0435 Python. \u0417\u0430\u0442\u0435\u043c \u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 Python.<\/p>\n<p>  \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u043e\u0431\u0449\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 Linux, \u0430 \u043d\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 Python.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d 10: \u0417\u0430\u043f\u0438\u0441\u044c \u0441\u0442\u0440\u043e\u043a\u0438<\/font><\/h3>\n<p>  \u041d\u043e \u043d\u0430\u043c \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u00abhello world\u00bb. \u0412\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>print<\/code> Python \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437 libc. \u041d\u043e \u043a\u0430\u043a\u0443\u044e? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u044f\u0441\u043d\u0438\u043c!<\/p>\n<p>  <strong><font color=\"#3AC1EF\">\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0430\u043c\u0438<\/font><\/strong>: \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 <code>ltrace -o out python3 hello.py<\/code>.<\/p>\n<pre><code class=\"bash\">$ ltrace -o out python3 hello.py $ grep hello out write(1, \"hello world\\n\", 12) = 12<\/code><\/pre>\n<p>  \u041f\u043e\u0445\u043e\u0436\u0435, \u043e\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>write<\/code><\/p>\n<p>  \u0427\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442\u043d\u043e\u0448\u0443\u0441\u044c \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u0435\u043c \u043a ltrace, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 strace (\u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u044b \u044f \u0434\u043e\u0432\u0435\u0440\u0438\u043b\u0430 \u0441\u0432\u043e\u044e \u0436\u0438\u0437\u043d\u044c) \u2014 \u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d\u0430, \u0447\u0442\u043e ltrace \u0442\u043e\u0447\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e \u0432\u044b\u0437\u043e\u0432\u0430\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u041d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d, \u043f\u043e\u0445\u043e\u0436\u0435, \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b. \u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/python\/cpython\/blob\/400835ea1626c8c6dcd967c7eabe0dad4a923182\/Python\/fileutils.c#L1955\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 cpython<\/a>, \u0442\u043e \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u043d \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>write()<\/code>. \u0422\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0432\u0435\u0440\u0438\u043c \u0432 \u044d\u0442\u043e.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 libc?<\/font><\/h3>\n<p>  \u041c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e Python \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>write<\/code> \u0438\u0437 libc. \u041d\u043e \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 libc? \u042d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 C, \u0438 \u043e\u043d\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>malloc<\/code>;<\/li>\n<li>\u0432\u0432\u043e\u0434-\u0432\u044b\u0432\u043e\u0434 \u0444\u0430\u0439\u043b\u043e\u0432 (\u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\/\u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435);<\/li>\n<li>\u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c (\u043a\u0430\u043a \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u0440\u0430\u043d\u0435\u0435, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>execvp<\/code>);<\/li>\n<li>\u043f\u043e\u0438\u0441\u043a \u0437\u0430\u043f\u0438\u0441\u0435\u0439 DNS \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>getaddrinfo<\/code>;<\/li>\n<li>\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>pthread<\/code>.<\/li>\n<\/ul>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0435 <em>\u043e\u0431\u044f\u0437\u0430\u043d\u044b<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c libc (\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e Linux \u044f\u0437\u044b\u043a Go \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0451 \u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b Linux), \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0438\u0445 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 (node, Python, Ruby, Rust). \u042f \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d\u0430 \u043d\u0430\u0441\u0447\u0451\u0442 Java.<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b libc, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 <code>ldd<\/code>: \u0435\u0441\u043b\u0438 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 <code>libc.so.6<\/code>, \u0442\u043e \u044d\u0442\u043e libc.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041f\u043e\u0447\u0435\u043c\u0443 \u0432\u0430\u0436\u043d\u0430 libc?<\/font><\/h3>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0437\u0430\u0434\u0430\u0451\u0442\u0435\u0441\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e Python \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>write<\/code> \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 libc, \u0430 \u0437\u0430\u0442\u0435\u043c libc \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>write<\/code>? \u041f\u043e\u0447\u0435\u043c\u0443 \u044f \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u044e, \u0447\u0442\u043e \u043f\u043e\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>libc<\/code>?<\/p>\n<p>  \u0414\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e (\u0435\u0441\u043b\u0438 \u043d\u0435 \u043e\u0448\u0438\u0431\u0430\u044e\u0441\u044c, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>write<\/code> libc \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>write<\/code>).<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 libc, \u0438 \u0438\u043d\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u0414\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u2014 \u044d\u0442\u043e glibc (GNU libc) \u0438 musl libc.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 <a href=\"https:\/\/www.openwall.com\/lists\/musl\/2023\/05\/02\/1\"><code>getaddrinfo<\/code> musl \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u0430 TCP DNS<\/a>. \u0412\u043e\u0442 \u043f\u043e\u0441\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u043c \u044d\u0442\u0438\u043c \u0431\u0430\u0433\u0435: <a href=\"https:\/\/christoph.luppri.ch\/fixing-dns-resolution-for-ruby-on-alpine-linux\">https:\/\/christoph.luppri.ch\/fixing-dns-resolution-for-ruby-on-alpine-linux<\/a>.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u043e stdout \u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430\u0445<\/font><\/h3>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 stdout (\u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0444\u0430\u0439\u043b\u0430 <code>1<\/code>) \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u043c. \u0410 \u0441 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0442\u0432\u043e\u0440\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0432\u0435\u0449\u0438! \u0412\u043e\u0442 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ol>\n<li>\u0412 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 <code>ls -l \/proc\/self\/fd\/1<\/code>. \u042f \u043f\u043e\u043b\u0443\u0447\u0430\u044e <code>\/dev\/pts\/2<\/code>.<\/li>\n<li>\u0412 \u0434\u0440\u0443\u0433\u043e\u043c \u043e\u043a\u043d\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 <code>echo hello > \/dev\/pts\/2<\/code>.<\/li>\n<li>\u0412\u0435\u0440\u043d\u0438\u0442\u0435\u0441\u044c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u0422\u0430\u043c \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f <code>hello<\/code>!<\/li>\n<\/ol>\n<p>  <\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u0412\u043e\u0442 \u043f\u043e\u043a\u0430 \u0438 \u0432\u0441\u0451!<\/font><\/h3>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u043a\u0430\u043a \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f <code>hello world<\/code>! \u041f\u043e\u043a\u0430 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0441\u0442 \u0438 \u0442\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u043b\u0438\u043d\u043d\u044b\u043c, \u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e\u0435. \u0412 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043c\u043d\u0435 \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0443\u0441\u043b\u044b\u0448\u0430\u0442\u044c \u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u0435\u0439 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<p>  \u0415\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0431\u044b \u044f \u043d\u0430\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0437\u0430 \u043d\u0438\u043c\u0438 \u0448\u043f\u0438\u043e\u043d\u0438\u0442\u044c:<\/p>\n<ul>\n<li>\u0417\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u044f\u0434\u0440\u0430 \u0438 ASLR (\u043f\u043e\u043a\u0430 \u044f \u043d\u0435 \u043f\u043e\u043d\u044f\u043b\u0430, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c bpftrace + kprobes \u0434\u043b\u044f \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 \u044f\u0434\u0440\u0430).<\/li>\n<li>TTY (\u043f\u043e\u043a\u0430 \u043d\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0430\u0441\u044c, \u043a\u0430\u043a \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 <code>write(1, \"hello world\", 11)<\/code> \u043d\u0430 TTY, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0441\u043c\u043e\u0442\u0440\u044e).<\/li>\n<\/ul>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u041c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u043f\u0440\u043e Mac<\/font><\/h2>\n<p>  \u0412 Mac OS \u043c\u0435\u043d\u044f \u0440\u0430\u0441\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u044f \u043d\u0435 \u0437\u043d\u0430\u044e, \u043a\u0430\u043a \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043d\u0430 \u044d\u0442\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u2014 \u043a\u043e\u0433\u0434\u0430 \u044f \u0432\u044b\u0432\u043e\u0436\u0443 <code>hello world<\/code>, \u0442\u043e \u043d\u0435 \u043c\u043e\u0433\u0443 \u0448\u043f\u0438\u043e\u043d\u0438\u0442\u044c \u0437\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432 Linux. \u041c\u043d\u0435 \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0441 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u043c \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u043c\u043d\u0435 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u044b \u0434\u043b\u044f Mac:<\/p>\n<ul>\n<li><code>ldd<\/code> -> <code>otool -L<\/code><\/li>\n<li><code>readelf<\/code> -> <code>otool<\/code><\/li>\n<li>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0430 Mac \u0432\u043c\u0435\u0441\u0442\u043e strace \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>dtruss<\/code> \u0438\u043b\u0438 <code>dtrace<\/code>, \u043d\u043e \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u043d\u0430\u0431\u0440\u0430\u043b\u0430\u0441\u044c \u0441\u043c\u0435\u043b\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0437\u0430\u0449\u0438\u0442\u0443 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e.<\/li>\n<li>\u041f\u043e\u0445\u043e\u0436\u0435, <code>strace<\/code> -> <code>sc_usage<\/code> \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432, \u0430 <code>fs_usage<\/code> \u2014 \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432.<\/li>\n<\/ul>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435<\/font><\/h2>\n<p>  \u0415\u0449\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0441\u044b\u043b\u043e\u043a:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.muppetlabs.com\/~breadbox\/software\/tiny\/teensy.html\">A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux<\/a>.<\/li>\n<li><a href=\"https:\/\/people.freebsd.org\/~brooks\/talks\/asiabsdcon2017-helloworld\/helloworld.pdf\">\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u00abhello world\u00bb \u0432 FreeBSD<\/a>.<\/li>\n<li><a href=\"https:\/\/gynvael.coldwind.pl\/?lang=en&amp;amp;id=754\">Hello world \u043f\u043e\u0434 \u043c\u0438\u043a\u0440\u043e\u0441\u043a\u043e\u043f\u043e\u043c<\/a> \u0434\u043b\u044f Windows.<\/li>\n<li>\u0421\u0442\u0430\u0442\u044c\u044f \u0441 LWN <a href=\"https:\/\/lwn.net\/Articles\/630727\/\">\u00ab\u041a\u0430\u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b\u00bb<\/a> (<a href=\"https:\/\/lwn.net\/Articles\/631631\/\">\u0438 \u0435\u0451 \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/a>) \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0435\u0439 \u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 <code>execve<\/code>.<\/li>\n<li><a href=\"https:\/\/cpu.land\/how-to-run-a-program\">\u041a\u0430\u043a \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443<\/a>.<\/li>\n<li><a href=\"https:\/\/www.youtube.com\/watch?v=LnzuMJLZRdU\">\u00abHello, world\u00bb \u0441 \u043d\u0443\u043b\u044f \u043d\u0430 6502 (\u0432\u0438\u0434\u0435\u043e \u0411\u0435\u043d\u0430 \u0418\u0442\u0435\u0440\u0430)<\/a>.<\/li>\n<\/ul>\n<p>  <\/p>\n<blockquote><p><b><font color=\"#3AC1EF\"><a href=\"https:\/\/t.me\/ruvds_community\">Telegram-\u043a\u0430\u043d\u0430\u043b \u0441 \u0440\u043e\u0437\u044b\u0433\u0440\u044b\u0448\u0430\u043c\u0438 \u043f\u0440\u0438\u0437\u043e\u0432, \u043d\u043e\u0432\u043e\u0441\u0442\u044f\u043c\u0438 IT \u0438 \u043f\u043e\u0441\u0442\u0430\u043c\u0438 \u043e \u0440\u0435\u0442\u0440\u043e\u0438\u0433\u0440\u0430\u0445 ?\ufe0f<\/a><\/font><\/b><\/p><\/blockquote>\n<p><a href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=ru_vds&amp;utm_content=chto_proisxodit_kogda_zapuskaesh_hello_world_v_linux\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/_p\/_h\/lv\/_p_hlvd2tv0cv9tny8tdytzfhje.png\" data-src=\"https:\/\/habrastorage.org\/webt\/_p\/_h\/lv\/_p_hlvd2tv0cv9tny8tdytzfhje.png\"\/><\/a><\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/753506\/\"> https:\/\/habr.com\/ru\/articles\/753506\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/companies\/ruvds\/articles\/753506\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sq\/v3\/58\/sqv358sbar5osudzalgqz4ax2ae.png\" data-src=\"https:\/\/habrastorage.org\/webt\/sq\/v3\/58\/sqv358sbar5osudzalgqz4ax2ae.png\"\/><\/div>\n<p><\/a><br \/>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0430\u0441\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0448\u044c \u0432 Linux \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u00abHello World\u00bb \u043d\u0430 Python.<\/p>\n<pre><code class=\"python\">print(\"hello world\")<\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435:<\/p>\n<pre><code class=\"bash\">$ python3 hello.py hello world<\/code><\/pre>\n<p>  \u041d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435. \u042f \u043e\u0431\u044a\u044f\u0441\u043d\u044e, \u0447\u0442\u043e \u0442\u0430\u043c \u0442\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0438, \u0447\u0442\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0432\u0430\u0436\u043d\u0435\u0435, \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b \u0441\u0430\u043c\u0438 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0435. \u041c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <code>readelf<\/code>, <code>strace<\/code>, <code>ldd<\/code>, <code>debugfs<\/code>, <code>\/proc<\/code>, <code>ltrace<\/code>, <code>dd<\/code> \u0438 <code>stat<\/code>. \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a Python \u0447\u0430\u0441\u0442\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0443\u0435\u043c\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-351713","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/351713","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=351713"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/351713\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=351713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=351713"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=351713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}