€•ÆgŒsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ#/translations/zh_CN/bpf/linux-notes”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ#/translations/zh_TW/bpf/linux-notes”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ#/translations/it_IT/bpf/linux-notes”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ#/translations/ja_JP/bpf/linux-notes”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ#/translations/ko_KR/bpf/linux-notes”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ#/translations/pt_BR/bpf/linux-notes”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ#/translations/sp_SP/bpf/linux-notes”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒtopic”“”)�”}”(hŒ Contents ”h]”(hŒtitle”“”)�”}”(hŒContents”h]”hŒContents”…”�”}”(hh½h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h»hh·h³Œ=/var/lib/git/docbuild/linux/Documentation/bpf/linux-notes.rst”h´KubhŒ bullet_list”“”)�”}”(hhh]”hŒ list_item”“”)�”}”(hhh]”(hŒ paragraph”“”)�”}”(hhh]”hŒ reference”“”)�”}”(hhh]”(hŒ generated”“”)�”}”(hhh]”hŒ1   ”…”�”}”(hhâh²hh³Nh´Nubah}”(h]”h ]”Œsectnum”ah"]”h$]”h&]”uh1hàh³Nh´NhhÝubhŒLinux implementation notes”…”�”}”(hhÝh²hh³Nh´Nubeh}”(h]”Œid1”ah ]”h"]”h$]”h&]”Œrefid”Œlinux-implementation-notes”uh1hÛhhØubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖhhÓubhÍ)�”}”(hhh]”(hÒ)�”}”(hhh]”h×)�”}”(hhh]”hÜ)�”}”(hhh]”(há)�”}”(hhh]”hŒ 1.1   ”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”hìah"]”h$]”h&]”uh1hàh³Nh´Nhj ubhŒByte swap instructions”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”Œid2”ah ]”h"]”h$]”h&]”Œrefid”Œbyte-swap-instructions”uh1hÛhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hÑhjubhÒ)�”}”(hhh]”h×)�”}”(hhh]”hÜ)�”}”(hhh]”(há)�”}”(hhh]”hŒ 1.2   ”…”�”}”(hj>h²hh³Nh´Nubah}”(h]”h ]”hìah"]”h$]”h&]”uh1hàh³Nh´Nhj;ubhŒJump instructions”…”�”}”(hj;h²hh³Nh´Nubeh}”(h]”Œid3”ah ]”h"]”h$]”h&]”Œrefid”Œjump-instructions”uh1hÛhj8ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖhj5ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÑhjubhÒ)�”}”(hhh]”h×)�”}”(hhh]”hÜ)�”}”(hhh]”(há)�”}”(hhh]”hŒ 1.3   ”…”�”}”(hjmh²hh³Nh´Nubah}”(h]”h ]”hìah"]”h$]”h&]”uh1hàh³Nh´NhjjubhŒMaps”…”�”}”(hjjh²hh³Nh´Nubeh}”(h]”Œid4”ah ]”h"]”h$]”h&]”Œrefid”Œmaps”uh1hÛhjgubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖhjdubah}”(h]”h ]”h"]”h$]”h&]”uh1hÑhjubhÒ)�”}”(hhh]”h×)�”}”(hhh]”hÜ)�”}”(hhh]”(há)�”}”(hhh]”hŒ 1.4   ”…”�”}”(hjœh²hh³Nh´Nubah}”(h]”h ]”hìah"]”h$]”h&]”uh1hàh³Nh´Nhj™ubhŒ Variables”…”�”}”(hj™h²hh³Nh´Nubeh}”(h]”Œid5”ah ]”h"]”h$]”h&]”Œrefid”Œ variables”uh1hÛhj–ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖhj“ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÑhjubhÒ)�”}”(hhh]”h×)�”}”(hhh]”hÜ)�”}”(hhh]”(há)�”}”(hhh]”hŒ 1.5   ”…”�”}”(hjËh²hh³Nh´Nubah}”(h]”h ]”hìah"]”h$]”h&]”uh1hàh³Nh´NhjÈubhŒ%Legacy BPF Packet access instructions”…”�”}”(hjÈh²hh³Nh´Nubeh}”(h]”Œid6”ah ]”h"]”h$]”h&]”Œrefid”Œ%legacy-bpf-packet-access-instructions”uh1hÛhjÅubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖhjÂubah}”(h]”h ]”h"]”h$]”h&]”uh1hÑhjubeh}”(h]”h ]”Œauto-toc”ah"]”h$]”h&]”uh1hÌhhÓubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÑhhÎubah}”(h]”h ]”jôah"]”h$]”h&]”uh1hÌhh·h²hh³Nh´Nubeh}”(h]”Œcontents”ah ]”Œcontents”ah"]”Œcontents”ah$]”h&]”uh1hµh³hËh´Khhh²hubhŒsection”“”)�”}”(hhh]”(h¼)�”}”(hŒLinux implementation notes”h]”(há)�”}”(hhh]”hŒ1   ”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”hìah"]”h$]”h&]”uh1hàhjh²hh³Nh´NubhŒLinux implementation notes”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œauto”KŒrefid”höuh1h»hjh²hh³hËh´Kubh×)�”}”(hŒlThis document provides more details specific to the Linux kernel implementation of the eBPF instruction set.”h]”hŒlThis document provides more details specific to the Linux kernel implementation of the eBPF instruction set.”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´Khjh²hubj)�”}”(hhh]”(h¼)�”}”(hŒByte swap instructions”h]”(há)�”}”(hhh]”hŒ 1.1   ”…”�”}”(hjDh²hh³Nh´Nubah}”(h]”h ]”hìah"]”h$]”h&]”uh1hàhj@h²hh³Nh´NubhŒByte swap instructions”…”�”}”(hj@h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j-Kj.j"uh1h»hj=h²hh³hËh´K ubh×)�”}”(hŒf``BPF_FROM_LE`` and ``BPF_FROM_BE`` exist as aliases for ``BPF_TO_LE`` and ``BPF_TO_BE`` respectively.”h]”(hŒliteral”“”)�”}”(hŒ``BPF_FROM_LE``”h]”hŒ BPF_FROM_LE”…”�”}”(hjah²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hj[ubhŒ and ”…”�”}”(hj[h²hh³Nh´Nubj`)�”}”(hŒ``BPF_FROM_BE``”h]”hŒ BPF_FROM_BE”…”�”}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hj[ubhŒ exist as aliases for ”…”�”}”(hj[h²hh³Nh´Nubj`)�”}”(hŒ ``BPF_TO_LE``”h]”hŒ BPF_TO_LE”…”�”}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hj[ubhŒ and ”…”�”}”hj[sbj`)�”}”(hŒ ``BPF_TO_BE``”h]”hŒ BPF_TO_BE”…”�”}”(hj—h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hj[ubhŒ respectively.”…”�”}”(hj[h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K hj=h²hubeh}”(h]”j(ah ]”h"]”Œbyte swap instructions”ah$]”h&]”uh1j hjh²hh³hËh´K ubj)�”}”(hhh]”(h¼)�”}”(hŒJump instructions”h]”(há)�”}”(hhh]”hŒ 1.2   ”…”�”}”(hj½h²hh³Nh´Nubah}”(h]”h ]”hìah"]”h$]”h&]”uh1hàhj¹h²hh³Nh´NubhŒJump instructions”…”�”}”(hj¹h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j-Kj.jQuh1h»hj¶h²hh³hËh´Kubh×)�”}”(hŒÚ``BPF_CALL | BPF_X | BPF_JMP`` (0x8d), ``callx dst``, performs an indirect call of a BPF function whose address is held in the ``dst`` register. The ``src``, ``offset`` and ``imm`` fields are reserved and must be zero.”h]”(j`)�”}”(hŒ``BPF_CALL | BPF_X | BPF_JMP``”h]”hŒBPF_CALL | BPF_X | BPF_JMP”…”�”}”(hjØh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjÔubhŒ (0x8d), ”…”�”}”(hjÔh²hh³Nh´Nubj`)�”}”(hŒ ``callx dst``”h]”hŒ callx dst”…”�”}”(hjêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjÔubhŒK, performs an indirect call of a BPF function whose address is held in the ”…”�”}”(hjÔh²hh³Nh´Nubj`)�”}”(hŒ``dst``”h]”hŒdst”…”�”}”(hjüh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjÔubhŒ register. The ”…”�”}”(hjÔh²hh³Nh´Nubj`)�”}”(hŒ``src``”h]”hŒsrc”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjÔubhŒ, ”…”�”}”(hjÔh²hh³Nh´Nubj`)�”}”(hŒ ``offset``”h]”hŒoffset”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjÔubhŒ and ”…”�”}”(hjÔh²hh³Nh´Nubj`)�”}”(hŒ``imm``”h]”hŒimm”…”�”}”(hj2h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjÔubhŒ& fields are reserved and must be zero.”…”�”}”(hjÔh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´Khj¶h²hubh×)�”}”(hŒFThe address of a BPF function gets into a register in one of two ways:”h]”hŒFThe address of a BPF function gets into a register in one of two ways:”…”�”}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´Khj¶h²hubhÍ)�”}”(hhh]”(hÒ)�”}”(hŒRit is loaded by a 64-bit immediate instruction with ``src`` = ``BPF_PSEUDO_FUNC``;”h]”h×)�”}”(hŒRit is loaded by a 64-bit immediate instruction with ``src`` = ``BPF_PSEUDO_FUNC``;”h]”(hŒ4it is loaded by a 64-bit immediate instruction with ”…”�”}”(hj_h²hh³Nh´Nubj`)�”}”(hŒ``src``”h]”hŒsrc”…”�”}”(hjgh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hj_ubhŒ = ”…”�”}”(hj_h²hh³Nh´Nubj`)�”}”(hŒ``BPF_PSEUDO_FUNC``”h]”hŒBPF_PSEUDO_FUNC”…”�”}”(hjyh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hj_ubhŒ;”…”�”}”(hj_h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´Khj[ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÑhjXh²hh³hËh´NubhÒ)�”}”(hX it is read, with a 64-bit load, from a frozen read-only array map, that no other program uses, that holds its read-only data: tables of functions, structures of operations, vtables, where pointers to functions may be mixed with other data. In the map a pointer to a function is the offset in bytes of its first instruction in the program, and that is how the verifier recognizes it. It is replaced with the address of the function when the program is loaded. The program reads it from there, which requires ``CAP_PERFMON``. ”h]”h×)�”}”(hX it is read, with a 64-bit load, from a frozen read-only array map, that no other program uses, that holds its read-only data: tables of functions, structures of operations, vtables, where pointers to functions may be mixed with other data. In the map a pointer to a function is the offset in bytes of its first instruction in the program, and that is how the verifier recognizes it. It is replaced with the address of the function when the program is loaded. The program reads it from there, which requires ``CAP_PERFMON``.”h]”(hXûit is read, with a 64-bit load, from a frozen read-only array map, that no other program uses, that holds its read-only data: tables of functions, structures of operations, vtables, where pointers to functions may be mixed with other data. In the map a pointer to a function is the offset in bytes of its first instruction in the program, and that is how the verifier recognizes it. It is replaced with the address of the function when the program is loaded. The program reads it from there, which requires ”…”�”}”(hj›h²hh³Nh´Nubj`)�”}”(hŒ``CAP_PERFMON``”h]”hŒ CAP_PERFMON”…”�”}”(hj£h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hj›ubhŒ.”…”�”}”(hj›h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´Khj—ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÑhjXh²hh³hËh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ*”uh1hÌh³hËh´Khj¶h²hubh×)�”}”(hXšIn both cases only static functions can be referenced. Therefore all functions that can be called indirectly are known to the verifier before it starts to analyze the program, and ``callx`` is verified as a direct call of every function that ``dst`` may point to at that instruction. The same rules apply: the calls can not be recursive, and the depth of the call chain and its combined stack size are limited.”h]”(hŒ´In both cases only static functions can be referenced. Therefore all functions that can be called indirectly are known to the verifier before it starts to analyze the program, and ”…”�”}”(hjÉh²hh³Nh´Nubj`)�”}”(hŒ ``callx``”h]”hŒcallx”…”�”}”(hjÑh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjÉubhŒ5 is verified as a direct call of every function that ”…”�”}”(hjÉh²hh³Nh´Nubj`)�”}”(hŒ``dst``”h]”hŒdst”…”�”}”(hjãh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjÉubhŒ¡ may point to at that instruction. The same rules apply: the calls can not be recursive, and the depth of the call chain and its combined stack size are limited.”…”�”}”(hjÉh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K#hj¶h²hubh×)�”}”(hŒÇCalling helper or kernel functions through a register, indirect calls of global functions, and tail calls in functions that are called via ``callx`` are not supported. ``callx`` requires the BPF JIT.”h]”(hŒ‹Calling helper or kernel functions through a register, indirect calls of global functions, and tail calls in functions that are called via ”…”�”}”(hjûh²hh³Nh´Nubj`)�”}”(hŒ ``callx``”h]”hŒcallx”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjûubhŒ are not supported. ”…”�”}”(hjûh²hh³Nh´Nubj`)�”}”(hŒ ``callx``”h]”hŒcallx”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjûubhŒ requires the BPF JIT.”…”�”}”(hjûh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K*hj¶h²hubeh}”(h]”jWah ]”h"]”Œjump instructions”ah$]”h&]”uh1j hjh²hh³hËh´Kubj)�”}”(hhh]”(h¼)�”}”(hŒMaps”h]”(há)�”}”(hhh]”hŒ 1.3   ”…”�”}”(hj;h²hh³Nh´Nubah}”(h]”h ]”hìah"]”h$]”h&]”uh1hàhj7h²hh³Nh´NubhŒMaps”…”�”}”(hj7h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j-Kj.j€uh1h»hj4h²hh³hËh´K/ubh×)�”}”(hŒULinux only supports the 'map_val(map)' operation on array maps with a single element.”h]”hŒYLinux only supports the ‘map_val(map)’ operation on array maps with a single element.”…”�”}”(hjRh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K1hj4h²hubh×)�”}”(hŒ�Linux uses an fd_array to store maps associated with a BPF program. Thus, map_by_idx(imm) uses the fd at that index in the array.”h]”hŒ�Linux uses an fd_array to store maps associated with a BPF program. Thus, map_by_idx(imm) uses the fd at that index in the array.”…”�”}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K3hj4h²hubeh}”(h]”j†ah ]”h"]”Œmaps”ah$]”h&]”uh1j hjh²hh³hËh´K/ubj)�”}”(hhh]”(h¼)�”}”(hŒ Variables”h]”(há)�”}”(hhh]”hŒ 1.4   ”…”�”}”(hj|h²hh³Nh´Nubah}”(h]”h ]”hìah"]”h$]”h&]”uh1hàhjxh²hh³Nh´NubhŒ Variables”…”�”}”(hjxh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j-Kj.j¯uh1h»hjuh²hh³hËh´K7ubh×)�”}”(hŒœThe following 64-bit immediate instruction specifies that a variable address, which corresponds to some integer stored in the 'imm' field, should be loaded:”h]”hŒ The following 64-bit immediate instruction specifies that a variable address, which corresponds to some integer stored in the ‘imm’ field, should be loaded:”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K9hjuh²hubhŒtable”“”)�”}”(hhh]”hŒtgroup”“”)�”}”(hhh]”(hŒcolspec”“”)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1j«hj¨ubj¬)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1j«hj¨ubj¬)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1j«hj¨ubj¬)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K)uh1j«hj¨ubj¬)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K uh1j«hj¨ubj¬)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1j«hj¨ubhŒthead”“”)�”}”(hhh]”hŒrow”“”)�”}”(hhh]”(hŒentry”“”)�”}”(hhh]”h×)�”}”(hŒopcode construction”h]”hŒopcode construction”…”�”}”(hjøh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K=hjõubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhjðubjô)�”}”(hhh]”h×)�”}”(hŒopcode”h]”hŒopcode”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K=hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhjðubjô)�”}”(hhh]”h×)�”}”(hŒsrc”h]”hŒsrc”…”�”}”(hj&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K=hj#ubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhjðubjô)�”}”(hhh]”h×)�”}”(hŒ pseudocode”h]”hŒ pseudocode”…”�”}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K=hj:ubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhjðubjô)�”}”(hhh]”h×)�”}”(hŒimm type”h]”hŒimm type”…”�”}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K=hjQubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhjðubjô)�”}”(hhh]”h×)�”}”(hŒdst type”h]”hŒdst type”…”�”}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K=hjhubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhjðubeh}”(h]”h ]”h"]”h$]”h&]”uh1jîhjëubah}”(h]”h ]”h"]”h$]”h&]”uh1jéhj¨ubhŒtbody”“”)�”}”(hhh]”jï)�”}”(hhh]”(jô)�”}”(hhh]”h×)�”}”(hŒBPF_IMM | BPF_DW | BPF_LD”h]”hŒBPF_IMM | BPF_DW | BPF_LD”…”�”}”(hj–h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K?hj“ubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhj�ubjô)�”}”(hhh]”h×)�”}”(hŒ0x18”h]”hŒ0x18”…”�”}”(hj­h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K?hjªubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhj�ubjô)�”}”(hhh]”h×)�”}”(hŒ0x3”h]”hŒ0x3”…”�”}”(hjÄh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K?hjÁubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhj�ubjô)�”}”(hhh]”h×)�”}”(hŒdst = var_addr(imm)”h]”hŒdst = var_addr(imm)”…”�”}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K?hjØubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhj�ubjô)�”}”(hhh]”h×)�”}”(hŒ variable id”h]”hŒ variable id”…”�”}”(hjòh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K?hjïubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhj�ubjô)�”}”(hhh]”h×)�”}”(hŒ data pointer”h]”hŒ data pointer”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K?hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jóhj�ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jîhj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‹hj¨ubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1j¦hj£ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¡hjuh²hh³hËh´Nubh×)�”}”(hŒ#On Linux, this integer is a BTF ID.”h]”hŒ#On Linux, this integer is a BTF ID.”…”�”}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´KBhjuh²hubeh}”(h]”jµah ]”h"]”Œ variables”ah$]”h&]”uh1j hjh²hh³hËh´K7ubj)�”}”(hhh]”(h¼)�”}”(hŒ%Legacy BPF Packet access instructions”h]”(há)�”}”(hhh]”hŒ 1.5   ”…”�”}”(hjRh²hh³Nh´Nubah}”(h]”h ]”hìah"]”h$]”h&]”uh1hàhjNh²hh³Nh´NubhŒ%Legacy BPF Packet access instructions”…”�”}”(hjNh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j-Kj.jÞuh1h»hjKh²hh³hËh´KEubh×)�”}”(hX.As mentioned in the `ISA standard documentation `_, Linux has special eBPF instructions for access to packet data that have been carried over from classic BPF to retain the performance of legacy socket filters running in the eBPF interpreter.”h]”(hŒAs mentioned in the ”…”�”}”(hjih²hh³Nh´NubhÜ)�”}”(hŒZ`ISA standard documentation `_”h]”hŒISA standard documentation”…”�”}”(hjqh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒISA standard documentation”Œrefuri”Œ:instruction-set.html#legacy-bpf-packet-access-instructions”uh1hÛhjiubhŒtarget”“”)�”}”(hŒ= ”h]”h}”(h]”Œisa-standard-documentation”ah ]”h"]”Œisa standard documentation”ah$]”h&]”Œrefuri”j‚uh1jƒŒ referenced”KhjiubhŒÀ, Linux has special eBPF instructions for access to packet data that have been carried over from classic BPF to retain the performance of legacy socket filters running in the eBPF interpreter.”…”�”}”(hjih²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´KGhjKh²hubh×)�”}”(hŒdThe instructions come in two forms: ``BPF_ABS | | BPF_LD`` and ``BPF_IND | | BPF_LD``.”h]”(hŒ$The instructions come in two forms: ”…”�”}”(hj�h²hh³Nh´Nubj`)�”}”(hŒ``BPF_ABS | | BPF_LD``”h]”hŒBPF_ABS | | BPF_LD”…”�”}”(hj¥h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hj�ubhŒ and ”…”�”}”(hj�h²hh³Nh´Nubj`)�”}”(hŒ``BPF_IND | | BPF_LD``”h]”hŒBPF_IND | | BPF_LD”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hj�ubhŒ.”…”�”}”(hj�h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´KMhjKh²hubh×)�”}”(hXUThese instructions are used to access packet data and can only be used when the program context is a pointer to a networking packet. ``BPF_ABS`` accesses packet data at an absolute offset specified by the immediate data and ``BPF_IND`` access packet data at an offset that includes the value of a register in addition to the immediate data.”h]”(hŒ†These instructions are used to access packet data and can only be used when the program context is a pointer to a networking packet. ”…”�”}”(hjÏh²hh³Nh´Nubj`)�”}”(hŒ ``BPF_ABS``”h]”hŒBPF_ABS”…”�”}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjÏubhŒP accesses packet data at an absolute offset specified by the immediate data and ”…”�”}”(hjÏh²hh³Nh´Nubj`)�”}”(hŒ ``BPF_IND``”h]”hŒBPF_IND”…”�”}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjÏubhŒi access packet data at an offset that includes the value of a register in addition to the immediate data.”…”�”}”(hjÏh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´KPhjKh²hubh×)�”}”(hŒ0These instructions have seven implicit operands:”h]”hŒ0These instructions have seven implicit operands:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´KVhjKh²hubhÍ)�”}”(hhh]”(hÒ)�”}”(hŒQRegister R6 is an implicit input that must contain a pointer to a struct sk_buff.”h]”h×)�”}”(hŒQRegister R6 is an implicit input that must contain a pointer to a struct sk_buff.”h]”hŒQRegister R6 is an implicit input that must contain a pointer to a struct sk_buff.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´KXhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hÑhjh²hh³hËh´NubhÒ)�”}”(hŒRRegister R0 is an implicit output which contains the data fetched from the packet.”h]”h×)�”}”(hŒRRegister R0 is an implicit output which contains the data fetched from the packet.”h]”hŒRRegister R0 is an implicit output which contains the data fetched from the packet.”…”�”}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´KZhj*ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÑhjh²hh³hËh´NubhÒ)�”}”(hŒMRegisters R1-R5 are scratch registers that are clobbered by the instruction. ”h]”h×)�”}”(hŒLRegisters R1-R5 are scratch registers that are clobbered by the instruction.”h]”hŒLRegisters R1-R5 are scratch registers that are clobbered by the instruction.”…”�”}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K\hjBubah}”(h]”h ]”h"]”h$]”h&]”uh1hÑhjh²hh³hËh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jÇjÈuh1hÌh³hËh´KXhjKh²hubh×)�”}”(hŒ®These instructions have an implicit program exit condition as well. If an eBPF program attempts access data beyond the packet boundary, the program execution will be aborted.”h]”hŒ®These instructions have an implicit program exit condition as well. If an eBPF program attempts access data beyond the packet boundary, the program execution will be aborted.”…”�”}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´K_hjKh²hubh×)�”}”(hŒ+``BPF_ABS | BPF_W | BPF_LD`` (0x20) means::”h]”(j`)�”}”(hŒ``BPF_ABS | BPF_W | BPF_LD``”h]”hŒBPF_ABS | BPF_W | BPF_LD”…”�”}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjnubhŒ (0x20) means:”…”�”}”(hjnh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´KchjKh²hubhŒ literal_block”“”)�”}”(hŒ8R0 = ntohl(*(u32 *) ((struct sk_buff *) R6->data + imm))”h]”hŒ8R0 = ntohl(*(u32 *) ((struct sk_buff *) R6->data + imm))”…”�”}”hjŒsbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1jŠh³hËh´KehjKh²hubh×)�”}”(hŒUwhere ``ntohl()`` converts a 32-bit value from network byte order to host byte order.”h]”(hŒwhere ”…”�”}”(hjœh²hh³Nh´Nubj`)�”}”(hŒ ``ntohl()``”h]”hŒntohl()”…”�”}”(hj¤h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hjœubhŒD converts a 32-bit value from network byte order to host byte order.”…”�”}”(hjœh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´KghjKh²hubh×)�”}”(hŒ+``BPF_IND | BPF_W | BPF_LD`` (0x40) means::”h]”(j`)�”}”(hŒ``BPF_IND | BPF_W | BPF_LD``”h]”hŒBPF_IND | BPF_W | BPF_LD”…”�”}”(hjÀh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j_hj¼ubhŒ (0x40) means:”…”�”}”(hj¼h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖh³hËh´KihjKh²hubj‹)�”}”(hŒ>R0 = ntohl(*(u32 *) ((struct sk_buff *) R6->data + src + imm))”h]”hŒ>R0 = ntohl(*(u32 *) ((struct sk_buff *) R6->data + src + imm))”…”�”}”hjØsbah}”(h]”h ]”h"]”h$]”h&]”jšj›uh1jŠh³hËh´KkhjKh²hubeh}”(h]”jäah ]”h"]”Œ%legacy bpf packet access instructions”ah$]”h&]”uh1j hjh²hh³hËh´KEubeh}”(h]”hüah ]”h"]”Œlinux implementation notes”ah$]”h&]”uh1j hhh²hh³hËh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hËuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(h»NŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”jóŒfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hËŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j jjñhüj³j(j1jWjrj†jHjµjêjäjŽj‹uŒ nametypes”}”(j ‰jñ‰j³‰j1‰jr‰jH‰jê‰jŽˆuh}”(jh·hüjj(j=jWj¶j†j4jµjujäjKj‹j…höhÝj"j jQj;j€jjj¯j™jÞjÈuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”j$Ks…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.