http://bugs.winehq.org/show_bug.cgi?id=16666
Summary: wine segfaults on launch Product: Wine Version: 1.1.11 Platform: PC OS/Version: OpenBSD Status: NEW Keywords: patch, source Severity: critical Priority: P2 Component: build-env AssignedTo: wine-bugs@winehq.org ReportedBy: austinenglish@gmail.com
Created an attachment (id=18290) --> (http://bugs.winehq.org/attachment.cgi?id=18290) core dump
Now for the biggest bug :-)
Wine segfaults on launch of any program. Even 'wine --version' crashes.
I've got this patch in place (from openbsd's port): diff --git a/loader/pthread.c b/loader/pthread.c index 4c0c892..e7f6479 100644 --- a/loader/pthread.c +++ b/loader/pthread.c @@ -96,6 +96,12 @@ static void init_thread( struct wine_pthread_thread_info *info ) /* if base is too large assume it's the top of the stack instead */ if ((char *)info->stack_base > &dummy) info->stack_base = (char *)info->stack_base - info->stack_size; +#elif defined(__OpenBSD__) + stack_t stack; + if (pthread_stackseg_np(pthread_self(), &stack) != 0) + abort (); + info->stack_base = (char *)stack.ss_sp - stack.ss_size; + info->stack_size = stack.ss_size; #else /* assume that the stack allocation is page aligned */ char dummy; @@ -163,6 +169,8 @@ static void init_current_teb( struct wine_pthread_thread_info *info ) info->pid = getpid(); #ifdef __sun info->tid = pthread_self(); /* this should return the lwp id on solaris */ +#elif defined(__OpenBSD__) + info->tid = pthread_self(); #elif defined(__APPLE__) info->tid = mach_thread_self(); #elif defined(__FreeBSD__)
Though, it still segfaults without it.
wine-pthread.core attached
http://bugs.winehq.org/show_bug.cgi?id=16666
--- Comment #1 from Austin English austinenglish@gmail.com 2009-01-02 18:41:22 --- Created an attachment (id=18415) --> (http://bugs.winehq.org/attachment.cgi?id=18415) new patch
This fixes 'wine --version', but anything more complex is still broken (even notepad). There are several more bugs to work through, but wanted to upload for anyone to test :-).
http://bugs.winehq.org/show_bug.cgi?id=16666
Tijl Coosemans tijl@ulyssis.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |tijl@ulyssis.org
--- Comment #2 from Tijl Coosemans tijl@ulyssis.org 2009-01-03 15:02:25 --- Removing the --section-start flag is probably not correct. It's there to make sure the wine executable is loaded where it doesn't interfere with the Windows program.
On FreeBSD there used to be a crash when Wine failed to allocate user_shared_data at 0x7ffe0000 and tried to initialise it (dlls/ntdll/thread.c:thread_init()), so you might want to check if that address is available. On FreeBSD loader/freebsd.c was needed to assure that.
Also, if you can't turn off the randomised mmap somehow, you'll have to port loader/preloader.c I'm afraid.
http://bugs.winehq.org/show_bug.cgi?id=16666
--- Comment #3 from Austin English austinenglish@gmail.com 2009-01-03 23:04:14 --- http://www.openbsd.org/cgi-bin/man.cgi?query=mmap&apropos=0&sektion=...
There's a flag, MAP_FIXED, that prohibits mmap from selecting a different address than specified.
http://bugs.winehq.org/show_bug.cgi?id=16666
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|critical |blocker Summary|wine segfaults on launch |wine segfaults on launch on | |OpenBSD
--- Comment #4 from Austin English austinenglish@gmail.com 2009-03-31 01:07:32 --- Without any threading/loader patches, in git wine (1.1.18 + a couple days), on OpenBSD out of the box, I get:
"Dynamic loader failure: malloc."
when attempting to run any wine process (even --version).
Still working on compiler bugs at the moment, and this is on a donated server, so I'm working a bit slowly.
http://bugs.winehq.org/show_bug.cgi?id=16666
--- Comment #5 from Tijl Coosemans tijl@ulyssis.org 2009-04-02 12:14:29 --- In loader/main.c there's a pre_exec() function defined for FreeBSD. Maybe you need that on OpenBSD as well.
http://bugs.winehq.org/show_bug.cgi?id=16666
--- Comment #6 from Austin English austinenglish@gmail.com 2009-04-02 13:48:16 --- (In reply to comment #5)
In loader/main.c there's a pre_exec() function defined for FreeBSD. Maybe you need that on OpenBSD as well.
I'm sure it needs something, but it probably needs its own. OpenBSD is very different from FreeBSD.
Just running './wine' gives the error. I'm attempting to contact OpenBSD developers for more information, but knowing how that went last time, doubt it'll get much done...
http://bugs.winehq.org/show_bug.cgi?id=16666
--- Comment #7 from Austin English austinenglish@gmail.com 2009-04-02 13:51:34 --- FWIW, here's the relevant OpenBSD code: http://packages.e.kth.se/common/src/os/OpenBSD/current/src/libexec/ld.so/loa...
http://bugs.winehq.org/show_bug.cgi?id=16666
--- Comment #8 from Austin English austinenglish@gmail.com 2009-04-11 03:38:40 --- Apparently the regression may be on OpenBSD's end:
Assorted improvements and code cleanup:
* malloc(3) has gained new attack mitigation measures; critical bookkeeping structures are protected at runtime using mprotect(2) and allocated at random addresses where possible. * A new version of the gdtoa code has been integrated, bringing better C99 support to printf(3) and friends. * Vastly improved C99 support in libm, including complex math support. * Sorry, this list is still being worked on.
http://bugs.winehq.org/show_bug.cgi?id=16666
--- Comment #9 from Austin English austinenglish@gmail.com 2009-04-11 12:13:00 --- Here's the diff from 4.4 to 4.5. I'm going to test soon to see if that's the cause.
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c.diff?r1=1...
http://bugs.winehq.org/show_bug.cgi?id=16666
Juan Lang juan_lang@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |robertgray86@gmail.com
--- Comment #10 from Juan Lang juan_lang@yahoo.com 2009-09-08 17:22:09 --- *** Bug 19987 has been marked as a duplicate of this bug. ***
http://bugs.winehq.org/show_bug.cgi?id=16666
--- Comment #11 from IronForge robertgray86@gmail.com 2009-09-10 17:37:15 --- Created an attachment (id=23546) --> (http://bugs.winehq.org/attachment.cgi?id=23546) An ualloc document - OpenBSD Programming
Reference Doc 1
http://bugs.winehq.org/show_bug.cgi?id=16666
--- Comment #12 from IronForge robertgray86@gmail.com 2009-09-10 17:39:36 --- Created an attachment (id=23547) --> (http://bugs.winehq.org/attachment.cgi?id=23547) Reference 2
http://bugs.winehq.org/show_bug.cgi?id=16666
--- Comment #13 from IronForge robertgray86@gmail.com 2009-09-10 19:28:19 --- Greetings:
I am not a system programmer; but have coded at tad for school and work - dealing mostly with packaged commercial apps.
Looking into the Dynamic Load Failure / Segfault / malloc issue, I wanted to post a few reference material for those interested in tackling this problem.
Correct me if I've read previous posts and the ref matl incorrectly; but from what's "obvious to the most casual observer" (my Math Prof used to say that), is that the Malloc Error we get when attempting to run Wine in recent versions of OBSD is due to the fact that OBSD changed the way its malloc system function handles memory pointer allocations back in OBSDv3.8.
Reasons given involve a few issues regarding security, efficiency, and the enforcement of proper coding practices.
IMHO, this bug can most likely be fixed if an OBSD Port of, or a complete revision of WINE Source Code become compliant with Dynamic, Randomized, and Thoroughly 'Freed' (work with me, here) Memory Management by System Calls employed by OBSD.
Openports.se, a repository of OBSD pkgs, has a maintainer designated for Wine; and OBSD Collective itself has mailing lists. I've sent a msg out to the Maintainer and the advocacy mailing list for assistance and review of WINE's memory allocation and usage practice (not in this detail; but you'll get the drift). I've also argued that it's beneficial to have a current, working version of WINE available for people curious and interested in trying OBSD.
My first impression on the 10-yro port was not positive; and IMHO, probably would disinterest others who may wish to try the OS outside of firewall/router roles. With various MMORGs, graphic intensive apps, and a good number of Desktop Office / Application Suites being tested and used on Wine, and with the improvement of Virtualization Software, more (and that includes new) *NIX users can forgo the need to have a Windows Box or Dual Boot - at home and at work.
I posted a document; and will list a few URLs on OBSD Man Pages and other malloc reference material here (attaching them one by one seems tedious).
My recommendation are to have someone from the WINE dev team: a) Contact Openports.se's WINE maintainer (and join their team)... b) Contact OBSD's camp and sign up to their misc, dev, and ports mailing lists... c) Sign up with Daemonforums.org and start a thread in the OpenBSD portion of the forum... ...to start a dialog and see if anyone's willing to take a look at your code and help you tackle this malloc issue and others. Maybe you may be able to invite several of their developers to sign up here as well.
You'll run into people who are strict in procedure; but you actually do need people like that on your team to write good code overall.
Without further delay, here are the links: Old Articles -malloc article for OBSD 3.8 http://kerneltrap.org/node/5584 -an O'Reilly interview with several OBSD gurus on the (then) "new" malloc http://onlamp.com/pub/a/bsd/2005/10/20/openbsd_3_8.html?page=last -older wiki article on malloc - citing OBSD segfaults... http://en.wikipedia.org/wiki/Malloc#OpenBSD.27s_malloc -a detailed explanation of Address Space Layout Randomization (ASLR) http://en.wikipedia.org/wiki/Address_space_layout_randomization
OBSD Man Pages for Malloc(3) Subroutine *** http://www.openbsd.org/cgi-bin/man.cgi?query=cfree&sektion=3&apropos... free(3) Subroutine *** http://www.openbsd.org/cgi-bin/man.cgi?query=free&apropos=0&sektion=... mmap(2) System Call *** http://www.openbsd.org/cgi-bin/man.cgi?query=mmap&apropos=0&sektion=... munmap(2) System Call *** http://www.openbsd.org/cgi-bin/man.cgi?query=munmap&sektion=2&arch=i... mprotect(2) System Call *** http://www.openbsd.org/cgi-bin/man.cgi?query=mprotect&sektion=2
Hope these help.
http://bugs.winehq.org/show_bug.cgi?id=16666
IronForge robertgray86@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #23547|0 |1 is obsolete| |
http://bugs.winehq.org/show_bug.cgi?id=16666
Sylvain Petreolle spetreolle@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |spetreolle@yahoo.fr
http://bugs.winehq.org/show_bug.cgi?id=16666
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nerv@dawncrow.de
--- Comment #14 from André H. nerv@dawncrow.de 2012-06-12 13:12:25 CDT --- Any update on this? I'd say the patches are both outdated...
http://bugs.winehq.org/show_bug.cgi?id=16666
--- Comment #15 from Austin English austinenglish@gmail.com 2013-01-25 20:46:01 CST --- (In reply to comment #14)
Any update on this? I'd say the patches are both outdated...
In wine-1.5.22-158-g236b4da (no patches) and OpenBSD 5.2, this is the bug I get when trying to run ./wine --version.
http://bugs.winehq.org/show_bug.cgi?id=16666
Ken Sharp kennybobs@o2.co.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #23546|application/octet-stream |application/pdf mime type| |
https://bugs.winehq.org/show_bug.cgi?id=16666
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #16 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-4.19?
https://bugs.winehq.org/show_bug.cgi?id=16666
Saulius K. saulius2@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |saulius2@gmail.com