Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 830482

Summary: x11-base/xorg-server-21.1.2-r4 segfaults with x11-drivers/nvidia-drivers-495.46 when using xpresent extensions
Product: Gentoo Linux Reporter: acab
Component: Current packagesAssignee: Gentoo X packagers <x11>
Status: RESOLVED FIXED    
Severity: normal CC: ionen, jstein, sam
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
URL: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1275
See Also: https://bugs.gentoo.org/show_bug.cgi?id=850679
Whiteboard: Fixed in master and in 21.1.4
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 837317    
Attachments: xorg log file
emerge --info

Description acab 2022-01-03 02:20:56 UTC
After upgrading from x11-base/xorg-server-21.1.1-r2 to x11-base/xorg-server-21.1.2-r4 X crashes as soon as log in via lxdm.
Log reports (after rebuilding with unwind):
[  2982.641] (EE) Backtrace:
[  2982.641] (EE) 0: /usr/bin/X (OsLookupColor+0x135) [0x55a2bbd22db5]
[  2982.641] (EE) 1: /lib64/libc.so.6 (__sigaction+0x50) [0x7f7c1432cb30]
[  2982.642] (EE) 2: ? (?+0x0) [0x0]
[  2982.642] (EE) 3: /usr/bin/X (AddTraps+0x5a23) [0x55a2bbcb0d93]
[  2982.642] (EE) 4: /usr/bin/X (present_register_complete_notify+0x23b0) [0x55a2bbcb3850]
[  2982.642] (EE) 5: /usr/bin/X (present_register_complete_notify+0x1202) [0x55a2bbcb26a2]
[  2982.642] (EE) 6: /usr/bin/X (SendErrorToClient+0x364) [0x55a2bbc541e4]
[  2982.642] (EE) 7: /usr/bin/X (InitFonts+0x3c3) [0x55a2bbc580e3]
[  2982.642] (EE) 8: /lib64/libc.so.6 (__libc_init_first+0x8a) [0x7f7c143182fa]
[  2982.642] (EE) 9: /lib64/libc.so.6 (__libc_start_main+0x78) [0x7f7c143183a8]
[  2982.642] (EE) 10: /usr/bin/X (_start+0x21) [0x55a2bbc1c0c1]

Upgrading further to 21.1.3 doesn't help and the 21.1.1 ebuild is long gone.
Staring X via alternative mechanisms (xinit, startx, X, etc) ends up in the same crash.
Any advice please?

Reproducible: Always

Steps to Reproduce:
1. Login via lxdm
Actual Results:  
X crashes and gets respawned by lxdm which presents the login form again and again

Expected Results:  
My desktop session should start
Comment 1 acab 2022-01-03 02:21:27 UTC
Created attachment 761133 [details]
xorg log file
Comment 2 Jonas Stein gentoo-dev 2022-01-03 02:28:26 UTC
Thank you for the report. We need to have all information at hand before ticket assignment. Please 
* paste the emerge info 
as described on https://wiki.gentoo.org/wiki/Attach_the_logs_to_the_bug_ticket
Comment 3 Ionen Wolkens gentoo-dev 2022-01-03 02:34:38 UTC
Does it still happen with nvidia-drivers-495.44-r2? (stable 470.94 should be fine too).

If it does, I suspect it's
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1275

Still unclear if it's a Xorg bug that happened to work by accident on a nvidia-drivers regression.
Comment 4 Ionen Wolkens gentoo-dev 2022-01-03 02:40:51 UTC
(In reply to Ionen Wolkens from comment #3)
> Does it still happen with nvidia-drivers-495.44-r2? (stable 470.94 should be
> fine too).
> 
> If it does, I suspect it's
err, meant to say if it doesn't
Comment 5 acab 2022-01-03 09:16:53 UTC
Created attachment 761176 [details]
emerge --info
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-01-03 09:17:36 UTC
No reason to doubt ionen's diagnosis, as usual, but could possibly be helpful to enable debugging symbols for X (I know you did libunwind though) and glibc, just to see if it makes it any more clearer.
Comment 7 acab 2022-01-03 09:20:49 UTC
(In reply to Ionen Wolkens from comment #3)
> Does it still happen with nvidia-drivers-495.44-r2? (stable 470.94 should be
> fine too).
> 
> If it does, I suspect it's
> https://gitlab.freedesktop.org/xorg/xserver/-/issues/1275
> 
> Still unclear if it's a Xorg bug that happened to work by accident on a
> nvidia-drivers regression.

No, with nvidia-drivers-495.44-r2 the bug goes away.
Nice catch thanks!
Comment 8 acab 2022-01-03 09:32:49 UTC
(In reply to Sam James from comment #6)
> No reason to doubt ionen's diagnosis, as usual, but could possibly be
> helpful to enable debugging symbols for X (I know you did libunwind though)
> and glibc, just to see if it makes it any more clearer.

Here you go

Thread 1 "X" received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x000055813fbf9ddd in present_get_crtc (window=window@entry=0x5581419e4320)
    at ../xorg-server-21.1.2/present/present.c:52
#2  0x000055813fbfd070 in present_scmd_pixmap (window=0x5581419e4320, pixmap=0x558141a44300, serial=0, valid=0x0, 
    update=0x558141a916a0, x_off=<optimized out>, y_off=0, target_crtc=<optimized out>, wait_fence=0x0, 
    idle_fence=0x0, options=0, target_window_msc=0, divisor=1, remainder=0, notifies=0x0, num_notifies=0)
    at ../xorg-server-21.1.2/present/present_scmd.c:699
#3  0x000055813fbfbb72 in proc_present_pixmap (client=0x5581419b2a20)
    at ../xorg-server-21.1.2/present/present_request.c:146
#4  0x000055813fb989e4 in Dispatch () at ../xorg-server-21.1.2/dix/dispatch.c:550
#5  0x000055813fb9cb63 in dix_main (argc=8, argv=0x7ffcdec2e688, envp=<optimized out>)
    at ../xorg-server-21.1.2/dix/main.c:272
#6  0x00007f0ccd7eb2fa in __libc_start_call_main () from /lib64/libc.so.6
#7  0x00007f0ccd7eb3a8 in __libc_start_main () from /lib64/libc.so.6
#8  0x000055813fb5f161 in _start ()
Comment 9 Ionen Wolkens gentoo-dev 2022-01-03 09:46:14 UTC
Thanks, that looks identical to the issue.

Technically could be fixed by patching Xorg but unsure if it's something that should be fixed on Xorg or nvidia's side (not that can do much about the latter beside wait).

Hopefully something comes out of $URL.
Comment 10 acab 2022-01-03 09:52:19 UTC
(In reply to Ionen Wolkens from comment #9)
> Thanks, that looks identical to the issue.
> 
> Technically could be fixed by patching Xorg but unsure if it's something
> that should be fixed on Xorg or nvidia's side (not that can do much about
> the latter beside wait).
> 
> Hopefully something comes out of $URL.

Yeah i think you should just wait for upstream to decide whether those nulls are legit or what.

Meanwhile thanks a lot, you've been amazing.
Comment 11 Ionen Wolkens gentoo-dev 2022-01-12 03:08:38 UTC
Is this still happening with nvidia-drivers-510.39.01?
Comment 12 Ionen Wolkens gentoo-dev 2022-01-12 18:56:14 UTC
(In reply to Ionen Wolkens from comment #11)
> Is this still happening with nvidia-drivers-510.39.01?
Unfortunately, got a report that it is
Comment 13 Ionen Wolkens gentoo-dev 2022-01-14 05:07:35 UTC
Looking at recent developments, looks like the way to go will be to fix this in Xorg.

I'll keep 495.44-r2 in the tree until:
https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/841
Comment 14 Marian Kyral 2022-01-23 20:59:47 UTC
I'm affected by this issue as well. I'm on x11-drivers/nvidia-drivers-470.94, the latest for my GK.

I'm back on x11-base/xorg-server-1.20.14 and have working desktop again. I'll test the patch from above later.
Comment 15 Marian Kyral 2022-01-24 17:50:29 UTC
So patch did not helped. It must be something else. Back on 1.20.14 again.

[    10.535] (EE) Backtrace:
[    10.535] (EE) 0: /usr/bin/X (xorg_backtrace+0x5b) [0x563aab5c251b]
[    10.535] (EE) 1: /usr/bin/X (0x563aab489000+0x13d185) [0x563aab5c6185]
[    10.535] (EE) 2: /lib64/libpthread.so.0 (0x7f010028c000+0x120e0) [0x7f010029e0e0]
[    10.535] (EE) 3: /usr/bin/X (InitOutput+0x491) [0x563aab5e2c81]
[    10.535] (EE) 4: /usr/bin/X (0x563aab489000+0x76ac3) [0x563aab4ffac3]
[    10.535] (EE) 5: /lib64/libc.so.6 (__libc_start_main+0xcd) [0x7f01000f27fd]
[    10.535] (EE) 6: /usr/bin/X (_start+0x2a) [0x563aab4c508a]
[    10.535] (EE) 
[    10.535] (EE) Segmentation fault at address 0x10
Comment 16 Henny 2022-01-31 21:07:18 UTC
Hi,

I'd like to chime in here...

Same sympthoms on xorg/lightdm/mate combination here.
any nvidia-drivers >495.44-r2 would segfault and returned me to login screen.

so after masking a few driver versions i found this bug. and the proposed solution to wait for a patch on the xorg side.

I looked yesterday and there seemed to be some progress so went the "don't try this at home!" way.

emerged xorg-server-9999, tried the latest nvidia-drivers. braced for impact and breakage.

no segfault, all seems well at first glance.


Guess what i'm trying to say here is... seems hopeful, just hold on a bit longer.

my compliments to the teams who are looking into this. I am happy!
Comment 17 Larry the Git Cow gentoo-dev 2022-02-07 21:13:29 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=48948713f238a734ddc80071ddb60fa9e6d5a966

commit 48948713f238a734ddc80071ddb60fa9e6d5a966
Author:     Ionen Wolkens <ionen@gentoo.org>
AuthorDate: 2022-02-07 20:52:36 +0000
Commit:     Ionen Wolkens <ionen@gentoo.org>
CommitDate: 2022-02-07 21:11:40 +0000

    x11-drivers/nvidia-drivers: drop vulnerable 470.94, 495.*
    
    Users affected by bug #830482 (with unpatched Xorg) should
    use stable 470.103.01 rather than vulnerable 495.44-r2.
    
    Bug: https://bugs.gentoo.org/830482
    Bug: https://bugs.gentoo.org/832867
    Signed-off-by: Ionen Wolkens <ionen@gentoo.org>

 x11-drivers/nvidia-drivers/Manifest                |  21 -
 .../nvidia-drivers/nvidia-drivers-470.94.ebuild    | 445 -------------------
 .../nvidia-drivers/nvidia-drivers-495.44-r2.ebuild | 493 ---------------------
 .../nvidia-drivers-495.46-r10.ebuild               | 462 -------------------
 4 files changed, 1421 deletions(-)
Comment 18 Ionen Wolkens gentoo-dev 2022-05-12 12:27:01 UTC
Would it be possible to backport and stable (or optionally straight-to):
https://gitlab.freedesktop.org/xorg/xserver/-/commit/22d58188

Just trivial null checks, should have consequence beside prevent segfaults.

Originally it sounded like they were going to do a new release very soon (recall a comment talking of 2 weeks) but it's been taking a long time and some users need >=nvidia-drivers-510 to be stable for new cards.
Comment 19 Larry the Git Cow gentoo-dev 2022-06-03 08:38:18 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e90981351332cd70992e6458fc7aec721b883dce

commit e90981351332cd70992e6458fc7aec721b883dce
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-06-03 08:38:02 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-06-03 08:38:13 +0000

    x11-base/xorg-server: backport present crash fix
    
    Closes: https://bugs.gentoo.org/830482
    Signed-off-by: Sam James <sam@gentoo.org>

 .../xorg-server-21.1.3-present-null-check.patch    |  36 ++++
 x11-base/xorg-server/xorg-server-21.1.3-r3.ebuild  | 190 +++++++++++++++++++++
 2 files changed, 226 insertions(+)
Comment 20 Ionen Wolkens gentoo-dev 2022-06-03 09:44:05 UTC
Thanks.