public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v6 0/3] Validating UAPI backwards compatibility
@ 2023-10-27 19:30 John Moon
  2023-10-27 19:30 ` [PATCH v6 1/3] check-uapi: Introduce check-uapi.sh John Moon
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: John Moon @ 2023-10-27 19:30 UTC (permalink / raw)
  To: Masahiro Yamada, Nathan Chancellor, Nick Desaulniers,
	Nicolas Schier, Jonathan Corbet
  Cc: John Moon, linux-kbuild, linux-kernel, linux-arm-kernel,
	linux-arm-msm, kernel, Greg Kroah-Hartman, Randy Dunlap,
	Arnd Bergmann, Bjorn Andersson, Todd Kjos, Matthias Maennich,
	Giuliano Procida, kernel-team, libabigail, Dodji Seketeli,
	Trilok Soni, Satya Durga Srinivasu Prabhala, Jordan Crouse

The kernel community has rigorously enforced a policy of backwards
compatibility in its userspace interfaces for a long time. This has
allowed user applications to enjoy stability across kernel upgrades
without recompiling. Our goal is to add tooling and documentation to
help kernel developers maintain this stability.

In terms of tooling, I've attached a couple of shell scripts we've been
internally to validate backwards compatibility of our UAPI headers.

The check-uapi.sh script uses libabigail's[1] tool abidiff[2] to compare a
modified header's ABI before and after a patch is applied. If an existing
UAPI is modified in a way that's not backwards compatibile, the script
exits non-zero. We use this script in our continuous integration system
to block changes that fail the check.

It generates output like this when a backwards incompatible change is
made to a UAPI header:

ABI differences detected in include/uapi/linux/bpf.h from HEAD~1 -> 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)

The check-module-params.sh script is quite a bit simpler. It basically
greps for module_param.* calls and compares their arguments before/after
a change is applied.

We wanted to share these scripts with the community and hopefully also
receive general feedback when it comes to tooling/policy surrounding
UAPI stability.

In the previous version of this patchset, we received feedback that there
were too many false positives flagged by the check-uapi.sh script. To
improve the situation, we've been working with Dodji Seketeli from
the libabigail team to add additional suppressions which filter out
many of the flags which were raised before. To take advantage of these
suppressions, we've raised the minimum abidiff version requirement to
2.4 which was recently released[3].

Big thanks to Dodji and the libabigail team for working on this use case
with us!

Previous discussion on v5 of this patch can be found here[4].

[1] https://sourceware.org/libabigail/manual/libabigail-overview.html
[2] https://sourceware.org/libabigail/manual/abidiff.html
[3] http://mirrors.kernel.org/sourceware/libabigail/libabigail-2.4.tar.xz
[4] https://lore.kernel.org/lkml/20230407203456.27141-1-quic_johmoo@quicinc.com/

P.S. While at Qualcomm, Jordan Crouse <jorcrous@amazon.com> authored the
original version of the UAPI checker script. Thanks Jordan!

John Moon (3):
  check-uapi: Introduce check-uapi.sh
  docs: dev-tools: Add UAPI checker documentation
  check-module-params: Introduce check-module-params.sh

 Documentation/dev-tools/checkuapi.rst | 477 +++++++++++++++++++++
 Documentation/dev-tools/index.rst     |   1 +
 scripts/check-module-params.sh        | 295 +++++++++++++
 scripts/check-uapi.sh                 | 585 ++++++++++++++++++++++++++
 4 files changed, 1358 insertions(+)
 create mode 100644 Documentation/dev-tools/checkuapi.rst
 create mode 100755 scripts/check-module-params.sh
 create mode 100755 scripts/check-uapi.sh


base-commit: fe1998aa935b44ef873193c0772c43bce74f17dc
--
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-11 22:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-27 19:30 [PATCH v6 0/3] Validating UAPI backwards compatibility John Moon
2023-10-27 19:30 ` [PATCH v6 1/3] check-uapi: Introduce check-uapi.sh John Moon
2023-11-14 10:10   ` Masahiro Yamada
2023-11-14 12:24     ` Greg Kroah-Hartman
2023-12-11 22:30     ` John Moon
2023-10-27 19:30 ` [PATCH v6 2/3] docs: dev-tools: Add UAPI checker documentation John Moon
2023-10-27 19:30 ` [PATCH v6 3/3] check-module-params: Introduce check-module-params.sh John Moon
2023-11-14 13:28   ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).