FS#59551 - [valgrind] Unsupported arch_prctl option since glibc 2.28-1

Attached to Project: Arch Linux
Opened by Remi Gacogne (rgacogne) - Tuesday, 07 August 2018, 09:09 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Friday, 24 August 2018, 04:38 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Bartłomiej Piotrowski (Barthalion)
Levente Polyak (anthraxx)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 36
Private No

Details

Hi,

glibc 2.28-1 enabled CET support [1], causing it to use arch_prctl to see whether the kernel supports CET. This makes valgrind 3.13.0-7 fails to start with:

valgrind: the 'impossible' happened:
Unsupported arch_prctl option

Because it doesn't know about the corresponding arch_prctl option, as described in [2].

It would be nice if we could backport the corresponding patch [3] to get Valgrind working again :) I have noticed that the tests in the check() part of the build are failing and I have not investigated why, but adding this patch at least makes Valgrind usable for me.

[1]: https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/glibc&id=da8a17b4e9c8d776525960fb4d22faa9804a9501
[2]: https://bugs.kde.org/show_bug.cgi?id=396887
[3]: https://sourceware.org/git/gitweb.cgi?p=valgrind.git;a=commitdiff;h=21a01b13e259b9a43f10f0046b2b3f409c11ea75
This task depends upon

Closed by  Bartłomiej Piotrowski (Barthalion)
Friday, 24 August 2018, 04:38 GMT
Reason for closing:  Fixed
Additional comments about closing:  valgrind 3.13.0+290+2b0aa0a5-1
Comment by Evgeniy (evgeniy) - Tuesday, 07 August 2018, 12:21 GMT
It is impossible to use valgrind now.


$ cat test.c
int main()
{
}

$ gcc -g test.c
$ valgrind ./a.out
==722== Memcheck, a memory error detector
==722== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==722== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==722== Command: ./a.out
==722==

valgrind: the 'impossible' happened:
Unsupported arch_prctl option

host stacktrace:
==722== at 0x580441BA: show_sched_status_wrk (m_libcassert.c:355)
==722== by 0x580442D4: report_and_quit (m_libcassert.c:426)
==722== by 0x58044517: panic (m_libcassert.c:502)
==722== by 0x58044517: vgPlain_core_panic_at (m_libcassert.c:507)
==722== by 0x5804454A: vgPlain_core_panic (m_libcassert.c:512)
==722== by 0x580DAE22: vgSysWrap_amd64_linux_sys_arch_prctl_before (syswrap-amd64-linux.c:286)
==722== by 0x580A0C23: vgPlain_client_syscall (syswrap-main.c:1857)
==722== by 0x5809D48A: handle_syscall (scheduler.c:1126)
==722== by 0x5809EBB6: vgPlain_scheduler (scheduler.c:1443)
==722== by 0x580AED50: thread_wrapper (syswrap-linux.c:103)
==722== by 0x580AED50: run_a_thread_NORETURN (syswrap-linux.c:156)
Comment by Christoph Hoopmann (choopm) - Wednesday, 08 August 2018, 08:55 GMT
After applying the patch and commenting out the checks, I needed to build valgrind using -fno-stack-protector in /etc/makepkg.conf because of [1], for now it works..

[1]:
choopm $ LANG=en_US.UTF-8 makepkg
...
mv -f .deps/vgpreload_core_x86_linux_so-vg_preloaded.Tpo .deps/vgpreload_core_x86_linux_so-vg_preloaded.Po
gcc -m32 -O2 -g -std=gnu99 -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers -Wmissing-parameter-type -Wold-style-declaration -fno-stack-protector -fno-strict-aliasing -fno-builtin -O -g -fno-omit-frame-pointer -fno-strict-aliasing -fpic -fno-builtin -fno-ipa-icf -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst -m32 -Wl,-O1,--sort-common,--as-needed,-z,relro -o vgpreload_core-x86-linux.so vgpreload_core_x86_linux_so-vg_preloaded.o
/usr/bin/ld: vgpreload_core_x86_linux_so-vg_preloaded.o: in function `_vgnU_ifunc_wrapper':
/tmp/makepkg/valgrind/src/valgrind-3.13.0/coregrind/vg_preloaded.c:124: undefined reference to `__stack_chk_fail_local'
/usr/bin/ld: vgpreload_core-x86-linux.so: hidden symbol `__stack_chk_fail_local' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:2730: vgpreload_core-x86-linux.so] Error 1
make[3]: Leaving directory '/tmp/makepkg/valgrind/src/valgrind-3.13.0/coregrind'
make[2]: *** [Makefile:1827: all] Error 2
make[2]: Leaving directory '/tmp/makepkg/valgrind/src/valgrind-3.13.0/coregrind'
make[1]: *** [Makefile:829: all-recursive] Error 1
make[1]: Leaving directory '/tmp/makepkg/valgrind/src/valgrind-3.13.0'
make: *** [Makefile:698: all] Error 2
==> ERROR: A failure occurred in build().
Aborting...
Comment by Kenneth Graunke (Kayden) - Thursday, 09 August 2018, 00:29 GMT
I can confirm that valgrind doesn't work at all with glibc 2.28. However, I tried hacking the valgrind 3.13 PKGBUILD to apply the patch in [3], and the resulting valgrind didn't work well at all...loads of uninitialized value issues in libc-2.28.so. Building valgrind from git did work. Hopefully they can put out a new release soon...if not, it might be worth packaging a git snapshot or seeing if they can backport a more complete fix...
Comment by Maciek Borzecki (bboozzoo) - Monday, 13 August 2018, 07:14 GMT Comment by Felix (droptable) - Wednesday, 22 August 2018, 02:15 GMT
valgrind-git from aur works, so I assume it has been fixed upstream but has not been made its way to a release yet.
Comment by Bartłomiej Piotrowski (Barthalion) - Wednesday, 22 August 2018, 19:16 GMT
Please check valgrind from [testing].
Comment by John Doe (Larivact) - Friday, 24 August 2018, 04:29 GMT
Works for me.

Loading...