From nobody Wed Sep 20 10:41:38 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RrFSy5PgNz4tTZN; Wed, 20 Sep 2023 10:41:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RrFSy4mkYz4Z3k; Wed, 20 Sep 2023 10:41:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695206498; h=from:from: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; bh=NbsCbebbrM1NQwuG9qEJb3C/IW1aqSTxUazYsFYNYqw=; b=msUoaIgBXVceKeh2y87A0xX3PW+Lqq+YhJfv2qxKzgwnmq2DNXJ9HJhgMlFJ4ZOsMpzgrR jMwOU8EwEqHF7Cb0lRDmjEO5IaZRH8zSIKbqho8vbgRK5jpQq/huNQJi0lXkUa+T21ldMb y4LnMhTyxO23JkUpiqxgcQq0fnCncwoAsyDelevS7wtM70i/smGYcoOk5VuFgZw8wg2ORx T7OCamKYjga7MNBLHRtVtpJqVWAqxCeXtRoE4nlkis/fCTh/yi7B/h3MSioR3D9EpI+cFJ 7/VBVfgoJ1itMwI+saBIb+2nvV8esZsLPmCk0l9CIO/OiTZhFzTY6jvP/greVw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695206498; a=rsa-sha256; cv=none; b=nfswfBxwoUgqYS4ay6QMjYB2iM1tChioQ4RyMZxI1Bbqe8lgUQs4Xn9qM2hxeuRY92bsGU xl8Fk+DQJGXSKYtt9Sn/Y22IZpUzPH1N5NZC6BrRfm1MOZl90YD99EWURJKIAyO8smx3h4 Uz4PGeMEg/zbnRZRc/BwaTrWIU1NY7EYgPxMbqs4sijzQeFqfdxfZzvWZ5o66ADbbYrNcJ DbNjXINkrDT/ZLZ1yr5eF4A+ezmbjY1jinRPXpI7tprsprz+EpYgmA2fP4QXGlTz1dq5kL IlYnxzZxN31KKNbR1MK32yyUh0czA8aA9cDSeotRxZFL2CSbhn4j/UBYhhMzAw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695206498; h=from:from: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; bh=NbsCbebbrM1NQwuG9qEJb3C/IW1aqSTxUazYsFYNYqw=; b=ZN5Bw+o0FIgnNiLO1Y+4DNCUf9O/QMLRqmqYfWtVctdXmYrYu1z5qDXRde6KX5Ppm5/u6p RRacJU2MAYwbgCxm2TtqIdeMwvDf58mth1IEz2QeCVpAHMdR+taqenoD6SlLNDTcV47cYu KCU6kiqJpMO2c//QE3FdQ53Jxxl97NzLLMewNoGGZ7XnLDy2RdN+23Qq/N60yy/B9+rdcA dnxGbF1BeZ1hsaLM8xawIJRI/Wjuk7fUE7EDPQrgRMbRfc872ZH2d6u9LfeyjYwamkV4Yy F+4GWPlFKWCRgMdlIPuJoBlilGArncl4NKA4/V+NThAQ37spL03rQYSH3vXunQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RrFSy3t4BzsxL; Wed, 20 Sep 2023 10:41:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38KAfcAD015375; Wed, 20 Sep 2023 10:41:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38KAfcoH015368; Wed, 20 Sep 2023 10:41:38 GMT (envelope-from git) Date: Wed, 20 Sep 2023 10:41:38 GMT Message-Id: <202309201041.38KAfcoH015368@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Ganael LAPLANCHE Subject: git: 35f73836d156 - main - comms/gnuradio: Fix crash with GNU Radio buffers List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: martymac X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35f73836d156fc5bcec6eb9d8d3cd60c81c453af Auto-Submitted: auto-generated The branch main has been updated by martymac: URL: https://cgit.FreeBSD.org/ports/commit/?id=35f73836d156fc5bcec6eb9d8d3cd60c81c453af commit 35f73836d156fc5bcec6eb9d8d3cd60c81c453af Author: Ganael LAPLANCHE AuthorDate: 2023-09-20 10:28:48 +0000 Commit: Ganael LAPLANCHE CommitDate: 2023-09-20 10:28:48 +0000 comms/gnuradio: Fix crash with GNU Radio buffers This patch is a backport of ca44241 from upstream: runtime: Use MAP_FIXED flag to ensure buffer halves are contiguous It fixes SIGSEGV observed with GNU Radio buffers consumers such as comms/gqrx. Discussed here: https://github.com/gqrx-sdr/gqrx/issues/1275 https://github.com/gnuradio/gnuradio/pull/6854 PR: 272543 Reported by: trasz Obtained from: GNU Radio team (GH pull request: 6854) MFH: 2023Q3 --- comms/gnuradio/Makefile | 2 +- ...gnuradio-runtime-lib-vmcircbuf_mmap_shm_open.cc | 28 ++++++++++++++ ...-gnuradio-runtime-lib-vmcircbuf_mmap_tmpfile.cc | 44 ++++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) diff --git a/comms/gnuradio/Makefile b/comms/gnuradio/Makefile index 95c946d062b5..314148e6f64a 100644 --- a/comms/gnuradio/Makefile +++ b/comms/gnuradio/Makefile @@ -1,7 +1,7 @@ PORTNAME= gnuradio DISTVERSIONPREFIX= v DISTVERSION= 3.8.4.0 -PORTREVISION= 11 +PORTREVISION= 12 CATEGORIES= comms astro hamradio MAINTAINER= hamradio@FreeBSD.org diff --git a/comms/gnuradio/files/patch-gnuradio-runtime-lib-vmcircbuf_mmap_shm_open.cc b/comms/gnuradio/files/patch-gnuradio-runtime-lib-vmcircbuf_mmap_shm_open.cc new file mode 100644 index 000000000000..efec2bb34ad1 --- /dev/null +++ b/comms/gnuradio/files/patch-gnuradio-runtime-lib-vmcircbuf_mmap_shm_open.cc @@ -0,0 +1,28 @@ +Use MAP_FIXED flag to ensure buffer halves are contiguous + +(backport of ca44241) + +--- gnuradio-runtime/lib/vmcircbuf_mmap_shm_open.cc.orig 2021-09-30 14:10:55 UTC ++++ gnuradio-runtime/lib/vmcircbuf_mmap_shm_open.cc +@@ -122,19 +122,11 @@ vmcircbuf_mmap_shm_open::vmcircbuf_mmap_shm_open(int s + throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); + } + +- // unmap the 2nd half +- if (munmap((char*)first_copy + size, size) == -1) { +- close(shm_fd); // cleanup +- perror("gr::vmcircbuf_mmap_shm_open: munmap (1)"); +- throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); +- } +- +- // map the first half into the now available hole where the +- // second half used to be. ++ // map the first half into the second half of the address space. + void* second_copy = mmap((char*)first_copy + size, + size, + PROT_READ | PROT_WRITE, +- MAP_SHARED, ++ MAP_SHARED | MAP_FIXED, + shm_fd, + (off_t)0); + diff --git a/comms/gnuradio/files/patch-gnuradio-runtime-lib-vmcircbuf_mmap_tmpfile.cc b/comms/gnuradio/files/patch-gnuradio-runtime-lib-vmcircbuf_mmap_tmpfile.cc new file mode 100644 index 000000000000..a3bb6811815c --- /dev/null +++ b/comms/gnuradio/files/patch-gnuradio-runtime-lib-vmcircbuf_mmap_tmpfile.cc @@ -0,0 +1,44 @@ +Use MAP_FIXED flag to ensure buffer halves are contiguous + +(backport of ca44241) + +--- gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc.orig 2021-09-30 14:10:55 UTC ++++ gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc +@@ -107,19 +107,11 @@ vmcircbuf_mmap_tmpfile::vmcircbuf_mmap_tmpfile(int siz + throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); + } + +- // unmap the 2nd half +- if (munmap((char*)first_copy + size, size) == -1) { +- close(seg_fd); // cleanup +- perror("gr::vmcircbuf_mmap_tmpfile: munmap (1)"); +- throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); +- } +- +- // map the first half into the now available hole where the +- // second half used to be. ++ // map the first half into the second half of the address space. + void* second_copy = mmap((char*)first_copy + size, + size, + PROT_READ | PROT_WRITE, +- MAP_SHARED, ++ MAP_SHARED | MAP_FIXED, + seg_fd, + (off_t)0); + +@@ -127,15 +119,6 @@ vmcircbuf_mmap_tmpfile::vmcircbuf_mmap_tmpfile(int siz + munmap(first_copy, size); // cleanup + close(seg_fd); + perror("gr::vmcircbuf_mmap_tmpfile: mmap(2)"); +- throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); +- } +- +- // check for contiguity +- if ((char*)second_copy != (char*)first_copy + size) { +- munmap(first_copy, size); // cleanup +- munmap(second_copy, size); +- close(seg_fd); +- perror("gr::vmcircbuf_mmap_tmpfile: non-contiguous second copy"); + throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); + } +