Wine and Valgrind / handling SIGILL

Sebastian Lackner sebastian at
Sun Jan 15 23:12:12 CST 2017

On 16.01.2017 04:57, Austin English wrote:
> On Dec 5, 2016 2:23 AM, "Austin English" <austinenglish at> wrote:
> Howdy all,
> Several months ago, a patch from Sebastian:
> commit 44fbc018eda12bdee5c2c1e2e40dbdc6a81b27fd
> Author: Sebastian Lackner <sebastian at>
> Date:   Thu Feb 12 11:09:34 2015 +0100
>     winebuild: Do not access memory below ESP when restoring thread
> contexts.
>     Based on a patch by John Reiser.
> for
> Caused problems for running Wine under Valgrind:
> There are patches floating around for both Wine and Valgrind (see
> previous link), but from what I've seen so far, both projects aren't a
> fan of the current patches.
> Given that Wine developers like using Valgrind to check for problems,
> and I know Julian would like to use Wine with Valgrind, I feel like some
> solution to this problem can be found. Since my efforts at trying to run
> messages between the two projects hasn't solved it yet, I figured an
> email thread would work better ;).
> --
> -Austin
> GPG: 14FB D7EA A041 937B
> Ping.
> --
> -Austin
> GPG: 14FB D7EA A041 937B

Hi all,

I'm not sure what the best way is to get this finally fixed. If this bug is
considered very critical for Wine, I can certainly write a patch to replace
this code with a slower version, which uses a different segment registers. The
SIGILL workaround is definitely too hacky for Wine sources imho.

When I wrote the Wine patch back then, my goal was to keep this code as
efficient as possible. Wine uses this specific piece of code quite a lot, so
even a couple of instructions could make a difference for applications with
lots of exceptions or while single-stepping.

It is important to keep in mind that Wine isn't doing anything special here -
those are all valid x86 assembly instructions. While we can certainly
workaround this bug on the Wine side, implementing this missing feature in
Valgrind would be the better option and also help other applications.

The Valgrind bugtracker also contains three patches I proposed back then. I
was hoping that this would speed up the process of getting this fixed, but
unfortunately it didn't help much. At many places Valgrind does not yet
handle signal registers correctly and doesn't complain - except here, which
is really unfortunate because even ignoring would be sufficient to make Wine

@Julian Seward: Could you please revisit this bug, and check if any of the
proposed ideas is acceptable for Valgrind?


More information about the wine-devel mailing list