From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:700:3204::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id +PbGAxS9mWX0FQEAkFu2QA (envelope-from ) for ; Sat, 06 Jan 2024 21:50:28 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id wLU8ORO9mWUI9gAAe85BDQ (envelope-from ) for ; Sat, 06 Jan 2024 21:50:28 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=soeren-tempel.net header.s=opensmtpd header.b=nPwsls4a; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=soeren-tempel.net (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1704574227; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=uOPJwWzSe2TI/Avkpx5qS62Q2LbMAZcQnSriG1kYr04=; b=FnIZ3t7qygoSvYIzIkppNXcoR3lqrv+sGzvcjRFxCdK/abLQe06zgWpwdzOzXCyD1SS/sX 5J5qQmU/urhf/yWz0qsO47paHbFDgeFHZqD8aYTo0hNsfGt86gA9rIBQJfPA2NH+ST0iea 57VBI7zBxY7DVMct5sA5nUV+x7lPNMvPexxcBnLfNHgTYanYrAj8y/qLlA0QNh6oki3HPJ nIl5KOUrKHO5TFMth4TS1qukeV8HiKrZYOhk/8LrJjy2jN0i6lLFi/SHeKhjqnVKIFgViE ypqi5iE1P07Hcc98Ypl78JXSJsiRNHbVjLXPsoBBPuCt/0L+QKlz+l5e8hD51g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1704574227; a=rsa-sha256; cv=none; b=bfQLNUyaIVOQvmgHT4EG2buY4KbEDBjRVh1dnlohtqmoW3oxTd5i1tJm3BROTQORS34oJX Ib75vbKV8Ubm3X63hzFFKom06C3DVBQNOB17lE3lG//Z9UMPZnGiQCJ5fNSuiL3lwbfj5+ 3bINyOQ/WoDPVT4l/pmwzqW44nw9z0wt6JGd12K8JV4VNgmYnRnwmFF7Kz0AKoJg1p8DB5 9W5RaO5V74byfOO8oC9R5rayNGaQRSJ3khSIUW8fCfnbfwU4xDPm6uTgYV3krocE7DKt8L loGeDFmdzuLy3ki+QNdwVfZTdEl9pmBdaE2ttB0iz8dCkcKH2GN5TzeQtqvq5w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=soeren-tempel.net header.s=opensmtpd header.b=nPwsls4a; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=soeren-tempel.net (policy=none) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7E3B66459F for ; Sat, 6 Jan 2024 21:50:27 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDcF-0003ul-Pw; Sat, 06 Jan 2024 15:49:59 -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 1rMDcD-0003uc-4b for guix-patches@gnu.org; Sat, 06 Jan 2024 15:49:57 -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 1rMDcC-0006Gi-T7 for guix-patches@gnu.org; Sat, 06 Jan 2024 15:49:56 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rMDcH-000547-Kr for guix-patches@gnu.org; Sat, 06 Jan 2024 15:50:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68296] [PATCH] gnu: Add KLEE. Resent-From: soeren@soeren-tempel.net Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 06 Jan 2024 20:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68296 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68296@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.170457415519410 (code B ref -1); Sat, 06 Jan 2024 20:50:01 +0000 Received: (at submit) by debbugs.gnu.org; 6 Jan 2024 20:49:15 +0000 Received: from localhost ([127.0.0.1]:60329 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMDbW-00052z-R4 for submit@debbugs.gnu.org; Sat, 06 Jan 2024 15:49:15 -0500 Received: from lists.gnu.org ([2001:470:142::17]:51408) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMDbV-00052n-AH for submit@debbugs.gnu.org; Sat, 06 Jan 2024 15:49:14 -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 1rMDbK-0003rL-IQ for guix-patches@gnu.org; Sat, 06 Jan 2024 15:49:02 -0500 Received: from magnesium.8pit.net ([45.76.88.171]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMDbI-0006AJ-79; Sat, 06 Jan 2024 15:49:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=Rp8vwAS+Ii gH1BWSEwmr55Dc/5d04LLRYmPUyC+DEu4=; h=date:subject:to:from; d=soeren-tempel.net; b=nPwsls4aCgPKk2SDYAWFnohzoimDmxQFBHZpn8jM7C190k2 OmczvEsvjQqmO0ZipdKFim2Ps1Pyhf13shwF5do4EP5jAAK7lfNoUUrvrZ33DG0I+JNoEJ A6mezbFJDLv/cp2RaZR8gz3AVZGspIoY1FoDj2d2gViVXMZcprkeV8= Received: from localhost (dynamic-2a02-3102-49da-001b-e576-f39c-a415-1e23.310.pool.telefonica.de [2a02:3102:49da:1b:e576:f39c:a415:1e23]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 0b1cbe9f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Sat, 6 Jan 2024 21:48:55 +0100 (CET) From: soeren@soeren-tempel.net Date: Sat, 6 Jan 2024 21:40:41 +0100 Message-ID: <890dc6595ccef88cb60ff0a380be9d323df479aa.1704573641.git.soeren@soeren-tempel.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=45.76.88.171; envelope-from=soeren@soeren-tempel.net; helo=magnesium.8pit.net 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, 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -4.20 X-Spam-Score: -4.20 X-Migadu-Queue-Id: 7E3B66459F X-Migadu-Scanner: mx12.migadu.com X-TUID: AazEP8D+6gow From: Sören Tempel * gnu/packages/check.scm (klee-uclibc): New variable. * gnu/packages/check.scm (klee): New variable. Signed-off-by: Sören Tempel --- This is a new package for KLEE, a popular piece of academic software in the software engineering domain. KLEE implements a technique called symbolic execution which allows for automated testing of software through SMT solving. KLEE forms the basis for a lot of research in the symbolic execution domain . Packaging KLEE and other related tools, eases using Guix for conducting reproducible research in this domain. I have Guix packages for other symbolic execution tools which I also would like to upstream in the future, I figured I would start with KLEE as it has little to no dependencies. I tested this package by conforming that the basic upstream tutorials work as intended, e.g. . This is my first Guix package, hence CC'ing the mentors. gnu/packages/check.scm | 107 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm index 5181d3a164..7e97e59955 100644 --- a/gnu/packages/check.scm +++ b/gnu/packages/check.scm @@ -71,6 +71,7 @@ (define-module (gnu packages check) #:use-module (gnu packages bash) #:use-module (gnu packages cmake) #:use-module (gnu packages compression) + #:use-module (gnu packages cpp) #:use-module (gnu packages linux) #:use-module (gnu packages llvm) #:use-module (gnu packages glib) @@ -79,6 +80,8 @@ (define-module (gnu packages check) #:use-module (gnu packages gtk) #:use-module (gnu packages guile) #:use-module (gnu packages guile-xyz) + #:use-module (gnu packages maths) + #:use-module (gnu packages ncurses) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) @@ -87,6 +90,7 @@ (define-module (gnu packages check) #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) #:use-module (gnu packages python-science) + #:use-module (gnu packages sqlite) #:use-module (gnu packages texinfo) #:use-module (gnu packages time) #:use-module (gnu packages xml) @@ -3648,3 +3652,106 @@ (define-public subunit command line filters to process a subunit stream and language bindings for Python, C, C++ and shell. Bindings are easy to write for other languages.") (license (list license:asl2.0 license:bsd-3)))) ;user can pick + +(define-public klee-uclibc + (let ((commit "955d502cc1f0688e82348304b053ad787056c754")) + (package + (name "klee-uclibc") + (version (git-version "20230612" "0" commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/klee/klee-uclibc") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "12fnr5mq80cxwvv09gi844mi31jgi8067swagxnlxlhxj4mi125j")))) + (build-system gnu-build-system) + (supported-systems '("x86_64-linux")) + (arguments + `(#:tests? #f ;upstream uClibc tests do not work in the fork + #:phases (modify-phases %standard-phases + ;; Disable locales as these would have to be downloaded and + ;; shouldn't really be needed for symbolic execution either. + (add-after 'unpack 'patch-config + (lambda _ + (substitute* "klee-premade-configs/x86_64/config" + (("UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA=y") + "UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA=n") + (("UCLIBC_PREGENERATED_LOCALE_DATA=y") + "UCLIBC_PREGENERATED_LOCALE_DATA=n") + (("UCLIBC_HAS_LOCALE=y") + "UCLIBC_HAS_LOCALE=n") + (("UCLIBC_HAS_XLOCALE=y") + "UCLIBC_HAS_XLOCALE=n")))) + + ;; Upstream uses a custom non-GNU configure script written + ;; in Python, replace the default configure phase accordingly. + (replace 'configure + (lambda _ + (invoke "./configure" + "--make-llvm-lib" + "--enable-release"))) + + ;; Custom install phase to only install the libc.a file manually. + ;; This is the only file which is used/needed by KLEE itself. + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (install-file "lib/libc.a" + (string-append (assoc-ref outputs "out") + "/lib"))))))) + (inputs (list clang-toolchain-13 python ncurses)) + (synopsis "Variant of uClibc tailored to symbolic execution") + (description + "Modified version of uClibc for symbolic execution of +Unix userland software. This library can only be used in conjunction +with the @code{klee} package.") + (home-page "https://klee.github.io/") + (license license:lgpl2.1)))) + +(define-public klee + (package + (name "klee") + (version "3.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/klee/klee") + (commit (string-append "v" version)))) + (sha256 + (base32 "0dj20nazkcq84ryr87dihvjznapsbl1n21sa8dhhnb0wsad5d6fb")) + (file-name (git-file-name name version)))) + (build-system cmake-build-system) + (supported-systems '("x86_64-linux")) + (arguments + `(#:test-target "systemtests" + #:strip-directories '("bin") + #:configure-flags ,#~(list "-DENABLE_KLEE_ASSERTS=OFF" + "-DENABLE_TCMALLOC=ON" + "-DENABLE_POSIX_RUNTIME=ON" + (string-append "-DKLEE_UCLIBC_PATH=" + #$klee-uclibc)) + #:phases (modify-phases %standard-phases + (add-after 'unpack 'patch-lit-config + (lambda _ + ;; Make sure that we retain the value of the GUIX_PYTHONPATH + ;; environment variable in the test environmented created by + ;; python-lit. Otherwise, the test scripts won't be able to + ;; find the python-tabulate dependency, causing test failures. + (substitute* "test/lit.cfg" + (("addEnv\\('PWD'\\)" env) + (string-append env "\n" "addEnv('GUIX_PYTHONPATH')")))))))) + (propagated-inputs (list klee-uclibc clang-toolchain-13 llvm-13 python + python-tabulate)) + (inputs (list python-lit z3 gperftools sqlite)) + (synopsis + "Symbolic execution engine built on top of the LLVM compiler infastructure") + (description + "Dynamic symbolic execution engine built on top of +LLVM. Symbolic execution is an automated software testing technique, +KLEE leverage this technique to automatically generate test cases for +software compiled to LLVM IR.") + (home-page "https://klee.github.io/") + (license (list license:expat license:bsd-4)))) base-commit: 29c94dd522833b2603a651c14a5b06120bcf1829