From patchwork Tue Jun 30 14:07:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 91413 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 495B9C43458 for ; Tue, 30 Jun 2026 14:08:13 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.21886.1782828486589460513 for ; Tue, 30 Jun 2026 07:08:06 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=MR+9HYLH; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A79B72ED2 for ; Tue, 30 Jun 2026 07:08:01 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A680F3F85F for ; Tue, 30 Jun 2026 07:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1782828486; bh=WbMnK8kU762USM7DvNVbYnC/VAzcKzA3LOBX8G29FCc=; h=From:To:Subject:Date:From; b=MR+9HYLHpUVsBff5LwYo8aEmoBEQ+1SmQvMPNbnIbE47iWg+GQCg9KLTv1s1sv4NL 7HDxY9zXb3iQOUCZkWFvKU1OvgYKmoafVBdh4tCoP5nVZyWemnlhLN/2C6pxl5JInW LG1aSv2wKMfL6T79LXIk7Oueem7WEGZxm6YD5UTo= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/3] classes/insane: increase shebang size limit Date: Tue, 30 Jun 2026 15:07:58 +0100 Message-ID: <20260630140800.4018491-1-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 30 Jun 2026 14:08:13 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/239899 Since Linux 5.1 the shebang buffer has been 256 bytes[1], so update the check to match. Also rewrite the test, create a variable for the magic number (that has the same name as the kernel #define), don't pointlessly try to decode the bytes as UTF-8, and consolidate the test logic to entirely inside the try block. [1] linux 6eb3c3d0a52dc ("exec: increase BINPRM_BUF_SIZE to 256") --- meta/classes-global/insane.bbclass | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index 4250331af12..08bff7dca45 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass @@ -83,25 +83,22 @@ QAPATHTEST[shebang-size] = "package_qa_check_shebang_size" def package_qa_check_shebang_size(path, name, d, elf): global cpath + # From kernel 5.1 onwards (specifically linux 6eb3c3d0a52dc ("exec: increase + # BINPRM_BUF_SIZE to 256")) the shebang buffer is was increased from 128 bytes + # to 256 bytes. + BINPRM_BUF_SIZE = 256 + if elf or cpath.islink(path) or not cpath.isfile(path): return try: with open(path, 'rb') as f: - stanza = f.readline(130) + stanza = f.readline(BINPRM_BUF_SIZE) + if stanza.startswith(b'#!') and len(stanza) > BINPRM_BUF_SIZE: + oe.qa.handle_error("shebang-size", "%s: %s maximum shebang size exceeded, the maximum size is %d" % (name, package_qa_clean_path(path, d, name), BINPRM_BUF_SIZE), d) + return except IOError: - return - - if stanza.startswith(b'#!'): - try: - stanza.decode("utf-8") - except UnicodeDecodeError: - #If it is not a text file, it is not a script - return - - if len(stanza) > 129: - oe.qa.handle_error("shebang-size", "%s: %s maximum shebang size exceeded, the maximum size is 128." % (name, package_qa_clean_path(path, d, name)), d) - return + pass QAPATHTEST[libexec] = "package_qa_check_libexec" def package_qa_check_libexec(path,name, d, elf): From patchwork Tue Jun 30 14:07:59 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 91414 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A02AC43327 for ; Tue, 30 Jun 2026 14:08:13 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.21887.1782828487434991356 for ; Tue, 30 Jun 2026 07:08:07 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=j5tt5fUX; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 73C212ED2 for ; Tue, 30 Jun 2026 07:08:02 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 718293F85F for ; Tue, 30 Jun 2026 07:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1782828486; bh=EsO63uSH4bzJD3UlZH64MF/CwfaAVTOlgyHzK/ONBSk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=j5tt5fUXg5dutG/RqpjVZ0rOuJ/rRh7MsiGyfdK2kRGzI8FRJLcbNDjz43FoMIX0z gVpW+CIg26MrB++RmdesUmvU0FUKBSPXGGn0XOm/oUYWn39XSXz8mpdLdUQsH/2rkW GecB4IiBBBj0oHNFZIwEnClzHIv3iifQ+h2fYVSY= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 2/3] classes/insane: create one CachedPath instance in qa_check_staged Date: Tue, 30 Jun 2026 15:07:59 +0100 Message-ID: <20260630140800.4018491-2-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260630140800.4018491-1-ross.burton@arm.com> References: <20260630140800.4018491-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 30 Jun 2026 14:08:13 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/239900 There's no need to create a new CachedPath instance for every file that we want to scan, just create one at the beginning of the function. Signed-off-by: Ross Burton --- meta/classes-global/insane.bbclass | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index 08bff7dca45..68ad78c39d6 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass @@ -729,6 +729,10 @@ def qa_check_staged(path,d): workdir = os.path.join(tmpdir, "work") recipesysroot = d.getVar("RECIPE_SYSROOT") + # package_qa_check_shebang_size needs the global cpath to be already created + global cpath + cpath = oe.cachedpath.CachedPath() + if bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d): pkgconfigcheck = workdir else: @@ -772,10 +776,7 @@ def qa_check_staged(path,d): oe.qa.handle_error("pkgconfig", error_msg, d) if not skip_shebang_size: - global cpath - cpath = oe.cachedpath.CachedPath() package_qa_check_shebang_size(path, "", d, None) - cpath = None # Walk over all files in a directory and call func def package_qa_walk(checkfuncs, package, d): From patchwork Tue Jun 30 14:08:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 91412 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5542FC43602 for ; Tue, 30 Jun 2026 14:08:13 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.21888.1782828488103326116 for ; Tue, 30 Jun 2026 07:08:08 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=m3/szwiI; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 481DC2ED2 for ; Tue, 30 Jun 2026 07:08:03 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3BB383F85F for ; Tue, 30 Jun 2026 07:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1782828487; bh=PgG308E44thjXAM6yVKIXqkj4Jeb2kqcFHjDE3rkf2k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=m3/szwiIA6f9aZ/YTMU1OPSWTO2nVDHkk4JXVLdr78K3tFXbqiMRvyKbVT2dzaA0X sJLKxITsU9+fRDJwAj5WTNdMB5JmdvFSV2owRvMvLkFfRoTsI59nQ8y9OnWAQw1TiA pPYGi6QCdzMPzBE3iRj9qVoZvDPsc342HJV6vd/M= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 3/3] classes/insane: clean up do_qa_sysroot Date: Tue, 30 Jun 2026 15:08:00 +0100 Message-ID: <20260630140800.4018491-3-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260630140800.4018491-1-ross.burton@arm.com> References: <20260630140800.4018491-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 30 Jun 2026 14:08:13 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/239901 do_populate_sysroot copies SYSROOT_DIRS into SYSROOT_DESTDIR, so there's no need to loop over SYSROOT_DIRS when checking files: qa_check_staged can just recurse down the entire tree. Signed-off-by: Ross Burton --- meta/classes-global/insane.bbclass | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index 68ad78c39d6..9640738f49f 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass @@ -1222,9 +1222,7 @@ addtask do_package_qa_setscene python do_qa_sysroot() { bb.note("QA checking do_populate_sysroot") - sysroot_destdir = d.expand('${SYSROOT_DESTDIR}') - for sysroot_dir in d.expand('${SYSROOT_DIRS}').split(): - qa_check_staged(sysroot_destdir + sysroot_dir, d) + qa_check_staged(d.getVar("SYSROOT_DESTDIR"), d) oe.qa.exit_with_message_if_errors("do_populate_sysroot for this recipe installed files with QA issues", d) } do_populate_sysroot[postfuncs] += "do_qa_sysroot"