[Bug 2532] Bug in wine-preloader

Wine Bugs wine-bugs at winehq.org
Mon Nov 29 15:56:53 CST 2004


------- Additional Comments From 9gfrye202 at sneakemail.com  2004-29-11 15:56 -------
OK, I have this problem too, from a Mandrake package. The problem stems from the
inline syscall wrappers (wld_xxx) introduced in wine/loader/preloader.c revision
1.6. Perhaps the Mandrake guys have compiled with the wrong flags, but it looks
like a wine bug to me.

Take for example wld_read:

static inline ssize_t wld_read( int fd, void *buffer, size_t len )
    int ret;
    __asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
                          : "=a" (ret)
                          : "0" (SYS_read), "g" (fd), "c" (buffer), "d" (len)
                          : "memory" );
    return SYSCALL_RET(ret);

here, the instruction movl %2,%%ebx refers to the 'fd' (file descriptor)
argument of the asm code snippet. This is fine if 'fd' argument is passed to the
 asm block as a register, but if it is passed as a variable on the stack then
the compiler gets the wrong location because the previous 'pushl %%ebx' has
modified the stack pointer since the asm snippet began. If you use the "r"
constraint instead of the "g" constraint, you can force 'fd' to be a register, ie

                          : "0" (SYS_read), "r" (fd), "c" (buffer), "d" (len)

However I say this without having produced & compiled a patch myself. This
explains why some distros are affected and others aren't (ie it's in the
optimisation flags) and it explains why wine-preload is trying to SYS_read()
from stdio (ie fd=0) on my Mandrake build.

I will post the relevant snippet from a disassembly listing if anyone wants -
but I think this info should be enough?


Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the wine-bugs mailing list