[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#536106: amd64 SEGVs due to dispatcher wrapper issue.



Hi Brian,

the following bug was reported against the mesa 7.0.3 package in Debian.
The relevant code doesn't seem to have changed in master.  Could you
take a look?

Thanks,
Julien

On Tue, Jul  7, 2009 at 17:50:06 +0100, roger wrote:

> It appears that mesa 7.0.3, crashes with some application in amd64 mode.
> 
> Weh I traced this into mesa I found the wrapper was only fetching the
> dispatch table thru _gl_DispatchTSD - although it had not been setup correctly
> - (The magic was 0) . 
> 
> I compared this gdb trace to the same application which does not crash on
> i386 and found that this _gl_DispatchTSD was also not set up on entry to the
> wrapper in i386 mode.
> 
> Comparing the i386 code and the dispatch documentation shows that the
> wrapper ought to be testing _glapi_Dispatch for NULL before getting the
> dispatch table from the TSD info.
> 
> The attached patch changes the wrapper generator script to create code
> which this extra check - and avoids unnecessary calls to pthread_getspecific()
> 
> Obviously this root cause of the segv could be an OpenGL programming
> issue but it is confusing that the behaviour changes between architectures.
> 
> 
> --- a/src/mesa/glapi/gl_x86-64_asm.py	2009-07-06 20:51:52.000000000 +0100
> +++ b/src/mesa/glapi/gl_x86-64_asm.py	2009-07-06 22:17:59.000000000 +0100
> @@ -166,7 +166,11 @@
>  		print ''
>  		print '\t.p2align\t4,,15'
>  		print '_x86_64_get_dispatch:'
> -		print '\tmovq\t_gl_DispatchTSD(%rip), %rdi'
> +		print '\tmovq\t_glapi_Dispatch(%rip), %rax'
> +		print '\ttestq\t%rax,%rax'
> +		print '\tje\t1f'
> +		print '\tret'
> +		print '1:\tmovq\t_gl_DispatchTSD(%rip), %rdi'
>  		print '\tjmp\tpthread_getspecific@PLT'
>  		print ''
>  		print '#elif defined(THREADS)'
> 
> 



Reply to: