From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id qP6TMz4Eh2Y2AwAAqHPOHw:P1 (envelope-from ) for ; Thu, 04 Jul 2024 20:21:18 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id qP6TMz4Eh2Y2AwAAqHPOHw (envelope-from ) for ; Thu, 04 Jul 2024 22:21:18 +0200 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=Xhrgtian; dmarc=fail reason="SPF not aligned (relaxed)" header.from=soeren-tempel.net (policy=none); 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1720124478; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: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=TLeLhF61bgOmnV3aQ7HlXU+ogr+atuX9QwKoKfyGjFQ=; b=fkxnalkaEfcZHnmvkTSfaM5icyswsMZrH2BM7ek2RyeWNw9oKyXm90f44uG5XI4XpqzG1x 2D1kVoz3PuX+itTNFV61NCUMiUitz6Wn9UuytTwnlQ63Otw0/IVrFvDPhqEvYy2CAAwFbR PezcThTbQA7JCdm5hMfhEosQBjD/N7PGUYETxWYggDgbq0YYF9Eo5lzTVVyvzCipzJqSal mR5fwIGdIBaluYDtplEh2fFZekyKx5kWnbeK1aFANBmqy1svSQFUkDEYYqzy7iOfpShok8 IJWBabe56Vz9iBdI/KTsN6e7fh8a4YYywe7b7ZPfB2Sgu4WFre1Xk/Bqj/RESQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1720124478; a=rsa-sha256; cv=none; b=LP1+B1FgKhbpMLI/UhpN63B9Er6whFp8Fy2fkyy02dZH0KZCZHUebpD7gGpn2CIQHEt+9p 5f75a9IWMVqp8EvY+wrfSDN/jk1lH1yXtKrKlOhydxTGR5kTK3WQRe40fj2Mx1v0g4H9vi /87+gp5dD8ZoasqTwoygpdBOOTGbookaroitKf6cWcwFkZpECbVo9RZwDsVQ/sr81wDgOQ mcI8qkq+U+FiVTOmxQsD4053e1rmPVq0gV3UedYIeF45WD+qYu2flWimn9IQt1L2MH3Wjb gCFihvwdlIEwuz5EnOOfqvX0uDNw2A98ZQsV2PY718KqqIAAVZu1DYs7fgwMVw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=soeren-tempel.net header.s=opensmtpd header.b=Xhrgtian; dmarc=fail reason="SPF not aligned (relaxed)" header.from=soeren-tempel.net (policy=none); 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" 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 9F8EF177B0 for ; Thu, 4 Jul 2024 22:21:18 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPSx1-0006sm-QI; Thu, 04 Jul 2024 16:21:07 -0400 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 1sPSwy-0006sT-5a for guix-patches@gnu.org; Thu, 04 Jul 2024 16:21:04 -0400 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 1sPSwx-0004ew-RU; Thu, 04 Jul 2024 16:21:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sPSwv-0007Qy-SE; Thu, 04 Jul 2024 16:21:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69074] [PATCH v3 14/14] gnu: Add python-angr. Resent-From: soeren@soeren-tempel.net Original-Sender: "Debbugs-submit" Resent-CC: lars@6xq.net, marius@gnu.org, me@bonfacemunyoki.com, sharlatanus@gmail.com, tanguy@bioneland.org, jgart@dismail.de, guix-patches@gnu.org Resent-Date: Thu, 04 Jul 2024 20:21:01 +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 Cc: Lars-Dominik Braun , Marius Bakke , Munyoki Kilyungi , Sharlatan Hellseher , Tanguy Le Carrour , jgart X-Debbugs-Original-Xcc: Lars-Dominik Braun , Marius Bakke , Munyoki Kilyungi , Sharlatan Hellseher , Tanguy Le Carrour , jgart Received: via spool by 69074-submit@debbugs.gnu.org id=B69074.172012441528502 (code B ref 69074); Thu, 04 Jul 2024 20:21:01 +0000 Received: (at 69074) by debbugs.gnu.org; 4 Jul 2024 20:20:15 +0000 Received: from localhost ([127.0.0.1]:43161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sPSwA-0007Pc-D1 for submit@debbugs.gnu.org; Thu, 04 Jul 2024 16:20:15 -0400 Received: from magnesium.8pit.net ([45.76.88.171]:19989) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sPSjR-0006yi-VQ; Thu, 04 Jul 2024 16:07:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=opensmtpd; bh=TLeLhF61 bgOmnV3aQ7HlXU+ogr+atuX9QwKoKfyGjFQ=; h=references:in-reply-to:date: subject:to:from; d=soeren-tempel.net; b=Xhrgtian6UAkg+4r30Pi9h4QsXPeAI cBbYZ2VSLpMRyB4KYtLrV8PKAZcWHek9WbW9NNKz4cxggpMHX6MlNCTa9dHK7troDTQp7I /HlPXeH4HHmYe8wV1w1Ghnx0tlq7tmlo0/poNPEDSTXttNHiC9GXhUvqOH+QdoUgUW75HV o= Received: from localhost (dynamic-2a02-3102-49da-001b-e21d-4fb5-a2ea-d7fd.310.pool.telefonica.de [2a02:3102:49da:1b:e21d:4fb5:a2ea:d7fd]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 60b5e368 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Thu, 4 Jul 2024 22:06:54 +0200 (CEST) From: soeren@soeren-tempel.net Date: Thu, 4 Jul 2024 22:05:23 +0200 Message-ID: <296cf35938c44c1b32ecb1e55551434cf65f1e78.1720123523.git.soeren@soeren-tempel.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <885683d751fc62e227a6d4c6eeea928fed4387c9.1720123523.git.soeren@soeren-tempel.net> References: <885683d751fc62e227a6d4c6eeea928fed4387c9.1720123523.git.soeren@soeren-tempel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-Queue-Id: 9F8EF177B0 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -4.29 X-Spam-Score: -4.29 X-TUID: RjkxMAzjScrj From: Sören Tempel * gnu/packages/patches/python-angr-addition-type-error.patch: New patch. * gnu/packages/patches/python-angr-check-exec-deps.patch: New patch. * gnu/local.mk (dist_patch_DATA): Add them. * 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 | 96 +++++++++++++++++++ 4 files changed, 209 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 d41f635b73..faf278ba44 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1945,6 +1945,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 6797bba3bd..0e423c9f64 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -34079,6 +34079,102 @@ (define-public python-itanium-demangle extracting type information.") (license license:bsd-0))) +(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 + #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'patch-tests + (lambda* (#:key inputs #:allow-other-keys) + (let ((coreutils (assoc-ref inputs "coreutils"))) + (substitute* "tests/test_vault.py" + (("/bin/false") + (which "false"))) + (substitute* "tests/common.py" + (("\\[\"cc\"\\]") + "[\"gcc\"]"))))) + (replace 'check + (lambda* (#:key inputs tests? #:allow-other-keys) + (when tests? + (copy-recursively #$(this-package-native-input "binaries") + "../binaries") + (with-directory-excursion "tests" + ;; test_mips32_missing_offset_in_instructions fails + ;; with capstone 5 and passes with capstone 4. Might + ;; be a capstone regressions, needs investigation. + ;; + ;; test_concrete_memset is a non-deterministic benchmark. + (invoke "pytest" "-vv" "-x" "--dist" "loadfile" + "-k" "not test_mips32_missing_offset_in_instructions and not test_concrete_memset" + "-n" (number->string (parallel-job-count))))))) + (add-before 'build 'set-cc + (lambda _ + (setenv "CC" "gcc")))))) + (propagated-inputs (list python-ailment + python-archinfo + python-cachetools + 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-peachpy ;; There is no tag in this repo. (let ((commit "913d74c35a6b1d330e90bfc055208ce5b06b35a0")