Is this a bug? (setcap wine-preloader => ERROR)

Questions about Wine on Linux
Locked
Xinkai
Level 1
Level 1
Posts: 8
Joined: Mon Dec 30, 2013 9:03 am

Is this a bug? (setcap wine-preloader => ERROR)

Post by Xinkai »

Hi,

I came into an issue with Wine under Linux. Since I am not sure if this is a bug of Wine, I am opening this thread before filling out a bug report. I am looking for someone with the knowledge to tell me whether this is a bug after all.

I have a Windows application (Kugou, a Chinese music player) that requires to bind ports under 1024. So I set

sudo setcap 'cap_net_bind_service=+ep' /usr/bin/wine-preloader

However with this capability enabled for wine preloader, Hearthstone fails to start from Battle.net app. It pops an error dialog that captions "Fatal error in gc", and says "GetThreadContext failed".

Other information:
- I am running Archlinux with everything up-to-date, so Wine 1.7.9.
- I tried reinstalling wine package (setcap is cancelled during the process): Kugou became malfunctional (as it needs to bind a port under 1024), and Hearthstone worked again. At this time if I setcap again, I get the same error with Hearthstone.
- Kugou and Hearthstone live in two different WINEPREFIX's.

Thanks in advance. I will provide more information if my description isn't sufficient, just me tell me what you need.
oiaohm
Level 8
Level 8
Posts: 1020
Joined: Fri Feb 29, 2008 2:54 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by oiaohm »

http://wiki.winehq.org/FAQ#get_log

Xinkai wine is not a simple program. We have wineserver and other parts that might be the item requiring the flag that you missed.

Application error messages don't mean much to us. We need a log as described above to attempt to work out what the failure is.
Xinkai
Level 1
Level 1
Posts: 8
Joined: Mon Dec 30, 2013 9:03 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by Xinkai »

My bad. Should've attached the logs in the first place.

The game executable cannot be run directly -- either run "Hearthstone Launcher" first or "Battle.net" first. Now I have two "sets" of log files: running "Hearthstone Beta Launcher.exe", and running "Battle.net.exe". Inside each set there are two files which are the before setcap and after.

For the before setcap ones, I run whatever .exe -> launch Hearthstone -> wait for finishing loading -> exit game -> exit launcher.

For the after setcap ones, I do the same until I meet the error. Also because Hearthstone.exe becomes a zombie I kill it.

Let me know what else if needed.
Attachments
terminal_output.zip
(58.36 KiB) Downloaded 294 times
oiaohm
Level 8
Level 8
Posts: 1020
Joined: Fri Feb 29, 2008 2:54 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by oiaohm »

Code: Select all

wine: Unhandled exception 0x80000003 in thread 50 at address 0x7bc7ff6c (thread 0050), starting debugger...
err:module:import_dll Library dbghelp.dll (which is needed by L"C:\\windows\\system32\\winedbg.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"C:\\windows\\system32\\winedbg.exe" failed, status c0000135
Xinkai I am sorry I cannot help you that much. The problem I have is Hearthstone is requiring debugger disabled on battle.net so I cannot debug this. There are only 1 failure without the flag there is 2 with. Yes 100 percent this one with the battle.net alone.

The Hearthstone has no clear error in face explaining failure

Again this program will be a major problem to debug due to debugger being disabled.

Would you mind trying wine built in iexplore with setcap 'cap_net_bind_service=+ep' enabled.

Did you perform a wineserver -k or a system reboot after setting setcap on the loader. This could be a cause of problems. wineserver stays running between programs a lot so may not have picked up the flag leading to a confusing state.
Xinkai
Level 1
Level 1
Posts: 8
Joined: Mon Dec 30, 2013 9:03 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by Xinkai »

Hi oiaohm,

I could've mentioned eariler that this issue persists over system reboots; wineserver -k doesn't help either.

I did some experiment with iexplorer.exe. I noticed with dbghelp disabled, iexplorer.exe cannot render any webpages, and also it cannot be stopped by closing the window -- have to kill it. On the other hand, setcap or not, from what I see it doesn't affect iexplorer at all.

Code: Select all

xinkai@ARCH-DESKTOP:~$ pacman -Qs wine_gecko
local/wine_gecko 2.24-1
    Wine's built-in replacement for Microsoft's Internet Explorer
Attachments
iexplorer.zip
(5.02 KiB) Downloaded 285 times
Xinkai
Level 1
Level 1
Posts: 8
Joined: Mon Dec 30, 2013 9:03 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by Xinkai »

Hello oiaohm,
oiaohm wrote:The problem I have is Hearthstone is requiring debugger disabled on battle.net so I cannot debug this.
I just discovered that you can run the Hearthstone executable directly (only battle.net app requires dbger disabled). Even on Windows this won't get you a successful game login, but this does reproduce the problem. I can see the same "fatal error in gc" error prompt.

run

Code: Select all

wine Hearthstone.exe -launch -uid hs_beta
to mimic most natural behaviors.

Here's my debug trace with +relay,+seh,+tid, as suggested in Wiki, too big for this forum.

http://www.cuoan.net/storage/hearthston ... ace.txt.gz

Let me know if you need any specified debug trace, or a Hearthstone installer, etc.

Thank you.
oiaohm
Level 8
Level 8
Posts: 1020
Joined: Fri Feb 29, 2008 2:54 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by oiaohm »

Xinkai do try a clean prefix with with iexpore it should in wine be able to at least render google once winegecko installs.

If you can render google with the setcap set or not we are most likely not looking at a basic setup error.

I would say open a bug report. setcap should be able to work with wine even that we don't recommend it due to how much of a secuirty risk windows programs are.
Xinkai
Level 1
Level 1
Posts: 8
Joined: Mon Dec 30, 2013 9:03 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by Xinkai »

oiaohm wrote:Xinkai do try a clean prefix with with iexpore it should in wine be able to at least render google once winegecko installs.

If you can render google with the setcap set or not we are most likely not looking at a basic setup error.
I did the tests in a new prefix. The result better presents in a table I guess.

      dbghelp on | dbghelp off
setcap    renders   | doesn't render
not setcap  renders   | doesn't render

The thing is winegecko also requires dbghelp, and iexplore isn't affected by setcap.

oiaohm wrote: I would say open a bug report. setcap should be able to work with wine even that we don't recommend it due to how much of a secuirty risk windows programs are.
This is the bug I just opened: http://bugs.winehq.org/show_bug.cgi?id=35291.
I do understand the security risk, but I assume granting the ability to bind ports under 1024 is not that big a deal, especially considering the alternative -- running Wine as root -- is much less risky.

Also it might interest you to know, I just find that setcap any capability would cause this problem, not just CAP_NET_BIND_SERVICE.


Thank you for your time helping me, and happy new year to you.
oiaohm
Level 8
Level 8
Posts: 1020
Joined: Fri Feb 29, 2008 2:54 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by oiaohm »

Xinkai I would recommend adding that note about dbghelp on/off having effect.

In setcap mode its triggering extra dbghelp so failure of winegecko with dbghelp off could be related.

If you are running as root we don't support you at all.

Using setcap we don't recommend it but we are not going cut support because setcap has been used.

The alterative of using root instead of setcap don't even bother asking for support. There is detections in some versions of wine that cause it to bail out if running as root.
Xinkai
Level 1
Level 1
Posts: 8
Joined: Mon Dec 30, 2013 9:03 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by Xinkai »

oiaohm wrote:Xinkai I would recommend adding that note about dbghelp on/off having effect.

In setcap mode its triggering extra dbghelp so failure of winegecko with dbghelp off could be related.
Hello oiaohm,

I failed to see why dbghelp or winegecko matters in this context. My English's bad sometimes and I sense you may have misunderstood what I said before, so let me re-illiterate here.

Dbghelp must be off to run Battle.net. dbghelp makes no differences on Hearthstone.exe.
Although Battle.net is required to successfully PLAY the game; to study this bug, one does NOT need the game to load to a playable state. Directly running hearthstone.exe won't get to a playable state, but it loads enough to reproduce the bug.
This method is what I recommended in the bug report, because it allows the developers not to have to turn off dbghelp flag, which in my understanding helps debugging.

Dbghelp does have impact on Iexplore; but Hearthstone.exe does not use IE. So winegecko is irrelevant in this case.

I hope this post makes you understand better.

It's also likely that I misunderstood you, please let me know if so.
oiaohm
Level 8
Level 8
Posts: 1020
Joined: Fri Feb 29, 2008 2:54 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by oiaohm »

Xinkai if you read logs closely you will notice hearthstone.exe has a error back from the battle.net agent.

I have a felling this could be a hidden bug. There is annoying possibility its all battle.net side.

winegecko itself is not meant to be dependent on dbghelp. I was using winegecko to run a basic is this functional test. There is something in wine that is dbghelp sensitive that should not be. Somewhere in the code base is presuming dbghelp should be always on not presuming its off. Code error basically.

Now it might be unrelated completely but those debugging do need to be aware there seams to be a fault linked to dbghelp disabled. The problem here is the bug could be A+B.
Xinkai
Level 1
Level 1
Posts: 8
Joined: Mon Dec 30, 2013 9:03 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by Xinkai »

Oh! You're talking about

Code: Select all

err:ntdll:RtlpWaitForCriticalSection section 0x710e94 "?" wait timed out in thread 0031, blocked by 002d, retrying (60 sec)
err:wininet:open_http_connection create_netconn failed: 12029
Argument[0]: 'C:/users/Public/Application Data/Battle.net/Agent/Agent.beta.2514/Agent.exe'
Argument[1]: '--locale=enUS'
Argument[2]: '--session=9559161223669231667'
this one?

Remember I said I found out that "Hearthstone.exe" can be run directly in one of the eariler posts? From that point, I totally stopped paying attention about "Hearthstone Beta Launcher.exe". The debug trace I provided in this thread is "Hearthstone Beta Launcher.exe". Now you have pointed that out, it's good since the backtrace of "Hearthstone.exe" -- the one I attached in the bug report -- doesn't even have an "err:" line. I think this information can be very helpful to those who work on this.

Winegecko wrongly depending on dbghelp, I feel that's a different issue. Should I start a new bug about it?
oiaohm
Level 8
Level 8
Posts: 1020
Joined: Fri Feb 29, 2008 2:54 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by oiaohm »

Xinkai I don't know how agent in battle net hooks up Hearthstone.exe.
err:ntdll:RtlpWaitForCriticalSection section 0x710e94 "?" wait timed out in thread 0031, blocked by 002d, retrying (60 sec)

This can be an application waiting for another application to answer.

err:wininet:open_http_connection create_netconn failed: 12029

I had missed this line. This should not be failing to happen just because setcap is done.

I think we have 4 possibly related bugs or 4 independent bugs.

Hartstone.exe bug 1 with err wininet:open_http_connection create_netconn with setcap set.
Battle.net bug with dbghelp and with setcap resulting in attempt an extra attempt to use dbghelp these bugs 2 and 3
And winegecko trouble with dbghelp bug 4.

Problem is I am not sure that they are truly independent bugs. winegecko is simple because source code to both side is available.

There is a existing bug report with Battle.net for dbghelp trouble.
Xinkai
Level 1
Level 1
Posts: 8
Joined: Mon Dec 30, 2013 9:03 am

Re: Is this a bug? (setcap wine-preloader => ERROR)

Post by Xinkai »

oiaohm wrote: err:wininet:open_http_connection create_netconn failed: 12029

I had missed this line. This should not be failing to happen just because setcap is done.
Hello oiaohm,

You're right. I added that to the bug.

About bug 2 and 3, I don't know how to say it because I don't really understand. If you feel you can help along, add a comment at the bug.

Winegecko wanting dbghelp badly bug is here: http://bugs.winehq.org/show_bug.cgi?id=35298
Locked