Bug 106293

Summary: Floating point exception
Product: xorg Reporter: Theo <alpha0x89>
Component: Driver/RadeonAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: 7.6 (2010.12)   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
GDB backtrace Mathematica 11.1.1 floating point exception
none
Desired Xorg log for floating point exception caused by Mathematica
none
Another backtrace
none
glamor: Bail CreatePixmap on unsupported pixmap depth
none
Backtrace of segfault after patch
none
Bail from dri2_create_buffer2 if we can't get a pixmap none

Description Theo 2018-04-28 10:58:54 UTC
Server aborts reproducibly when I try to start Mathematica 11.1. I didn't have this problem until now on a up-to-date openSUSE Tumbleweed. Some information from the openSUSE RPM:

Name        : xorg-x11-server
Version     : 1.19.6
Release     : 7.1
Architecture: x86_64
Build Date  : So 22 Apr 2018 17:02:38 CEST

Some information about my system and the error from Xorg.0.log:

X.Org X Server 1.19.6
Release Date: 2017-12-20
Current Operating System: Linux 4.16.3-1-default #1 SMP PREEMPT Thu Apr 19 20:56:06 UTC 2018 (2fd48c5) x86_64
(II) LoadModule: "glx"
(II) Loading /usr/lib64/xorg/modules/extensions/libglx.so
(II) Module glx: vendor="X.Org Foundation"
	compiled for 1.19.6, module version = 1.0.0
	ABI class: X.Org Server Extension, version 10.0
(II) LoadModule: "radeon"
(II) Loading /usr/lib64/xorg/modules/drivers/radeon_drv.so
(II) Module radeon: vendor="X.Org Foundation"
	compiled for 1.19.6, module version = 18.0.1
	Module class: X.Org Video Driver
	ABI class: X.Org Video Driver, version 23.0
(**) RADEON(0): Option "Accel" "on"
(**) RADEON(0): Option "SWcursor" "on"
(**) RADEON(0): Option "AccelMethod" "glamor"
(**) RADEON(0): Option "DRI" "2"
(**) RADEON(0): Option "TearFree" "on"
(--) RADEON(0): Chipset: "ATI Radeon HD 3200 Graphics" (ChipID = 0x9610)
(II) Loading sub module "glamoregl"
(II) LoadModule: "glamoregl"
(II) Loading /usr/lib64/xorg/modules/libglamoregl.so
(II) Module glamoregl: vendor="X.Org Foundation"
	compiled for 1.19.6, module version = 1.0.0
	ABI class: X.Org ANSI C Emulation, version 0.4
(EE) 
(EE) Backtrace:
(EE) 0: /usr/bin/X (xorg_backtrace+0x65) [0x560ee2dfafd5]
(EE) 1: /usr/bin/X (0x560ee2c46000+0x1b8d89) [0x560ee2dfed89]
(EE) 2: /lib64/libpthread.so.0 (0x7f722ef1b000+0x12080) [0x7f722ef2d080]
(EE) 3: /usr/lib64/xorg/modules/drivers/radeon_drv.so (0x7f722bedd000+0x54bd0) [0x7f722bf31bd0]
(EE) 4: /usr/lib64/xorg/modules/drivers/radeon_drv.so (0x7f722bedd000+0x4ecef) [0x7f722bf2bcef]
(EE) 5: /usr/lib64/xorg/modules/drivers/radeon_drv.so (0x7f722bedd000+0x59b6b) [0x7f722bf36b6b]
(EE) 6: /usr/lib64/xorg/modules/drivers/radeon_drv.so (0x7f722bedd000+0x4580e) [0x7f722bf2280e]
(EE) 7: /usr/bin/X (0x560ee2c46000+0x187275) [0x560ee2dcd275]
(EE) 8: /usr/bin/X (0x560ee2c46000+0x187fa9) [0x560ee2dcdfa9]
(EE) 9: /usr/bin/X (DRI2GetBuffersWithFormat+0xb) [0x560ee2dce13b]
(EE) 10: /usr/bin/X (0x560ee2c46000+0x189c20) [0x560ee2dcfc20]
(EE) 11: /usr/bin/X (0x560ee2c46000+0x53f68) [0x560ee2c99f68]
(EE) 12: /usr/bin/X (0x560ee2c46000+0x57fb0) [0x560ee2c9dfb0]
(EE) 13: /lib64/libc.so.6 (__libc_start_main+0xe7) [0x7f722eb7ea87]
(EE) 14: /usr/bin/X (_start+0x2a) [0x560ee2c87c5a]
(EE) 
(EE) Floating point exception at address 0x7f722bf31bd0
(EE) 
Fatal server error:
(EE) Caught signal 8 (Floating point exception). Server aborting
(EE) 
(EE) 
Please consult the The X.Org Foundation support 
	 at http://wiki.x.org
 for help. 
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE) 
(II) AIGLX: Suspending AIGLX clients for VT switch
(EE) Server terminated with error (1). Closing log file.
Comment 1 Theo 2018-04-29 08:45:05 UTC
The exact Mathematica version is 11.1.1.0. The error happens independent of desktop environment or logged-in user. The crash happens only with options "AccelMethod" "glamor" and "DRI" "2". With "AccelMethod" "EXA" or "DRI" "3", Mathematica does not crash the X server. Instead it outputs the message "failed to create drawable" the moment it would crash the server.
Comment 2 Michel Dänzer 2018-04-30 09:07:52 UTC
Can you get a gdb backtrace of the crash?
Comment 3 Theo 2018-05-04 12:01:38 UTC
Created attachment 139349 [details]
GDB backtrace Mathematica 11.1.1 floating point exception
Comment 4 Michel Dänzer 2018-05-09 16:33:29 UTC
Please attach the corresponding Xorg log file.

So far, this looks like an X server bug: cpp == 0 in radeon_alloc_pixmap_bo, which means pixmap->drawable.bitsPerPixel <= 7 after fbCreatePixmap in radeon_glamor_create_pixmap, but it should be 32. Can you maybe also provide the output of the following at the gdb prompt when it crashes?

 p *radeon_glamor_create_pixmap::pixmap
Comment 5 Theo 2018-05-13 16:31:41 UTC
Created attachment 139545 [details]
Desired Xorg log for floating point exception caused by Mathematica

(In reply to Michel Dänzer from comment #4)
> Please attach the corresponding Xorg log file.
Attached Xorg log has messages about monitor and input devices cut out.
Comment 6 Theo 2018-05-13 16:36:32 UTC
Created attachment 139546 [details]
Another backtrace

(In reply to Michel Dänzer from comment #4)
> Can you maybe also provide
> the output of the following at the gdb prompt when it crashes?
> 
>  p *radeon_glamor_create_pixmap::pixmap
This outputs "value has been optimized out".
Comment 7 Michel Dänzer 2018-05-15 17:01:19 UTC
Created attachment 139578 [details] [review]
glamor: Bail CreatePixmap on unsupported pixmap depth

Does this patch fix it?
Comment 8 Theo 2018-05-16 17:44:38 UTC
Created attachment 139599 [details]
Backtrace of segfault after patch

(In reply to Michel Dänzer from comment #7)
> Created attachment 139578 [details] [review] [review]
> glamor: Bail CreatePixmap on unsupported pixmap depth
> 
> Does this patch fix it?
Not really. This turns it into a segmentation fault when I add the two lines to the source package[1] provided by openSUSE.

GDB backtrace is attached, here are the error messages from the Xorg log:

(EE) Backtrace:
(EE) 0: /usr/bin/X (xorg_backtrace+0x65) [0x55e3703f8fd5]
(EE) 1: /usr/bin/X (0x55e370244000+0x1b8d89) [0x55e3703fcd89]
(EE) 2: /lib64/libpthread.so.0 (0x7fedc4cec000+0x12080) [0x7fedc4cfe080]
(EE) 3: /usr/lib64/xorg/modules/drivers/radeon_drv.so (0x7fedc1caf000+0x448ca) [0x7fedc1cf38ca]
(EE) 4: /usr/bin/X (0x55e370244000+0x187407) [0x55e3703cb407]
(EE) 5: /usr/bin/X (DRI2CopyRegion+0x78) [0x55e3703cbc08]
(EE) 6: /usr/bin/X (0x55e370244000+0x188096) [0x55e3703cc096]
(EE) 7: /usr/bin/X (DRI2GetBuffersWithFormat+0xb) [0x55e3703cc13b]
(EE) 8: /usr/bin/X (0x55e370244000+0x189c20) [0x55e3703cdc20]
(EE) 9: /usr/bin/X (0x55e370244000+0x53f68) [0x55e370297f68]
(EE) 10: /usr/bin/X (0x55e370244000+0x57fb0) [0x55e37029bfb0]
(EE) 11: /lib64/libc.so.6 (__libc_start_main+0xe7) [0x7fedc494fa87]
(EE) 12: /usr/bin/X (_start+0x2a) [0x55e370285c5a]
(EE) 
(EE) Segmentation fault at address 0x2

[1] http://download.opensuse.org/source/tumbleweed/repo/oss/src/xf86-video-ati-18.0.1-1.1.src.rpm
Comment 9 Michel Dänzer 2018-05-17 07:52:29 UTC
Created attachment 139609 [details] [review]
Bail from dri2_create_buffer2 if we can't get a pixmap

Please try this patch on top.
Comment 10 Theo 2018-05-18 10:26:46 UTC
(In reply to Michel Dänzer from comment #9)
> Created attachment 139609 [details] [review] [review]
> Bail from dri2_create_buffer2 if we can't get a pixmap
> 
> Please try this patch on top.

This works. Mathematica no longer crashes the X server.
Comment 11 Michel Dänzer 2018-05-22 16:35:29 UTC
Thanks for the report and testing, fixed in Git master:

commit 65c9dfea4e841b7d6f795c7489fede58c5e9631f
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue May 15 18:59:30 2018 +0200

    glamor: Bail CreatePixmap on unsupported pixmap depth
    
commit 3dcfce8d0f495d09d7836caf98ef30d625b78a13
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu May 17 09:50:50 2018 +0200

    Bail from dri2_create_buffer2 if we can't get a pixmap

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.