sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget'/translations/zh_CN/dev-tools/checkuapimodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/zh_TW/dev-tools/checkuapimodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/it_IT/dev-tools/checkuapimodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/ja_JP/dev-tools/checkuapimodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/ko_KR/dev-tools/checkuapimodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/sp_SP/dev-tools/checkuapimodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h%SPDX-License-Identifier: GPL-2.0-onlyh]h%SPDX-License-Identifier: GPL-2.0-only}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhA/var/lib/git/docbuild/linux/Documentation/dev-tools/checkuapi.rsthKubhsection)}(hhh](htitle)}(h UAPI Checkerh]h UAPI Checker}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hThe UAPI checker (``scripts/check-uapi.sh``) is a shell script which checks UAPI header files for userspace backwards-compatibility across the git tree.h](hThe UAPI checker (}(hhhhhNhNubhliteral)}(h``scripts/check-uapi.sh``h]hscripts/check-uapi.sh}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubhm) is a shell script which checks UAPI header files for userspace backwards-compatibility across the git tree.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hOptionsh]hOptions}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh)}(hOThis section will describe the options with which ``check-uapi.sh`` can be run.h](h2This section will describe the options with which }(hhhhhNhNubh)}(h``check-uapi.sh``h]h check-uapi.sh}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubh can be run.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hUsage::h]hUsage:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh literal_block)}(hNcheck-uapi.sh [-b BASE_REF] [-p PAST_REF] [-j N] [-l ERROR_LOG] [-i] [-q] [-v]h]hNcheck-uapi.sh [-b BASE_REF] [-p PAST_REF] [-j N] [-l ERROR_LOG] [-i] [-q] [-v]}hj.sbah}(h]h ]h"]h$]h&]hhuh1j,hhhKhhhhubh)}(hAvailable options::h]hAvailable options:}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubj-)}(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).}hjJsbah}(h]h ]h"]h$]h&]hhuh1j,hhhKhhhhubh)}(hEnvironmental args::h]hEnvironmental args:}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hhhhubj-)}(hABIDIFF Custom path to abidiff binary CC C compiler (default is "gcc") ARCH Target architecture of C compiler (default is host arch)h]hABIDIFF Custom path to abidiff binary CC C compiler (default is "gcc") ARCH Target architecture of C compiler (default is host arch)}hjfsbah}(h]h ]h"]h$]h&]hhuh1j,hhhK%hhhhubh)}(h Exit codes::h]h Exit codes:}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK)hhhhubj-)}(h=0) Success 1) ABI difference detected 2) Prerequisite not meth]h=0) Success 1) ABI difference detected 2) Prerequisite not met}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhK+hhhhubeh}(h]optionsah ]h"]optionsah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hExamplesh]hExamples}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK0ubh)}(hhh](h)}(h Basic Usageh]h Basic Usage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK3ubh)}(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:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK5hjhhubj-)}(hXcat << '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 EOFh]hXcat << '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}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhK8hjhhubh)}(h'Now, let's use the script to validate::h]h(Now, let’s use the script to validate:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKIhjhhubj-)}(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 compatibleh]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}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhKKhjhhubh)}(h7Let's add another change that *might* break userspace::h](h Let’s add another change that }(hjhhhNhNubhemphasis)}(h*might*h]hmight}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh break userspace:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKQhjhhubj-)}(hXcat << '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 */ EOFh]hXcat << '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}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhKShjhhubh)}(hThe script will catch this::h]hThe script will catch this:}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKahjhhubj-)}(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 compatibleh]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}hj0sbah}(h]h ]h"]h$]h&]hhuh1j,hhhKchjhhubh)}(hXIn 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](hIn 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 }(hj>hhhNhNubh)}(h``imm``h]himm}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj>ubhT, so changing to an unsigned type there shouldn’t hurt anything. You can pass the }(hj>hhhNhNubh)}(h``-i``h]h-i}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj>ubhb flag to the script to ignore changes in which the userspace backwards compatibility is ambiguous:}(hj>hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKthjhhubj-)}(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 compatibleh]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}hjpsbah}(h]h ]h"]h$]h&]hhuh1j,hhhK{hjhhubh)}(h>Now, let's make a similar change that *will* break userspace::h](h(Now, let’s make a similar change that }(hj~hhhNhNubj)}(h*will*h]hwill}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj~ubh break userspace:}(hj~hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj-)}(hXcat << '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 */ }; EOFh]hXcat << '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}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhKhjhhubh)}(hSince 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](hSince we’re re-ordering an existing struct member, there’s no ambiguity, and the script will report the breakage even if you pass }(hjhhhNhNubh)}(h``-i``h]h-i}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj-)}(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 compatibleh]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}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhKhjhhubh)}(hDLet's commit the breaking change, then commit the innocuous change::h]hELet’s commit the breaking change, then commit the innocuous change:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj-)}(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(-)}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhKhjhhubh)}(h3Now, let's run the script again with no arguments::h]h4Now, let’s run the script again with no arguments:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj-)}(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 compatibleh]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&]hhuh1j,hhhKhjhhubh)}(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](hMIt doesn’t catch any breaking change because, by default, it only compares }(hjhhhNhNubh)}(h``HEAD``h]hHEAD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh to }(hjhhhNhNubh)}(h ``HEAD^1``h]hHEAD^1}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh'. The breaking change was committed on }(hjhhhNhNubh)}(h ``HEAD~2``h]hHEAD~2}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhK. If we wanted the search scope to go back further, we’d have to use the }(hjhhhNhNubh)}(h``-p``h]h-p}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhG option to pass a different past reference. In this case, let’s pass }(hjhhhNhNubh)}(h ``-p HEAD~2``h]h -p HEAD~2}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh1 to the script so it checks UAPI changes between }(hjhhhNhNubh)}(h ``HEAD~2``h]hHEAD~2}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh and }(hjhhhNhNubh)}(h``HEAD``h]hHEAD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj-)}(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 compatibleh]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}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhKhjhhubh)}(hAlternatively, 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 }(hjhhhNhNubh)}(h ``-b HEAD~``h]h-b HEAD~}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh'. This would set the base reference to }(hjhhhNhNubh)}(h ``HEAD~``h]hHEAD~}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh( so then the script would compare it to }(hjhhhNhNubh)}(h ``HEAD~^1``h]hHEAD~^1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h] basic-usageah ]h"] basic usageah$]h&]uh1hhjhhhhhK3ubh)}(hhh](h)}(hArchitecture-specific Headersh]hArchitecture-specific Headers}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hConsider this change::h]hConsider this change:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj-)}(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 EOFh]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}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhKhjhhubh)}(hThis 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]hThis 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:}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj-)}(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 treeh]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}hj3sbah}(h]h ]h"]h$]h&]hhuh1j,hhhKhjhhubh)}(hdWith an x86 compiler, we can't check header files in ``arch/arm64``, so the script doesn't even try.h](h7With an x86 compiler, we can’t check header files in }(hjAhhhNhNubh)}(h``arch/arm64``h]h arch/arm64}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjAubh#, so the script doesn’t even try.}(hjAhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hgIf we want to check the header file, we'll have to use an arm64 compiler and set ``ARCH`` accordingly::h](hSIf we want to check the header file, we’ll have to use an arm64 compiler and set }(hjahhhNhNubh)}(h``ARCH``h]hARCH}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1hhjaubh accordingly:}(hjahhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj-)}(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 compatibleh]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}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhKhjhhubh)}(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](hWe can see with }(hjhhhNhNubh)}(h``ARCH``h]hARCH}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh and }(hjhhhNhNubh)}(h``CC``h]hCC}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh 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.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]architecture-specific-headersah ]h"]architecture-specific headersah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(hCross-Dependency Breakagesh]hCross-Dependency Breakages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hConsider this change::h]hConsider this change:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj-)}(hXcat << '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 */ EOFh]hXcat << '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}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhM hjhhubh)}(hHere, 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](hHere, we’re changing a }(hjhhhNhNubh)}(h ``typedef``h]htypedef}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh in }(hjhhhNhNubh)}(h ``types.h``h]htypes.h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh!. This doesn’t break a UAPI in }(hjhhhNhNubh)}(h ``types.h``h]htypes.h}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh;, but other UAPIs in the tree may break due to this change:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj-)}(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 }hj:sbah}(h]h ]h"]h$]h&]hhuh1j,hhhMhjhhubh)}(hNote 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](hNote 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 }(hjHhhhNhNubh)}(h``linux/types.h``h]h linux/types.h}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjHubh is used from }(hjHhhhNhNubh)}(h``eventpoll.h``h]h eventpoll.h}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjHubh.}(hjHhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM/hjhhubeh}(h]cross-dependency-breakagesah ]h"]cross-dependency breakagesah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(hUAPI Header Removalsh]hUAPI Header Removals}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM4ubh)}(hConsider this change::h]hConsider this change:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM6hjhhubj-)}(hXcat << '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 EOFh]hXcat << '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}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhM8hjhhubh)}(hTThis script removes a UAPI header file from the install list. Let's run the script::h]hUThis script removes a UAPI header file from the install list. Let’s run the script:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMGhjhhubj-)}(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 compatibleh]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}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhMJhjhhubh)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMRhjhhubeh}(h]uapi-header-removalsah ]h"]uapi header removalsah$]h&]uh1hhjhhhhhM4ubh)}(hhh](h)}(h$Checking Historic UAPI Compatibilityh]h$Checking Historic UAPI Compatibility}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMVubh)}(hYou 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](hYou can use the }(hjhhhNhNubh)}(h``-b``h]h-b}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh and }(hjhhhNhNubh)}(h``-p``h]h-p}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh 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:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMXhjhhubj-)}(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 compatibleh]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}hj$sbah}(h]h ]h"]h$]h&]hhuh1j,hhhM\hjhhubh)}(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.}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMdhjhhubh)}(hYou'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]hYou’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.}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMghjhhubeh}(h]$checking-historic-uapi-compatibilityah ]h"]$checking historic uapi compatibilityah$]h&]uh1hhjhhhhhMVubeh}(h]examplesah ]h"]examplesah$]h&]uh1hhhhhhhhK0ubh)}(hhh](h)}(hCaveatsh]hCaveats}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhj^hhhhhMmubh)}(hThe 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]hThe UAPI checker makes no assumptions about the author’s intention, so some types of changes may be flagged even though they intentionally break UAPI.}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMohj^hhubh)}(hhh](h)}(h'Removals For Refactoring or Deprecationh]h'Removals For Refactoring or Deprecation}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj}hhhhhMsubh)}(hNSometimes drivers for very old hardware are removed, such as in this example::h]hMSometimes drivers for very old hardware are removed, such as in this example:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMuhj}hhubj-)}(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 compatibleh]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}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhMwhj}hhubh)}(hCThe script will always flag removals (even if they're intentional).h]hEThe script will always flag removals (even if they’re intentional).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj}hhubeh}(h]'removals-for-refactoring-or-deprecationah ]h"]'removals for refactoring or deprecationah$]h&]uh1hhj^hhhhhMsubh)}(hhh](h)}(hStruct Expansionsh]hStruct Expansions}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hnDepending on how a structure is handled in kernelspace, a change which expands a struct could be non-breaking.h]hnDepending on how a structure is handled in kernelspace, a change which expands a struct could be non-breaking.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hIf 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](hIf 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 }(hjhhhNhNubh)}(h``struct foo``h]h struct foo}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh is changed like this:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj-)}(hstruct foo { __u64 a; /* added in version 1 */ + __u32 b; /* added in version 2 */ + __u32 c; /* added in version 2 */ }h]hstruct 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&]hhuh1j,hhhMhjhhubh)}(hIBy default, the script will flag this kind of change for further review::h]hHBy default, the script will flag this kind of change for further review:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj-)}(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)}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhMhjhhubh)}(h9However, it is possible that this change was made safely.h]h9However, it is possible that this change was made safely.}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hIf 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 }(hj7hhhNhNubh)}(h``sizeof(struct foo)``h]hsizeof(struct foo)}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7ubh 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 }(hj7hhhNhNubh)}(h``sizeof(struct foo)``h]hsizeof(struct foo)}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7ubh is 16.}(hj7hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hThe 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](hThe kernel can use the }(hjihhhNhNubh)}(h ``_IOC_SIZE``h]h _IOC_SIZE}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjiubhV macro to get the size encoded in the ioctl code that the user passed in and then use }(hjihhhNhNubh)}(h``copy_struct_from_user()``h]hcopy_struct_from_user()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjiubh to safely copy the value:}(hjihhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj-)}(hint 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]hint 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)); ...}hjsbah}(h]h ]h"]h$]h&]hhuh1j,hhhMhjhhubh)}(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]hcopy_struct_from_user}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh 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.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hIf 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](hMIf you know this situation is accounted for in the kernel code, you can pass }(hjhhhNhNubh)}(h``-i``h]h-i}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh@ to the script, and struct expansions like this will be ignored.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]struct-expansionsah ]h"]struct expansionsah$]h&]uh1hhj^hhhhhMubh)}(hhh](h)}(hFlex Array Migrationh]hFlex Array Migration}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hWhile 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]hWhile 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:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj-)}(hhstruct foo { __u32 x; - __u32 flex[1]; /* fake flex */ + __u32 flex[]; /* real flex */ };h]hhstruct foo { __u32 x; - __u32 flex[1]; /* fake flex */ + __u32 flex[]; /* real flex */ };}hj sbah}(h]h ]h"]h$]h&]hhuh1j,hhhMhjhhubh)}(h,This change would be flagged by the script::h]h+This change would be flagged by the script:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj-)}(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&]hhuh1j,hhhMhjhhubh)}(hkAt this time, there's no way to filter these types of changes, so be aware of this possible false positive.h]hmAt this time, there’s no way to filter these types of changes, so be aware of this possible false positive.}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]flex-array-migrationah ]h"]flex array migrationah$]h&]uh1hhj^hhhhhMubh)}(hhh](h)}(hSummaryh]hSummary}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjLhhhhhMubh)}(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](hWhile 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 }(hj]hhhNhNubj)}(h*does*h]hdoes}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1jhj]ubh 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.}(hj]hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjLhhubh)}(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}hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjLhhubeh}(h]summaryah ]h"]summaryah$]h&]uh1hhj^hhhhhMubeh}(h]caveatsah ]h"]caveatsah$]h&]uh1hhhhhhhhMmubeh}(h] uapi-checkerah ]h"] uapi checkerah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjjjj[jXjjjjjj|jjjSjPjjjjjjjIjFjju nametypes}(jjj[jjjjjSjjjjIjuh}(jhjhjXjjjjjj|jjjjPjjj^jj}jjjFjjjLu footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.