Bug 16627 - unaligned access(bus error) in drivers/dri/common/utils.c
Summary: unaligned access(bus error) in drivers/dri/common/utils.c
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: 7.1
Hardware: SPARC Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL: https://bugs.gentoo.org/show_bug.cgi?...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-06 16:01 UTC by Friedrich Oslage
Modified: 2008-09-14 12:17 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
concept-patch to fix alignment issues (2.08 KB, patch)
2008-07-23 11:46 UTC, Friedrich Oslage
Details | Splinter Review

Description Friedrich Oslage 2008-07-06 16:01:35 UTC
When using GLX on an architecture that can't do unaligned memory access(sparc64 in this case) Xorg fails to start.

GDB shows a SIGBUS(bus error) in src/mesa/drivers/dri/common/utils.c line 840 which is:

    default:
    *value = *(unsigned int *)
        ((char *) &config->modes + attribMap[index].offset);

    break;

sizeof(unsigned int) is 4
sizeof(char) is 1

If you need further information or testing please let me know.
Comment 1 Michel Dänzer 2008-07-07 04:23:04 UTC
AFAICT the crashing code was added by the commit below. Any ideas George?

commit c95e66120be049ee51ff84868b1da3379b312fab
Author: George Sapountzis <gsap7@yahoo.gr>
Date:   Sun May 11 14:43:22 2008 +0300

    Make utils.h self-contained.

    Move stuff with drm dependencies to dri_util.h, and move a couple of
    types without drm dependencies to utils.h.
Comment 2 George - 2008-07-07 08:32:35 UTC
The commit above is just code movement and should be harmless. The problem probably is with the xserver loading dri/swrast.

The segfault is in the dri-config to glx-visual conversion. glcore used to have ad-hoc logic in the xserver for generating the glx visuals. dri/swrast properly generates dri-configs driver-side which get converted to glx-visuals.

My guess is that the problem is with __GLcontectModes having GLboolean fields which we try to access as (unsigned int). Either change GLboolean to GLint in glcore.h or add padding for GLboolean fields to (unsigned int), to check if it works.


Comment 3 Friedrich Oslage 2008-07-23 11:46:41 UTC
Created attachment 17842 [details] [review]
concept-patch to fix alignment issues

Sorry for the long delay, couldn't test it any sooner :(

> My guess is that the problem is with __GLcontectModes having GLboolean fields
> which we try to access as (unsigned int). Either change GLboolean to GLint in
> glcore.h or add padding for GLboolean fields to (unsigned int), to check if it
> works.

You were right, simply changing GLboolean to GLint fixes the unaligned access. However xserver uses it's own copy of __GLcontextModes(named __GLXconfig) which would also need to be changed. Can we use this bug for xserver as well or should I file another bug?

I attached the changes I made to get it working.
Comment 4 Friedrich Oslage 2008-09-14 12:17:04 UTC
closing since it's fixed in 7.1 final :)


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.