{"id":304517,"date":"2020-05-29T15:00:49","date_gmt":"2020-05-29T15:00:49","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=304517"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=304517","title":{"rendered":"\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u044f\u0445 \u0432 \u044f\u0434\u0440\u0435 Linux"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/504442\/\">\u0420\u0435\u0448\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u2014 \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u044f\u0434\u0440\u0430 Linux \u0431\u043b\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0435\u0433\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u044f\u0434\u0440\u0430, \u0432 \u043d\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e foo, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0433\u0440\u0430\u0442\u044c \u0440\u043e\u043b\u044c \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 module_alloc \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0431\u043b\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 memcpy \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u0435\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442:<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<pre><code class=\"plaintext\">static noinline int foo(int ret) { \treturn (ret + 2); }  static int exe_init(void) { \tint ret = 0; \tint (*new_foo)(int);  \tret = foo(0); \tprintk(KERN_INFO &quot;ret=%d\\n&quot;, ret);  \tnew_foo = module_alloc(PAGE_SIZE); \tset_memory_x((unsigned long)new_foo, 1);  \tprintk(KERN_INFO &quot;foo=%lx new_foo=%lx\\n&quot;, \t\t(unsigned long)foo, (unsigned long)new_foo);  \tmemcpy((void *)new_foo, (const void *)foo, PAGE_SIZE);  \tret = new_foo(1); \tprintk(KERN_INFO &quot;ret=%d\\n&quot;, ret);  \tvfree(new_foo); \treturn 0; } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f exe_init \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043c\u043e\u0434\u0443\u043b\u044f. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u043b\u043e\u0433\u0435 \u044f\u0434\u0440\u0430:<\/p>\n<pre><code class=\"plaintext\">[ 6972.522422] ret=2 [ 6972.522443] foo=ffffffffc0000000 new_foo=ffffffffc0007000 [ 6972.522457] ret=3 <\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 foo \u0444\u0443\u043d\u043a\u0446\u0438\u044e printk \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430:<\/p>\n<pre><code class=\"plaintext\">static noinline int foo(int ret) { \tprintk(KERN_INFO &quot;ret=%d\\n&quot;, ret); \treturn (ret + 2); } <\/code><\/pre>\n<p>  \u0438 \u0441\u0434\u0430\u043c\u043f\u0438\u043c 25 \u0431\u0430\u0439\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 new_foo() \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"plaintext\">\tmemcpy((void *)new_foo, (const void *)foo, PAGE_SIZE); \tdump((unsigned long)new_foo); <\/code><\/pre>\n<p>  dump \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043a\u0430\u043a<\/p>\n<pre><code class=\"plaintext\">static inline void dump(unsigned long x) { \tint i; \tfor (i = 0; i &lt; 25; i++) \\ \t\tpr_cont(&quot;%.2x &quot;, *((unsigned char *)(x) + i) & 0xFF); \\ \tpr_cont(&quot;\\n&quot;); } <\/code><\/pre>\n<p>  \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u0440\u0430\u0448 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u0432 \u043b\u043e\u0433\u0435:<\/p>\n<pre><code class=\"plaintext\">[ 8482.806092] ret=0 [ 8482.806092] ret=2 [ 8482.806111] foo=ffffffffc0000000 new_foo=ffffffffc0007000 [ 8482.806113] 53 89 fe 89 fb 48 c7 c7 24 10 00 c0 e8 e8 3d 0b c1 8d 43 02 5b c3 66 2e 0f  [ 8482.806135] invalid opcode: 0000 [#1] SMP NOPTI [ 8482.806639] CPU: 0 PID: 5081 Comm: insmod Tainted: G           O      5.4.27 #12 [ 8482.807669] Hardware name: innotek GmbH VirtualBox\/VirtualBox, BIOS VirtualBox 12\/01\/2006 [ 8482.808560] RIP: 0010:irq_create_direct_mapping+0x79\/0x90 <\/code><\/pre>\n<p>  \u041a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 irq_create_direct_mapping, \u0445\u043e\u0442\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c printk. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e.<\/p>\n<p>  \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 foo. \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0435\u0433\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b objdump -d:<\/p>\n<pre><code class=\"plaintext\">Disassembly of section .text:  0000000000000000 &lt;foo&gt;:    0:\t53                   \tpush   %rbx    1:\t89 fe                \tmov    %edi,%esi    3:\t89 fb                \tmov    %edi,%ebx    5:\t48 c7 c7 00 00 00 00 \tmov    $0x0,%rdi    c:\te8 00 00 00 00       \tcallq  11 &lt;foo+0x11&gt;   11:\t8d 43 02             \tlea    0x2(%rbx),%eax   14:\t5b                   \tpop    %rbx   15:\tc3                   \tretq      16:\t66 2e 0f 1f 84 00 00 \tnopw   %cs:0x0(%rax,%rax,1)   1d:\t00 00 00  <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f foo \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438. \u041f\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e 0xC \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043e\u043f\u043a\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0431\u043b\u0438\u0436\u043d\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 (near call) e8 \u2014 \u0431\u043b\u0438\u0436\u043d\u0435\u0433\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u0434\u0430, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 4 \u0431\u0430\u0439\u0442\u0430 \u2014 \u044d\u0442\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 RIP, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0442.\u0435. RIP = RIP + offset, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Intel (Intel 64 and IA-32 Architectures Software Developer\u2019s Manual, Instruction Set Reference A-Z):  <\/p>\n<blockquote><p>A relative offset (rel16 or rel32) is generally specified as a label in assembly code. But at the machine code level, it is encoded as a signed, 16- or 32-bit immediate value.<br \/>  This value is added to the value in the EIP(RIP) register. In 64-bit mode the relative offset is always a 32-bit immediate value which is sign extended to 64-bits before it is added to the value in the RIP register for the target calculation.  <\/p><\/blockquote>\n<p>  \u0410\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 foo \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u044d\u0442\u043e 0xffffffffc0000000, \u0437\u043d\u0430\u0447\u0438\u0442 \u0432 RIP = 0xffffffffc0000000 + 0xc + 0x5 = 0xffffffffc00000011 (0xc \u2014 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a \u043a\u043e\u043c\u0430\u043d\u0434\u0435 e8, 1 \u0431\u0430\u0439\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 4 \u0431\u0430\u0439\u0442\u0430 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f). \u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0442.\u043a. \u0441\u0434\u0430\u043c\u043f\u0438\u043b\u0438 \u0442\u0435\u043b\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0412\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u043a\u0443\u0434\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442 \u043d\u0430\u0441 \u0432\u044b\u0437\u043e\u0432 call \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 foo:<\/p>\n<pre><code class=\"plaintext\">0xffffffffc00000011 + 0xffffffffc10b3de8 = 0xffffffff810b3df9 <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0430\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 printk:  <\/p>\n<pre><code class=\"plaintext\"># cat \/proc\/kallsyms | grep ffffffff810b3df9   ffffffff810b3df9 T printk <\/code><\/pre>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f new_foo, \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 0xffffffffc0007000<\/p>\n<pre><code class=\"plaintext\">0xffffffffc0007011 + 0xffffffffc10b3de8 = 0xffffffff810badf9 <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441 \u0432 kallsyms \u043d\u0435\u0442, \u043d\u043e \u0435\u0441\u0442\u044c 0xffffffff810badf9 \u2014 0x79 = 0xffffffff810bad80  <\/p>\n<pre><code class=\"plaintext\"># cat \/proc\/kallsyms | grep ffffffff810bad80 ffffffff810bad80 T irq_create_direct_mapping <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0442\u0430 \u0441\u0430\u043c\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043a\u0440\u0430\u0448.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043a\u0440\u0430\u0448, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435, \u0437\u043d\u0430\u044f \u0430\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 new_foo:<\/p>\n<pre><code class=\"plaintext\">memcpy((void *)new_foo, (const void *)foo, PAGE_SIZE); unsigned int delta = (unsigned long)printk - (unsigned long)new_foo - 0x11; *(unsigned int *)((void *)new_foo + 0xD) = delta; <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0440\u0430\u0448\u0435\u0439 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0444\u0443\u043d\u043a\u0446\u0438\u044f new_foo \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0432\u0435\u0440\u043d\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0435\u043d\u0430. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0447\u0435\u043c\u0443 \u0432 \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u043c \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u043e\u043f\u043a\u043e\u0434\u0430 e8 \u043d\u0443\u043b\u0435\u0432\u043e\u0435, \u0430 \u0432 \u0434\u0430\u043c\u043f\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0438 \u043a\u0430\u043a \u0441 \u043d\u0438\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u044f\u0434\u0440\u043e. \u041d\u043e \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ELF.<\/p>\n<p>  ELF \u044d\u0442\u043e \u0430\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0442\u0443\u0440\u0430 Executable and Linkable Format \u2014 \u0444\u043e\u0440\u043c\u0430\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u043c\u044b\u0445 \u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0443\u0435\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. \u0424\u0430\u0439\u043b \u0444\u043e\u0440\u043c\u0430\u0442\u0430 ELF \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0441\u0435\u043a\u0446\u0438\u0439. \u0421\u0435\u043a\u0446\u0438\u044f \u0445\u0440\u0430\u043d\u0438\u0442 \u043d\u0430\u0431\u043e\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043b\u0438\u043d\u043a\u0435\u0440\u0443 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430 \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0437\u0430\u043f\u0438\u0441\u0438 \u043e \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u044f\u0445 \u0438 \u0442.\u043f. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0435\u043a\u0446\u0438\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c. \u0412\u0441\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0438 \u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441. \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0441\u0435\u043a\u0446\u0438\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a \u043d\u0430\u0447\u0430\u043b\u0443 \u0441\u0435\u043a\u0446\u0438\u0438 \u0438 \u043f\u0440\u043e\u0447\u0443\u044e \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0435\u043a\u0446\u0438\u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432.<\/p>\n<p>  \u041f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 printk, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u044f\u0434\u0440\u0443, \u0447\u0442\u043e \u044d\u0442\u0443 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043d\u0430\u0434\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c. \u0417\u0430\u043f\u0438\u0441\u044c \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0433\u0434\u0435 \u043d\u0430\u0434\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f (\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438), \u0442\u0438\u043f \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e. \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u0435\u043d \u0442\u0438\u043f \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0438\u0436\u0435. \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0441\u0435\u043a\u0446\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0439 \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043d\u0430 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0441\u0435\u043a\u0446\u0438\u0438 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u0441\u0435\u043a\u0446\u0438\u0438, \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u044b objdump \u0441 \u043a\u043b\u044e\u0447\u0435\u043c -r.<br \/>  \u0418\u0437 \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u0433\u043e \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0430 \u043d\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e 0xD \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 printk, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0449\u0435\u043c \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 objdump \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u044e \u0441 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439:<\/p>\n<pre><code class=\"plaintext\">000000000000000d R_X86_64_PC32     printk-0x0000000000000004 <\/code><\/pre>\n<p>  \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u043d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043f\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e 0xD, \u0438 \u0438\u043c\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0432 \u044d\u0442\u0443 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c.<\/p>\n<p>  \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (-4). \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a \u0430\u0434\u0440\u0435\u0441\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 printk, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f addendum, \u0438 \u043e\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b printk:<\/p>\n<pre><code class=\"plaintext\">$ objdump -t exe.ko | grep printk 0000000000000000         *UND*\t0000000000000000 printk <\/code><\/pre>\n<p>  \u0421\u0438\u043c\u0432\u043e\u043b \u0435\u0441\u0442\u044c, \u043e\u043d \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0434\u0443\u043b\u044f (undefined), \u0437\u043d\u0430\u0447\u0438\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0435\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0432 \u044f\u0434\u0440\u0435.<\/p>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u043c \u0432\u0438\u0434\u0435. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 wireshark, \u043e\u043d \u0443\u043c\u0435\u0435\u0442 \u043f\u0430\u0440\u0441\u0438\u0442\u044c ELF \u0444\u043e\u0440\u043c\u0430\u0442. \u0412\u043e\u0442 \u043d\u0430\u0448\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 (\u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442 \u0438\u0437 writeshark, LSB \u0441\u043b\u0435\u0432\u0430):<\/p>\n<pre><code class=\"plaintext\">  0d 00 00 00 00 00 00 00  02 00 00 00 22 00 00 00  fc ff ff ff ff ff ff ff   |                     |  |          ||         |  |                     |   +---- \u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 -------+  +-- \u0422\u0438\u043f ---++--\u0418\u043d\u0434\u0435\u043a\u0441-+  +---- addendum  ------+ <\/code><\/pre>\n<p>  \u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u044d\u0442\u0443 \u0437\u0430\u043f\u0438\u0441\u044c \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438\u0437 &lt;linux\/elf.h&gt;:<\/p>\n<pre><code class=\"plaintext\">typedef struct elf64_rela {   Elf64_Addr r_offset;\t\/* Location at which to apply the action *\/   Elf64_Xword r_info;\t\/* index and type of relocation *\/   Elf64_Sxword r_addend;\t\/* Constant addend used to compute value *\/ } Elf64_Rela; <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0443 \u043d\u0430\u0441 8 \u0431\u0430\u0439\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f 0x00000000d, 4 \u0431\u0430\u0439\u0442\u0430 \u0442\u0438\u043f 0x00000002, 4 \u0431\u0430\u0439\u0442\u0430 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 0x00000022 (\u0438\u043b\u0438 34 \u0432 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u043e\u0439) \u0438 8 \u0431\u0430\u0439\u0442 addendum -4.<\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043f\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u043e\u043c 34:<\/p>\n<pre><code class=\"plaintext\">  01 01 00 00 10 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 <\/code><\/pre>\n<p>  \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430<\/p>\n<pre><code class=\"plaintext\">typedef struct elf64_sym {   Elf64_Word st_name;\t\t\/* Symbol name, index in string tbl *\/   unsigned char\tst_info;\t\/* Type and binding attributes *\/   unsigned char\tst_other;\t\/* No defined meaning, 0 *\/   Elf64_Half st_shndx;\t\t\/* Associated section index *\/   Elf64_Addr st_value;\t\t\/* Value of the symbol *\/   Elf64_Xword st_size;\t\t\/* Associated symbol size *\/ } Elf64_Sym; <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0435 4 \u0431\u0430\u0439\u0442\u0430 0x00000101 \u2014 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u0442\u0440\u043e\u043a .strtab \u043a \u0438\u043c\u0435\u043d\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u0442.\u0435. printk. \u041f\u043e\u043b\u0435 st_info \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442.\u043f., \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 ELF \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u041f\u043e\u043b\u0435 st_other \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442, \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0442\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u043f\u043e\u043b\u044f st_shndx, st_value \u0438 st_size. st_shndx \u2014 \u0438\u043d\u0434\u0435\u043a\u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0441\u0435\u043a\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0441\u0438\u043c\u0432\u043e\u043b. \u041c\u044b \u0432\u0438\u0434\u0438\u043c \u0442\u0443\u0442 \u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442.\u043a. \u0441\u0438\u043c\u0432\u043e\u043b \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0434\u0443\u043b\u044f, \u0435\u0433\u043e \u043d\u0435\u0442 \u0432 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0435\u043a\u0446\u0438\u044f\u0445. <br \/>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 st_value \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 st_size \u0442\u0430\u043a\u0436\u0435 \u043d\u0443\u043b\u0435\u0432\u044b\u0435. \u042d\u0442\u0438 \u043f\u043e\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442 \u044f\u0434\u0440\u043e \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<p>  \u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b foo, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043d\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442:<\/p>\n<pre><code class=\"plaintext\">  08 00 00 00 02 00 02 00  00 00 00 00 00 00 00 00  16 00 00 00 00 00 00 00 <\/code><\/pre>\n<p>  \u0421\u0438\u043c\u0432\u043e\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 .text \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0435\u043a\u0446\u0438\u0438 0x00000000, \u0442.\u0435. \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0432 \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u043c \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0435, \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 22 \u0431\u0430\u0439\u0442\u0430.<\/p>\n<p>  \u0422\u0430\u043a\u0443\u044e \u0436\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0438 objdump:<\/p>\n<pre><code class=\"plaintext\">$ objdump -t exe.ko | grep foo 0000000000000000 l     F .text\t0000000000000016 foo <\/code><\/pre>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u044f\u0434\u0440\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c, \u043e\u043d\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0432\u0441\u0435 Undefined \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u043e\u043b\u044f st_value \u0438 st_size \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 simplify_symbols, \u0444\u0430\u0439\u043b kernel\/module.c:<\/p>\n<pre><code class=\"plaintext\">\/* Change all symbols so that st_value encodes the pointer directly. *\/ static int simplify_symbols(struct module *mod, const struct load_info *info) { ... <\/code><\/pre>\n<p>  \u0412 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 load_info \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430<\/p>\n<pre><code class=\"plaintext\">struct load_info { \tconst char *name; \t\/* pointer to module in temporary copy, freed at end of load_module() *\/ \tstruct module *mod; \tElf_Ehdr *hdr; \tunsigned long len; \tElf_Shdr *sechdrs; \tchar *secstrings, *strtab; \tunsigned long symoffs, stroffs, init_typeoffs, core_typeoffs; \tstruct _ddebug *debug; \tunsigned int num_debug; \tbool sig_ok; #ifdef CONFIG_KALLSYMS \tunsigned long mod_kallsyms_init_off; #endif \tstruct { \t\tunsigned int sym, str, mod, vers, info, pcpu; \t} index; }; <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u043b\u044f:<br \/>   \u2014 hdr \u2014 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a ELF \u0444\u0430\u0439\u043b\u0430<br \/>   \u2014 sechdrs \u2014 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0441\u0435\u043a\u0446\u0438\u0439<br \/>   \u2014 strtab \u2014 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0438\u043c\u0435\u043d \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u2014 \u043d\u0430\u0431\u043e\u0440 \u0441\u0442\u0440\u043e\u043a, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0443\u043b\u044f\u043c\u0438<br \/>   \u2014 index.sym \u2014 \u0438\u043d\u0434\u0435\u043a\u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0441\u0435\u043a\u0446\u0438\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0435\u043a\u0446\u0438\u0438 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u0438\u043f\u0430 Elf64_Sym:<\/p>\n<pre><code class=\"plaintext\">Elf64_Shdr *symsec = &info-&gt;sechdrs[info-&gt;index.sym]; Elf64_Sym *sym = (void *)symsec-&gt;sh_addr; <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432 \u0446\u0438\u043a\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u0432\u0441\u0435\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0435\u0433\u043e \u0438\u043c\u044f:  <\/p>\n<pre><code class=\"plaintext\">for (i = 1; i &lt; symsec-&gt;sh_size \/ sizeof(Elf_Sym); i++) { \tconst char *name = info-&gt;strtab + sym[i].st_name; <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0435 st_shndx \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0441\u0435\u043a\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044d\u0442\u043e\u0442 \u0441\u0438\u043c\u0432\u043e\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d. \u0415\u0441\u043b\u0438 \u0442\u0430\u043c \u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u043d\u0430\u0448 \u0441\u043b\u0443\u0447\u0430\u0439), \u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043d\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0434\u0443\u043b\u044f, \u0438\u0441\u043a\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430\u0434\u043e \u0432 \u044f\u0434\u0440\u0435:<\/p>\n<pre><code class=\"plaintext\">\tswitch (sym[i].st_shndx) { \t..... \t case SHN_UNDEF: \/\/ \u044d\u0442\u043e 0 \tksym = resolve_symbol_wait(mod, info, name);  \t\/* Ok if resolved.  *\/ \tif (ksym && !IS_ERR(ksym)) { \t\tsym[i].st_value = kernel_symbol_value(ksym); \t\tbreak; \t} <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0439 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 apply_relocations:<\/p>\n<pre><code class=\"plaintext\">static int apply_relocations(struct module *mod, const struct load_info *info) { \tunsigned int i; \tint err = 0;  \t\/* Now do relocations. *\/ \tfor (i = 1; i &lt; info-&gt;hdr-&gt;e_shnum; i++) { \t..... <\/code><\/pre>\n<p>  \u0412 \u0446\u0438\u043a\u043b\u0435 \u0438\u0449\u0435\u043c \u0441\u0435\u043a\u0446\u0438\u0438 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0439 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 apply_relocate_add:<\/p>\n<pre><code class=\"plaintext\">if (info-&gt;sechdrs[i].sh_type == SHT_RELA) \/\/ \u043d\u0430\u0448\u043b\u0438 \u0441\u0435\u043a\u0446\u0438\u044e \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0439 \terr = apply_relocate_add(info-&gt;sechdrs, info-&gt;strtab, \t\t\t\tinfo-&gt;index.sym, i, mod); <\/code><\/pre>\n<p>  \u0412 apply_relocate_add \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0441\u0435\u043a\u0446\u0438\u0439, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u043c\u0435\u043d \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0438\u043d\u0434\u0435\u043a\u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0441\u0435\u043a\u0446\u0438\u0438 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0441\u0435\u043a\u0446\u0438\u0438 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0439:<\/p>\n<pre><code class=\"plaintext\">int apply_relocate_add(Elf64_Shdr *sechdrs, \t   const char *strtab, \t   unsigned int symindex, \t   unsigned int relsec, \t   struct module *me) { <\/code><\/pre>\n<p>  \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u0430\u0434\u0440\u0435\u0441\u0443\u0435\u043c \u0441\u0435\u043a\u0446\u0438\u044e \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0439:<\/p>\n<pre><code class=\"plaintext\">Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr; <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0432 \u0446\u0438\u043a\u043b\u0435 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0435\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439:<\/p>\n<pre><code class=\"plaintext\">for (i = 0; i &lt; sechdrs[relsec].sh_size \/ sizeof(*rel); i++) { <\/code><\/pre>\n<p>  \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u0435\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0432 \u043d\u0435\u0439, \u0442.\u0435. \u0433\u0434\u0435 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u041f\u043e\u043b\u0435 sh_info \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0441\u0435\u043a\u0446\u0438\u0438 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u2014 \u044d\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0441\u0435\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438, \u043f\u043e\u043b\u0435 r_offset \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u2014 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"plaintext\">\/* This is where to make the change *\/ loc = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr + rel[i].r_offset; <\/code><\/pre>\n<p>  A\u0434\u0440\u0435\u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0434\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u044d\u0442\u0443 \u043f\u043e\u0437\u0438\u0446\u0438\u044e, \u0441 \u0443\u0447\u0435\u0442\u043e\u043c addendum. \u041f\u043e\u043b\u0435 r_info \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 \u044d\u0442\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432:<\/p>\n<pre><code class=\"plaintext\">\t\/* This is the symbol it is referring to.  Note that all \t   undefined symbols have been resolved.  *\/ \tsym = (Elf64_Sym *)sechdrs[symindex].sh_addr \t\t+ ELF64_R_SYM(rel[i].r_info);  \tval = sym-&gt;st_value + rel[i].r_addend; <\/code><\/pre>\n<p>  \u0422\u0438\u043f \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044d\u0442\u043e R_X86_64_PLT32:<\/p>\n<pre><code class=\"plaintext\">\tswitch (ELF64_R_TYPE(rel[i].r_info)) { \t...... \tcase R_X86_64_PLT32:\t \t\tif (*(u32 *)loc != 0) \t\t\tgoto invalid_relocation; \t\tval -= (u64)loc;\t\/\/ \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \t\t*(u32 *)loc = val;  \/\/ \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \t\tbreak; \t..... <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0430\u043c\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0435 val, \u0437\u043d\u0430\u044f \u0447\u0442\u043e sym-&gt;st_value \u2014 \u0430\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 printk 0xffffffff810b3df9, r_addend \u0440\u0430\u0432\u043d\u043e (-4), \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u2014 0xd \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f, \u0438\u043b\u0438 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 foo, \u0442.\u0435. \u0431\u0443\u0434\u0435\u0442 ffffffffc000000d. \u041f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0432\u0441\u0435 \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c:<\/p>\n<pre><code class=\"plaintext\">val = (u32)(0xffffffff810b3df9 - 0x4 - 0xffffffffc000000d) = 0xc10b3de8 <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0434\u0430\u043c\u043f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 foo, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435:<\/p>\n<pre><code class=\"plaintext\">53 89 fe 89 fb 48 c7 c7 24 10 00 c0 e8 e8 3d 0b c1 8d 43 02 5b c3 66 2e 0f <\/code><\/pre>\n<p>  \u041f\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e 0xD \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0xc10b3de8, \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e\u0435 \u0442\u043e\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043b\u0438.<\/p>\n<p>  \u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u044f\u0434\u0440\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0431\u043b\u0438\u0436\u043d\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430.<\/p>\n<p>  \u041f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0432\u0435\u0440\u0441\u0438\u044f \u044f\u0434\u0440\u0430 Linux 5.4.27.<\/p><\/div>\n<p> \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\/post\/504442\/\"> https:\/\/habr.com\/ru\/post\/504442\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/504442\/\">\u0420\u0435\u0448\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u2014 \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u044f\u0434\u0440\u0430 Linux \u0431\u043b\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0435\u0433\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u044f\u0434\u0440\u0430, \u0432 \u043d\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e foo, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0433\u0440\u0430\u0442\u044c \u0440\u043e\u043b\u044c \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 module_alloc \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0431\u043b\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 memcpy \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u0435\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442:  <\/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-304517","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/304517","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=304517"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/304517\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=304517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=304517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=304517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}