From patchwork Thu Nov 3 03:13:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhu Zihao X-Patchwork-Id: 44255 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 7BF6027BBEA; Thu, 3 Nov 2022 03:14:23 +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_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2, 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 A6DC327BBE9 for ; Thu, 3 Nov 2022 03:14:19 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqQg8-0005nL-Uc; Wed, 02 Nov 2022 23:14:04 -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 1oqQg6-0005nC-HZ for guix-patches@gnu.org; Wed, 02 Nov 2022 23:14:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oqQg6-0007UP-9Y for guix-patches@gnu.org; Wed, 02 Nov 2022 23:14:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oqQg5-0006uo-Ov for guix-patches@gnu.org; Wed, 02 Nov 2022 23:14:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58977] [PATCH] gnu: upx: Update to 4.0.0. Resent-From: Zhu Zihao Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 03 Nov 2022 03:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58977 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58977@debbugs.gnu.org Cc: Zhu Zihao X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166744521126534 (code B ref -1); Thu, 03 Nov 2022 03:14:01 +0000 Received: (at submit) by debbugs.gnu.org; 3 Nov 2022 03:13:31 +0000 Received: from localhost ([127.0.0.1]:47491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqQfa-0006tt-QQ for submit@debbugs.gnu.org; Wed, 02 Nov 2022 23:13:31 -0400 Received: from lists.gnu.org ([209.51.188.17]:48434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqQfY-0006tl-4r for submit@debbugs.gnu.org; Wed, 02 Nov 2022 23:13:29 -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 1oqQfX-0005k1-Vg for guix-patches@gnu.org; Wed, 02 Nov 2022 23:13:28 -0400 Received: from mail-m971.mail.163.com ([123.126.97.1]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqQfU-0007MW-TN for guix-patches@gnu.org; Wed, 02 Nov 2022 23:13:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=Gg0wO MNyad9iiC/DZau9LEDo2RsiC4N2CwDUsm3rB2Y=; b=ahWviemQbDcwDRJ92D0EP yWuB/KRPa4eIZ4oSQ6E3bMS68/8Pv2HFxJZjEbs81cfin7a2sDyDhGjyeIqg2KKu cEwUfxDYtzcK/z9yKdevle9zhP25d+eZhPi17qSmz4oVeQEou1bFmAFrm11pPoH1 ZZt9yvlR0Uc9mqzVI/NN+M= Received: from localhost.localdomain (unknown [163.125.249.77]) by smtp1 (Coremail) with SMTP id GdxpCgAXH8vHMWNjlj+PpQ--.12489S2; Thu, 03 Nov 2022 11:13:16 +0800 (CST) From: Zhu Zihao Date: Thu, 3 Nov 2022 11:13:09 +0800 Message-Id: <20221103031309.7735-1-all_but_last@163.com> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 X-CM-TRANSID: GdxpCgAXH8vHMWNjlj+PpQ--.12489S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxtrW5AF4UCry8uF48Aw1UWrg_yoWxXrW5pr 4avr1fuw4rWrWrJrZ2gF1jkF15Xan7GFyDJw1fC3y8Kwn09FW8uFWxtF4rAa9xWryrWw13 uFnYgr4kGFW5JaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRqjgcUUUUU= X-Originating-IP: [163.125.249.77] X-CM-SenderInfo: pdoosuxxwbztlvw6il2tof0z/xtbBoQ2ur2I0Vgt-ggAAsb Received-SPF: pass client-ip=123.126.97.1; envelope-from=all_but_last@163.com; helo=mail-m971.mail.163.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 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: , Sender: "Guix-patches" Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/compression.scm (upx): Update to 4.0.0. [build-system]: Use cmake-build-system. [arguments]: Remove all stale arguments. * gnu/packages/patches/upx-CVE-2021-20285.patch: Delete. * gnu/local.mk (dist_patch_DATA): Remove corresponding entry. --- gnu/local.mk | 1 - gnu/packages/compression.scm | 45 +++-------- gnu/packages/patches/upx-CVE-2021-20285.patch | 76 ------------------- 3 files changed, 11 insertions(+), 111 deletions(-) delete mode 100644 gnu/packages/patches/upx-CVE-2021-20285.patch diff --git a/gnu/local.mk b/gnu/local.mk index 57f20b7314..eb6ac3df58 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1954,7 +1954,6 @@ dist_patch_DATA = \ %D%/packages/patches/unzip-zipbomb-part2.patch \ %D%/packages/patches/unzip-zipbomb-part3.patch \ %D%/packages/patches/unzip-32bit-zipbomb-fix.patch \ - %D%/packages/patches/upx-CVE-2021-20285.patch \ %D%/packages/patches/ustr-fix-build-with-gcc-5.patch \ %D%/packages/patches/util-linux-tests.patch \ %D%/packages/patches/util-linux-CVE-2021-3995.patch \ diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm index 857722ef4a..7b8977c8ce 100644 --- a/gnu/packages/compression.scm +++ b/gnu/packages/compression.scm @@ -35,6 +35,7 @@ ;;; Copyright © 2021 Simon Tournier ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2021 Ahmad Jarara +;;; Copyright © 2022 Zhu Zihao ;;; ;;; This file is part of GNU Guix. ;;; @@ -2293,40 +2294,16 @@ (define-public ucl (define-public upx (package (name "upx") - (version "3.96") - (source (origin - (method url-fetch) - (uri (string-append "https://github.com/upx/upx/releases/download/v" - version "/upx-" version "-src.tar.xz")) - (sha256 - (base32 - "051pk5jk8fcfg5mpgzj43z5p4cn7jy5jbyshyn78dwjqr7slsxs7")) - (patches (search-patches "upx-CVE-2021-20285.patch")))) - (build-system gnu-build-system) - (native-inputs - (list perl)) - (inputs - (list ucl zlib)) - (arguments - `(#:make-flags - (list "all") - #:phases - (modify-phases %standard-phases - (delete 'configure) ; no configure script - (delete 'check) ; no test suite - (add-before 'build 'patch-exec-bin-sh - (lambda _ - (substitute* (list "Makefile" - "src/Makefile") - (("/bin/sh") (which "sh"))) - #t)) - (replace 'install - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (bin (string-append out "/bin"))) - (mkdir-p bin) - (copy-file "src/upx.out" (string-append bin "/upx"))) - #t))))) + (version "4.0.0") + (source + (origin + (method url-fetch) + (uri (string-append "https://github.com/upx/upx/releases/download/v" + version "/upx-" version "-src.tar.xz")) + (sha256 + (base32 + "1sinky0rq40q2qqzly99c5hdd6ilz2bxlbqla9lg0rafhbw3iyga")))) + (build-system cmake-build-system) (home-page "https://upx.github.io/") (synopsis "Compression tool for executables") (description diff --git a/gnu/packages/patches/upx-CVE-2021-20285.patch b/gnu/packages/patches/upx-CVE-2021-20285.patch deleted file mode 100644 index 1d47b2a8bb..0000000000 --- a/gnu/packages/patches/upx-CVE-2021-20285.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 3781df9da23840e596d5e9e8493f22666802fe6c Mon Sep 17 00:00:00 2001 -From: John Reiser -Date: Fri, 11 Dec 2020 13:38:18 -0800 -Subject: [PATCH] Check DT_REL/DT_RELA, DT_RELSZ/DT_RELASZ - -https://github.com/upx/upx/issues/421 - modified: p_lx_elf.cpp ---- - src/p_lx_elf.cpp | 34 +++++++++++++++++++++++++++++----- - 1 file changed, 29 insertions(+), 5 deletions(-) - -diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp -index 182db192..3a4101cf 100644 ---- a/src/p_lx_elf.cpp -+++ b/src/p_lx_elf.cpp -@@ -2222,8 +2222,20 @@ bool PackLinuxElf32::canPack() - int z_rsz = dt_table[Elf32_Dyn::DT_RELSZ]; - if (z_rel && z_rsz) { - unsigned rel_off = get_te32(&dynseg[-1+ z_rel].d_val); -+ if ((unsigned)file_size <= rel_off) { -+ char msg[70]; snprintf(msg, sizeof(msg), -+ "bad Elf32_Dynamic[DT_REL] %#x\n", -+ rel_off); -+ throwCantPack(msg); -+ } - Elf32_Rel *rp = (Elf32_Rel *)&file_image[rel_off]; - unsigned relsz = get_te32(&dynseg[-1+ z_rsz].d_val); -+ if ((unsigned)file_size <= relsz) { -+ char msg[70]; snprintf(msg, sizeof(msg), -+ "bad Elf32_Dynamic[DT_RELSZ] %#x\n", -+ relsz); -+ throwCantPack(msg); -+ } - Elf32_Rel *last = (Elf32_Rel *)(relsz + (char *)rp); - for (; rp < last; ++rp) { - unsigned r_va = get_te32(&rp->r_offset); -@@ -2562,14 +2574,26 @@ PackLinuxElf64::canPack() - int z_rel = dt_table[Elf64_Dyn::DT_RELA]; - int z_rsz = dt_table[Elf64_Dyn::DT_RELASZ]; - if (z_rel && z_rsz) { -- unsigned rel_off = get_te64(&dynseg[-1+ z_rel].d_val); -+ upx_uint64_t rel_off = get_te64(&dynseg[-1+ z_rel].d_val); -+ if ((u64_t)file_size <= rel_off) { -+ char msg[70]; snprintf(msg, sizeof(msg), -+ "bad Elf64_Dynamic[DT_RELA] %#llx\n", -+ rel_off); -+ throwCantPack(msg); -+ } - Elf64_Rela *rp = (Elf64_Rela *)&file_image[rel_off]; -- unsigned relsz = get_te64(&dynseg[-1+ z_rsz].d_val); -+ upx_uint64_t relsz = get_te64(&dynseg[-1+ z_rsz].d_val); -+ if ((u64_t)file_size <= relsz) { -+ char msg[70]; snprintf(msg, sizeof(msg), -+ "bad Elf64_Dynamic[DT_RELASZ] %#llx\n", -+ relsz); -+ throwCantPack(msg); -+ } - Elf64_Rela *last = (Elf64_Rela *)(relsz + (char *)rp); - for (; rp < last; ++rp) { -- unsigned r_va = get_te64(&rp->r_offset); -+ upx_uint64_t r_va = get_te64(&rp->r_offset); - if (r_va == user_init_ava) { // found the Elf64_Rela -- unsigned r_info = get_te64(&rp->r_info); -+ upx_uint64_t r_info = get_te64(&rp->r_info); - unsigned r_type = ELF64_R_TYPE(r_info); - if (Elf64_Ehdr::EM_AARCH64 == e_machine - && R_AARCH64_RELATIVE == r_type) { -@@ -2581,7 +2605,7 @@ PackLinuxElf64::canPack() - } - else { - char msg[50]; snprintf(msg, sizeof(msg), -- "bad relocation %#x DT_INIT_ARRAY[0]", -+ "bad relocation %#llx DT_INIT_ARRAY[0]", - r_info); - throwCantPack(msg); - }