From b8c7370a682e4e29cda623222d17a790c01c3642 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 7 Aug 2024 12:37:21 +0100 Subject: gentoo auto-resync : 07:08:2024 - 12:37:20 --- dev-util/pahole/Manifest | 2 + ...hole-1.27-r1-fix-clang-btf-generation-bug.patch | 83 ++++++++++++++++++++++ dev-util/pahole/pahole-1.27-r1.ebuild | 79 ++++++++++++++++++++ 3 files changed, 164 insertions(+) create mode 100644 dev-util/pahole/files/pahole-1.27-r1-fix-clang-btf-generation-bug.patch create mode 100644 dev-util/pahole/pahole-1.27-r1.ebuild (limited to 'dev-util/pahole') diff --git a/dev-util/pahole/Manifest b/dev-util/pahole/Manifest index 560f2abe099c..062780b73f50 100644 --- a/dev-util/pahole/Manifest +++ b/dev-util/pahole/Manifest @@ -1,4 +1,5 @@ AUX pahole-1.10-python-import.patch 399 BLAKE2B 7abd98ec5711ec4ce9230a2d0bb06328174a4a67b62ba14b2413b83b6d44676d372930d4796b9ece230c4de9185d35cb31a086ca340871e50e29d584ab9a7487 SHA512 c2f5c1e99ef2ffeaf0e7962cbdf28817f6896b27ff6894571823c81ba08b9e9440af1a5b6ad82770b8e8d6ec99ec2ef8f46a98b67fea7cd4ed7e8c22e716e314 +AUX pahole-1.27-r1-fix-clang-btf-generation-bug.patch 4687 BLAKE2B 2aa919c78e1cf4372bd2e3fd7f6fa2264dc8893d16eacbfeb05d85de45397030ebb404ce52ecf84bb1f32a6c5764f855d4438c11945f3b7be23b763861f09e85 SHA512 ec8205f0a2aa9ca944cee8b370fddf9608dcaabf002a1c7f64042b865c9467485801dee78fc248c000cf803e521def777514f54173d2d44e0dbe9fcdd11fd54b DIST dwarves-1.24.tar.xz 875744 BLAKE2B 6766b5a5ecbf64013227e7cd459af662fc213f230b5b1279354fcaaccebfa3d74f9a2254542dc4f3f1bb4a5def1d4c77e2445fa8b531fa8b9e331cdfc23155fe SHA512 3cdca183cf68ec46fd9a0301ae4a8a30b23a8139c65ffba64ae11f85f9e942f7341dca6f88a4a3b49f32bfd880927193a80fa011726e4a33d3e5a1a146326c06 DIST dwarves-1.25.tar.xz 2244876 BLAKE2B 1926fa1fa123fc3ad0f7f063406260b1e1e2611c563fedebee4c837e491164571fdb40408421c0c4ea2fd24e89c54a7a1ea669313b6dd6d7dcfa4934e2c1336e SHA512 104bfb8712d863e04d0c827c008b23ebc49543b17bfb5b44ce276a5b3d39f12cf71f721055ae2e5f430aa77a3c70f85f6eeaf72fd8c1cdf547260488bc5b5070 DIST dwarves-1.26.tar.sign 228 BLAKE2B 211f73da11d6ed61383fc0470c298360e7acae5fbeb2f963533fd3a984257f35b5626f04de9de92326723f06bea95a38903cee7f602146b12b1333cea2b720d0 SHA512 2f92951019847cddbfe90cd0e49a5746ca4886e25a9f8e26697688bec25d667255556bdc1ab897021eaa739d067a8d3e4fbbd0d7c9f7f56934676616fa11bce8 @@ -10,6 +11,7 @@ EBUILD pahole-1.24_p20221024.ebuild 1692 BLAKE2B 06963686b5161a63841e5184603a6f1 EBUILD pahole-1.25.ebuild 1699 BLAKE2B cd5422b82887a43fdf49c0f402aeeda058bab76b53d575f736c8c88f27d43643d57bc35595d0a2b5857333bec75085f719be8fb34260a85eb401c4ce7debc242 SHA512 8292e2d7815dc49ad2b821b96f2d04976ef4c092b21532657e6ab5a8675096743b806ef10a989e225dcc6e0255ebac05866a00d5a3df8c83b6bce8a4b82e2379 EBUILD pahole-1.26-r1.ebuild 2115 BLAKE2B ff141cfe6b5acf9541d0a996e40bd1c35e22b6d06ed7fb2e1eba4c02714b16d603af6a469664700b89919f31ff6f941833b4459ee91c01e7643c218a9fe4befa SHA512 82e8d8e30348a8011b7dd49722f1f915fb969db4e10dd67113e0dbc91fc22434b1691f303bcf422e7aa7aba3f96e3d1d89b1ff7e649ae34282b7a6e310e60493 EBUILD pahole-1.26.ebuild 1698 BLAKE2B 48d80b80170687ffa9b91966deb9b1b8f7fb8d839799bcd4e2e1d96fa7cb92b842ea6fe2d5a8f9cdb6558e71fc0914857cb50ab615b399609a49ad40dd64fdb9 SHA512 9b1f28ac235b906327c452bd173087ab8102f0ebe3ec5a9f305f19e9114b89d8a99c58acc094512c4342768c576dbfeb00b69ead274411121ad25b5058baeb66 +EBUILD pahole-1.27-r1.ebuild 2179 BLAKE2B be5b357c36bfb3c352e37d603cecd115022f53277c20c17536eb4a526b0e820f4a8ea39b30f42d64a25865becd9f72113e15989148bac1d4e993b65f95857f99 SHA512 a243a7b2e1d10457bc958f9f32d6e0762ea8d6275c015562c79bbed63389121b41d21e74db1ba659c3e67ab3e7bc4d0fedfe15ac06e2f60d9ceca887d68b754c EBUILD pahole-1.27.ebuild 2115 BLAKE2B ff141cfe6b5acf9541d0a996e40bd1c35e22b6d06ed7fb2e1eba4c02714b16d603af6a469664700b89919f31ff6f941833b4459ee91c01e7643c218a9fe4befa SHA512 82e8d8e30348a8011b7dd49722f1f915fb969db4e10dd67113e0dbc91fc22434b1691f303bcf422e7aa7aba3f96e3d1d89b1ff7e649ae34282b7a6e310e60493 EBUILD pahole-9999.ebuild 2115 BLAKE2B ff141cfe6b5acf9541d0a996e40bd1c35e22b6d06ed7fb2e1eba4c02714b16d603af6a469664700b89919f31ff6f941833b4459ee91c01e7643c218a9fe4befa SHA512 82e8d8e30348a8011b7dd49722f1f915fb969db4e10dd67113e0dbc91fc22434b1691f303bcf422e7aa7aba3f96e3d1d89b1ff7e649ae34282b7a6e310e60493 MISC metadata.xml 671 BLAKE2B 02f5850fd69e3eda9a616d312232cdfbda1b557c56c9f802edd5a79e4e231ebddae57d50fbe44ca595d06b86da9c1f72a1dc516245c3525d73be46accffa0944 SHA512 7877a56f0879df1b6550bd6dc576a69ce5cc5a26e34e18d403cfa0c6cb5a9279c0ff6a11c56a7990de8255a55b67687755be0df62c6ff247b2b35f2e3df30235 diff --git a/dev-util/pahole/files/pahole-1.27-r1-fix-clang-btf-generation-bug.patch b/dev-util/pahole/files/pahole-1.27-r1-fix-clang-btf-generation-bug.patch new file mode 100644 index 000000000000..ab740729ac6b --- /dev/null +++ b/dev-util/pahole/files/pahole-1.27-r1-fix-clang-btf-generation-bug.patch @@ -0,0 +1,83 @@ +From 6a2b27c0f512619b0e7a769a18a0fb05bb3789a5 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Tue, 18 Jun 2024 10:37:30 -0300 +Subject: [PATCH] core: Initialize cu->node with INIT_LIST_HEAD() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In cu__new() zalloc() is used defensively, and that helped catch this +problem where we assume that a cu us in the cus list of cu instances, +but that is not the case when we use cus__merge_and_process_cu(), for +instance when loading files created by clang with LTO, as reported by +Peter Jung and narrowed down by Nathan Chancellor. + +If we use INIT_LIST_HEAD() in cu__new() to initialize cu->node, which is +what we do with other lists and nodes there, then the unconditional +removal using list_del_init() will be a no-op and removing something not +on the cus list of cu instances will not cause problems, just keep an +unconsistent cus->nr_entries field. + +So lets just have this fix in first, keeping Nathan's Tested-by and then +do the a bit more involved fix of either adding that cu to the cus list +or checking at removal time if it is there. + + Program received signal SIGSEGV, Segmentation fault. + 0x00007ffff7f1e13e in __list_del (prev=0x0, next=0x0) at /home/acme/git/pahole/list.h:106 + 106 next->prev = prev; + (gdb) bt + #0 0x00007ffff7f1e13e in __list_del (prev=0x0, next=0x0) at /home/acme/git/pahole/list.h:106 + #1 0x00007ffff7f1e176 in list_del_init (entry=0x417980) at /home/acme/git/pahole/list.h:165 + #2 0x00007ffff7f1f8f9 in __cus__remove (cus=0x4142a0, cu=0x417980) at /home/acme/git/pahole/dwarves.c:527 + #3 0x00007ffff7f1f92b in cus__remove (cus=0x4142a0, cu=0x417980) at /home/acme/git/pahole/dwarves.c:533 + #4 0x00007ffff7f3d01c in cus__finalize (cus=0x4142a0, cu=0x417980, conf=0x4133c0 , thr_data=0x0) + at /home/acme/git/pahole/dwarf_loader.c:3040 + #5 0x00007ffff7f3e05c in cus__merge_and_process_cu (cus=0x4142a0, conf=0x4133c0 , mod=0x415cf0, dw=0x416110, elf=0x414380, + filename=0x7fffffffe3f7 "cast_common.ko", build_id=0x416680 "\265D\371U\213\373u|\037\250\242\032\271\365⒜]y\023", build_id_len=20, + type_dcu=0x0) at /home/acme/git/pahole/dwarf_loader.c:3482 + #6 0x00007ffff7f3e218 in cus__load_module (cus=0x4142a0, conf=0x4133c0 , mod=0x415cf0, dw=0x416110, elf=0x414380, + filename=0x7fffffffe3f7 "cast_common.ko") at /home/acme/git/pahole/dwarf_loader.c:3521 + #7 0x00007ffff7f3e396 in cus__process_dwflmod (dwflmod=0x415cf0, userdata=0x415d00, name=0x415ea0 "cast_common.ko", base=65536, + arg=0x7fffffffde40) at /home/acme/git/pahole/dwarf_loader.c:3581 + #8 0x00007ffff7eb4609 in dwfl_getmodules (dwfl=0x414300, callback=0x7ffff7f3e2ec , arg=0x7fffffffde40, offset=0) + at ../libdwfl/dwfl_getmodules.c:86 + #9 0x00007ffff7f3e4c5 in cus__process_file (cus=0x4142a0, conf=0x4133c0 , fd=3, filename=0x7fffffffe3f7 "cast_common.ko") + at /home/acme/git/pahole/dwarf_loader.c:3647 + #10 0x00007ffff7f3e5cd in dwarf__load_file (cus=0x4142a0, conf=0x4133c0 , filename=0x7fffffffe3f7 "cast_common.ko") + at /home/acme/git/pahole/dwarf_loader.c:3684 + #11 0x00007ffff7f232df in cus__load_file (cus=0x4142a0, conf=0x4133c0 , filename=0x7fffffffe3f7 "cast_common.ko") + at /home/acme/git/pahole/dwarves.c:2134 + #12 0x00007ffff7f23e8b in cus__load_files (cus=0x4142a0, conf=0x4133c0 , filenames=0x7fffffffe0f0) + at /home/acme/git/pahole/dwarves.c:2637 + #13 0x000000000040aec0 in main (argc=2, argv=0x7fffffffe0e8) at /home/acme/git/pahole/pahole.c:3805 + (gdb) fr 1 + #1 0x00007ffff7f1e176 in list_del_init (entry=0x417980) at /home/acme/git/pahole/list.h:165 + 165 __list_del(entry->prev, entry->next); + (gdb) p entry + $1 = (struct list_head *) 0x417980 + (gdb) p entry->next + $2 = (struct list_head *) 0x0 + (gdb) p entry->prev + $3 = (struct list_head *) 0x0 + +Closes: https://github.com/acmel/dwarves/issues/53 +Closes: https://gitlab.archlinux.org/archlinux/packaging/packages/pahole/-/issues/1 +Tested-by: Nathan Chancellor +Link: https://lore.kernel.org/all/20240617210810.GA1877676@thelio-3990X +Signed-off-by: Arnaldo Carvalho de Melo +--- + dwarves.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/dwarves.c b/dwarves.c +index 1ec259f5..823a0152 100644 +--- a/dwarves.c ++++ b/dwarves.c +@@ -739,6 +739,7 @@ struct cu *cu__new(const char *name, uint8_t addr_size, + cu->dfops = NULL; + INIT_LIST_HEAD(&cu->tags); + INIT_LIST_HEAD(&cu->tool_list); ++ INIT_LIST_HEAD(&cu->node); + + cu->addr_size = addr_size; + cu->extra_dbg_info = 0; diff --git a/dev-util/pahole/pahole-1.27-r1.ebuild b/dev-util/pahole/pahole-1.27-r1.ebuild new file mode 100644 index 000000000000..97e2e021ecf9 --- /dev/null +++ b/dev-util/pahole/pahole-1.27-r1.ebuild @@ -0,0 +1,79 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{9..12} ) +inherit cmake python-single-r1 + +MY_PN=dwarves +MY_P=${MY_PN}-${PV%%_p*} + +DESCRIPTION="pahole (Poke-a-Hole) and other DWARF utilities" +HOMEPAGE="https://git.kernel.org/cgit/devel/pahole/pahole.git/" + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://git.kernel.org/pub/scm/devel/pahole/pahole.git" + inherit git-r3 +else + VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/arnaldocarvalhodemelo.asc + inherit verify-sig + SRC_URI="http://fedorapeople.org/~acme/${MY_PN}/${MY_P}.tar.xz + verify-sig? ( http://fedorapeople.org/~acme/${MY_PN}/${MY_P}.tar.sign )" + if [[ ${PV} == *_p* ]] ; then + # Patch rollups from git format-patch. Sometimes there are important + # fixes in git which haven't been released (and no release in sight). + # Patch rollups are a bit better for understanding where changes have + # come from for users. + SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-patches.tar.xz" + fi + S="${WORKDIR}"/${MY_P} + BDEPEND="verify-sig? ( sec-keys/openpgp-keys-arnaldocarvalhodemelo )" + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86" +fi + +LICENSE="GPL-2" # only +SLOT="0" +IUSE="debug" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +RDEPEND="${PYTHON_DEPS} + >=dev-libs/elfutils-0.178 + sys-libs/zlib" +DEPEND="${RDEPEND}" + +DOCS=( README README.ctracer NEWS ) + +PATCHES=( + "${FILESDIR}/${PN}-1.10-python-import.patch" + "${FILESDIR}/${PN}-1.27-r1-fix-clang-btf-generation-bug.patch" +) + +src_unpack() { + if [[ ${PV} == 9999 ]] ; then + git-r3_src_unpack + return + fi + + # Upstream sign the decompressed .tar + if use verify-sig; then + einfo "Unpacking ${MY_P}.tar.xz ..." + verify-sig_verify_detached - "${DISTDIR}"/${MY_P}.tar.sign \ + < <(xz -cd "${DISTDIR}"/${MY_P}.tar.xz | tee >(tar -x)) + assert "Unpack failed" + else + default + fi +} + +src_prepare() { + [[ -d "${WORKDIR}"/${P}-patches ]] && PATCHES+=( "${WORKDIR}"/${P}-patches ) + + cmake_src_prepare + python_fix_shebang ostra/ostra-cg ostra/python/ostra.py +} + +src_configure() { + local mycmakeargs=( "-D__LIB=$(get_libdir)" ) + cmake_src_configure +} -- cgit v1.2.3