[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9529ba0b-4031-c91c-e231-86ee1c845539@quicinc.com>
Date: Fri, 7 Apr 2023 13:09:12 -0700
From: John Moon <quic_johmoo@...cinc.com>
To: Masahiro Yamada <masahiroy@...nel.org>
CC: Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nicolas Schier <nicolas@...sle.eu>,
<linux-kbuild@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-arm-msm@...r.kernel.org>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
Randy Dunlap <rdunlap@...radead.org>,
Arnd Bergmann <arnd@...db.de>,
Bjorn Andersson <andersson@...nel.org>,
Todd Kjos <tkjos@...gle.com>,
Matthias Maennich <maennich@...gle.com>,
Giuliano Procida <gprocida@...gle.com>,
<kernel-team@...roid.com>, <libabigail@...rceware.org>,
Jordan Crouse <jorcrous@...zon.com>,
Trilok Soni <quic_tsoni@...cinc.com>,
"Satya Durga Srinivasu Prabhala" <quic_satyap@...cinc.com>,
Elliot Berman <quic_eberman@...cinc.com>,
Guru Das Srinagesh <quic_gurus@...cinc.com>
Subject: Re: [PATCH v4 1/2] check-uapi: Introduce check-uapi.sh
On 4/7/2023 12:27 PM, Masahiro Yamada wrote:
> On Tue, Mar 28, 2023 at 2:42 AM John Moon <quic_johmoo@...cinc.com> wrote:
>>
>> While the kernel community has been good at maintaining backwards
>> compatibility with kernel UAPIs, it would be helpful to have a tool
>> to check if a commit introduces changes that break backwards
>> compatibility.
>>
>> To that end, introduce check-uapi.sh: a simple shell script that
>> checks for changes to UAPI headers using libabigail.
>>
>> libabigail is "a framework which aims at helping developers and
>> software distributors to spot some ABI-related issues like interface
>> incompatibility in ELF shared libraries by performing a static
>> analysis of the ELF binaries at hand."
>>
>> The script uses one of libabigail's tools, "abidiff", to compile the
>> changed header before and after the commit to detect any changes.
>>
>> abidiff "compares the ABI of two shared libraries in ELF format. It
>> emits a meaningful report describing the differences between the two
>> ABIs."
>>
>> The script also includes the ability to check the compatibility of
>> all UAPI headers across commits. This allows developers to inspect
>> the stability of the UAPIs over time.
>>
>> Signed-off-by: John Moon <quic_johmoo@...cinc.com>
>> ---
>> - Refactored to exclusively check headers installed by make
>> headers_install. This simplified the code dramatically and removed
>> the need to perform complex git diffs.
>> - Removed the "-m" flag. Since we're checking all installed headers
>> every time, a flag to check only modified files didn't make sense.
>> - Added info message when usr/include/Makefile is not present that
>> it's likely because that file was only introduced in v5.3.
>> - Changed default behavior of log file. Now, the script will not
>> create a log file unless you pass "-l <file>".
>> - Simplified exit handler.
>> - Added -j $MAX_THREADS to make headers_install to improve speed.
>> - Cleaned up variable references.
>>
>> scripts/check-uapi.sh | 488 ++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 488 insertions(+)
>> create mode 100755 scripts/check-uapi.sh
>>
>
>> +
>> +# Install headers for both git refs
>> +install_headers() {
>> + local -r base_ref="$1"
>> + local -r past_ref="$2"
>> +
>> + DEVIATED_FROM_CURRENT_TREE="false"
>> + for ref in "$base_ref" "$past_ref"; do
>> + if [ -n "$ref" ]; then
>> + if [ "$DEVIATED_FROM_CURRENT_TREE" = "false" ]; then
>> + save_tree_state
>> + DEVIATED_FROM_CURRENT_TREE="true"
>> + fi
>> + # This script ($0) is already loaded into memory at this point,
>> + # so this operation is safe
>> + git checkout --quiet "$(git rev-parse "$ref")"
>> + fi
>> +
>> + printf "Installing sanitized UAPI headers from %s... " "${ref:-dirty tree}"
>> + make -j "$MAX_THREADS" ARCH="$ARCH" INSTALL_HDR_PATH="${TMP_DIR}/${ref}/usr" headers_install > /dev/null 2>&1
>
>
> You suppressed stderr.
>
> If 'make headers_install' fails, users see a sudden death
> with no clue.
>
Good point, will remove that suppression.
Powered by blists - more mailing lists