xdg-desktop-portal-wlr: Segfault when using greetd + Sway
I’m using greetd as login manager with the GTK greeter and Sway.
This setup is more or less explained here and here.
After a specific upgrade, the greeter now takes a few seconds to start due to xdpw crashing and being restarted several times.
Here’s the log with -l DEBUG: xdpw.log
This is what coredumpctl info says:
[I] ~ $ coredumpctl info
PID: 3072 (xdg-desktop-por)
UID: 976 (greeter)
GID: 976 (greeter)
Signal: 11 (SEGV)
Timestamp: Sun 2021-06-13 22:02:18 -03 (14min ago)
Command Line: /usr/lib/xdg-desktop-portal-wlr -l DEBUG
Executable: /usr/lib/xdg-desktop-portal-wlr
Control Group: /user.slice/user-976.slice/user@976.service/app.slice/xdg-desktop-portal-wlr.service
Unit: user@976.service
User Unit: xdg-desktop-portal-wlr.service
Slice: user-976.slice
Owner UID: 976 (greeter)
Boot ID: a52b1ef6df664d259ee863b9aa403656
Machine ID: 3d14cd859eed44e78935812dd176271f
Hostname: ryzen
Storage: /var/lib/systemd/coredump/core.xdg-desktop-por.976.a52b1ef6df664d259ee863b9aa403656.3072.1623632538000000.zst (inaccessible)
Message: Process 3072 (xdg-desktop-por) of user 976 dumped core.
Stack trace of thread 3072:
#0 0x00007fe571794515 __strlen_avx2 (libc.so.6 + 0x160515)
#1 0x000055b5f806a5c2 n/a (xdg-desktop-portal-wlr + 0x45c2)
#2 0x00007fe57165bb25 __libc_start_main (libc.so.6 + 0x27b25)
#3 0x000055b5f806b05e n/a (xdg-desktop-portal-wlr + 0x505e)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (1 by maintainers)
Commits related to this issue
- config: handle missing HOME env variable gracefully Fixes: https://github.com/emersion/xdg-desktop-portal-wlr/issues/149 — committed to columbarius/xdg-desktop-portal-wlr by columbarius 3 years ago
- config: handle missing HOME env variable gracefully Fixes: https://github.com/emersion/xdg-desktop-portal-wlr/issues/149 — committed to emersion/xdg-desktop-portal-wlr by columbarius 3 years ago
I took a look at the code and it seems you are calling
strlenover aNULLpointer, here:The environment variable
HOMEis not defined because greetd and greetd-gtkgreet run as thegreeteruser.The
greeteruser has no home:Now that I think of, isn’t
HOMEguaranteed to be always defined?Let me know if you need anything else.
That’s strange, I’ll probably do more research, for example
xdg-desktop-portalhasHOMEdefined in my regular session but not in the greetd session.Yes, I just built
xdg-desktop-portal-wlr-gitand it didn’t crashed in the greetd’s login screen.@itaranto Thanks for finding hat. Never came to my mind, that xdpw could run as a system user without home.
Could you test if #151 fixes it, please?
getenvcalls are “safe” by default in that they either return a string or NULL, we just need to check for that.You nailed it! This is a regression. @columbarius, can we make these
getenvcalls safe? If you don’t have time, I may be able to push a PR tomorrow evening.It’s strange, xdpw is still crashing but now there’s no logs.
Another strange thing is that I found a crash for gtkgreet that I can reproduce 100% of the time. Every time I enter an incorrect password it segfaults, with a correct one it doesn’t. I’ll report that to
greetd-gtkgreet.I think this is probably unrelated to xdwp.