Summary: | xorg-x11 crashes when closing laptop lid | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | xorg | Reporter: | Bram Verweij <amverweij> | ||||||
Component: | Server/General | Assignee: | Xorg Project Team <xorg-team> | ||||||
Status: | RESOLVED FIXED | QA Contact: | |||||||
Severity: | normal | ||||||||
Priority: | high | CC: | colin, joshuabaergen, wendallc | ||||||
Version: | 7.1 (2006.05) | ||||||||
Hardware: | x86 (IA32) | ||||||||
OS: | Linux (All) | ||||||||
Whiteboard: | |||||||||
i915 platform: | i915 features: | ||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 6666 | ||||||||
Attachments: |
|
Description
Bram Verweij
2006-10-26 07:37:03 UTC
Created attachment 7531 [details] [review] Check zero-pointer result of strtok in lnx_acpi.c When I include this patch, my X server survives closing and opening the lid of my beautifull 6 years old Dell inspiron 4000... It is bug 6364 that has the similar stack trace, not 5140. Sorry about the mixup. *** Bug 8717 has been marked as a duplicate of this bug. *** Created attachment 7553 [details] [review] new patch that fixes real problem Take another look at lnx_acpi.c, starting from line 61. In the event of the crash, the string that should be parsed is "video VID 00000080 00000000". The old code tries to chop off "video" with a call to strtok(ev, "video") on line 68, and then goes on to parse the rest of the string. This is not what happens: the call to strtok sees "v","i","d","e", and "o" as delimiters, and puts the first non-empty string (i.e., " VID 0000080 00000000") into the variable video. The remainder of the string is then empty; the subsequent calls to strtok(NULL, " ") return NULL. When such a NULL is passed to strtoul, we have our well-known crash. This new patch changes the initial call to strtok to indeed just chop off the "video" bit by using a space as delimiter. This leaves the rest for parsing into GFX, notify and data. This seems to be what was intended, enabling the debug code in there also puts the right lines into my Xorg.0.log. I've removed the zero-pointer checks from my earlier patch; even though this is making assumptions about the format that is being read; i.e., all video events should read "video <string1> <string2> <string3>". I don't have the specs but it seems that this assumption is valid. I've just tested this on my Mandriva Cooker x11-server pacakage and it has appeared to fix the problem I was having on my Dell Inspiron 6400 (2.0 GHz Core 2 Duo x86_64 with pci=noirq arg which hides one of the cores but makes the machine usable!). My xorg used to crash whenever I closed the lit. With the attached patch applied I no longer get a crash. Adding me to CC. committed to master, and server 1.2 branch, thanks |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.