Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

SUID: Drop root permission like Sway #7

Closed
sdsddsd1 opened this issue Jun 9, 2020 · 16 comments
Closed

SUID: Drop root permission like Sway #7

sdsddsd1 opened this issue Jun 9, 2020 · 16 comments
Labels
A: enhancement New feature or request B: not applicable Resolution: not a valid issue

Comments

@sdsddsd1
Copy link

sdsddsd1 commented Jun 9, 2020

Hey,
since this project might be interesting for minimal envoriments without systemd/elogind, I wanted to ask if its on your agenda to add support for setuid on the binary and drop the provilieges as soon as they are unneded like it is done in Sway.
sway wiki
Sway refuses to start when it cant drop privileges

@djpohly
Copy link
Owner

djpohly commented Jun 13, 2020

Sounds good to me. Send a PR to review?

@sdsddsd1
Copy link
Author

I am not able to do this. I just want to ask or encourage the conversation.

@djpohly djpohly added the A: enhancement New feature or request label Jul 26, 2020
@LukasZumvorde
Copy link

A pull request has been added trying to copy this feature form Sway #36

@djpohly
Copy link
Owner

djpohly commented Aug 7, 2020

Can someone with this use case test the PR?

@sdsddsd1
Copy link
Author

sdsddsd1 commented Aug 9, 2020

I would test, but I cant build dwl because of missing xwayland. I cannot find a way to disable it in the makefile.

@alex-courtis
Copy link
Contributor

xwayland is not optional; you'll need it to build and run.

@djpohly
Copy link
Owner

djpohly commented Aug 10, 2020

It ought to be optional, really. You shouldn't have to install X11 cruft in order to run dwl.

@djpohly
Copy link
Owner

djpohly commented Aug 10, 2020

Fixed that. @sdsddsd1, give it another try!

@sdsddsd1
Copy link
Author

I have no success to start dwl. It cannot become 'drm master' and ends with a segmention fault. There is chmod u+s /usr/bin/dwl.
Here is a strace, if that helps. https://termbin.com/195v

@sdsddsd1
Copy link
Author

@LukasZumvorde , I somehow couldnt ping you in the first post.

@sdsddsd1
Copy link
Author

Is this feature still relevant? As of linux 5.8 it is possible to become and drop drm_master for unprevileged users. This feature is available in the latest wlroots master. I can run other compositors with setgid on input as a user process.

chown :input /usr/bin/sway
chmod g+s    /usr/bin/sway

I can start also dwl like this, but firefox refuses to start because of allegedly root permissions.

@djpohly
Copy link
Owner

djpohly commented Dec 25, 2020

@sdsddsd1 Do you still have an issue with this on your setup, or did the Linux fix (plus, perhaps, adding your user to the input group) solve it?

@sdsddsd1
Copy link
Author

@djpohly : I dont have wayland setup at the moment to test on. My setup was the lines above and to be in the video group. I think I tried with to be in the input group aswell. When I remember right dwl was still started as a root process. My guess is, it does not know how to drop root.

@yellowhat
Copy link

Hi,
I have just tried to compile dwl but on running it the tty gets frozen even with:

chown :input dwl
chmod g+s dwl

Does dwl requires to be run as root?

Thanks

@yellowhat
Copy link

No having my user part of the input group was the problem.

@djpohly
Copy link
Owner

djpohly commented Apr 26, 2021

I think this was due to missing either the input or video group for the running user, so I'm going to go ahead and close it.

@djpohly djpohly closed this as completed Apr 26, 2021
@djpohly djpohly added the B: not applicable Resolution: not a valid issue label Apr 26, 2021
link2xt added a commit to link2xt/dwl that referenced this issue Nov 19, 2023
…NULL

Passing NULL to wlr_keyboard_set_keymap results in a segfault.
Example:

  Thread 1 "dwl" received signal SIGSEGV, Segmentation fault.
  0x00007ffff7e49b64 in xkb_keymap_ref () from /usr/lib/libxkbcommon.so.0
  (gdb) bt
  #0  0x00007ffff7e49b64 in xkb_keymap_ref () at /usr/lib/libxkbcommon.so.0
  djpohly#1  0x00007ffff7f06389 in wlr_keyboard_set_keymap () at /usr/lib/libwlroots.so.11
  djpohly#2  0x000055555555bc54 in createkeyboard ()
  djpohly#3  0x000055555555c283 in inputdevice ()
  djpohly#4  0x00007ffff7e8101e in wl_signal_emit_mutable () at /usr/lib/libwayland-server.so.0
  djpohly#5  0x00007ffff7e8101e in wl_signal_emit_mutable () at /usr/lib/libwayland-server.so.0
  djpohly#6  0x00007ffff7edb52c in  () at /usr/lib/libwlroots.so.11
  djpohly#7  0x00007ffff7ee44b6 in  () at /usr/lib/libwlroots.so.11
  djpohly#8  0x000055555555fe66 in main ()
sevz17 pushed a commit that referenced this issue Nov 19, 2023
…NULL

Passing NULL to wlr_keyboard_set_keymap results in a segfault.
Example:

  Thread 1 "dwl" received signal SIGSEGV, Segmentation fault.
  0x00007ffff7e49b64 in xkb_keymap_ref () from /usr/lib/libxkbcommon.so.0
  (gdb) bt
  #0  0x00007ffff7e49b64 in xkb_keymap_ref () at /usr/lib/libxkbcommon.so.0
  #1  0x00007ffff7f06389 in wlr_keyboard_set_keymap () at /usr/lib/libwlroots.so.11
  #2  0x000055555555bc54 in createkeyboard ()
  #3  0x000055555555c283 in inputdevice ()
  #4  0x00007ffff7e8101e in wl_signal_emit_mutable () at /usr/lib/libwayland-server.so.0
  #5  0x00007ffff7e8101e in wl_signal_emit_mutable () at /usr/lib/libwayland-server.so.0
  #6  0x00007ffff7edb52c in  () at /usr/lib/libwlroots.so.11
  #7  0x00007ffff7ee44b6 in  () at /usr/lib/libwlroots.so.11
  #8  0x000055555555fe66 in main ()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A: enhancement New feature or request B: not applicable Resolution: not a valid issue
Projects
None yet
Development

No branches or pull requests

5 participants