Bug 1597339

Summary: User session is terminated after User Switch
Product: Red Hat Enterprise Linux 7 Reporter: Jiri Koten <jkoten>
Component: gdmAssignee: Ray Strode [halfline] <rstrode>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: urgent Docs Contact: Marie Hornickova <mdolezel>
Priority: urgent    
Version: 7.6CC: ajax, alanm, btissoir, jkoten, lmiksik, ovasik, tpelka
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: gdm-3.28.2-9.el7 Doc Type: If docs needed, set a value
Doc Text:
undefined
Story Points: ---
Clone Of:
: 1632807 (view as bug list) Environment:
Last Closed: 2018-10-30 10:27:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1489977, 1635747, 1636460    
Bug Blocks: 1607454, 1632807    
Attachments:
Description Flags
Xorg log
none
xorg backtrace
none
gdm debug log
none
dmesg
none
Xorg.7.log
none
backtrace
none
dmesg drm debug
none
backtrace
none
Xorg.1.log none

Description Jiri Koten 2018-07-02 15:57:21 UTC
Description of problem:
For users which are not listed in login screen and have to login using 'Not listed?', the User Switching is broken. The user session is terminated. The Xorg crashed with signal 6, it failed on EnterVT. But this doesn't happen for normal users listed on login screen, so I blame GDM to mishandle the VT switching. 

The user session terminates when I try to log back in the session, since the gdm shows unlock button instead off login. But after I press 'unlock' the login screen appears again and after another login the user session is immediately locked.

Version-Release number of selected component (if applicable):
gdm-3.28.2-5.el7
kernel-3.10.0-915.el7
xorg-x11-server-Xorg-1.20.0-0.1.el7

How reproducible:
100%

Steps to Reproduce:
1. Login user through 'Not listed?'
2. Switch User
3. Login back as the same user through 'Not listed?'

Actual results:
The user session is terminated and i'm back at the login screen 

Expected results:
User is logged back in the running session.

Additional info:

Comment 2 Jiri Koten 2018-07-02 15:59:34 UTC
Probably related to rhbz#1489977

Comment 3 Jiri Koten 2018-07-02 16:00:55 UTC
Created attachment 1455988 [details]
Xorg log

Comment 4 Jiri Koten 2018-07-02 16:02:17 UTC
Created attachment 1455989 [details]
xorg backtrace

Comment 5 Jiri Koten 2018-07-02 17:17:23 UTC
Created attachment 1456003 [details]
gdm debug log

Comment 6 Jiri Koten 2018-07-30 13:36:59 UTC
This happens even with regular user. 
Reproducer:

1) Login to gnome session
2) Switch user
3) Log back in

Xorg crashes

Xorg.log
[snip] 
(EE) modeset(0): failed to set mode: Invalid argument.
(EE) Fatal server error:
(EE) EnterVT failed for screen 0

hw: T450s, VGA compatible controller [0300]: Intel Corporation HD Graphics 5500 [8086:1616] (rev 09)

Comment 8 Adam Jackson 2018-07-30 14:15:15 UTC
Please boot with drm.debug=7, provoke this failure, and attach the output of 'journalctl -k'.

Comment 9 Jiri Koten 2018-07-30 15:53:13 UTC
Created attachment 1471573 [details]
dmesg

journactl -k output at the time of the crash.

Comment 10 Jiri Koten 2018-07-30 15:58:25 UTC
I can confirm that the Xorg crash only with external monitors connected, using just the internal laptop screen, the crash won't happen.

I use two external monitors connected through docking station, laptop lid is closed.

$ xrandr -q
Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 8192 x 8192
eDP-1 connected (normal left inverted right x axis y axis)
   1920x1080     60.05 +  60.01    59.97    59.96    59.93  
   1680x1050     59.95    59.88  
   1400x1050     59.98  
   1600x900      59.99    59.94    59.95    59.82  
   1280x1024     60.02  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1440x810      60.00    59.97  
   1368x768      59.88    59.85  
   1280x800      59.99    59.97    59.81    59.91  
   1280x720      60.00    59.99    59.86    59.74  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   960x540       59.96    59.99    59.63    59.82  
   800x600       60.00    60.32    56.25  
   840x525       60.01    59.88  
   864x486       59.92    59.57  
   700x525       59.98  
   800x450       59.95    59.82  
   640x512       60.02  
   700x450       59.96    59.88  
   640x480       60.00    59.94  
   720x405       59.51    58.99  
   684x384       59.88    59.85  
   640x400       59.88    59.98  
   640x360       59.86    59.83    59.84    59.32  
   512x384       60.00  
   512x288       60.00    59.92  
   480x270       59.63    59.82  
   400x300       60.32    56.34  
   432x243       59.92    59.57  
   320x240       60.05  
   360x202       59.51    59.13  
   320x180       59.84    59.32  
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
DP-2-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 477mm x 268mm
   1920x1080     60.00*+  50.00    59.94  
   1600x1200     60.00  
   1680x1050     59.88  
   1280x1024     75.02    60.02  
   1440x900      74.98    59.90  
   1280x960      60.00  
   1280x800      59.91  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94  
   720x400       70.08  
DP-2-2 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 477mm x 268mm
   1920x1080     60.00*+  50.00    59.94  
   1600x1200     60.00  
   1680x1050     59.88  
   1280x1024     75.02    60.02  
   1440x900      74.98    59.90  
   1280x960      60.00  
   1280x800      59.91  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94  
   720x400       70.08  
DP-2-3 disconnected (normal left inverted right x axis y axis)

Comment 11 Adam Jackson 2018-08-01 21:10:37 UTC
This is almost certainly an issue in the new modifier support code in the modesetting driver, though our 1.20 server build seems to have many of the patches for that already. Definitely worth fixing but I'm not sure I'd block a compose or a beta for it.

Comment 13 Jiri Koten 2018-08-06 13:15:12 UTC
*** Bug 1611562 has been marked as a duplicate of this bug. ***

Comment 14 Benjamin Tissoires 2018-09-13 12:59:08 UTC
Apologies for the inconvenience. We won't be able to make 7.6 GA with this bug.
Moving to 7.7.

Comment 16 Jiri Koten 2018-09-18 14:46:27 UTC
(In reply to Jiri Koten from comment #10)
> I can confirm that the Xorg crash only with external monitors connected,
> using just the internal laptop screen, the crash won't happen.
> 

Sadly I have to take that back. With only internal display, the user session won't crash but the gdm Xorg will. So the crash happens also with only the internal screen.

This affects Fast-User-Switching on intel graphics using the modesetting Xorg driver.

Reproducer:

1) Have at least two users on the system
2) Login first user
3) Switch user

The gdm Xorg will crash
(EE) modeset(0): drmSetMaster failed: Invalid argument
(EE) 
Fatal server error:
(EE) AddScreen/ScreenInit failed for driver 0

Comment 17 Jiri Koten 2018-09-18 14:47:41 UTC
Created attachment 1484403 [details]
Xorg.7.log

Comment 18 Jiri Koten 2018-09-18 14:48:32 UTC
Created attachment 1484405 [details]
backtrace

Comment 19 Jiri Koten 2018-09-18 15:18:01 UTC
Looking at the backtraces there are actually two different crashes.

When I use dual-head with two external screens connected and laptop lid closed, the user session Xorg crahes in EnterVT, when I try to log back in, after user switch.

When I use only the internal laptop screen, gdm Xorg will crash in ScreenInit, right after the user switch.

In both cases the reproducer is the same.

Comment 20 Jiri Koten 2018-09-18 15:27:02 UTC
I can confirm that using the intel driver is a viable workaround.

$ cat /etc/X11/xorg.conf.d/20-intel.conf 
Section "Device"
  Identifier  "Intel Graphics"
  Driver      "intel"
EndSection

Comment 21 Adam Jackson 2018-09-18 19:21:59 UTC
(In reply to Jiri Koten from comment #19)

> When I use only the internal laptop screen, gdm Xorg will crash in
> ScreenInit, right after the user switch.

This part I can reproduce, at least, and I think I have a fix. Give this scratch build a shot, with 'drm.debug=0x10' on kcmdline:

https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=18384599

I think I've found at least one more bug in the modesetting driver that might affect the EnterVT failure, which I'm still investigating.

Re-adding rhel-7.6.0?, fix is getting closer.

Comment 23 Jiri Koten 2018-09-19 13:14:29 UTC
The scratch build won't crash with the original reproducer, but It crashes with the following one:

1) Login first user
2) Switch user
3) Login second user
4) Log out

After that, gdm Xorg crashes multiple times - I have counted 6 coredumps, and I'm back at the first user Lock screen. Crash in InitOutput.

This is just with the internal laptop screen.

Comment 24 Jiri Koten 2018-09-19 13:15:16 UTC
Created attachment 1484728 [details]
dmesg drm debug

Comment 25 Jiri Koten 2018-09-19 13:16:56 UTC
Created attachment 1484729 [details]
backtrace

Comment 26 Jiri Koten 2018-09-19 13:19:05 UTC
Created attachment 1484730 [details]
Xorg.1.log

Comment 27 Adam Jackson 2018-09-20 15:56:56 UTC
This looks like a gdm bug. After the second user logs out, gdm tries to launch another server to handle the login screen:

root      3540  0.1  2.3 329912 47492 tty1     Ssl+ 11:41   0:00 /usr/bin/X :0 -background none -noreset -audit 4 -verbose -auth /run/gdm/auth-for-gdm-smW7lI/database -seat seat0 vt1
root      6421  0.0  0.8 191860 18092 ?        Ss   11:45   0:00 /usr/bin/X :1 -background none -noreset -audit 4 -verbose -auth /run/gdm/auth-for-gdm-1iWAlB/database -seat seat0 vt1

Since the first server is already running on vt1, the second server is naturally going to fail in drmSetMaster.

Comment 31 Jiri Koten 2018-09-25 15:19:15 UTC
Using only the internal screen, the fast-user switching works fine, no crashes.

There is still the original issue with dual-head and crash in EnterVT after User Switch. I'll clone bug for that.

xorg-x11-server-Xorg-1.20.1-3.el7
gdm-3.28.2-9.el7

Comment 36 errata-xmlrpc 2018-10-30 10:27:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:3140