From patchwork Tue Jan 30 04:26:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 59571 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BE39D27BBE2; Tue, 30 Jan 2024 05:25:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3053427BBE9 for ; Tue, 30 Jan 2024 05:25:15 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUgcA-0007mt-T1; Tue, 30 Jan 2024 00:24:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUgc9-0007md-VQ for guix-patches@gnu.org; Tue, 30 Jan 2024 00:24:53 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUgc9-0006wf-N0 for guix-patches@gnu.org; Tue, 30 Jan 2024 00:24:53 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rUgcI-0001yf-2H for guix-patches@gnu.org; Tue, 30 Jan 2024 00:25:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68813] [PATCH 1/5] gnu: Add atf. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 30 Jan 2024 05:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68813 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68813@debbugs.gnu.org Cc: Maxim Cournoyer X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17065922527538 (code B ref -1); Tue, 30 Jan 2024 05:25:01 +0000 Received: (at submit) by debbugs.gnu.org; 30 Jan 2024 05:24:12 +0000 Received: from localhost ([127.0.0.1]:34124 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUgbT-0001xV-8N for submit@debbugs.gnu.org; Tue, 30 Jan 2024 00:24:11 -0500 Received: from lists.gnu.org ([2001:470:142::17]:46084) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUgbP-0001xG-Gq for submit@debbugs.gnu.org; Tue, 30 Jan 2024 00:24:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUgbB-0007iX-10 for guix-patches@gnu.org; Tue, 30 Jan 2024 00:23:53 -0500 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUgb9-0006in-4A for guix-patches@gnu.org; Tue, 30 Jan 2024 00:23:52 -0500 Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-42a4516ec46so30318651cf.0 for ; Mon, 29 Jan 2024 21:23:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706592230; x=1707197030; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=b/5sd9P8SMfORTrp99FyzLoRvReK9b0ANkKYSTg8gjg=; b=ecW9EBQkTtzE6j7UcQ8vmg1AKleYt/8J90jt08fqo+7yv3uq9M5JKoIpM3oqlY90/c YGNiON0E6gG9k8+XWGfQaBatWEno24wBzsjg2NjGtwSRpp2usoxE5/CKbjJs4LA1TGYF S3y1ZEMbLWFob/aNS06a16LjPsZyj/SoSlhnjLcQVc2rlk5df3oaRtN9gUK+OkX4LEQX VXPtDkxTWjEUY+bnKkoVZOx9doNr9JO3j1UQPpyNnIeh/2umsqi09TOKIa/7ERVu5b3Z 3Ve0x5Ujc0jh4sGcCKw0/zmzr85pwLMRboIz8Vkn/FvmUauhfFWYH9YE/NDPWuY1OzHi skXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706592230; x=1707197030; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b/5sd9P8SMfORTrp99FyzLoRvReK9b0ANkKYSTg8gjg=; b=tUQK87XzBFrq3VvtrkjjvPLvD1C0AnLZW8HywnKplI/k4UjQDFYuwRIFgpYn8qIWaM PUfus/yTGu7mgU6tZT/yzEfAhuP7kTR8oJQ/XvWgyEEZdnuwlwx/erLtjZ1fhuDh6wGk U743WA+sKJo+C/UXr062ao1/g/Ku9kk+A/kktqzvL+W7DG8FkASXjVOhpLu1ITMcgqww hFWmp91NemdaXgCX3nUBgJ5bN4Z8bm8czcycMkDIiYQ3kPAUQIPvZ5NrGM+lPQGHY5v0 HPtXxCqZhT5vt6ishVcDVWH7t2GsbWaRiHDIA0PXp3oobr4Edu1bMJiq9UHWX4Mng5u+ 6txA== X-Gm-Message-State: AOJu0Yzzy6Ke5Esm2CnViQ5dcKYdmgevTlmeOnyQ7CQq4+KgBk7N+x43 JrZ+0HWLQW7Bo254J2x8IJJEr9CqCW+GIDtEry6WCbm8t9tiJGm+WkR2nwPk X-Google-Smtp-Source: AGHT+IGDhG7DmHAWmCw45mQ5HvG9G4wWeNZyhgtoN23YkagxhsSB07S/FeDNRQUQjXAWWwfm4xofqw== X-Received: by 2002:ac8:4796:0:b0:42a:db63:c0c with SMTP id k22-20020ac84796000000b0042adb630c0cmr147506qtq.35.1706588795476; Mon, 29 Jan 2024 20:26:35 -0800 (PST) Received: from localhost.localdomain (dsl-10-133-172.b2b2c.ca. [72.10.133.172]) by smtp.gmail.com with ESMTPSA id ez12-20020a05622a4c8c00b0042a5c2a81a8sm4142622qtb.60.2024.01.29.20.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 20:26:34 -0800 (PST) From: Maxim Cournoyer Date: Mon, 29 Jan 2024 23:26:25 -0500 Message-ID: <1eb5ed150b9c8d7bdbcc7fed96d65d7e0507f03d.1706588716.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::82e; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x82e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/check.scm (atf): New variable. * gnu/packages/patches/atf-execute-with-shell.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. Change-Id: I37a57069380309382bc0ff24977a1fd165985f5e --- gnu/local.mk | 3 +- gnu/packages/check.scm | 40 ++++++++++++++++++- .../patches/atf-execute-with-shell.patch | 39 ++++++++++++++++++ 3 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 gnu/packages/patches/atf-execute-with-shell.patch base-commit: 6573a72cdadebdf802ec7383253e44b975833895 diff --git a/gnu/local.mk b/gnu/local.mk index 8170ba6b83..69bf23c89e 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -19,7 +19,7 @@ # Copyright © 2018 Amirouche Boubekki # Copyright © 2018, 2019, 2020, 2021, 2022 Oleg Pykhalov # Copyright © 2018 Stefan Stefanović -# Copyright © 2018, 2020, 2021, 2022, 2023 Maxim Cournoyer +# Copyright © 2018, 2020, 2021, 2022, 2023, 2024 Maxim Cournoyer # Copyright © 2019, 2020, 2021, 2022, 2044 Guillaume Le Vaillant # Copyright © 2019, 2020 John Soo # Copyright © 2019 Jonathan Brielmaier @@ -931,6 +931,7 @@ dist_patch_DATA = \ %D%/packages/patches/asli-use-system-libs.patch \ %D%/packages/patches/aspell-CVE-2019-25051.patch \ %D%/packages/patches/aspell-default-dict-dir.patch \ + %D%/packages/patches/atf-execute-with-shell.patch \ %D%/packages/patches/ath9k-htc-firmware-binutils.patch \ %D%/packages/patches/ath9k-htc-firmware-gcc.patch \ %D%/packages/patches/ath9k-htc-firmware-gcc-compat.patch \ diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm index 4de5b1c0d4..bc2abf2bc0 100644 --- a/gnu/packages/check.scm +++ b/gnu/packages/check.scm @@ -35,7 +35,7 @@ ;;; Copyright © 2020 Josh Marshall ;;; Copyright © 2020 Vinicius Monego ;;; Copyright © 2020 Tanguy Le Carrour -;;; Copyright © 2020, 2021, 2022, 2023 Maxim Cournoyer +;;; Copyright © 2020, 2021, 2022, 2023, 2024 Maxim Cournoyer ;;; Copyright © 2021 Hugo Lecomte ;;; Copyright © 2022 Maxime Devos ;;; Copyright © 2022, 2023 David Elsing @@ -111,6 +111,44 @@ (define-module (gnu packages check) #:use-module (ice-9 match) #:use-module (srfi srfi-1)) +(define-public atf + (package + (name "atf") + (version "0.21") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/freebsd/atf") + (commit (string-append name "-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0jwzz6g9jdi5f8v10y0wf3hq73vxyv5qqhkh832ddsj36gn8rlcz")) + (patches (search-patches "atf-execute-with-shell.patch")))) + (build-system gnu-build-system) + (arguments + (list #:configure-flags + #~(list (string-append "ATF_SHELL=" + #$(this-package-input "bash-minimal") + "/bin/sh")))) + (native-inputs (list autoconf automake libtool)) + (inputs (list bash-minimal)) + (home-page "https://github.com/freebsd/atf") + (synopsis "C/C++ Automated Testing Framework libraries") + (description "ATF, or Automated Testing Framework, is a collection of +libraries to write test programs in C, C++ and POSIX shell. + +The ATF libraries offer a simple API. The API is orthogonal through the +various bindings, allowing developers to quickly learn how to write test +programs in different languages. + +ATF-based test programs offer a consistent end-user command-line interface to +allow both humans and automation to run the tests. + +ATF-based test programs rely on an execution engine to be run and this +execution engine is not shipped with ATF. Kyua is the engine of choice.") + (license (list license:bsd-2 license:bsd-3)))) + (define-public pict (package (name "pict") diff --git a/gnu/packages/patches/atf-execute-with-shell.patch b/gnu/packages/patches/atf-execute-with-shell.patch new file mode 100644 index 0000000000..bde4fb336a --- /dev/null +++ b/gnu/packages/patches/atf-execute-with-shell.patch @@ -0,0 +1,39 @@ +Submitted here: https://github.com/freebsd/atf/pull/57 + +From 098b66269b1cf1d944b8b214ceb7ce9febde3682 Mon Sep 17 00:00:00 2001 +From: Maxim Cournoyer +Date: Mon, 29 Jan 2024 22:35:49 -0500 +Subject: [PATCH] Fix use after free in execute_with_shell. + +The temporary string returned by atf::env::get would be used outside +its statement, which is invalid and cause undefined behavior. Copy it +to a local variable to avoid the issue. + +Fixes: https://github.com/freebsd/atf/issues/26 +Fixes: https://github.com/freebsd/kyua/issues/223 + +Reported-by: Ruslan Bukin +--- + atf-sh/atf-check.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/atf-sh/atf-check.cpp b/atf-sh/atf-check.cpp +index 41f0b13..9d6f7a8 100644 +--- a/atf-sh/atf-check.cpp ++++ b/atf-sh/atf-check.cpp +@@ -436,7 +436,9 @@ execute_with_shell(char* const* argv) + const std::string cmd = flatten_argv(argv); + + const char* sh_argv[4]; +- sh_argv[0] = atf::env::get("ATF_SHELL", ATF_SHELL).c_str(); ++ const std::string shell = atf::env::get("ATF_SHELL", ATF_SHELL); ++ ++ sh_argv[0] = shell.c_str(); + sh_argv[1] = "-c"; + sh_argv[2] = cmd.c_str(); + sh_argv[3] = NULL; + +base-commit: 18eb8168b70a0f934b4824b6391b55ac0b2f4fdf +-- +2.41.0 +