Commit Graph

19 Commits

Author SHA1 Message Date
Patrick Steinhardt fa05d3cde6 session: Don't refuse unprivileged creation of "direct" backend
When starting a compositor that's using the "direct" session backend,
wlroots needs to handle calls to `drmSetMaster()` and `drmDropMaster()`.
As both calls used to require `CAP_SYS_ADMIN`, wlroots thus simply
refused starting in case the process doesn't enjoy evelated privileges.

Permission rules have changed since linux.git commit 45bc3d26c95a (drm:
rework SET_MASTER and DROP_MASTER perm handling, 2020-03-19). As a
result, starting with Linux v5.8, both ioctls will now also succeed if
the process is currently or has been the DRM master. And as the first
process to open render nodes will become the DRM master automatically,
this effectively means that process elevation is not strictly required
in all setups anymore.

So let's drop the `geteuid() != 0` permission check to allow those new
rules to do their magic.
2020-09-04 11:39:25 +02:00
Scott Anderson 906c0766df Remove libcap support
This is simply a false sense of security, and is worse than just using
setuid. CAP_SYS_ADMIN is an extremely serious capability that is
effectively as powerful as root.

It also required users to be in the input group, which allows any
process to keylog the entire system.
2020-04-29 10:39:09 +02:00
Jan Beich f80d174e8b Simplify evdev includes on FreeBSD by relying on up-to-date package
As evdev-proto is installed by CI some files have been missed:

 ../examples/pointer-constraints.c:2:10: fatal error: 'linux/input-event-codes.h' file not found
 #include <linux/input-event-codes.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
 ../examples/relative-pointer-unstable-v1.c:5:10: fatal error: 'linux/input-event-codes.h' file not found
 #include <linux/input-event-codes.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-01-07 08:08:47 +00:00
emersion 51bfdd620e
Use #if instead of #ifdef for wlroots config data
This prevents some annoying issues when e.g. not including wlr/config.h or
making a typo in the guard name.
2018-11-12 10:12:46 +01:00
sghctoma ba5df0d21d Fix build failure on non-FreeBSD systems
Accidentally included the FreeBSD-specific dev/evdev/input.h file on
other systems too. This commit fixes that.
2018-09-07 17:44:48 +02:00
sghctoma 7a5d3c4d3b Implement device type discovery using ioctl calls
This commit implements device type discovery by calling two ioctls
(DRM_IOCTL_VERSION and EVIOCGVERSION) on the device. These iocts are
specific to drm and input devices respectively, therefore we can
determine the device type based on which one returns an error.
2018-09-07 16:37:25 +02:00
sghctoma 2bd6fbf20e Fix that major(st_rdev) have no meaning on FreeBSD
The major device number does not indicate the device type on FreeBSD,
and AFAIK the only way to differentiate between DRM, input, and other
devices is checking the fd path. This commit implements that.

The drmDropmaster and drmSetmaster calls are necessary, because the
implicit drop (that should occur when the DRM fd is closed) seems not
to be working in some scenarios (e.g. if you have a tmux session
running - maybe the fd is retained somehow by tmux?). This is a
problem, because once you exit the compositor, you can't start it (or
any other program that wants to be DRM master) again until you close
all your tmux sessions.
2018-08-30 11:15:39 +02:00
Drew DeVault 4b096fc114 Revert "Merge pull request #1153 from emersion/include-config"
This reverts commit ef0a6ea4d2, reversing
changes made to 8d03bc9178.
2018-07-21 09:44:20 -04:00
emersion 41094a7df5 Always include config.h 2018-07-21 13:08:23 +01:00
emersion 7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Dominique Martinet 266898ca1f direct session backend: fix closing -1 on error
Found through static analysis
2018-06-30 11:38:21 +09:00
Tobias Blass 482fc48c74 FIX: Suprocess loops endlessly when the control socket closes.
recvmsg(3) returns 0 if the connection partner has shut down its socket.
The communicate function considered 0 a successful message, though, and
keeps calling recvmsg(3) again and again.
2018-06-20 22:00:45 +02:00
emersion c2e1474010
Reformat all #include directives 2018-02-12 21:29:23 +01:00
Björn Esser ff13849624
config: Avoid clash with other config-headers 2017-12-27 17:13:58 +01:00
Björn Esser 57a09c8ca4
config: Put all defines into config.h 2017-12-26 18:51:27 +01:00
Greg V a5fe9aa736 Add FreeBSD compatibility 2017-10-11 00:07:21 +03:00
Scott Anderson 46823152ea Rename functions to be consistent with #93 2017-08-26 11:56:43 +12:00
Scott Anderson cb4d50e22c Changed header paths. 2017-08-06 13:25:26 +12:00
Scott Anderson 2ae5cd6539 Moved session/ into backend/ 2017-08-06 13:25:26 +12:00
Renamed from session/direct-ipc.c (Browse further)