From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id WDwIHfWHzmW/FwEAqHPOHw:P1 (envelope-from ) for ; Thu, 15 Feb 2024 22:53:57 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id WDwIHfWHzmW/FwEAqHPOHw (envelope-from ) for ; Thu, 15 Feb 2024 22:53:57 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=troyfigiel.com header.s=MBO0001 header.b="iO9Z/H7Y"; 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=troyfigiel.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708034037; 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:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=wAx1E2027LzhgfwOjGxAVanxU2+IjME1lHIbWCgk4Co=; b=joK8FJnz1AzwReUpq/RQP1AqyFK1+8xBczgmy0FVdqptPiRwieLa7F4iu6JTssgzAJc5Ci NcyXANSkKbOAIk98F/KHICW6PQa/kK0NoHwRZ2/xfTL838eFjK3oEFTDF2HLGUGl/lzjXU enMwH9MuLlUP+4261m+y730oA+rMj+sHqHPfHX2grNYcYoZQJx/lmq2prd++wulwlxHAg+ 6K4hWQ+E1NQOdyumfiFrV9BnYDtEtndSgr0YfBK2TRvmkHK/5SydAseaQ7YteZWlwOIDtW cWLWHj/7Z14jZc8Awct1l/N3pwda+tsKAEFK811rXUR/nPaDcOgP8WRLsQ889g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=troyfigiel.com header.s=MBO0001 header.b="iO9Z/H7Y"; 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=troyfigiel.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708034037; a=rsa-sha256; cv=none; b=T5OAR+6xgAmDUxi3dg0sLBBGaWPdJP2ljx9sOIEYEDnfUT0mXLpXVCD/w46wlbh+5xIEd6 FKFqA9YQAkyfAW6T8ABdVpSTAvkh8GNiA+J5E0vODyhCTA/CVVG4qa31QWO8wvhrZjIsEW umXX85jsNAJATuQ+pfUhfei/zznAK5973ZJ0TTXTJIxc995V7AXBzfdiun8RVD/ilx9pFP uibPyjkCsR7ldZDVO/TccfNxsWRMAoi9gCkCr1DUe8URYBnnSRNcvLAmepoWKY9LRipMM7 0w635hsmOcs7TGWiPAu4cYDSGtPD4yaQosp5iZsAQnMsvtre1b1hg1BSno7gBw== 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 EC4DB5CC69 for ; Thu, 15 Feb 2024 22:53:56 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rajfu-0007OP-Kt; Thu, 15 Feb 2024 16:53:46 -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 1rajfr-0007Nz-UJ for guix-patches@gnu.org; Thu, 15 Feb 2024 16:53:44 -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 1rajfr-0006r3-MW for guix-patches@gnu.org; Thu, 15 Feb 2024 16:53:43 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rajgA-0006yx-G9 for guix-patches@gnu.org; Thu, 15 Feb 2024 16:54:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69074] [PATCH] gnu: Add python-angr. References: In-Reply-To: Resent-From: Troy Figiel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 15 Feb 2024 21:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69074 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69074@debbugs.gnu.org Received: via spool by 69074-submit@debbugs.gnu.org id=B69074.170803403626827 (code B ref 69074); Thu, 15 Feb 2024 21:54:02 +0000 Received: (at 69074) by debbugs.gnu.org; 15 Feb 2024 21:53:56 +0000 Received: from localhost ([127.0.0.1]:57634 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rajg3-0006yc-Dg for submit@debbugs.gnu.org; Thu, 15 Feb 2024 16:53:56 -0500 Received: from mout-p-102.mailbox.org ([80.241.56.152]:39764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rajg1-0006yQ-E6 for 69074@debbugs.gnu.org; Thu, 15 Feb 2024 16:53:54 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4TbTMD4R0nz9sdn for <69074@debbugs.gnu.org>; Thu, 15 Feb 2024 22:52:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=troyfigiel.com; s=MBO0001; t=1708033976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=wAx1E2027LzhgfwOjGxAVanxU2+IjME1lHIbWCgk4Co=; b=iO9Z/H7YzuOsnBUsE+T66EgXZb1UUQ6Rq3TeiHRlJLKxJbo/4rC8xylLJb6uTCIe8IsZM7 cBCIWqKagUgEIUIDuqtPdcCSv3niz8RFPkfRwjfXErIif6mlHU8ZD5zG6OHYKuBBS/chNg qFVIQ5PDMkIn8kB9owElyAz9srhxkdPbP3EIH6h3s1aOI43BK0YXeNegdGZPA6w6JWIebs UaA5wGVsihmt6hqxrsN/AMbpoIZvtaJneF1A03rxbw3B6yUaO+Yb2ml3COuB//m5WjDfuJ yrsyQ8yvVOguLVG87ZoBn5OARYW3cRX5AtmZGEndgSqaA9W9I86lXpdq7Z7sxg== From: Troy Figiel Date: Mon, 12 Feb 2024 15:58:29 +0100 Message-ID: <87h6i9bdjc.fsf@troyfigiel.com> MIME-Version: 1.0 Content-Type: text/plain 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -4.48 X-Spam-Score: -4.48 X-Migadu-Queue-Id: EC4DB5CC69 X-Migadu-Scanner: mx11.migadu.com X-TUID: NK7cKHikaqVe And here the patch for python-angr. I changed a couple of things: - Used pytest test-flags - Used (which "false") - Used #$(this-package-native-inputs "binaries") - Removed the "-x" flag in pytest. If it fails in the CI, it can be nice to see all tests that failed * gnu/packages/python-xyz.scm (python-angr): New variable. --- gnu/local.mk | 2 + .../python-angr-addition-type-error.patch | 18 ++++ .../patches/python-angr-check-exec-deps.patch | 93 ++++++++++++++++++ gnu/packages/python-xyz.scm | 97 +++++++++++++++++++ 4 files changed, 210 insertions(+) create mode 100644 gnu/packages/patches/python-angr-addition-type-error.patch create mode 100644 gnu/packages/patches/python-angr-check-exec-deps.patch diff --git a/gnu/local.mk b/gnu/local.mk index 59e930ffb9..716bde347b 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1899,6 +1899,8 @@ dist_patch_DATA = \ %D%/packages/patches/python-3-search-paths.patch \ %D%/packages/patches/python-3-fix-tests.patch \ %D%/packages/patches/python-3-hurd-configure.patch \ + %D%/packages/patches/python-angr-addition-type-error.patch \ + %D%/packages/patches/python-angr-check-exec-deps.patch \ %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch \ %D%/packages/patches/python-argcomplete-1.11.1-fish31.patch \ %D%/packages/patches/python-capstone-fix-python-constants.patch \ diff --git a/gnu/packages/patches/python-angr-addition-type-error.patch b/gnu/packages/patches/python-angr-addition-type-error.patch new file mode 100644 index 0000000000..7301d8b505 --- /dev/null +++ b/gnu/packages/patches/python-angr-addition-type-error.patch @@ -0,0 +1,18 @@ +This fixes failures of the test_ln_gcc_O2 and other related tests +in the angr test suite. The patch has been proposed upstream. + +Taken form: https://github.com/angr/angr/pull/4443 + +diff --git a/angr/analyses/reassembler.py b/angr/analyses/reassembler.py +index 7a2399a60..b09b3a8cb 100644 +--- a/angr/analyses/reassembler.py ++++ b/angr/analyses/reassembler.py +@@ -730,7 +730,7 @@ class Instruction: + elif operand.type == capstone.CS_OP_MEM: + operand_offsets.append(capstone_instr.disp_offset) + else: +- operand_offsets.append(None) ++ operand_offsets.append(0) + + if self.addr is not None: + self._initialize(capstone_instr.operands, operand_offsets) diff --git a/gnu/packages/patches/python-angr-check-exec-deps.patch b/gnu/packages/patches/python-angr-check-exec-deps.patch new file mode 100644 index 0000000000..438f8ef183 --- /dev/null +++ b/gnu/packages/patches/python-angr-check-exec-deps.patch @@ -0,0 +1,93 @@ +The angr test suite performs analysis on several pre-compiled binaries +to ensure its binary analysis capabilities are working as intended. +Some of these binaries are also executed as part of the test suite to +test if the simulation engine provided by angr results in the same +output as native execution of the binary. + +For Guix, this files as the glibc shared objects cannot be found. +Additionally, we don't really want to execute pre-compiled binaries +on Guix, hence we disable those tests. + +diff --git a/tests/test_ctype_locale.py b/tests/test_ctype_locale.py +index 08cb89836..2b9233558 100644 +--- a/tests/test_ctype_locale.py ++++ b/tests/test_ctype_locale.py +@@ -14,7 +14,7 @@ test_location = os.path.dirname(os.path.abspath(__file__)) + + + class TestCtypeLocale(unittest.TestCase): +- @skip_if_not_linux ++ @unittest.skip("test executes pre-compiled binaries") + def test_ctype_b_loc(self): + """ + test_ctype_locale.test_ctype_b_loc +@@ -60,7 +60,7 @@ class TestCtypeLocale(unittest.TestCase): + output = subprocess.check_output(bin_path, shell=True) + assert result == output + +- @skip_if_not_linux ++ @unittest.skip("test executes pre-compiled binaries") + def test_ctype_tolower_loc(self): + """ + test_ctype_locale.test_ctype_tolower_loc +@@ -109,7 +109,7 @@ class TestCtypeLocale(unittest.TestCase): + output = subprocess.check_output(bin_path, shell=True) + assert result == output + +- @skip_if_not_linux ++ @unittest.skip("test executes pre-compiled binaries") + def test_ctype_toupper_loc(self): + """ + test_ctype_locale.test_ctype_toupper_loc +diff --git a/tests/test_signed_div.py b/tests/test_signed_div.py +index 59cb9b8d1..994ed9c65 100644 +--- a/tests/test_signed_div.py ++++ b/tests/test_signed_div.py +@@ -1,6 +1,7 @@ + import angr + import subprocess + import sys ++import pytest + + import logging + +@@ -13,7 +14,7 @@ import os + test_location = os.path.dirname(os.path.realpath(__file__)) + + +-@skipUnless(sys.platform.startswith("linux"), "linux only") ++@pytest.mark.skip(reason="test executes pre-compiled binaries") + def test_signed_div(): + test_bin = os.path.join(test_location, "..", "..", "binaries", "tests", "x86_64", "test_signed_div") + b = angr.Project(test_bin, auto_load_libs=False) +diff --git a/tests/test_sscanf.py b/tests/test_sscanf.py +index 29d2c8403..ea799b310 100644 +--- a/tests/test_sscanf.py ++++ b/tests/test_sscanf.py +@@ -1,3 +1,4 @@ ++import pytest + import angr + import subprocess + import sys +@@ -14,7 +15,7 @@ test_location = os.path.dirname(os.path.realpath(__file__)) + + + class TestSscanf(unittest.TestCase): +- @unittest.skipUnless(sys.platform.startswith("linux"), "linux only") ++ @unittest.skip("test executes pre-compiled binaries") + def test_sscanf(self): + test_bin = os.path.join(test_location, "..", "..", "binaries", "tests", "x86_64", "sscanf_test") + b = angr.Project(test_bin, auto_load_libs=False) +diff --git a/tests/test_strtol.py b/tests/test_strtol.py +index 6c29cab22..f36181407 100644 +--- a/tests/test_strtol.py ++++ b/tests/test_strtol.py +@@ -11,7 +11,7 @@ class TestStrtol(unittest.TestCase): + # pylint: disable=no-self-use + + @slow_test +- @unittest.skipUnless(sys.platform.startswith("linux"), "linux-only") ++ @unittest.skip("test executes pre-compiled binaries") + def test_strtol(self, threads=None): + test_bin = os.path.join(bin_location, "tests", "x86_64", "strtol_test") + # disabling auto_load_libs increases the execution time of the test case. diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index e42cbde76e..b3a0f70bd2 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -189,6 +189,7 @@ (define-module (gnu packages python-xyz) #:use-module (gnu packages djvu) #:use-module (gnu packages docker) #:use-module (gnu packages documentation) + #:use-module (gnu packages emulators) #:use-module (gnu packages engineering) #:use-module (gnu packages enchant) #:use-module (gnu packages file) @@ -32390,6 +32391,102 @@ (define-public python-pyvex to enable all kinds of binary analysis tasks.") (license license:bsd-2))) +(define-public python-angr + (package + (name "python-angr") + (version "9.2.46") + (source + (origin + (method git-fetch) + (patches (search-patches "python-angr-addition-type-error.patch" + "python-angr-check-exec-deps.patch")) + (uri (git-reference + (url "https://github.com/angr/angr") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "18y9wyf7va7gvp9zd6lhw82j9a2x2ajsvbawh96xnxzml0jwlwjm")))) + (build-system pyproject-build-system) + (arguments + (list + #:test-flags '(list "tests" + "--dist" + "loadfile" + "-k" + ;; test_mips32_missing_offset_in_instructions fails + ;; with capstone 5 and passes with capstone 4. Might + ;; be a capstone regressions, needs investigation. + "not test_mips32_missing_offset_in_instructions" + "-n" + (number->string (parallel-job-count))) + #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'patch-tests + (lambda _ + (substitute* "tests/test_vault.py" + (("/bin/false") + (which "false"))) + (substitute* "tests/common.py" + (("\\[\"cc\"\\]") + "[\"gcc\"]")))) + (add-before 'build 'set-cc + (lambda _ + (setenv "CC" "gcc"))) + (add-before 'check 'copy-binaries + (lambda _ + (copy-recursively #$(this-package-native-input + "binaries") "../binaries")))))) + (propagated-inputs (list python-ailment + python-archinfo + python-cachetools + python-capstone + python-cffi + python-claripy + python-cle + python-colorama + python-cppheaderparser + python-dpkt + python-gitpython + python-mulpyplexer + python-nampa + python-networkx + python-protobuf + python-psutil + python-itanium-demangle + python-pycparser + python-pyvex + python-progressbar2 + python-rpyc + python-sortedcontainers + python-sqlalchemy + python-sympy + unicorn)) + (native-inputs `(("python-pytest" ,python-pytest) + ("python-pytest-xdist" ,python-pytest-xdist) + ("binaries" + ;; This repository ships several binaries used only for testing + ;; purpose. The binaries are not executed and not part of the + ;; angr distribution, they are only used to test angr's binary + ;; analysis capabilities. In the context of the GNU FSDG, these + ;; files should be considered non-functional data. + ,(origin + (method git-fetch) + (uri (git-reference (url + "https://github.com/angr/binaries") + (commit (string-append "v" + version)))) + (file-name (git-file-name "angr-binaries" version)) + (sha256 (base32 + "1f286b2239zavxzwg1184hj1zs380cr9qr549mvy3vywvm8bsmgr")))))) + (home-page "https://github.com/angr/angr") + (synopsis "Multi-architecture binary analysis toolkit") + (description + "This package provides a versatile binary analysis platform with the +ability to perform dynamic symbolic execution as well as various +static analyses directly on binaries. As such, it can be used for all +kinds of reverse engineering, vulnerability discovery, exploit +generation, and software testing purposes.") + (license license:bsd-2))) + (define-public python-archinfo (package (name "python-archinfo") -- 2.42.0