[Bug 21896] sigaltstack: invalid argument

wine-bugs at winehq.org wine-bugs at winehq.org
Wed May 2 20:35:34 CDT 2012


http://bugs.winehq.org/show_bug.cgi?id=21896

Matias Colli <matiasbsd at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matiasbsd at gmail.com

--- Comment #1 from Matias Colli <matiasbsd at gmail.com> 2012-05-02 20:35:34 CDT ---
I'm looking in the wine source code. I found that "sigaltstack: invalid
argument" happens if the call to sigaltstack() fails. So I searched for why
sigaltstack() fails. I found the answer in the source code of the OpenBSD
pthreads library.

OpenBSD does not have kernel threads. The OpenBSD pthreads library implements
threads in userspace. (OpenBSD is the only operating system, that I know, where
pthreads are not kernel threads. They say that Wine 1.1.19 uses kernel threads,
but this is not true for OpenBSD!) The OpenBSD pthreads library does override
multiple libc functions, including sigaltstack().

Here is the comment in OpenBSD src/lib/libpthread/uthread/uthread_sigaltstack.c

<pre>
/*
 * IEEE Std 1003.1-2001 says:
 *
 * "Use of this function by library threads that are not bound to
 * kernel-scheduled entities results in undefined behavior."
 *
 * There exists code (e.g. alpha setjmp) that uses this function
 * to get information about the current stack.
 *
 * The "undefined behaviour" in this implementation is thus:
 * o if ss is *not* null return -1 with errno set to EINVAL
 * o if oss is *not* null fill it in with information about the
 *   current stack and return 0.
 *
 * This lets things like alpha setjmp work in threaded applications.
 */

int
sigaltstack(const struct sigaltstack *ss, struct sigaltstack *oss)
{
    struct pthread *curthread = _get_curthread();

    int ret = 0;
    if (ss != NULL) {
        errno = EINVAL;
        ret = -1;
    } else ...
</pre>

So the OpenBSD pthreads library does not allow a separate signal stack.
Whenever you give a signal stack to sigaltstack(), it always returns EINVAL.

Remove sigalstack option in configure and configure.ac files:
configure:    sigaltstack \
configure.ac:    sigaltstack \

So I comment the sigalstack funtion in signal_i386.c file to ignore this error:
dlls/ntdll/signal_i386.c:    //if (sigaltstack(&ss, NULL) == -1) perror(
"sigaltstack" );

Regards,
Matias Colli
UNIX SysAdmin

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list