Bug 16315 - icebp (opcode 0xf1) no longer causing a SIGTRAP, breaks Wine
icebp (opcode 0xf1) no longer causing a SIGTRAP, breaks Wine
Status: RESOLVED CODE_FIX
Product: Platform Specific/Hardware
Classification: Unclassified
Component: i386
All Linux
: P1 normal
Assigned To: platform_i386
http://bugs.winehq.org/show_bug.cgi?i...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-29 20:08 UTC by Alexandre Julliard
Modified: 2012-08-09 14:14 UTC (History)
10 users (show)

See Also:
Kernel Version: 2.6.33
Tree: Mainline
Regression: Yes


Attachments
Fix for testing (1.31 KB, patch)
2010-06-30 12:26 UTC, Frederic Weisbecker
Details | Diff
Homemade testcase (321 bytes, text/x-csrc)
2010-06-30 12:47 UTC, Frederic Weisbecker
Details
testcase (223 bytes, text/x-csrc)
2010-07-12 09:49 UTC, Frederic Weisbecker
Details
Dump ptrace breakpoint requests (645 bytes, patch)
2010-08-22 02:20 UTC, Frederic Weisbecker
Details | Diff
Fix (1.41 KB, patch)
2010-08-26 23:44 UTC, Frederic Weisbecker
Details | Diff

Description Alexandre Julliard 2010-06-29 20:08:05 UTC
The icebp/int01 instructions (opcode 0xf1) is no longer causing a SIGTRAP. This is a regression caused by 08d68323d1f0c34452e614263b212ca556dae47f. Since this commit, send_sigtrap() is skipped because icebp doesn't set any of the DR6 bits.

This is breaking several Windows application under Wine, notably World of Warcraft. See http://bugs.winehq.org/show_bug.cgi?id=23323 and http://bugs.winehq.org/show_bug.cgi?id=23222 for the gory details.

The patch posted at http://bugs.winehq.org/show_bug.cgi?id=23323#c84 has been confirmed to fix the problem.
Comment 1 Frederic Weisbecker 2010-06-30 00:53:30 UTC
Thanks for reporting this.

I'll cook a fix ASAP.
Comment 2 Frederic Weisbecker 2010-06-30 12:26:52 UTC
Created attachment 26981 [details]
Fix for testing

This patch should fix the issue. Please test and tell me. If
it's fine, I'll push it for 2.6.35 and backport it for versions
that need it (presumably since 2.6.31).

Thanks.
Comment 3 Frederic Weisbecker 2010-06-30 12:47:33 UTC
Created attachment 26982 [details]
Homemade testcase

Note, I've been using this homemade testcase to test the patch.
However I would feel more comfortable if someone could try the
real testcase (ie: Wow) just to see if it really fixes the issue.
Comment 4 Frederic Weisbecker 2010-06-30 12:49:33 UTC
This is against 2.6.34
Comment 5 Alexandre Julliard 2010-06-30 13:06:55 UTC
Yes, it works fine for WoW. Thanks!
Comment 6 Robert Clark 2010-07-03 20:29:55 UTC
Tested this patch against: 

- 2.6.34 + Gentoo patches (x86_64)
- Wine 1.2_rc2

Works just fine. Thanks!
Comment 7 Ted Creamean 2010-07-04 11:52:56 UTC
Verified Fix.
Comment 8 Rinaldus 2010-07-05 15:31:02 UTC
Patch works very well! When it will be included into stable version 2.6.34-xx or 2.6.36?
Comment 9 Ingo Molnar 2010-07-05 17:10:11 UTC
> Patch works very well! When it will be included into stable version 
> 2.6.34-xx or 2.6.36?

It's already in v2.6.35-rc4, and it should be in .33.x and .32.x soon as well 
[in a few weeks], as it has a -stable backport tag.

Thanks,

	Ingo
Comment 10 Ignacio Salcedo 2010-07-08 02:12:32 UTC
Tested on Mandriva Linux 2010.1, with a Compilated Parched kernel 2.6.34... Works Fine. Im in Wow rigth now.
Comment 11 Mathijs Kwik 2010-07-11 15:22:11 UTC
Tested on Ubuntu Lucid (10.04) with a Mainline (vanilla) 2.6.35-rc4.
Does not seem to work.

I tried to run the "homemade testcase" attached to this bug and it segfaults.
Also, I cannot login to WoW.

Please see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/604261 where I first filed the bugreport (before finding out this was not ubuntu-kernel related).
Comment 12 Ingo Molnar 2010-07-11 19:24:09 UTC
> Tested on Ubuntu Lucid (10.04) with a Mainline (vanilla) 2.6.35-rc4. Does 
> not seem to work.

The fix was merged after -rc4 - please wait for -rc5 or use Linus's latest 
linus/master tree:

  http://people.redhat.com/mingo/tip.git/README

Thanks,

	Ingo
Comment 13 Mathijs Kwik 2010-07-11 21:55:27 UTC
just checked out linus and tip.
It appears it was merged before -rc4
according to gitk on the commit for this patch:

Author: Frederic Weisbecker <fweisbec@gmail.com>  2010-06-30 15:09:06
Committer: Frederic Weisbecker <fweisbec@gmail.com>  2010-06-30 16:16:20
Parent: b70e4f0529c089b00d0a6da13106db4de1ada4c7 (tracing: Fix undeclared ENOSYS in include/linux/tracepoint.h)
Child:  a147b88fd00962ba42c3c7f4e9b8fd013f565d2e (Merge branch 'perf/urgent')
Child:  c214909b36efec632432acdcbfacdd46a6e11370 (perf tools: Fix find tids routine by excluding "." and "..")
Child:  bf25ff66633b6f0e57e3b20d099efac22aae079d (Merge branches 'perf/urgent', 'sched/urgent' and 'sched/core' into auto-latest)
Branches: remotes/linus/master, remotes/tip/auto-latest, remotes/tip/master, remotes/tip/out-of-tree, remotes/tip/perf-fixes-for-linus, remotes/tip/perf/core, remotes/tip/perf/urgent, remotes/tip/x86/alternatives, remotes/tip/x86/apic, remotes/tip/x86/fpu, remotes/tip/x86/urgent, tip-latest
Follows: v2.6.35-rc1
Precedes: v2.6.35-rc4
    x86: Send a SIGTRAP for user icebp traps

Also, I checked the kernel source I'm using (ubuntu 2.6.35-7.11~lucid1 backport kernel) and the fix is included there as well. 
On both this kernel, and mainline 2.6.35-rc4 the icebp.c testcase segfaults.

Please let me know what I can do to debug this issue further.
Comment 14 K.Prasad 2010-07-12 09:01:45 UTC
Is this a regression that you see (as reported in Description: https://bugzilla.kernel.org/show_bug.cgi?id=16315#c0)? Do you see this behaviour after the patch commit, cited in description or is it a different WoW bug?
Comment 15 Mathijs Kwik 2010-07-12 09:45:58 UTC
for playing WoW, it's a regression.
On my ubuntu kernel (2.6.32.*) WoW works fine.
On 2.6.35-rc4 (mainline and ubuntu version) WoW breaks when logging in.
As far as I've seen (searched quite a lot) this is the issue that's being described here, since I couldn't find any kernel-related WoW issues (just wine version/settings).

The strange thing is:
I would have expected the icebp.c testcase to work on 2.6.32 and not on 2.6.35 (as indeed this bug is described as a regression), but on both 2.6.32 (where WoW works) as on 2.6.35, the icebp.c testcase segfaults.

So that seems to indicate this bug might not be related to my WoW issue, but on the other hand, the kernels I tested (mainline 2.6.35-rc4 and ubuntu version of it) should succeed with the testcase, which they don't on my system.
Whether or not my WoW problem is related is not relevant I think. If the problem persists _after_ I find the testcase succeeding, I will need to look elsewhere for that problem.
Comment 16 Frederic Weisbecker 2010-07-12 09:49:12 UTC
Created attachment 27071 [details]
testcase

Better testcase, should pass through NX data page protection.
Comment 17 Frederic Weisbecker 2010-07-12 09:51:21 UTC
PLease test the new testcase. It's possible you have NX page protection on your data pages, which was required to be off with the previous testcase.
Comment 18 Mathijs Kwik 2010-07-12 18:19:45 UTC
Ok, sorry to have bothered you all here.

the new testcase succeeds in all 3 kernels:
2.6.32 (ubuntu lucid)
2.6.35-rc4 (mainline)
2.6.35-7.11 (ubuntu maverick backport)

So my wow issue must be related to something else.
Thanks
Comment 19 Kelvie Wong 2010-08-21 09:28:40 UTC
This is broken again in 2.6.36-rc1; I did a bit of rebasing, and found the commit that broke it, by Mr. Frederic Weisbecker again.

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f7809da

x86: Support for instruction breakpoints

Reverting this commit fixes it.
Comment 20 Frederic Weisbecker 2010-08-21 14:56:17 UTC
(In reply to comment #19)
> This is broken again in 2.6.36-rc1; I did a bit of rebasing, and found the
> commit that broke it, by Mr. Frederic Weisbecker again.
> 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f7809da
> 
> x86: Support for instruction breakpoints
> 
> Reverting this commit fixes it.

Is it the same issue? I mean, does the testcase https://bugzilla.kernel.org/attachment.cgi?id=27071 work for you?
Comment 21 Kelvie Wong 2010-08-21 19:06:28 UTC
Hmm, the test case does work, so perhaps this is a different issue that has broken the game.  I'll wait for an update from the wine bug.

Does reverting this commit (locally) alone have any nasty side effects?
Comment 22 Frederic Weisbecker 2010-08-22 02:18:10 UTC
(In reply to comment #21)
> Hmm, the test case does work, so perhaps this is a different issue that has
> broken the game.  I'll wait for an update from the wine bug.


This is indeed a different issue. But still a bad issue.

Could you please apply the patch that follows, rebuild your kernel and test
again the game?
It will still fail but this time it will dump the informations I need to debug it.
Could you then post the result of:

dmesg | grep ptrace_pokeusr


> Does reverting this commit (locally) alone have any nasty side effects?


No, it should be fine.

Thanks.
Comment 23 Frederic Weisbecker 2010-08-22 02:20:04 UTC
Created attachment 27671 [details]
Dump ptrace breakpoint requests

Dump ptrace breakpoint requests.
Comment 24 Kelvie Wong 2010-08-23 04:33:20 UTC
Thank you for your response.  This is the output:

Aug 22 21:31:53 pantagruel kernel: [  121.066134] ptrace_pokeusr: nr: 0 val: 3c93e830 err: 0
Aug 22 21:31:53 pantagruel kernel: [  121.066144] ptrace_pokeusr: nr: 1 val: 3c95b410 err: 0
Aug 22 21:31:53 pantagruel kernel: [  121.066152] ptrace_pokeusr: nr: 2 val: 3c976610 err: 0
Aug 22 21:31:53 pantagruel kernel: [  121.066159] ptrace_pokeusr: nr: 3 val: 3c941e80 err: 0
Aug 22 21:31:53 pantagruel kernel: [  121.066167] ptrace_pokeusr: nr: 7 val: 155 err: -22
Aug 22 21:32:04 pantagruel kernel: [  132.061330] ptrace_pokeusr: nr: 0 val: 3c93e830 err: 0
Aug 22 21:32:04 pantagruel kernel: [  132.061337] ptrace_pokeusr: nr: 1 val: 3c95b410 err: 0
Aug 22 21:32:04 pantagruel kernel: [  132.061342] ptrace_pokeusr: nr: 2 val: 3c976610 err: 0
Aug 22 21:32:04 pantagruel kernel: [  132.061347] ptrace_pokeusr: nr: 3 val: 3c941e80 err: 0
Aug 22 21:32:04 pantagruel kernel: [  132.061354] ptrace_pokeusr: nr: 7 val: 0 err: 0


The -22 error is where the crash happens.
Comment 25 Kelvie Wong 2010-08-23 04:35:00 UTC
If this helps at all, I also did a run with the commit reverted (normal behaviour?)


Aug 22 21:21:14 pantagruel kernel: [  436.556494] ptrace_pokeusr: nr: 0 val: 3c93e830 err: 0
Aug 22 21:21:14 pantagruel kernel: [  436.556499] ptrace_pokeusr: nr: 1 val: 3c95b410 err: 0
Aug 22 21:21:14 pantagruel kernel: [  436.556503] ptrace_pokeusr: nr: 2 val: 3c976610 err: 0
Aug 22 21:21:14 pantagruel kernel: [  436.556507] ptrace_pokeusr: nr: 3 val: 3c941e80 err: 0
Aug 22 21:21:14 pantagruel kernel: [  436.556512] ptrace_pokeusr: nr: 7 val: 155 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036177] ptrace_pokeusr: nr: 0 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036183] ptrace_pokeusr: nr: 1 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036187] ptrace_pokeusr: nr: 2 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036191] ptrace_pokeusr: nr: 3 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036195] ptrace_pokeusr: nr: 7 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036409] ptrace_pokeusr: nr: 0 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036414] ptrace_pokeusr: nr: 1 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036419] ptrace_pokeusr: nr: 2 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036423] ptrace_pokeusr: nr: 3 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036426] ptrace_pokeusr: nr: 7 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036637] ptrace_pokeusr: nr: 0 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036642] ptrace_pokeusr: nr: 1 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036646] ptrace_pokeusr: nr: 2 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036650] ptrace_pokeusr: nr: 3 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036653] ptrace_pokeusr: nr: 7 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036834] ptrace_pokeusr: nr: 0 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036839] ptrace_pokeusr: nr: 1 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036843] ptrace_pokeusr: nr: 2 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036848] ptrace_pokeusr: nr: 3 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.036851] ptrace_pokeusr: nr: 7 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037031] ptrace_pokeusr: nr: 0 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037036] ptrace_pokeusr: nr: 1 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037041] ptrace_pokeusr: nr: 2 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037045] ptrace_pokeusr: nr: 3 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037048] ptrace_pokeusr: nr: 7 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037256] ptrace_pokeusr: nr: 0 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037261] ptrace_pokeusr: nr: 1 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037266] ptrace_pokeusr: nr: 2 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037271] ptrace_pokeusr: nr: 3 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037274] ptrace_pokeusr: nr: 7 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037449] ptrace_pokeusr: nr: 0 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037454] ptrace_pokeusr: nr: 1 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037459] ptrace_pokeusr: nr: 2 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037465] ptrace_pokeusr: nr: 3 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037468] ptrace_pokeusr: nr: 7 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037689] ptrace_pokeusr: nr: 0 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037692] ptrace_pokeusr: nr: 1 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037695] ptrace_pokeusr: nr: 2 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037697] ptrace_pokeusr: nr: 3 val: 0 err: 0
Aug 22 21:21:20 pantagruel kernel: [  442.037700] ptrace_pokeusr: nr: 7 val: 0 err: 0

And everything is fine here.
Comment 26 Frederic Weisbecker 2010-08-26 23:44:32 UTC
Created attachment 28081 [details]
Fix

Thanks a lot for your test.
I think the following patch should fix it. Can you give it a try?

Thanks.
Comment 27 Kelvie Wong 2010-08-29 05:20:53 UTC
It works beautifully.  Thanks.
Comment 28 Frederic Weisbecker 2010-09-08 21:16:21 UTC
I'll push the fix soon, thanks a lot!
Comment 29 Scott Ritchie 2010-09-20 03:18:53 UTC
The WoW crash Kelvie Wong had may also be http://bugs.winehq.org/show_bug.cgi?id=24193 as it occurs after login as well.

Note You need to log in before you can comment on or make changes to this bug.