€•¯ÔŒ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/dev-tools/checkuapi”Œ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/dev-tools/checkuapi”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/it_IT/dev-tools/checkuapi”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/ja_JP/dev-tools/checkuapi”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/ko_KR/dev-tools/checkuapi”Œ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/dev-tools/checkuapi”Œ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/dev-tools/checkuapi”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)�”}”(hŒ%SPDX-License-Identifier: GPL-2.0-only”h]”hŒ%SPDX-License-Identifier: GPL-2.0-only”…”�”}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒA/var/lib/git/docbuild/linux/Documentation/dev-tools/checkuapi.rst”h´KubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒ UAPI Checker”h]”hŒ UAPI Checker”…”�”}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒ paragraph”“”)�”}”(hŒ˜The UAPI checker (``scripts/check-uapi.sh``) is a shell script which checks UAPI header files for userspace backwards-compatibility across the git tree.”h]”(hŒThe UAPI checker (”…”�”}”(hhßh²hh³Nh´NubhŒliteral”“”)�”}”(hŒ``scripts/check-uapi.sh``”h]”hŒscripts/check-uapi.sh”…”�”}”(hhéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhhßubhŒm) is a shell script which checks UAPI header files for userspace backwards-compatibility across the git tree.”…”�”}”(hhßh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhhÊh²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒOptions”h]”hŒOptions”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´K ubhÞ)�”}”(hŒOThis section will describe the options with which ``check-uapi.sh`` can be run.”h]”(hŒ2This section will describe the options with which ”…”�”}”(hjh²hh³Nh´Nubhè)�”}”(hŒ``check-uapi.sh``”h]”hŒ check-uapi.sh”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjubhŒ can be run.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjh²hubhÞ)�”}”(hŒUsage::”h]”hŒUsage:”…”�”}”(hj2h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjh²hubhŒ literal_block”“”)�”}”(hŒNcheck-uapi.sh [-b BASE_REF] [-p PAST_REF] [-j N] [-l ERROR_LOG] [-i] [-q] [-v]”h]”hŒNcheck-uapi.sh [-b BASE_REF] [-p PAST_REF] [-j N] [-l ERROR_LOG] [-i] [-q] [-v]”…”�”}”hjBsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´Khjh²hubhÞ)�”}”(hŒAvailable options::”h]”hŒAvailable options:”…”�”}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjh²hubjA)�”}”(hX4-b BASE_REF Base git reference to use for comparison. If unspecified or empty, will use any dirty changes in tree to UAPI files. If there are no dirty changes, HEAD will be used. -p PAST_REF Compare BASE_REF to PAST_REF (e.g. -p v6.1). If unspecified or empty, will use BASE_REF^1. Must be an ancestor of BASE_REF. Only headers that exist on PAST_REF will be checked for compatibility. -j JOBS Number of checks to run in parallel (default: number of CPU cores). -l ERROR_LOG Write error log to file (default: no error log is generated). -i Ignore ambiguous changes that may or may not break UAPI compatibility. -q Quiet operation. -v Verbose operation (print more information about each header being checked).”h]”hX4-b BASE_REF Base git reference to use for comparison. If unspecified or empty, will use any dirty changes in tree to UAPI files. If there are no dirty changes, HEAD will be used. -p PAST_REF Compare BASE_REF to PAST_REF (e.g. -p v6.1). If unspecified or empty, will use BASE_REF^1. Must be an ancestor of BASE_REF. Only headers that exist on PAST_REF will be checked for compatibility. -j JOBS Number of checks to run in parallel (default: number of CPU cores). -l ERROR_LOG Write error log to file (default: no error log is generated). -i Ignore ambiguous changes that may or may not break UAPI compatibility. -q Quiet operation. -v Verbose operation (print more information about each header being checked).”…”�”}”hj^sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´Khjh²hubhÞ)�”}”(hŒEnvironmental args::”h]”hŒEnvironmental args:”…”�”}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K#hjh²hubjA)�”}”(hŒ�ABIDIFF Custom path to abidiff binary CC C compiler (default is "gcc") ARCH Target architecture of C compiler (default is host arch)”h]”hŒ�ABIDIFF Custom path to abidiff binary CC C compiler (default is "gcc") ARCH Target architecture of C compiler (default is host arch)”…”�”}”hjzsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´K%hjh²hubhÞ)�”}”(hŒ Exit codes::”h]”hŒ Exit codes:”…”�”}”(hjˆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K)hjh²hubjA)�”}”(hŒ=0) Success 1) ABI difference detected 2) Prerequisite not met”h]”hŒ=0) Success 1) ABI difference detected 2) Prerequisite not met”…”�”}”hj–sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´K+hjh²hubeh}”(h]”Œoptions”ah ]”h"]”Œoptions”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒExamples”h]”hŒExamples”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj¬h²hh³hÇh´K0ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Basic Usage”h]”hŒ Basic Usage”…”�”}”(hjÀh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj½h²hh³hÇh´K3ubhÞ)�”}”(hŒ]First, let's try making a change to a UAPI header file that obviously won't break userspace::”h]”hŒ`First, let’s try making a change to a UAPI header file that obviously won’t break userspace:”…”�”}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K5hj½h²hubjA)�”}”(hX­cat << 'EOF' | patch -l -p1 --- a/include/uapi/linux/acct.h +++ b/include/uapi/linux/acct.h @@ -21,7 +21,9 @@ #include #include -/* +#define FOO + +/* * comp_t is a 16-bit "floating" point number with a 3-bit base 8 * exponent and a 13-bit fraction. * comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h EOF”h]”hX­cat << 'EOF' | patch -l -p1 --- a/include/uapi/linux/acct.h +++ b/include/uapi/linux/acct.h @@ -21,7 +21,9 @@ #include #include -/* +#define FOO + +/* * comp_t is a 16-bit "floating" point number with a 3-bit base 8 * exponent and a 13-bit fraction. * comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h EOF”…”�”}”hjÜsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´K8hj½h²hubhÞ)�”}”(hŒ'Now, let's use the script to validate::”h]”hŒ(Now, let’s use the script to validate:”…”�”}”(hjêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KIhj½h²hubjA)�”}”(hX% ./scripts/check-uapi.sh Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... All 912 UAPI headers compatible with x86 appear to be backwards compatible”h]”hX% ./scripts/check-uapi.sh Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... All 912 UAPI headers compatible with x86 appear to be backwards compatible”…”�”}”hjøsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´KKhj½h²hubhÞ)�”}”(hŒ7Let's add another change that *might* break userspace::”h]”(hŒ Let’s add another change that ”…”�”}”(hjh²hh³Nh´NubhŒemphasis”“”)�”}”(hŒ*might*”h]”hŒmight”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubhŒ break userspace:”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KQhj½h²hubjA)�”}”(hXÕcat << 'EOF' | patch -l -p1 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -74,7 +74,7 @@ struct bpf_insn { __u8 dst_reg:4; /* dest register */ __u8 src_reg:4; /* source register */ __s16 off; /* signed offset */ - __s32 imm; /* signed immediate constant */ + __u32 imm; /* unsigned immediate constant */ }; /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */ EOF”h]”hXÕcat << 'EOF' | patch -l -p1 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -74,7 +74,7 @@ struct bpf_insn { __u8 dst_reg:4; /* dest register */ __u8 src_reg:4; /* source register */ __s16 off; /* signed offset */ - __s32 imm; /* signed immediate constant */ + __u32 imm; /* unsigned immediate constant */ }; /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */ EOF”…”�”}”hj(sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´KShj½h²hubhÞ)�”}”(hŒThe script will catch this::”h]”hŒThe script will catch this:”…”�”}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kahj½h²hubjA)�”}”(hX% ./scripts/check-uapi.sh Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... ==== ABI differences detected in include/linux/bpf.h from HEAD -> dirty tree ==== [C] 'struct bpf_insn' changed: type size hasn't changed 1 data member change: type of '__s32 imm' changed: typedef name changed from __s32 to __u32 at int-ll64.h:27:1 underlying type 'int' changed: type name changed from 'int' to 'unsigned int' type size hasn't changed ================================================================================== error - 1/912 UAPI headers compatible with x86 appear _not_ to be backwards compatible”h]”hX% ./scripts/check-uapi.sh Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... ==== ABI differences detected in include/linux/bpf.h from HEAD -> dirty tree ==== [C] 'struct bpf_insn' changed: type size hasn't changed 1 data member change: type of '__s32 imm' changed: typedef name changed from __s32 to __u32 at int-ll64.h:27:1 underlying type 'int' changed: type name changed from 'int' to 'unsigned int' type size hasn't changed ================================================================================== error - 1/912 UAPI headers compatible with x86 appear _not_ to be backwards compatible”…”�”}”hjDsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´Kchj½h²hubhÞ)�”}”(hX£In this case, the script is reporting the type change because it could break a userspace program that passes in a negative number. Now, let's say you know that no userspace program could possibly be using a negative value in ``imm``, so changing to an unsigned type there shouldn't hurt anything. You can pass the ``-i`` flag to the script to ignore changes in which the userspace backwards compatibility is ambiguous::”h]”(hŒãIn this case, the script is reporting the type change because it could break a userspace program that passes in a negative number. Now, let’s say you know that no userspace program could possibly be using a negative value in ”…”�”}”(hjRh²hh³Nh´Nubhè)�”}”(hŒ``imm``”h]”hŒimm”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjRubhŒT, so changing to an unsigned type there shouldn’t hurt anything. You can pass the ”…”�”}”(hjRh²hh³Nh´Nubhè)�”}”(hŒ``-i``”h]”hŒ-i”…”�”}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjRubhŒb flag to the script to ignore changes in which the userspace backwards compatibility is ambiguous:”…”�”}”(hjRh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kthj½h²hubjA)�”}”(hX% ./scripts/check-uapi.sh -i Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... All 912 UAPI headers compatible with x86 appear to be backwards compatible”h]”hX% ./scripts/check-uapi.sh -i Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... All 912 UAPI headers compatible with x86 appear to be backwards compatible”…”�”}”hj„sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´K{hj½h²hubhÞ)�”}”(hŒ>Now, let's make a similar change that *will* break userspace::”h]”(hŒ(Now, let’s make a similar change that ”…”�”}”(hj’h²hh³Nh´Nubj)�”}”(hŒ*will*”h]”hŒwill”…”�”}”(hjšh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj’ubhŒ break userspace:”…”�”}”(hj’h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K�hj½h²hubjA)�”}”(hXÍcat << 'EOF' | patch -l -p1 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -71,8 +71,8 @@ enum { struct bpf_insn { __u8 code; /* opcode */ - __u8 dst_reg:4; /* dest register */ __u8 src_reg:4; /* source register */ + __u8 dst_reg:4; /* dest register */ __s16 off; /* signed offset */ __s32 imm; /* signed immediate constant */ }; EOF”h]”hXÍcat << 'EOF' | patch -l -p1 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -71,8 +71,8 @@ enum { struct bpf_insn { __u8 code; /* opcode */ - __u8 dst_reg:4; /* dest register */ __u8 src_reg:4; /* source register */ + __u8 dst_reg:4; /* dest register */ __s16 off; /* signed offset */ __s32 imm; /* signed immediate constant */ }; EOF”…”�”}”hj²sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´Kƒhj½h²hubhÞ)�”}”(hŒŠSince we're re-ordering an existing struct member, there's no ambiguity, and the script will report the breakage even if you pass ``-i``::”h]”(hŒ†Since we’re re-ordering an existing struct member, there’s no ambiguity, and the script will report the breakage even if you pass ”…”�”}”(hjÀh²hh³Nh´Nubhè)�”}”(hŒ``-i``”h]”hŒ-i”…”�”}”(hjÈh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjÀubhŒ:”…”�”}”(hjÀh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K’hj½h²hubjA)�”}”(hXº% ./scripts/check-uapi.sh -i Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... ==== ABI differences detected in include/linux/bpf.h from HEAD -> dirty tree ==== [C] 'struct bpf_insn' changed: type size hasn't changed 2 data member changes: '__u8 dst_reg' offset changed from 8 to 12 (in bits) (by +4 bits) '__u8 src_reg' offset changed from 12 to 8 (in bits) (by -4 bits) ================================================================================== error - 1/912 UAPI headers compatible with x86 appear _not_ to be backwards compatible”h]”hXº% ./scripts/check-uapi.sh -i Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... ==== ABI differences detected in include/linux/bpf.h from HEAD -> dirty tree ==== [C] 'struct bpf_insn' changed: type size hasn't changed 2 data member changes: '__u8 dst_reg' offset changed from 8 to 12 (in bits) (by +4 bits) '__u8 src_reg' offset changed from 12 to 8 (in bits) (by -4 bits) ================================================================================== error - 1/912 UAPI headers compatible with x86 appear _not_ to be backwards compatible”…”�”}”hjàsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´K•hj½h²hubhÞ)�”}”(hŒDLet's commit the breaking change, then commit the innocuous change::”h]”hŒELet’s commit the breaking change, then commit the innocuous change:”…”�”}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K£hj½h²hubjA)�”}”(hXE% git commit -m 'Breaking UAPI change' include/uapi/linux/bpf.h [detached HEAD f758e574663a] Breaking UAPI change 1 file changed, 1 insertion(+), 1 deletion(-) % git commit -m 'Innocuous UAPI change' include/uapi/linux/acct.h [detached HEAD 2e87df769081] Innocuous UAPI change 1 file changed, 3 insertions(+), 1 deletion(-)”h]”hXE% git commit -m 'Breaking UAPI change' include/uapi/linux/bpf.h [detached HEAD f758e574663a] Breaking UAPI change 1 file changed, 1 insertion(+), 1 deletion(-) % git commit -m 'Innocuous UAPI change' include/uapi/linux/acct.h [detached HEAD 2e87df769081] Innocuous UAPI change 1 file changed, 3 insertions(+), 1 deletion(-)”…”�”}”hjüsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´K¥hj½h²hubhÞ)�”}”(hŒ3Now, let's run the script again with no arguments::”h]”hŒ4Now, let’s run the script again with no arguments:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K¬hj½h²hubjA)�”}”(hX % ./scripts/check-uapi.sh Installing user-facing UAPI headers from HEAD... OK Installing user-facing UAPI headers from HEAD^1... OK Checking changes to UAPI headers between HEAD^1 and HEAD... All 912 UAPI headers compatible with x86 appear to be backwards compatible”h]”hX % ./scripts/check-uapi.sh Installing user-facing UAPI headers from HEAD... OK Installing user-facing UAPI headers from HEAD^1... OK Checking changes to UAPI headers between HEAD^1 and HEAD... All 912 UAPI headers compatible with x86 appear to be backwards compatible”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´K®hj½h²hubhÞ)�”}”(hX}It doesn't catch any breaking change because, by default, it only compares ``HEAD`` to ``HEAD^1``. The breaking change was committed on ``HEAD~2``. If we wanted the search scope to go back further, we'd have to use the ``-p`` option to pass a different past reference. In this case, let's pass ``-p HEAD~2`` to the script so it checks UAPI changes between ``HEAD~2`` and ``HEAD``::”h]”(hŒMIt doesn’t catch any breaking change because, by default, it only compares ”…”�”}”(hj&h²hh³Nh´Nubhè)�”}”(hŒ``HEAD``”h]”hŒHEAD”…”�”}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj&ubhŒ to ”…”�”}”(hj&h²hh³Nh´Nubhè)�”}”(hŒ ``HEAD^1``”h]”hŒHEAD^1”…”�”}”(hj@h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj&ubhŒ'. The breaking change was committed on ”…”�”}”(hj&h²hh³Nh´Nubhè)�”}”(hŒ ``HEAD~2``”h]”hŒHEAD~2”…”�”}”(hjRh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj&ubhŒK. If we wanted the search scope to go back further, we’d have to use the ”…”�”}”(hj&h²hh³Nh´Nubhè)�”}”(hŒ``-p``”h]”hŒ-p”…”�”}”(hjdh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj&ubhŒG option to pass a different past reference. In this case, let’s pass ”…”�”}”(hj&h²hh³Nh´Nubhè)�”}”(hŒ ``-p HEAD~2``”h]”hŒ -p HEAD~2”…”�”}”(hjvh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj&ubhŒ1 to the script so it checks UAPI changes between ”…”�”}”(hj&h²hh³Nh´Nubhè)�”}”(hŒ ``HEAD~2``”h]”hŒHEAD~2”…”�”}”(hjˆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj&ubhŒ and ”…”�”}”(hj&h²hh³Nh´Nubhè)�”}”(hŒ``HEAD``”h]”hŒHEAD”…”�”}”(hjšh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj&ubhŒ:”…”�”}”(hj&h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K´hj½h²hubjA)�”}”(hX±% ./scripts/check-uapi.sh -p HEAD~2 Installing user-facing UAPI headers from HEAD... OK Installing user-facing UAPI headers from HEAD~2... OK Checking changes to UAPI headers between HEAD~2 and HEAD... ==== ABI differences detected in include/linux/bpf.h from HEAD~2 -> HEAD ==== [C] 'struct bpf_insn' changed: type size hasn't changed 2 data member changes: '__u8 dst_reg' offset changed from 8 to 12 (in bits) (by +4 bits) '__u8 src_reg' offset changed from 12 to 8 (in bits) (by -4 bits) ============================================================================== error - 1/912 UAPI headers compatible with x86 appear _not_ to be backwards compatible”h]”hX±% ./scripts/check-uapi.sh -p HEAD~2 Installing user-facing UAPI headers from HEAD... OK Installing user-facing UAPI headers from HEAD~2... OK Checking changes to UAPI headers between HEAD~2 and HEAD... ==== ABI differences detected in include/linux/bpf.h from HEAD~2 -> HEAD ==== [C] 'struct bpf_insn' changed: type size hasn't changed 2 data member changes: '__u8 dst_reg' offset changed from 8 to 12 (in bits) (by +4 bits) '__u8 src_reg' offset changed from 12 to 8 (in bits) (by -4 bits) ============================================================================== error - 1/912 UAPI headers compatible with x86 appear _not_ to be backwards compatible”…”�”}”hj²sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´K»hj½h²hubhÞ)�”}”(hŒ›Alternatively, we could have also run with ``-b HEAD~``. This would set the base reference to ``HEAD~`` so then the script would compare it to ``HEAD~^1``.”h]”(hŒ+Alternatively, we could have also run with ”…”�”}”(hjÀh²hh³Nh´Nubhè)�”}”(hŒ ``-b HEAD~``”h]”hŒ-b HEAD~”…”�”}”(hjÈh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjÀubhŒ'. This would set the base reference to ”…”�”}”(hjÀh²hh³Nh´Nubhè)�”}”(hŒ ``HEAD~``”h]”hŒHEAD~”…”�”}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjÀubhŒ( so then the script would compare it to ”…”�”}”(hjÀh²hh³Nh´Nubhè)�”}”(hŒ ``HEAD~^1``”h]”hŒHEAD~^1”…”�”}”(hjìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjÀubhŒ.”…”�”}”(hjÀh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KÉhj½h²hubeh}”(h]”Œ basic-usage”ah ]”h"]”Œ basic usage”ah$]”h&]”uh1hÈhj¬h²hh³hÇh´K3ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒArchitecture-specific Headers”h]”hŒArchitecture-specific Headers”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj h²hh³hÇh´KÍubhÞ)�”}”(hŒConsider this change::”h]”hŒConsider this change:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KÏhj h²hubjA)�”}”(hX"cat << 'EOF' | patch -l -p1 --- a/arch/arm64/include/uapi/asm/sigcontext.h +++ b/arch/arm64/include/uapi/asm/sigcontext.h @@ -70,6 +70,7 @@ struct sigcontext { struct _aarch64_ctx { __u32 magic; __u32 size; + __u32 new_var; }; #define FPSIMD_MAGIC 0x46508001 EOF”h]”hX"cat << 'EOF' | patch -l -p1 --- a/arch/arm64/include/uapi/asm/sigcontext.h +++ b/arch/arm64/include/uapi/asm/sigcontext.h @@ -70,6 +70,7 @@ struct sigcontext { struct _aarch64_ctx { __u32 magic; __u32 size; + __u32 new_var; }; #define FPSIMD_MAGIC 0x46508001 EOF”…”�”}”hj+sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´KÑhj h²hubhÞ)�”}”(hŒÓThis is a change to an arm64-specific UAPI header file. In this example, I'm running the script from an x86 machine with an x86 compiler, so, by default, the script only checks x86-compatible UAPI header files::”h]”hŒÔThis is a change to an arm64-specific UAPI header file. In this example, I’m running the script from an x86 machine with an x86 compiler, so, by default, the script only checks x86-compatible UAPI header files:”…”�”}”(hj9h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KÞhj h²hubjA)�”}”(hŒË% ./scripts/check-uapi.sh Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK No changes to UAPI headers were applied between HEAD and dirty tree”h]”hŒË% ./scripts/check-uapi.sh Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK No changes to UAPI headers were applied between HEAD and dirty tree”…”�”}”hjGsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´Kâhj h²hubhÞ)�”}”(hŒdWith an x86 compiler, we can't check header files in ``arch/arm64``, so the script doesn't even try.”h]”(hŒ7With an x86 compiler, we can’t check header files in ”…”�”}”(hjUh²hh³Nh´Nubhè)�”}”(hŒ``arch/arm64``”h]”hŒ arch/arm64”…”�”}”(hj]h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjUubhŒ#, so the script doesn’t even try.”…”�”}”(hjUh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kçhj h²hubhÞ)�”}”(hŒgIf we want to check the header file, we'll have to use an arm64 compiler and set ``ARCH`` accordingly::”h]”(hŒSIf we want to check the header file, we’ll have to use an arm64 compiler and set ”…”�”}”(hjuh²hh³Nh´Nubhè)�”}”(hŒ``ARCH``”h]”hŒARCH”…”�”}”(hj}h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjuubhŒ accordingly:”…”�”}”(hjuh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kêhj h²hubjA)�”}”(hXÞ% CC=aarch64-linux-gnu-gcc ARCH=arm64 ./scripts/check-uapi.sh Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... ==== ABI differences detected in include/asm/sigcontext.h from HEAD -> dirty tree ==== [C] 'struct _aarch64_ctx' changed: type size changed from 64 to 96 (in bits) 1 data member insertion: '__u32 new_var', at offset 64 (in bits) at sigcontext.h:73:1 -- snip -- [C] 'struct zt_context' changed: type size changed from 128 to 160 (in bits) 2 data member changes (1 filtered): '__u16 nregs' offset changed from 64 to 96 (in bits) (by +32 bits) '__u16 __reserved[3]' offset changed from 80 to 112 (in bits) (by +32 bits) ======================================================================================= error - 1/884 UAPI headers compatible with arm64 appear _not_ to be backwards compatible”h]”hXÞ% CC=aarch64-linux-gnu-gcc ARCH=arm64 ./scripts/check-uapi.sh Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... ==== ABI differences detected in include/asm/sigcontext.h from HEAD -> dirty tree ==== [C] 'struct _aarch64_ctx' changed: type size changed from 64 to 96 (in bits) 1 data member insertion: '__u32 new_var', at offset 64 (in bits) at sigcontext.h:73:1 -- snip -- [C] 'struct zt_context' changed: type size changed from 128 to 160 (in bits) 2 data member changes (1 filtered): '__u16 nregs' offset changed from 64 to 96 (in bits) (by +32 bits) '__u16 __reserved[3]' offset changed from 80 to 112 (in bits) (by +32 bits) ======================================================================================= error - 1/884 UAPI headers compatible with arm64 appear _not_ to be backwards compatible”…”�”}”hj•sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´Kíhj h²hubhÞ)�”}”(hXWe can see with ``ARCH`` and ``CC`` set properly for the file, the ABI change is reported properly. Also notice that the total number of UAPI header files checked by the script changes. This is because the number of headers installed for arm64 platforms is different than x86.”h]”(hŒWe can see with ”…”�”}”(hj£h²hh³Nh´Nubhè)�”}”(hŒ``ARCH``”h]”hŒARCH”…”�”}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj£ubhŒ and ”…”�”}”(hj£h²hh³Nh´Nubhè)�”}”(hŒ``CC``”h]”hŒCC”…”�”}”(hj½h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj£ubhŒñ set properly for the file, the ABI change is reported properly. Also notice that the total number of UAPI header files checked by the script changes. This is because the number of headers installed for arm64 platforms is different than x86.”…”�”}”(hj£h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Mhj h²hubeh}”(h]”Œarchitecture-specific-headers”ah ]”h"]”Œarchitecture-specific headers”ah$]”h&]”uh1hÈhj¬h²hh³hÇh´KÍubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒCross-Dependency Breakages”h]”hŒCross-Dependency Breakages”…”�”}”(hjàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjÝh²hh³hÇh´MubhÞ)�”}”(hŒConsider this change::”h]”hŒConsider this change:”…”�”}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MhjÝh²hubjA)�”}”(hX›cat << 'EOF' | patch -l -p1 --- a/include/uapi/linux/types.h +++ b/include/uapi/linux/types.h @@ -52,7 +52,7 @@ typedef __u32 __bitwise __wsum; #define __aligned_be64 __be64 __attribute__((aligned(8))) #define __aligned_le64 __le64 __attribute__((aligned(8))) -typedef unsigned __bitwise __poll_t; +typedef unsigned short __bitwise __poll_t; #endif /* __ASSEMBLY__ */ #endif /* _UAPI_LINUX_TYPES_H */ EOF”h]”hX›cat << 'EOF' | patch -l -p1 --- a/include/uapi/linux/types.h +++ b/include/uapi/linux/types.h @@ -52,7 +52,7 @@ typedef __u32 __bitwise __wsum; #define __aligned_be64 __be64 __attribute__((aligned(8))) #define __aligned_le64 __le64 __attribute__((aligned(8))) -typedef unsigned __bitwise __poll_t; +typedef unsigned short __bitwise __poll_t; #endif /* __ASSEMBLY__ */ #endif /* _UAPI_LINUX_TYPES_H */ EOF”…”�”}”hjüsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´M hjÝh²hubhÞ)�”}”(hŒ—Here, we're changing a ``typedef`` in ``types.h``. This doesn't break a UAPI in ``types.h``, but other UAPIs in the tree may break due to this change::”h]”(hŒHere, we’re changing a ”…”�”}”(hj h²hh³Nh´Nubhè)�”}”(hŒ ``typedef``”h]”hŒtypedef”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj ubhŒ in ”…”�”}”(hj h²hh³Nh´Nubhè)�”}”(hŒ ``types.h``”h]”hŒtypes.h”…”�”}”(hj$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj ubhŒ!. This doesn’t break a UAPI in ”…”�”}”(hj h²hh³Nh´Nubhè)�”}”(hŒ ``types.h``”h]”hŒtypes.h”…”�”}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj ubhŒ;, but other UAPIs in the tree may break due to this change:”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MhjÝh²hubjA)�”}”(hXØ% ./scripts/check-uapi.sh Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... ==== ABI differences detected in include/linux/eventpoll.h from HEAD -> dirty tree ==== [C] 'struct epoll_event' changed: type size changed from 96 to 80 (in bits) 2 data member changes: type of '__poll_t events' changed: underlying type 'unsigned int' changed: type name changed from 'unsigned int' to 'unsigned short int' type size changed from 32 to 16 (in bits) '__u64 data' offset changed from 32 to 16 (in bits) (by -16 bits) ======================================================================================== include/linux/eventpoll.h did not change between HEAD and dirty tree... It's possible a change to one of the headers it includes caused this error: #include #include ”h]”hXØ% ./scripts/check-uapi.sh Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... ==== ABI differences detected in include/linux/eventpoll.h from HEAD -> dirty tree ==== [C] 'struct epoll_event' changed: type size changed from 96 to 80 (in bits) 2 data member changes: type of '__poll_t events' changed: underlying type 'unsigned int' changed: type name changed from 'unsigned int' to 'unsigned short int' type size changed from 32 to 16 (in bits) '__u64 data' offset changed from 32 to 16 (in bits) (by -16 bits) ======================================================================================== include/linux/eventpoll.h did not change between HEAD and dirty tree... It's possible a change to one of the headers it includes caused this error: #include #include ”…”�”}”hjNsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´MhjÝh²hubhÞ)�”}”(hŒÈNote that the script noticed the failing header file did not change, so it assumes one of its includes must have caused the breakage. Indeed, we can see ``linux/types.h`` is used from ``eventpoll.h``.”h]”(hŒ™Note that the script noticed the failing header file did not change, so it assumes one of its includes must have caused the breakage. Indeed, we can see ”…”�”}”(hj\h²hh³Nh´Nubhè)�”}”(hŒ``linux/types.h``”h]”hŒ linux/types.h”…”�”}”(hjdh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj\ubhŒ is used from ”…”�”}”(hj\h²hh³Nh´Nubhè)�”}”(hŒ``eventpoll.h``”h]”hŒ eventpoll.h”…”�”}”(hjvh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj\ubhŒ.”…”�”}”(hj\h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M/hjÝh²hubeh}”(h]”Œcross-dependency-breakages”ah ]”h"]”Œcross-dependency breakages”ah$]”h&]”uh1hÈhj¬h²hh³hÇh´MubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒUAPI Header Removals”h]”hŒUAPI Header Removals”…”�”}”(hj™h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj–h²hh³hÇh´M4ubhÞ)�”}”(hŒConsider this change::”h]”hŒConsider this change:”…”�”}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M6hj–h²hubjA)�”}”(hX»cat << 'EOF' | patch -l -p1 diff --git a/include/uapi/asm-generic/Kbuild b/include/uapi/asm-generic/Kbuild index ebb180aac74e..a9c88b0a8b3b 100644 --- a/include/uapi/asm-generic/Kbuild +++ b/include/uapi/asm-generic/Kbuild @@ -31,6 +31,6 @@ mandatory-y += stat.h mandatory-y += statfs.h mandatory-y += swab.h mandatory-y += termbits.h -mandatory-y += termios.h +#mandatory-y += termios.h mandatory-y += types.h mandatory-y += unistd.h EOF”h]”hX»cat << 'EOF' | patch -l -p1 diff --git a/include/uapi/asm-generic/Kbuild b/include/uapi/asm-generic/Kbuild index ebb180aac74e..a9c88b0a8b3b 100644 --- a/include/uapi/asm-generic/Kbuild +++ b/include/uapi/asm-generic/Kbuild @@ -31,6 +31,6 @@ mandatory-y += stat.h mandatory-y += statfs.h mandatory-y += swab.h mandatory-y += termbits.h -mandatory-y += termios.h +#mandatory-y += termios.h mandatory-y += types.h mandatory-y += unistd.h EOF”…”�”}”hjµsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´M8hj–h²hubhÞ)�”}”(hŒTThis script removes a UAPI header file from the install list. Let's run the script::”h]”hŒUThis script removes a UAPI header file from the install list. Let’s run the script:”…”�”}”(hjÃh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MGhj–h²hubjA)�”}”(hXs% ./scripts/check-uapi.sh Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... ==== UAPI header include/asm/termios.h was removed between HEAD and dirty tree ==== error - 1/912 UAPI headers compatible with x86 appear _not_ to be backwards compatible”h]”hXs% ./scripts/check-uapi.sh Installing user-facing UAPI headers from dirty tree... OK Installing user-facing UAPI headers from HEAD... OK Checking changes to UAPI headers between HEAD and dirty tree... ==== UAPI header include/asm/termios.h was removed between HEAD and dirty tree ==== error - 1/912 UAPI headers compatible with x86 appear _not_ to be backwards compatible”…”�”}”hjÑsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´MJhj–h²hubhÞ)�”}”(hŒ\Removing a UAPI header is considered a breaking change, and the script will flag it as such.”h]”hŒ\Removing a UAPI header is considered a breaking change, and the script will flag it as such.”…”�”}”(hjßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MRhj–h²hubeh}”(h]”Œuapi-header-removals”ah ]”h"]”Œuapi header removals”ah$]”h&]”uh1hÈhj¬h²hh³hÇh´M4ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ$Checking Historic UAPI Compatibility”h]”hŒ$Checking Historic UAPI Compatibility”…”�”}”(hjøh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjõh²hh³hÇh´MVubhÞ)�”}”(hŒ³You can use the ``-b`` and ``-p`` options to examine different chunks of your git tree. For example, to check all changed UAPI header files between tags v6.0 and v6.1, you'd run::”h]”(hŒYou can use the ”…”�”}”(hjh²hh³Nh´Nubhè)�”}”(hŒ``-b``”h]”hŒ-b”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjubhŒ and ”…”�”}”(hjh²hh³Nh´Nubhè)�”}”(hŒ``-p``”h]”hŒ-p”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjubhŒ“ options to examine different chunks of your git tree. For example, to check all changed UAPI header files between tags v6.0 and v6.1, you’d run:”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MXhjõh²hubjA)�”}”(hX1% ./scripts/check-uapi.sh -b v6.1 -p v6.0 Installing user-facing UAPI headers from v6.1... OK Installing user-facing UAPI headers from v6.0... OK Checking changes to UAPI headers between v6.0 and v6.1... --- snip --- error - 37/907 UAPI headers compatible with x86 appear _not_ to be backwards compatible”h]”hX1% ./scripts/check-uapi.sh -b v6.1 -p v6.0 Installing user-facing UAPI headers from v6.1... OK Installing user-facing UAPI headers from v6.0... OK Checking changes to UAPI headers between v6.0 and v6.1... --- snip --- error - 37/907 UAPI headers compatible with x86 appear _not_ to be backwards compatible”…”�”}”hj8sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´M\hjõh²hubhÞ)�”}”(hŒ{Note: Before v5.3, a header file needed by the script is not present, so the script is unable to check changes before then.”h]”hŒ{Note: Before v5.3, a header file needed by the script is not present, so the script is unable to check changes before then.”…”�”}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Mdhjõh²hubhÞ)�”}”(hŒáYou'll notice that the script detected many UAPI changes that are not backwards compatible. Knowing that kernel UAPIs are supposed to be stable forever, this is an alarming result. This brings us to the next section: caveats.”h]”hŒãYou’ll notice that the script detected many UAPI changes that are not backwards compatible. Knowing that kernel UAPIs are supposed to be stable forever, this is an alarming result. This brings us to the next section: caveats.”…”�”}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Mghjõh²hubeh}”(h]”Œ$checking-historic-uapi-compatibility”ah ]”h"]”Œ$checking historic uapi compatibility”ah$]”h&]”uh1hÈhj¬h²hh³hÇh´MVubeh}”(h]”Œexamples”ah ]”h"]”Œexamples”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K0ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒCaveats”h]”hŒCaveats”…”�”}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjrh²hh³hÇh´MmubhÞ)�”}”(hŒ–The UAPI checker makes no assumptions about the author's intention, so some types of changes may be flagged even though they intentionally break UAPI.”h]”hŒ˜The UAPI checker makes no assumptions about the author’s intention, so some types of changes may be flagged even though they intentionally break UAPI.”…”�”}”(hjƒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Mohjrh²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ'Removals For Refactoring or Deprecation”h]”hŒ'Removals For Refactoring or Deprecation”…”�”}”(hj”h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj‘h²hh³hÇh´MsubhÞ)�”}”(hŒNSometimes drivers for very old hardware are removed, such as in this example::”h]”hŒMSometimes drivers for very old hardware are removed, such as in this example:”…”�”}”(hj¢h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Muhj‘h²hubjA)�”}”(hX¦% ./scripts/check-uapi.sh -b ba47652ba655 Installing user-facing UAPI headers from ba47652ba655... OK Installing user-facing UAPI headers from ba47652ba655^1... OK Checking changes to UAPI headers between ba47652ba655^1 and ba47652ba655... ==== UAPI header include/linux/meye.h was removed between ba47652ba655^1 and ba47652ba655 ==== error - 1/910 UAPI headers compatible with x86 appear _not_ to be backwards compatible”h]”hX¦% ./scripts/check-uapi.sh -b ba47652ba655 Installing user-facing UAPI headers from ba47652ba655... OK Installing user-facing UAPI headers from ba47652ba655^1... OK Checking changes to UAPI headers between ba47652ba655^1 and ba47652ba655... ==== UAPI header include/linux/meye.h was removed between ba47652ba655^1 and ba47652ba655 ==== error - 1/910 UAPI headers compatible with x86 appear _not_ to be backwards compatible”…”�”}”hj°sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´Mwhj‘h²hubhÞ)�”}”(hŒCThe script will always flag removals (even if they're intentional).”h]”hŒEThe script will always flag removals (even if they’re intentional).”…”�”}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Mhj‘h²hubeh}”(h]”Œ'removals-for-refactoring-or-deprecation”ah ]”h"]”Œ'removals for refactoring or deprecation”ah$]”h&]”uh1hÈhjrh²hh³hÇh´MsubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒStruct Expansions”h]”hŒStruct Expansions”…”�”}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjÔh²hh³hÇh´M‚ubhÞ)�”}”(hŒnDepending on how a structure is handled in kernelspace, a change which expands a struct could be non-breaking.”h]”hŒnDepending on how a structure is handled in kernelspace, a change which expands a struct could be non-breaking.”…”�”}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M„hjÔh²hubhÞ)�”}”(hŒüIf a struct is used as the argument to an ioctl, then the kernel driver must be able to handle ioctl commands of any size. Beyond that, you need to be careful when copying data from the user. Say, for example, that ``struct foo`` is changed like this::”h]”(hŒ×If a struct is used as the argument to an ioctl, then the kernel driver must be able to handle ioctl commands of any size. Beyond that, you need to be careful when copying data from the user. Say, for example, that ”…”�”}”(hjóh²hh³Nh´Nubhè)�”}”(hŒ``struct foo``”h]”hŒ struct foo”…”�”}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjóubhŒ is changed like this:”…”�”}”(hjóh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M‡hjÔh²hubjA)�”}”(hŒ€struct foo { __u64 a; /* added in version 1 */ + __u32 b; /* added in version 2 */ + __u32 c; /* added in version 2 */ }”h]”hŒ€struct foo { __u64 a; /* added in version 1 */ + __u32 b; /* added in version 2 */ + __u32 c; /* added in version 2 */ }”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´MŒhjÔh²hubhÞ)�”}”(hŒIBy default, the script will flag this kind of change for further review::”h]”hŒHBy default, the script will flag this kind of change for further review:”…”�”}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M’hjÔh²hubjA)�”}”(hŒ®[C] 'struct foo' changed: type size changed from 64 to 128 (in bits) 2 data member insertions: '__u32 b', at offset 64 (in bits) '__u32 c', at offset 96 (in bits)”h]”hŒ®[C] 'struct foo' changed: type size changed from 64 to 128 (in bits) 2 data member insertions: '__u32 b', at offset 64 (in bits) '__u32 c', at offset 96 (in bits)”…”�”}”hj/sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´M”hjÔh²hubhÞ)�”}”(hŒ9However, it is possible that this change was made safely.”h]”hŒ9However, it is possible that this change was made safely.”…”�”}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MšhjÔh²hubhÞ)�”}”(hŒýIf a userspace program was built with version 1, it will think ``sizeof(struct foo)`` is 8. That size will be encoded in the ioctl value that gets sent to the kernel. If the kernel is built with version 2, it will think the ``sizeof(struct foo)`` is 16.”h]”(hŒ?If a userspace program was built with version 1, it will think ”…”�”}”(hjKh²hh³Nh´Nubhè)�”}”(hŒ``sizeof(struct foo)``”h]”hŒsizeof(struct foo)”…”�”}”(hjSh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjKubhŒ‹ is 8. That size will be encoded in the ioctl value that gets sent to the kernel. If the kernel is built with version 2, it will think the ”…”�”}”(hjKh²hh³Nh´Nubhè)�”}”(hŒ``sizeof(struct foo)``”h]”hŒsizeof(struct foo)”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjKubhŒ is 16.”…”�”}”(hjKh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MœhjÔh²hubhÞ)�”}”(hŒ°The kernel can use the ``_IOC_SIZE`` macro to get the size encoded in the ioctl code that the user passed in and then use ``copy_struct_from_user()`` to safely copy the value::”h]”(hŒThe kernel can use the ”…”�”}”(hj}h²hh³Nh´Nubhè)�”}”(hŒ ``_IOC_SIZE``”h]”hŒ _IOC_SIZE”…”�”}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj}ubhŒV macro to get the size encoded in the ioctl code that the user passed in and then use ”…”�”}”(hj}h²hh³Nh´Nubhè)�”}”(hŒ``copy_struct_from_user()``”h]”hŒcopy_struct_from_user()”…”�”}”(hj—h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj}ubhŒ to safely copy the value:”…”�”}”(hj}h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M¡hjÔh²hubjA)�”}”(hŒúint handle_ioctl(unsigned long cmd, unsigned long arg) { switch _IOC_NR(cmd) { 0x01: { struct foo my_cmd; /* size 16 in the kernel */ ret = copy_struct_from_user(&my_cmd, arg, sizeof(struct foo), _IOC_SIZE(cmd)); ...”h]”hŒúint handle_ioctl(unsigned long cmd, unsigned long arg) { switch _IOC_NR(cmd) { 0x01: { struct foo my_cmd; /* size 16 in the kernel */ ret = copy_struct_from_user(&my_cmd, arg, sizeof(struct foo), _IOC_SIZE(cmd)); ...”…”�”}”hj¯sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´M¥hjÔh²hubhÞ)�”}”(hŒ×``copy_struct_from_user`` will zero the struct in the kernel and then copy only the bytes passed in from the user (leaving new members zeroized). If the user passed in a larger struct, the extra members are ignored.”h]”(hè)�”}”(hŒ``copy_struct_from_user``”h]”hŒcopy_struct_from_user”…”�”}”(hjÁh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhj½ubhŒ¾ will zero the struct in the kernel and then copy only the bytes passed in from the user (leaving new members zeroized). If the user passed in a larger struct, the extra members are ignored.”…”�”}”(hj½h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M®hjÔh²hubhÞ)�”}”(hŒ“If you know this situation is accounted for in the kernel code, you can pass ``-i`` to the script, and struct expansions like this will be ignored.”h]”(hŒMIf you know this situation is accounted for in the kernel code, you can pass ”…”�”}”(hjÙh²hh³Nh´Nubhè)�”}”(hŒ``-i``”h]”hŒ-i”…”�”}”(hjáh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hçhjÙubhŒ@ to the script, and struct expansions like this will be ignored.”…”�”}”(hjÙh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M²hjÔh²hubeh}”(h]”Œstruct-expansions”ah ]”h"]”Œstruct expansions”ah$]”h&]”uh1hÈhjrh²hh³hÇh´M‚ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒFlex Array Migration”h]”hŒFlex Array Migration”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´M¶ubhÞ)�”}”(hŒ¢While the script handles expansion into an existing flex array, it does still flag initial migration to flex arrays from 1-element fake flex arrays. For example::”h]”hŒ¡While the script handles expansion into an existing flex array, it does still flag initial migration to flex arrays from 1-element fake flex arrays. For example:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M¸hjh²hubjA)�”}”(hŒhstruct foo { __u32 x; - __u32 flex[1]; /* fake flex */ + __u32 flex[]; /* real flex */ };”h]”hŒhstruct foo { __u32 x; - __u32 flex[1]; /* fake flex */ + __u32 flex[]; /* real flex */ };”…”�”}”hj sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´M¼hjh²hubhÞ)�”}”(hŒ,This change would be flagged by the script::”h]”hŒ+This change would be flagged by the script:”…”�”}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MÂhjh²hubjA)�”}”(hX)[C] 'struct foo' changed: type size changed from 64 to 32 (in bits) 1 data member change: type of '__u32 flex[1]' changed: type name changed from '__u32[1]' to '__u32[]' array type size changed from 32 to 'unknown' array type subrange 1 changed length from 1 to 'unknown'”h]”hX)[C] 'struct foo' changed: type size changed from 64 to 32 (in bits) 1 data member change: type of '__u32 flex[1]' changed: type name changed from '__u32[1]' to '__u32[]' array type size changed from 32 to 'unknown' array type subrange 1 changed length from 1 to 'unknown'”…”�”}”hj<sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j@h³hÇh´MÄhjh²hubhÞ)�”}”(hŒkAt this time, there's no way to filter these types of changes, so be aware of this possible false positive.”h]”hŒmAt this time, there’s no way to filter these types of changes, so be aware of this possible false positive.”…”�”}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MÌhjh²hubeh}”(h]”Œflex-array-migration”ah ]”h"]”Œflex array migration”ah$]”h&]”uh1hÈhjrh²hh³hÇh´M¶ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒSummary”h]”hŒSummary”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj`h²hh³hÇh´MÐubhÞ)�”}”(hXzWhile many types of false positives are filtered out by the script, it's possible there are some cases where the script flags a change which does not break UAPI. It's also possible a change which *does* break userspace would not be flagged by this script. While the script has been run on much of the kernel history, there could still be corner cases that are not accounted for.”h]”(hŒÈWhile many types of false positives are filtered out by the script, it’s possible there are some cases where the script flags a change which does not break UAPI. It’s also possible a change which ”…”�”}”(hjqh²hh³Nh´Nubj)�”}”(hŒ*does*”h]”hŒdoes”…”�”}”(hjyh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjqubhŒ° break userspace would not be flagged by this script. While the script has been run on much of the kernel history, there could still be corner cases that are not accounted for.”…”�”}”(hjqh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MÒhj`h²hubhÞ)�”}”(hX%The intention is for this script to be used as a quick check for maintainers or automated tooling, not as the end-all authority on patch compatibility. It's best to remember: use your best judgment (and ideally a unit test in userspace) to make sure your UAPI changes are backwards-compatible!”h]”hX'The intention is for this script to be used as a quick check for maintainers or automated tooling, not as the end-all authority on patch compatibility. It’s best to remember: use your best judgment (and ideally a unit test in userspace) to make sure your UAPI changes are backwards-compatible!”…”�”}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MÙhj`h²hubeh}”(h]”Œsummary”ah ]”h"]”Œsummary”ah$]”h&]”uh1hÈhjrh²hh³hÇh´MÐubeh}”(h]”Œcaveats”ah ]”h"]”Œcaveats”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´Mmubeh}”(h]”Œ uapi-checker”ah ]”h"]”Œ uapi checker”ah$]”h&]”uh1hÈ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”Œentry”Œ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´j±j©j¦jojlj jjÚj×j“j�jòjïjgjdj¬j©jÑjÎjþjûj]jZj¤j¡uŒ nametypes”}”(j´‰j©‰jo‰j ‰jÚ‰j“‰jò‰jg‰j¬‰jщjþ‰j]‰j¤‰uh}”(j±hÊj¦jjlj¬jj½j×j j�jÝjïj–jdjõj©jrjÎj‘jûjÔjZjj¡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”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.