Not too long ago OpenBSD/amd64 switched from gcc3 (3.3.5) to gcc4 (4.2.1) and we noticed that liboil started to crash with a stack overflow in oil_cpu_detect_arch(). liboil 0.3.17 $ cc -v Reading specs from /usr/lib/gcc-lib/amd64-unknown-openbsd4.7/4.2.1/specs Target: amd64-unknown-openbsd4.7 Configured with: OpenBSD/amd64 system compiler Thread model: posix gcc version 4.2.1 20070719 $ libtool --mode=execute gdb align align.core GNU gdb 6.3 Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "amd64-unknown-openbsd4.7"... Core was generated by `align'. Program terminated with signal 6, Aborted. Reading symbols from /home/ports/devel/liboil/w-liboil-0.3.17p1/liboil-0.3.17/liboil/.libs/liboil-0.3.so.4.0...done. Loaded symbols for /home/ports/devel/liboil/w-liboil-0.3.17p1/liboil-0.3.17/liboil/.libs/liboil-0.3.so.4.0 Reading symbols from /usr/lib/libm.so.5.2...done. Loaded symbols for /usr/lib/libm.so.5.2 Reading symbols from /usr/lib/libc.so.55.0...done. Loaded symbols for /usr/lib/libc.so.55.0 Reading symbols from /usr/libexec/ld.so...done. Loaded symbols for /usr/libexec/ld.so #0 0x000000020b68104a in kill () from /usr/lib/libc.so.55.0 (gdb) bt full #0 0x000000020b68104a in kill () from /usr/lib/libc.so.55.0 No symbol table info available. #1 0x000000020b6ad18d in __stack_smash_handler (func=0x20a0b41e0 "oil_cpu_detect_arch", damaged=Variable "damaged" is not available. ) at /usr/src/lib/libc/sys/stack_protector.c:89 sdata = {log_file = -1, connected = 0, opened = 1, log_stat = 0, log_tag = 0x802540 "align", log_fac = 8, log_mask = 255} message = "stack overflow in function %s" sa = {__sigaction_u = {__sa_handler = 0, __sa_sigaction = 0}, sa_mask = 0, sa_flags = 0} mask = 4294967263 #2 0x0000000209f8ce7c in oil_cpu_detect_arch () at liboilcpu-x86.c:358 No locals. #3 0x0000000209f889f0 in _oil_cpu_init () at liboilcpu.c:107 envvar = Variable "envvar" is not available.
Created attachment 37005 [details] [review] patch
Could you do one or more of the following: - try the same test with Orc (I tried to fix this bug in Orc, curious if I succeeded), either with git or the upcoming 0.4.6 release. - attach the file liboil/.libs/liboil_0.3_la-liboilcpu-x86.o - try the attached patch
With the patch applied all of the regression tests now pass.
Currently OpenBSD ports is using Orc 0.4.4, but I have an update to 0.4.6 and this also passes all of the included testsuite on OpenBSD/amd64. Still have to test on i386/arm. I didn't update to 0.4.5 because it was crashing on arm.
David, if the diff is Ok with you could you please see about getting it commited to the liboil repo?
Pushed. commit 705916007fba0a845229a02dc6474cb523eff150 Author: David Schleef <ds@schleef.org> Date: Tue Jul 20 14:05:26 2010 -0700 x86: Fix cpuid function on x86-64 Fixes: #28956.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.