From patchwork Thu Feb 22 16:29:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 60900 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 AC4C227BBEA; Thu, 22 Feb 2024 16:31:49 +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_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 7A99C27BBE9 for ; Thu, 22 Feb 2024 16:31:48 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdBz4-0005y9-5c; Thu, 22 Feb 2024 11:31:42 -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 1rdBz2-0005xg-3d for guix-patches@gnu.org; Thu, 22 Feb 2024 11:31:40 -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 1rdBz1-0008C0-RY for guix-patches@gnu.org; Thu, 22 Feb 2024 11:31:39 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdBzO-0004LM-9a for guix-patches@gnu.org; Thu, 22 Feb 2024 11:32:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68813] [core-updates PATCH 01/20] gnu: Add atf. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 22 Feb 2024 16:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68813 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68813@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 68813-submit@debbugs.gnu.org id=B68813.170861949916632 (code B ref 68813); Thu, 22 Feb 2024 16:32:02 +0000 Received: (at 68813) by debbugs.gnu.org; 22 Feb 2024 16:31:39 +0000 Received: from localhost ([127.0.0.1]:39771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdByz-0004K7-Sz for submit@debbugs.gnu.org; Thu, 22 Feb 2024 11:31:38 -0500 Received: from mail-oi1-f177.google.com ([209.85.167.177]:52404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdByw-0004Jd-EG for 68813@debbugs.gnu.org; Thu, 22 Feb 2024 11:31:36 -0500 Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-3c02adddb8eso1556144b6e.0 for <68813@debbugs.gnu.org>; Thu, 22 Feb 2024 08:31:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708619405; x=1709224205; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JIKwmj2v9XD5SSFxEBwHR1TQXaUCfRhjWhYlnCXkN2s=; b=KB6pItiStlbqS4KjmoQfSrSLVlal+rNvQSj4qAdWL2pudQJgTz/5NnxeqJLP7CJO5l z4Vw6+KNB1nzuT1wsGnZsMsvUALjMHZaXfD/kAlTF0bwwFwSTUFWoya/EXduw5JvPz40 v35X3u07fjJdIhzCrcLCAhtWMvWf5gRuO7wIRtsX5kmOp07X4PQJ9qaJKF/ZsfbGBnmg WgUyosZ2V4bh84GGaLB3akcR5ViooTfw7aigNgzCrcTfrV3NLtiYGuy360oZkRMAVjKd SE1sKColNqHVcy9sBYlB553a3C7jfo5CC8yVeIgTJi8/KrOxW4IfrErFISqMfGiCSjKV aFSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708619405; x=1709224205; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JIKwmj2v9XD5SSFxEBwHR1TQXaUCfRhjWhYlnCXkN2s=; b=F2GAYA8szGOMrCzaW8Cno7qsf53CSZlnHas9RiT7ZuOqDDCVSVqqOnC2e6a+cngz8M RRpKGnWkz1tEj/l3NZlJUSSc8ipaskt2JTnzPMBXRlx06nWveERZb3jD3Y/zupfY4SLf nafW6kq4U/e+wwPwPvfSwi7rsS2N3SgwqZkt6GCYIiGVowpD8cPxxC4Ffx0ggP6YgS80 VKl8t0BNnLFA/qg+XcWkEtrNrGcEexiW7prhD8MPmf4dS5uASmbAl4T0H0SYjONZRGZS a/1llB5rgLyvxxmJ92zCNbAHR76CYglz3AOewHflmMXsiws/7F/aehzKXQe3UvZVMhaE WMBA== X-Gm-Message-State: AOJu0YyDP++53Kzt2o+585Kq+2yqbQZWdLcXPnzyQZ3+zwC96DML8zYj jyitLUXVrMOJwxWE6Yd/iThgCkZimnXqUIjUYb2o5/DvoNxcb2fTBbs2+21F X-Google-Smtp-Source: AGHT+IEvXQgcd6J8JG9NI5aYaO9AvXi9QGFfxNakYMsITlqbyq8LjblxHMKryM5uph3Ss6UkWA5nMQ== X-Received: by 2002:a05:6808:1907:b0:3c0:408f:2098 with SMTP id bf7-20020a056808190700b003c0408f2098mr30191277oib.24.1708619405425; Thu, 22 Feb 2024 08:30:05 -0800 (PST) Received: from localhost.localdomain (dsl-155-144.b2b2c.ca. [66.158.155.144]) by smtp.gmail.com with ESMTPSA id pd4-20020a056214490400b0068c968c3b33sm132141qvb.20.2024.02.22.08.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 08:30:05 -0800 (PST) From: Maxim Cournoyer Date: Thu, 22 Feb 2024 11:29:57 -0500 Message-ID: <704c6dbd83706ec0c978998cd3853e1969246573.1708618218.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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 | 1 + gnu/packages/check.scm | 40 ++++++++++++++++++- .../patches/atf-execute-with-shell.patch | 39 ++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/atf-execute-with-shell.patch diff --git a/gnu/local.mk b/gnu/local.mk index 62368f3511..34cdf6564d 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -935,6 +935,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 4f593cde8d..3920c5dace 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 +