Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1259419rwl; Fri, 7 Apr 2023 12:34:20 -0700 (PDT) X-Google-Smtp-Source: AKy350bIdK1S74QOFVtKDNcc4aZPQibzGA0pDrZZEwomdPG1iREoPmKdS/5GbrLvFRBoDzrXXURl X-Received: by 2002:a17:907:6a0e:b0:8a6:5720:9101 with SMTP id rf14-20020a1709076a0e00b008a657209101mr545144ejc.4.1680896060361; Fri, 07 Apr 2023 12:34:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680896060; cv=none; d=google.com; s=arc-20160816; b=etwitbXswEIsyzBrPFxxXqxEzQmOJhMDlKo+mzeOTzG77HJDuWh53yU85ZS1/nITy1 xOPW4XkVeZfscUTNWAQY5FAHK94aRztfprIBXcZGof3nMcKtBTti+3++MhEgsAGfgQBI XGyQfYsb7cCn4TGuCFi9XpRwuov1YvN3nF2JYXmsQOXKounfezsqb2XNjCpyzW443vm6 16LT/J8+h/HJbAl9TlrVgLeRFD/XslxCz34VJEEzBJ0IW3ecqZO6Vmb3yIsFUPmg2Pez ROQi1ZgA+JHN7Y7b2oXfN5IJl1ycXwIa8uyaAKIDHgOE5MhRNBgZG9E/xherXezsEc6C z+ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=vhbse/E0HanWtvs3RFUN5y7zqTLReZnaAqUS2aMjv9g=; b=k6J7IUk3xLt9MJmtm55USD7Dc5tze1CmKtpbfzbS1ZUdZCQkmL9tAhq/I/6QzqxmMw 4VA8ViXPtZQXjftMTchQvDNnPaFDvKXT2j1l1cork7mJESf2MmMElI9w2uaq/3T4JwMi 82k59ZAngvCL1QIWlDi61mZkFU7yDh1H9Uz/kg0Zs+xOa6jniaKWIjKf1rO4jTTA6M4V 52FeIk7SZ0XqRnzcZJugd2lLJeuRNKDAkWwbr40xgtByW2M4ZSu0jbUT8QrYX7ZyJOT7 TM7cQqTV5B1aJ6fD2zsN9eX0ByHk0VJjdfTCCcsbdf0QpxuOpWTNJKTcGaPuSzMS1AvV 0d3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Xx6R3K6g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a170906938600b008d7983495b4si3508020ejx.971.2023.04.07.12.33.54; Fri, 07 Apr 2023 12:34:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Xx6R3K6g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230039AbjDGTdm (ORCPT + 99 others); Fri, 7 Apr 2023 15:33:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjDGTdj (ORCPT ); Fri, 7 Apr 2023 15:33:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EE465FCB; Fri, 7 Apr 2023 12:33:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 022E9611DB; Fri, 7 Apr 2023 19:28:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A41DC433A7; Fri, 7 Apr 2023 19:28:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680895714; bh=tLuYmZCaB6pcx1B5nefyV2H/zPduYUn1OkjtxTZ6xUI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Xx6R3K6g48YPJPS3SQuaU7w4dWVg0aIVFEyFB5sypxj+ZMxEhcs2hnYMbqHK3mA4M Uf/GjjL/+FQoVet4YOm6DPhfxK47opiuocGz1ebCW/1h3k945Zx0E/GrdGYRSlRYEf 5h3zWJTGZstvw0xkZED4reXmtWKAfibCLXUxIJlydrq2Bc8O2lGs39CzUEe9hPaQ9F CbXziaCjCoEPYkb+9Z7e9TfmEg5C1Vc/wX4JjGKNepREFEKuo5c9BG1tHLJLCHu4IH r7iI654GL8eUBRlpUwO2aH1tnz6p3uJUVnQdK2/UWH13vhTqo4ISFNirkjAR/Qal7b vG0GmxdlyU80A== Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-18412684c50so2493696fac.5; Fri, 07 Apr 2023 12:28:34 -0700 (PDT) X-Gm-Message-State: AAQBX9dwjNYr2PkQkuc2+VEUwtSNbls1e5L5336BXr00k3xIFQ3vWwVE /HeEw0fC3nGM2zJyXQmOcGEIcAQymhe2p718fU4= X-Received: by 2002:a05:6870:1258:b0:17f:84f8:1f44 with SMTP id 24-20020a056870125800b0017f84f81f44mr1570897oao.11.1680895713574; Fri, 07 Apr 2023 12:28:33 -0700 (PDT) MIME-Version: 1.0 References: <20230327174140.8169-1-quic_johmoo@quicinc.com> <20230327174140.8169-2-quic_johmoo@quicinc.com> In-Reply-To: <20230327174140.8169-2-quic_johmoo@quicinc.com> From: Masahiro Yamada Date: Sat, 8 Apr 2023 04:27:57 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 1/2] check-uapi: Introduce check-uapi.sh To: John Moon Cc: Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Greg Kroah-Hartman , Randy Dunlap , Arnd Bergmann , Bjorn Andersson , Todd Kjos , Matthias Maennich , Giuliano Procida , kernel-team@android.com, libabigail@sourceware.org, Jordan Crouse , Trilok Soni , Satya Durga Srinivasu Prabhala , Elliot Berman , Guru Das Srinagesh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 28, 2023 at 2:42=E2=80=AFAM John Moon = 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 > --- > - 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 ". > - 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=3D"$1" > + local -r past_ref=3D"$2" > + > + DEVIATED_FROM_CURRENT_TREE=3D"false" > + for ref in "$base_ref" "$past_ref"; do > + if [ -n "$ref" ]; then > + if [ "$DEVIATED_FROM_CURRENT_TREE" =3D "false" ];= then > + save_tree_state > + DEVIATED_FROM_CURRENT_TREE=3D"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=3D"$ARCH" INSTALL_HDR_PATH=3D= "${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. --=20 Best Regards Masahiro Yamada