You are not logged in.
Hello so when I updated something in my system a few weeks ago I noticed a segmentation fault error in journalctl everytime I would exit a game.
The few games seem to run just fine but I guess are crashing when exiting?
I decided to downgrade and I wasn't experiencing the error anymore, I'm not sure which package though. I did save a list of both updates. Also the command I used to downgrade.
I just decided to update and retry and the errors are back again.
At first I thought it might be nvidia packages, but downgrading them didn't help.
Heres the full journalctl -b https://pastebin.com/shW0E6tD
Oct 19 02:50:51 archlinux kernel: lsb_release[3328]: segfault at 0 ip 00007f26954ad6f4 sp 00007fff7ee97180 error 4 in libnvidia-glvkspirv.so.535.113.01[7f2694400000+2038000] likely on CPU 6 (core 0, socket 0)
Oct 19 02:50:51 archlinux kernel: Code: 00 00 00 00 00 90 53 48 8b 1f 48 89 df e8 74 38 0d ff 48 89 df 5b e9 2b 39 0d ff 66 2e 0f 1f 84 00 00 00 00 00 90 48 83 ec 08 <48> 8b 3f e8 94 3a 0d ff 85 c0 0f 94 c0 48 83 c4 08 c3 66 2e 0f 1f
Oct 19 02:50:51 archlinux systemd[1]: Created slice Slice /system/systemd-coredump.
Oct 19 02:50:51 archlinux systemd[1]: Started Process Core Dump (PID 3331/UID 0).
Oct 19 02:50:51 archlinux systemd-coredump[3332]: Process 3328 (lsb_release) of user 1000 dumped core.
Stack trace of thread 3328:
#0 0x00007f26954ad6f4 n/a (libnvidia-glvkspirv.so.535.113.01 + 0x10ad6f4)
#1 0x00007f26954ac7d2 n/a (libnvidia-glvkspirv.so.535.113.01 + 0x10ac7d2)
#2 0x00007f269544ef66 n/a (libnvidia-glvkspirv.so.535.113.01 + 0x104ef66)
#3 0x00007f26957649ef n/a (libnvidia-glvkspirv.so.535.113.01 + 0x13649ef)
#4 0x00007f26983481e2 n/a (libnvidia-glcore.so.535.113.01 + 0x15481e2)
#5 0x00007f269a016ba1 n/a (libGLX_nvidia.so.0 + 0x83ba1)
#6 0x00007f269a016fbd n/a (libGLX_nvidia.so.0 + 0x83fbd)
#7 0x00007f269a017194 n/a (libGLX_nvidia.so.0 + 0x84194)
#8 0x00007f269831510e n/a (libnvidia-glcore.so.535.113.01 + 0x151510e)
#9 0x00007f2699fe475b n/a (libGLX_nvidia.so.0 + 0x5175b)
#10 0x00007f2699fe4f3f n/a (libGLX_nvidia.so.0 + 0x51f3f)
#11 0x00007f269a073009 n/a (libGLX_nvidia.so.0 + 0xe0009)
ELF object binary architecture: AMD x86-64
Oct 19 02:50:51 archlinux systemd[1]: systemd-coredump@0-3331-0.service: Deactivated successfully.
Last edited by Dotslash (2023-11-07 22:37:18)
Offline
Your issues start here:
Oct 19 02:47:26 archlinux kernel: ------------[ cut here ]------------
Oct 19 02:47:26 archlinux kernel: Unhandled error in __nv_drm_gem_user_memory_handle_vma_fault: -22
Oct 19 02:47:26 archlinux kernel: WARNING: CPU: 0 PID: 643 at /build/nvidia/src/nvidia/535.113.01/build/nvidia-drm/nvidia-drm-gem-user-memory.c:130 __nv_drm_gem_user_memory_handle_vma_fault+0x92/0xa0 [nvidia_drm]
Oct 19 02:47:26 archlinux kernel: Modules linked in: snd_seq_dummy snd_hrtimer snd_seq snd_seq_device ccm algif_aead crypto_null cbc des_generic libdes ecb algif_skcipher cmac md4 algif_hash af_alg ip6t_REJECT nf_reject_ipv6 xt_hl ip6t_rt ipt_REJECT nf_reject_ipv4 xt_LOG nf_log_syslog xt_limit xt_addrtype xt_tcpudp xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c ip6table_filter ip6_tables iptable_filter nvidia_drm(POE) nvidia_modeset(POE) pkcs8_key_parser nvidia_uvm(POE) intel_rapl_msr intel_rapl_common intel_tcc_cooling x86_pkg_temp_thermal snd_soc_avs intel_powerclamp snd_soc_hda_codec snd_hda_ext_core ath9k snd_soc_core coretemp snd_hda_codec_realtek ath9k_common crct10dif_pclmul vfat crc32_pclmul snd_compress snd_hda_codec_generic snd_hda_codec_hdmi polyval_clmulni fat ath9k_hw ac97_bus polyval_generic ath snd_pcm_dmaengine gf128mul mousedev nvidia(POE) joydev snd_hda_intel ghash_clmulni_intel snd_intel_dspcfg sha512_ssse3 aesni_intel mac80211 snd_intel_sdw_acpi crypto_simd snd_hda_codec cryptd rapl eeepc_wmi
Oct 19 02:47:26 archlinux kernel: snd_hda_core libarc4 asus_wmi snd_hwdep ledtrig_audio intel_cstate iTCO_wdt snd_pcm intel_pmc_bxt sparse_keymap mei_pxp mei_hdcp ee1004 wmi_bmof iTCO_vendor_support platform_profile mxm_wmi cfg80211 intel_uncore snd_timer video mei_me snd usbhid i2c_i801 e1000e pcspkr i2c_smbus rfkill mei soundcore wmi acpi_pad mac_hid fuse dm_mod loop zram ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 nvme nvme_core xhci_pci crc32c_intel nvme_common xhci_pci_renesas
Oct 19 02:47:26 archlinux kernel: CPU: 0 PID: 643 Comm: Xorg Tainted: P OE 6.5.7-arch1-1 #1 0f5c742c3372ed589b7098a21a0ff406fc2e7c9c
Oct 19 02:47:26 archlinux kernel: Hardware name: ASUS System Product Name/ROG STRIX Z370-H GAMING, BIOS 2701 07/13/2021
Oct 19 02:47:26 archlinux kernel: RIP: 0010:__nv_drm_gem_user_memory_handle_vma_fault+0x92/0xa0 [nvidia_drm]
Oct 19 02:47:26 archlinux kernel: Code: ba 00 01 00 00 89 d0 c3 cc cc cc cc 0f 0b 89 c2 48 c7 c6 80 29 c6 c0 48 c7 c7 e4 2c c6 c0 c6 05 9b 30 00 00 01 e8 8e cc 33 f3 <0f> 0b eb c6 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90
Oct 19 02:47:26 archlinux kernel: RSP: 0018:ffffab53023bf9a8 EFLAGS: 00010282
Oct 19 02:47:26 archlinux kernel: RAX: 0000000000000000 RBX: ffffab53023bfa28 RCX: 0000000000000027
Oct 19 02:47:26 archlinux kernel: RDX: ffff8bf85ea216c8 RSI: 0000000000000001 RDI: ffff8bf85ea216c0
Oct 19 02:47:26 archlinux kernel: RBP: ffff8bf58a122e40 R08: 0000000000000000 R09: ffffab53023bf838
Oct 19 02:47:26 archlinux kernel: R10: 0000000000000003 R11: ffffffffb5aca068 R12: 0000000000000001
Oct 19 02:47:26 archlinux kernel: R13: 0000000000000e10 R14: 000000012b0bc067 R15: ffff8bf51f12e3d0
Oct 19 02:47:26 archlinux kernel: FS: 00007f1ebf086480(0000) GS:ffff8bf85ea00000(0000) knlGS:0000000000000000
Oct 19 02:47:26 archlinux kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Oct 19 02:47:26 archlinux kernel: CR2: 00007ffe573e3ed8 CR3: 0000000101e5a005 CR4: 00000000003706f0
Oct 19 02:47:26 archlinux kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Oct 19 02:47:26 archlinux kernel: DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Oct 19 02:47:26 archlinux kernel: Call Trace:
Oct 19 02:47:26 archlinux kernel: <TASK>
Oct 19 02:47:26 archlinux kernel: ? __nv_drm_gem_user_memory_handle_vma_fault+0x92/0xa0 [nvidia_drm ba86f39a23ad170c161efc949af1b48d8b437bf9]
Oct 19 02:47:26 archlinux kernel: ? __warn+0x81/0x130
Oct 19 02:47:26 archlinux kernel: ? __nv_drm_gem_user_memory_handle_vma_fault+0x92/0xa0 [nvidia_drm ba86f39a23ad170c161efc949af1b48d8b437bf9]
Oct 19 02:47:26 archlinux kernel: ? report_bug+0x171/0x1a0
Oct 19 02:47:26 archlinux kernel: ? prb_read_valid+0x1b/0x30
Oct 19 02:47:26 archlinux kernel: ? handle_bug+0x3c/0x80
Oct 19 02:47:26 archlinux kernel: ? exc_invalid_op+0x17/0x70
Oct 19 02:47:26 archlinux kernel: ? asm_exc_invalid_op+0x1a/0x20
Oct 19 02:47:26 archlinux kernel: ? __nv_drm_gem_user_memory_handle_vma_fault+0x92/0xa0 [nvidia_drm ba86f39a23ad170c161efc949af1b48d8b437bf9]
Oct 19 02:47:26 archlinux kernel: ? __nv_drm_gem_user_memory_handle_vma_fault+0x92/0xa0 [nvidia_drm ba86f39a23ad170c161efc949af1b48d8b437bf9]
Oct 19 02:47:26 archlinux kernel: __do_fault+0x30/0x130
Oct 19 02:47:26 archlinux kernel: do_fault+0xdd/0x3d0
Oct 19 02:47:26 archlinux kernel: __handle_mm_fault+0x65b/0xbb0
Oct 19 02:47:26 archlinux kernel: handle_mm_fault+0x155/0x350
Oct 19 02:47:26 archlinux kernel: __get_user_pages+0x1ed/0x620
Oct 19 02:47:26 archlinux kernel: __gup_longterm_locked+0xbe/0xc50
Oct 19 02:47:26 archlinux kernel: ? os_alloc_mem+0xc8/0xe0 [nvidia d717e9310c707cc635c855338d8aac5b07aa3d66]
Oct 19 02:47:26 archlinux kernel: pin_user_pages+0x7a/0xb0
Oct 19 02:47:26 archlinux kernel: os_lock_user_pages+0xc6/0x1b0 [nvidia d717e9310c707cc635c855338d8aac5b07aa3d66]
Oct 19 02:47:26 archlinux kernel: _nv000649rm+0x67/0x160 [nvidia d717e9310c707cc635c855338d8aac5b07aa3d66]
Oct 19 02:47:26 archlinux kernel: _nv000715rm+0xa71/0xe70 [nvidia d717e9310c707cc635c855338d8aac5b07aa3d66]
Oct 19 02:47:26 archlinux kernel: rm_ioctl+0x58/0xb0 [nvidia d717e9310c707cc635c855338d8aac5b07aa3d66]
Oct 19 02:47:26 archlinux kernel: nvidia_ioctl+0x5d8/0x880 [nvidia d717e9310c707cc635c855338d8aac5b07aa3d66]
Oct 19 02:47:26 archlinux kernel: nvidia_frontend_unlocked_ioctl+0x3c/0x60 [nvidia d717e9310c707cc635c855338d8aac5b07aa3d66]
Oct 19 02:47:26 archlinux kernel: __x64_sys_ioctl+0x94/0xd0
Oct 19 02:47:26 archlinux kernel: do_syscall_64+0x5d/0x90
Oct 19 02:47:26 archlinux kernel: ? syscall_exit_to_user_mode+0x2b/0x40
Oct 19 02:47:26 archlinux kernel: ? do_syscall_64+0x6c/0x90
Oct 19 02:47:26 archlinux kernel: ? __x64_sys_ioctl+0xaf/0xd0
Oct 19 02:47:26 archlinux kernel: ? syscall_exit_to_user_mode+0x2b/0x40
Oct 19 02:47:26 archlinux kernel: ? do_syscall_64+0x6c/0x90
Oct 19 02:47:26 archlinux kernel: ? syscall_exit_to_user_mode+0x2b/0x40
Oct 19 02:47:26 archlinux kernel: ? do_syscall_64+0x6c/0x90
Oct 19 02:47:26 archlinux kernel: ? do_syscall_64+0x6c/0x90
Oct 19 02:47:26 archlinux kernel: ? do_syscall_64+0x6c/0x90
Oct 19 02:47:26 archlinux kernel: entry_SYSCALL_64_after_hwframe+0x6e/0xd8
Oct 19 02:47:26 archlinux kernel: RIP: 0033:0x7f1ebfa743af
Oct 19 02:47:26 archlinux kernel: Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 18 48 8b 44 24 18 64 48 2b 04 25 28 00 00
Oct 19 02:47:26 archlinux kernel: RSP: 002b:00007ffe573f6b20 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
Oct 19 02:47:26 archlinux kernel: RAX: ffffffffffffffda RBX: 00000000000000b8 RCX: 00007f1ebfa743af
Oct 19 02:47:26 archlinux kernel: RDX: 00007ffe573f6d20 RSI: 00000000c0b8464a RDI: 000000000000000f
Oct 19 02:47:26 archlinux kernel: RBP: 00007ffe573f6d20 R08: 00007ffe573f6d20 R09: 00007ffe573f6d34
Oct 19 02:47:26 archlinux kernel: R10: 0000000000000001 R11: 0000000000000246 R12: 000000000000000f
Oct 19 02:47:26 archlinux kernel: R13: 00007ffe573f6b80 R14: 00000000c0b8464a R15: 000000000000004a
Oct 19 02:47:26 archlinux kernel: </TASK>
Oct 19 02:47:26 archlinux kernel: ---[ end trace 0000000000000000 ]---
What leads up to a lot of
Oct 19 02:48:06 archlinux kernel: Cannot map memory with base addr 0x7f1e5b817000 and size of 0x7e9 pages
Downgrading nvidia in isolation won't work - did you try the LTS kernel and nvidia-lts?
Offline
I've never tried the lts kernel and driver, how do I go out swapping?
Offline
Just installing linux-lts and nvidia-lts should do, you'll have to add them to your bootloader (typically by re-configuring that w/ eg. grub-mkconfig)
Offline
Please explain the re-configuring that w/ eg. grub-mkconfig, the grub wiki page is a bit overwhelming.
I see the message about running grub-install, but never figured out how to do that.
I did it once but broke the system I had to use a liveusb to fix and don't remember how I fixed it exactly.
Nevermind I figured out how to swap.
Last edited by Dotslash (2023-10-19 17:49:44)
Offline
So both errors still showing up while on lts.
I want to mention that the nvidia error stuff and the Cannot map memory with base addr has been happening every time I run steam and was showing up on a previous ssd that I had to replace.
Offline
https://forums.developer.nvidia.com/t/l … ult/268901
https://www.reddit.com/r/linux_gaming/c … r_freezes/
I searched the error w/o the version and that's two out of three results, last one apparently a HW defect over a year ago.
535.113.01 was added to the repos 9/22
You could try to downgrade to 535.104.05 (nvidia-utils, probably lib32-nvidia-utils and nvidia-dkms) from the ALA
https://archive.archlinux.org/packages/n/nvidia-dkms/
https://archive.archlinux.org/packages/n/nvidia-utils/
https://archive.archlinux.org/packages/ … dia-utils/
Offline
Yeah thanks I made a reply on that nvidia forum.
As far as downgrading to at least fix that top error that didn't seem to work.
sudo pacman -U nvidia-utils-535.104.05-1-x86_64.pkg.tar.zst libxnvctrl-535.104.05-1-x86_64.pkg.tar.zst linux-6.5.4.arch2-1-x86_64.pkg.tar.zst nvidia-535.104.05-7-x86_64.pkg.tar.zst nvidia-settings-535.104.05-1-x86_64.pkg.tar.zst lib32-nvidia-utils-535.104.05-1-x86_64.pkg.tar.zst
but one of these did or maybe a combo of both?
sudo pacman -U glibc-2.38-3-x86_64.pkg.tar.zst brotli-1.0.9-12-x86_64.pkg.tar.zst cairo-1.17.8-2-x86_64.pkg.tar.zst gettext-0.22-1-x86_64.pkg.tar.zst imlib2-1.12.0-1-x86_64.pkg.tar.zst kbd-2.6.2-1-x86_64.pkg.tar.zst lib32-glibc-2.38-3-x86_64.pkg.tar.zst systemd-libs-254.4-1-x86_64.pkg.tar.zst shadow-4.14.0-3-x86_64.pkg.tar.zst systemd-254.4-1-x86_64.pkg.tar.zst lsof-4.98.0-1-x86_64.pkg.tar.zst mpg123-1.32.0-1-x86_64.pkg.tar.zst pinentry-1.2.1-1-x86_64.pkg.tar.zst systemd-sysvcompat-254.4-1-x86_64.pkg.tar.zst udisks2-2.10.1-1-x86_64.pkg.tar.zst gperftools-2.12-1-x86_64.pkg.tar.zst man-db-2.11.2-1-x86_64.pkg.tar.zst openexr-3.2.0-2-x86_64.pkg.tar.zst lib32-systemd-254.4-1-x86_64.pkg.tar.zst
I did this the last time it showed up around sep 28.
I waited a few weeks and then tried updating hoping it was fixed but its back.
I wonder if one set of errors is because of the age of the card, it is a GTX 970. Either because of the drivers working differently on this line of card or because its wearing out.
Last edited by Dotslash (2023-10-19 20:58:44)
Offline
Is the breaking version glibc-2.38-5?
https://gitlab.archlinux.org/archlinux/ … f2c138dd1a
Offline
glibc 2.38-3 -> 2.38-4 is when it first happened. I did see one of the updates (the memory one) which made me think it was fixed, but i'm still getting the error. I wonder if I can downgrade glibc back to 2.38-3.
Do you think I can downgrade just that package w/o breaking the system?
Last edited by Dotslash (2023-10-19 21:27:54)
Offline
You'll also have to downgrade lib32-glibc, but otherwise those are all just rebuilds and should™ be safe to downgrade in isolation.
However, that won't last forever and downgrading glibc in isolation is almost guaranteed to break the system at *some* point.
So it's mostly good for testing whether this is the cause (I have a hard time imagining that this hinges on nscd, but we shall see)
Since Murphy rules laws, don't move the live iso too far away…
Offline
Ok so I updated a few things since this morning and as expected that didn't change anything.
Then I downgraded glibc and lib32-glibc to 2.38-3 and i ran a few games just to the title screen and then exited, the error isn't showing up anymore.
The other errors are still showing up though which I expected. Wish I knew what those are about.
Then the only thing is For The King didn't like when I swapped to lts kernel. I had to click the compatibility in steam to steam linux runtime 1.0 scout. Otherwise the main menu doesn't show up. It's broken on both unless I select proton or steam linux runtime. Weird
Last edited by Dotslash (2023-10-19 22:32:45)
Offline
For the other errors I wonder if I'm missing something from the nvidia install, I don't have nvidia-dkms installed like you mentioned.
Offline
dkms is only relevant for kernels w/o a precompiled module in the repos or if you want to to downgrade either nvidia or the kernel, but not not both.
You could try to add "transparent_hugepage=never" to the kernel parameters, https://bbs.archlinux.org/viewtopic.php … 7#p2110357
Please also test whether 2.38-4 still works so we know whether it's b/c of nscd or one of the CVE fixes.
Offline
I could test 2.38-4 if you want, but that is one of the packages that I updated on 9/27 that caused this error in the first place.
Downgrading from 2.38-4 to 2.38-3 along with everything else I updated that day fixed it.
Then today I updating everything which installed glibc & lib32-glibc to 2.38-7 which caused the error to return.
Currently glibc and lib32-glibc are the only things that aren't updated. They're both at 2.38-3.
I believe I installed the packages then shut off the computer and went to bed. The errors then shown up when I started the next day.
So I have had 2.38-3 2.38-4 and 2.38-7 installed
Last edited by Dotslash (2023-10-20 09:25:45)
Offline
If you're relatively certain that 2.38-4 is the offending version https://gitlab.archlinux.org/archlinux/ … 0a2c4e3ab2 actually also removes
patch -Np1 -i "${srcdir}"/fix-malloc-p1.patch
patch -Np1 -i "${srcdir}"/fix-malloc-p2.patch
which kinda loosk way more relevant to your problem.
1. See whether you can get rid of the older/permanent error by disabling transparent_hugepage
2. If so, see whether you still run into the new bugs w/ newer glibc versions
If not, you might want to explore compiling the latest PKGBUILD but re-introduce the malloc patches, it almost looks to me as if those were accidentally dropped (the patches are still in the package repo and apparently were only intrduced for 2.38-3
Offline
Ok I disabled transparent_hugepage
cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
I'm still getting the
kernel: Unhandled error in __nv_drm_gem_user_memory_handle_vma_fault: -22
kernel: Cannot map memory with base addr 0x7faa48411000 and size of 0x39 pages
Then updated glibc and lib32-glibc and it still gives
Oct 20 08:55:43 archlinux kernel: wineserver[1659]: segfault at 0 ip 00007f07daead6f4 sp 00007ffe467b9b20 error 4 in libnvidia-glvkspirv.so.535.113.01[7f07d9e00000+2038000] likely on CPU 9 (core 3, socket 0)
Oct 20 08:55:43 archlinux kernel: Code: 00 00 00 00 00 90 53 48 8b 1f 48 89 df e8 74 38 0d ff 48 89 df 5b e9 2b 39 0d ff 66 2e 0f 1f 84 00 00 00 00 00 90 48 83 ec 08 <48> 8b 3f e8 94 3a 0d ff 85 c0 0f 94 c0 48 83 c4 08 c3 66 2e 0f 1f
Oct 20 08:55:43 archlinux systemd[1]: Created slice Slice /system/systemd-coredump.
Oct 20 08:55:44 archlinux systemd[1]: Started Process Core Dump (PID 1910/UID 0).
Oct 20 08:55:44 archlinux (sd-parse-elf)[1912]: Could not parse number of program headers from core file: invalid `Elf' handle
Oct 20 08:55:44 archlinux systemd-coredump[1911]: Process 1659 (wineserver) of user 1000 dumped core.
Module /home/blumimic/.local/share/Steam/steamapps/common/Proton 8.0/dist/bin/wineserver without build-id.
Module /home/blumimic/.local/share/Steam/steamapps/common/Proton 8.0/dist/bin/wineserver
Stack trace of thread 1659:
#0 0x00007f07daead6f4 n/a (/run/host/usr/lib/libnvidia-glvkspirv.so.535.113.01 + 0x10ad6f4)
ELF object binary architecture: AMD x86-64
Oct 20 08:55:44 archlinux systemd[1]: systemd-coredump@0-1910-0.service: Deactivated successfully.
Offline
How do I do the compiling the latest PKGBUILD but re-introduce the malloc patches that you said.
Offline
https://wiki.archlinux.org/title/Arch_b … t_directly
You fetch that, re-introduce the two patch statements in the prepare() function and run "makepkg -i"
Offline
Ok I ran
git clone https://gitlab.archlinux.org/archlinux/packaging/packages/glibc.git
I assume doing it w/ lib32-glibc isn't needed? It wouldn't even let me.
I then added the 2 patch files in prepare()
I ran makepkg -si because of missing dependencies, It gave an error about missing file in src so I dropped copies of the 2 files and ran it again.
Then it gives an error
==> Making package: glibc 2.38-7 (Fri 20 Oct 2023 02:45:27 PM PDT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Updating glibc git repo...
-> Found locale.gen.txt
-> Found locale-gen
-> Found lib32-glibc.conf
-> Found sdt.h
-> Found sdt-config.h
-> Found reenable_DT_HASH.patch
==> Validating source files with b2sums...
glibc ... Skipped
locale.gen.txt ... Passed
locale-gen ... Passed
lib32-glibc.conf ... Passed
sdt.h ... Passed
sdt-config.h ... Passed
reenable_DT_HASH.patch ... Passed
==> Extracting sources...
-> Creating working copy of glibc git repo...
Reset branch 'makepkg'
==> Starting prepare()...
patching file Makeconfig
patching file malloc/malloc.c
Reversed (or previously applied) patch detected! Skipping patch.
7 out of 7 hunks ignored -- saving rejects to file malloc/malloc.c.rej
==> ERROR: A failure occurred in prepare().
Aborting...
Offline
It would almost seem as if the patch had been upstreamed, can you please post malloc/malloc.c.rej ?
Offline
Ok
--- malloc/malloc.c
+++ malloc/malloc.c
@@ -1086,6 +1086,11 @@ typedef struct malloc_chunk* mchunkptr;
static void* _int_malloc(mstate, size_t);
static void _int_free(mstate, mchunkptr, int);
+static void _int_free_merge_chunk (mstate, mchunkptr, INTERNAL_SIZE_T);
+static INTERNAL_SIZE_T _int_free_create_chunk (mstate,
+ mchunkptr, INTERNAL_SIZE_T,
+ mchunkptr, INTERNAL_SIZE_T);
+static void _int_free_maybe_consolidate (mstate, INTERNAL_SIZE_T);
static void* _int_realloc(mstate, mchunkptr, INTERNAL_SIZE_T,
INTERNAL_SIZE_T);
static void* _int_memalign(mstate, size_t, size_t);
@@ -4637,31 +4642,52 @@ _int_free (mstate av, mchunkptr p, int have_lock)
if (!have_lock)
__libc_lock_lock (av->mutex);
- nextchunk = chunk_at_offset(p, size);
-
- /* Lightweight tests: check whether the block is already the
- top block. */
- if (__glibc_unlikely (p == av->top))
- malloc_printerr ("double free or corruption (top)");
- /* Or whether the next chunk is beyond the boundaries of the arena. */
- if (__builtin_expect (contiguous (av)
- && (char *) nextchunk
- >= ((char *) av->top + chunksize(av->top)), 0))
- malloc_printerr ("double free or corruption (out)");
- /* Or whether the block is actually not marked used. */
- if (__glibc_unlikely (!prev_inuse(nextchunk)))
- malloc_printerr ("double free or corruption (!prev)");
-
- nextsize = chunksize(nextchunk);
- if (__builtin_expect (chunksize_nomask (nextchunk) <= CHUNK_HDR_SZ, 0)
- || __builtin_expect (nextsize >= av->system_mem, 0))
- malloc_printerr ("free(): invalid next size (normal)");
+ _int_free_merge_chunk (av, p, size);
- free_perturb (chunk2mem(p), size - CHUNK_HDR_SZ);
+ if (!have_lock)
+ __libc_lock_unlock (av->mutex);
+ }
+ /*
+ If the chunk was allocated via mmap, release via munmap().
+ */
+
+ else {
+ munmap_chunk (p);
+ }
+}
+
+/* Try to merge chunk P of SIZE bytes with its neighbors. Put the
+ resulting chunk on the appropriate bin list. P must not be on a
+ bin list yet, and it can be in use. */
+static void
+_int_free_merge_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T size)
+{
+ mchunkptr nextchunk = chunk_at_offset(p, size);
+
+ /* Lightweight tests: check whether the block is already the
+ top block. */
+ if (__glibc_unlikely (p == av->top))
+ malloc_printerr ("double free or corruption (top)");
+ /* Or whether the next chunk is beyond the boundaries of the arena. */
+ if (__builtin_expect (contiguous (av)
+ && (char *) nextchunk
+ >= ((char *) av->top + chunksize(av->top)), 0))
+ malloc_printerr ("double free or corruption (out)");
+ /* Or whether the block is actually not marked used. */
+ if (__glibc_unlikely (!prev_inuse(nextchunk)))
+ malloc_printerr ("double free or corruption (!prev)");
+
+ INTERNAL_SIZE_T nextsize = chunksize(nextchunk);
+ if (__builtin_expect (chunksize_nomask (nextchunk) <= CHUNK_HDR_SZ, 0)
+ || __builtin_expect (nextsize >= av->system_mem, 0))
+ malloc_printerr ("free(): invalid next size (normal)");
+
+ free_perturb (chunk2mem(p), size - CHUNK_HDR_SZ);
- /* consolidate backward */
- if (!prev_inuse(p)) {
- prevsize = prev_size (p);
+ /* Consolidate backward. */
+ if (!prev_inuse(p))
+ {
+ INTERNAL_SIZE_T prevsize = prev_size (p);
size += prevsize;
p = chunk_at_offset(p, -((long) prevsize));
if (__glibc_unlikely (chunksize(p) != prevsize))
@@ -4669,9 +4695,25 @@ _int_free (mstate av, mchunkptr p, int have_lock)
unlink_chunk (av, p);
}
- if (nextchunk != av->top) {
+ /* Write the chunk header, maybe after merging with the following chunk. */
+ size = _int_free_create_chunk (av, p, size, nextchunk, nextsize);
+ _int_free_maybe_consolidate (av, size);
+}
+
+/* Create a chunk at P of SIZE bytes, with SIZE potentially increased
+ to cover the immediately following chunk NEXTCHUNK of NEXTSIZE
+ bytes (if NEXTCHUNK is unused). The chunk at P is not actually
+ read and does not have to be initialized. After creation, it is
+ placed on the appropriate bin list. The function returns the size
+ of the new chunk. */
+static INTERNAL_SIZE_T
+_int_free_create_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T size,
+ mchunkptr nextchunk, INTERNAL_SIZE_T nextsize)
+{
+ if (nextchunk != av->top)
+ {
/* get and clear inuse bit */
- nextinuse = inuse_bit_at_offset(nextchunk, nextsize);
+ bool nextinuse = inuse_bit_at_offset (nextchunk, nextsize);
/* consolidate forward */
if (!nextinuse) {
@@ -4686,8 +4728,8 @@ _int_free (mstate av, mchunkptr p, int have_lock)
been given one chance to be used in malloc.
*/
- bck = unsorted_chunks(av);
- fwd = bck->fd;
+ mchunkptr bck = unsorted_chunks (av);
+ mchunkptr fwd = bck->fd;
if (__glibc_unlikely (fwd->bk != bck))
malloc_printerr ("free(): corrupted unsorted chunks");
p->fd = fwd;
@@ -4706,61 +4748,52 @@ _int_free (mstate av, mchunkptr p, int have_lock)
check_free_chunk(av, p);
}
- /*
- If the chunk borders the current high end of memory,
- consolidate into top
- */
-
- else {
+ else
+ {
+ /* If the chunk borders the current high end of memory,
+ consolidate into top. */
size += nextsize;
set_head(p, size | PREV_INUSE);
av->top = p;
check_chunk(av, p);
}
- /*
- If freeing a large space, consolidate possibly-surrounding
- chunks. Then, if the total unused topmost memory exceeds trim
- threshold, ask malloc_trim to reduce top.
-
- Unless max_fast is 0, we don't know if there are fastbins
- bordering top, so we cannot tell for sure whether threshold
- has been reached unless fastbins are consolidated. But we
- don't want to consolidate on each free. As a compromise,
- consolidation is performed if FASTBIN_CONSOLIDATION_THRESHOLD
- is reached.
- */
+ return size;
+}
- if ((unsigned long)(size) >= FASTBIN_CONSOLIDATION_THRESHOLD) {
+/* If freeing a large space, consolidate possibly-surrounding
+ chunks. Then, if the total unused topmost memory exceeds trim
+ threshold, ask malloc_trim to reduce top. */
+static void
+_int_free_maybe_consolidate (mstate av, INTERNAL_SIZE_T size)
+{
+ /* Unless max_fast is 0, we don't know if there are fastbins
+ bordering top, so we cannot tell for sure whether threshold has
+ been reached unless fastbins are consolidated. But we don't want
+ to consolidate on each free. As a compromise, consolidation is
+ performed if FASTBIN_CONSOLIDATION_THRESHOLD is reached. */
+ if (size >= FASTBIN_CONSOLIDATION_THRESHOLD)
+ {
if (atomic_load_relaxed (&av->have_fastchunks))
malloc_consolidate(av);
- if (av == &main_arena) {
+ if (av == &main_arena)
+ {
#ifndef MORECORE_CANNOT_TRIM
- if ((unsigned long)(chunksize(av->top)) >=
- (unsigned long)(mp_.trim_threshold))
- systrim(mp_.top_pad, av);
+ if (chunksize (av->top) >= mp_.trim_threshold)
+ systrim (mp_.top_pad, av);
#endif
- } else {
- /* Always try heap_trim(), even if the top chunk is not
- large, because the corresponding heap might go away. */
- heap_info *heap = heap_for_ptr(top(av));
+ }
+ else
+ {
+ /* Always try heap_trim, even if the top chunk is not large,
+ because the corresponding heap might go away. */
+ heap_info *heap = heap_for_ptr (top (av));
- assert(heap->ar_ptr == av);
- heap_trim(heap, mp_.top_pad);
- }
+ assert (heap->ar_ptr == av);
+ heap_trim (heap, mp_.top_pad);
+ }
}
-
- if (!have_lock)
- __libc_lock_unlock (av->mutex);
- }
- /*
- If the chunk was allocated via mmap, release via munmap().
- */
-
- else {
- munmap_chunk (p);
- }
}
/*
@@ -5221,7 +5254,7 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_inuse_bit_at_offset (newp, newsize);
set_head_size (p, leadsize | (av != &main_arena ? NON_MAIN_ARENA : 0));
- _int_free (av, p, 1);
+ _int_free_merge_chunk (av, p, leadsize);
p = newp;
assert (newsize >= nb &&
@@ -5232,15 +5265,27 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)
if (!chunk_is_mmapped (p))
{
size = chunksize (p);
- if ((unsigned long) (size) > (unsigned long) (nb + MINSIZE))
+ mchunkptr nextchunk = chunk_at_offset(p, size);
+ INTERNAL_SIZE_T nextsize = chunksize(nextchunk);
+ if (size > nb)
{
remainder_size = size - nb;
- remainder = chunk_at_offset (p, nb);
- set_head (remainder, remainder_size | PREV_INUSE |
- (av != &main_arena ? NON_MAIN_ARENA : 0));
- set_head_size (p, nb);
- _int_free (av, remainder, 1);
- }
+ if (remainder_size >= MINSIZE
+ || nextchunk == av->top
+ || !inuse_bit_at_offset (nextchunk, nextsize))
+ {
+ /* We can only give back the tail if it is larger than
+ MINSIZE, or if the following chunk is unused (top
+ chunk or unused in-heap chunk). Otherwise we would
+ create a chunk that is smaller than MINSIZE. */
+ remainder = chunk_at_offset (p, nb);
+ set_head_size (p, nb);
+ remainder_size = _int_free_create_chunk (av, remainder,
+ remainder_size,
+ nextchunk, nextsize);
+ _int_free_maybe_consolidate (av, remainder_size);
+ }
+ }
}
check_inuse_chunk (av, p);
Offline
That's the majority of fix-malloc-p1.patch
Sanity check, since you ran makepkg twice and the source is a git repo: did you get that error on the first run as well and did you take the second run on a clean slate (removed pkg and src directories)?
Offline
First run gave a missing file error then I just ran it again, was wondering if I needed do a clean slate as you say. I just delete those 2 folders?
Offline
You technically don't have to, but it's a straight way to hopefully get this to build (I suspect that the patches were actually applied before and you could "git diff" check that in the src git)
Offline