From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id 82A333858D32 for ; Fri, 7 Apr 2023 20:09:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 82A333858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 337Jiwb0029048; Fri, 7 Apr 2023 20:09:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=Oue0184In+1WXLod3+6ssUfkgG2cv48XML0xIhs6V1I=; b=GWJ2cCaFaVBEXCd7Fnlh7tUpyoI8kHM1n/FJthSrR4usvAaxp2vEe0dLd9BJawMWvuzh 3Jatv2t8W34Dy8OXqMeYy4ucfqnFSUAuU0vLs0D7ONtyI0KP6zXIeSfxbO60Zf/3R3JD MgzsbA2P9qB/hIgCcFYWHQtjymKVwyY1GTaMMZsuqHdskVLjVroiBVM//yIFIIo82OF1 0bv8dWtcvTtm1r//Ku7RyKU9xlzQQm8REy6fNSbeyeQ90vkhGmQdtVRwgE8dsuu0Q0ER eekIPUrVRFezRuE/DoUr3eKZWfcf4VYPnt8QV6z/HxRH2AvM8abgvSbACT+Re18GgU5X iA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ptcrn1rbj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Apr 2023 20:09:16 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 337K9FFf029562 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 7 Apr 2023 20:09:15 GMT Received: from [10.110.116.85] (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Fri, 7 Apr 2023 13:09:13 -0700 Message-ID: <9529ba0b-4031-c91c-e231-86ee1c845539@quicinc.com> Date: Fri, 7 Apr 2023 13:09:12 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v4 1/2] check-uapi: Introduce check-uapi.sh Content-Language: en-US To: Masahiro Yamada CC: Nathan Chancellor , Nick Desaulniers , Nicolas Schier , , , , , "Greg Kroah-Hartman" , Randy Dunlap , Arnd Bergmann , Bjorn Andersson , Todd Kjos , Matthias Maennich , Giuliano Procida , , , Jordan Crouse , Trilok Soni , "Satya Durga Srinivasu Prabhala" , Elliot Berman , Guru Das Srinagesh References: <20230327174140.8169-1-quic_johmoo@quicinc.com> <20230327174140.8169-2-quic_johmoo@quicinc.com> From: John Moon In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: fIdeXfPC_7ksN8uDDFcLhnwfm32E-YFL X-Proofpoint-GUID: fIdeXfPC_7ksN8uDDFcLhnwfm32E-YFL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-07_12,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 mlxscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 phishscore=0 spamscore=0 mlxlogscore=635 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304070181 X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 4/7/2023 12:27 PM, Masahiro Yamada wrote: > On Tue, Mar 28, 2023 at 2:42 AM 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="$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.