Commit Graph

34 Commits

Author SHA1 Message Date
Kristian Høgsberg
3f4958755d launcher: Move rest of tty object into struct weston_launcher
The struct weston_launcher object will now either handle tty and vt switching
details in-process (when running weston directly as root) or talk to
the weston-launch process.
2013-09-18 23:00:17 -07:00
Kristian Høgsberg
6a7c8492cc weston-launch: Use fstat to make sure we stat the right fd
Instead of the racy stat+open, open first and then use fstat.  We want to
make sure we're stating the fd we'll be sending to weston and nothing else.
2013-09-18 22:14:09 -07:00
Kristian Høgsberg
81b4963949 launcher: Handle tty setup and teardown in launcher 2013-09-18 11:14:14 -07:00
Kristian Høgsberg
1eb482d814 launcher: Handle drm set/drop master and vt switch signals in launcher 2013-09-18 11:14:14 -07:00
Kristian Høgsberg
bf3c374b1b weston-launch: Use SOCK_SEQPACKET for the launcher socket
This lets us detect hang-up when weston-launch dies and clean up properly.
2013-09-18 11:14:14 -07:00
Kristian Høgsberg
f45b1e8284 weston-launch: Pass the right CLOEXEC flag to fcntl
Passing O_CLOEXEC to fcntl is wrong, we need to pass FD_CLOEXEC.
2013-09-18 11:14:14 -07:00
Kristian Høgsberg
1ff5109b5f compositor: Open drm device through launcher 2013-09-17 14:05:47 -07:00
Rob Bradford
7ac9f73c7d weston-launch: Only pass non-NULL value into setenv()
getenv() can return NULL is the key is not set, passing NULL into
setenv() is an error
2013-08-12 22:24:44 -07:00
Peter Hutterer
34be0608c7 weston-launch: always drop privileges before execve
The current code works if pw->pw_shell is bash because:
 "If the shell is started with the effective user (group) id not equal to
 the real user (group) id, and the -p option is not supplied, these actions
 are taken and the effective user id is set to the real user id."

Thus, for bash, weston's EUID == UID.

For zsh, the -p option "is enabled automatically on startup if the effective
user (group) ID is  not equal to the real user (group) ID."
Thus, weston's EUID = 0, and if pw_shell is zsh, /run/user/$UID/wayland-0 is
created with euid root and not writeable by the user, causing all clients to
fail.

Fix this by always dropping privileges to the user.

Regression introduced in 636156d.
2013-08-08 14:11:09 -07:00
Eduardo Lima
d0357bbb97 weston-launch: Fix signal mask typo 2013-07-30 10:45:26 -07:00
Kristian Høgsberg
73c60ab6e9 weston-launch: Unblock our signalfd signals before execing child
Giovanni Campagna ran into this with mutter.
2013-07-30 09:45:04 -07:00
Kristian Høgsberg
f2807701d9 weston-launch: Switch to regular poll
epoll doesn't provide any convenince here and is just awkward to use.
2013-07-25 15:58:00 -07:00
Kristian Høgsberg
636156d5f6 weston-launch: Don't start new session unless -u is given 2013-07-25 15:57:01 -07:00
Kristian Høgsberg
ab4999492c weston-launch: Drop sleep_fork option 2013-07-25 15:56:58 -07:00
Kristian Høgsberg
ca70f2fc68 weston-launch: Move child setup and exec to its own function 2013-07-25 15:56:49 -07:00
Kristian Høgsberg
18684d442e weston-launch: Ignore sighup
When our session terminates all processes get a SIGHUP.  We need to ignore
that in weston-launch and stay around to help weston shut down properly.

https://bugs.freedesktop.org/show_bug.cgi?id=63004
2013-07-22 16:34:41 -07:00
Kristian Høgsberg
07d48a306e weston-launch: Fix the typo for real this time
Thanks to MonkeyofDoom for point this out.  I'm still adjusting to the
fact that there's no 'd' in privilege, but I'll get over it.
2013-07-08 14:34:53 -04:00
Kristian Høgsberg
7e80f1b656 weston-launch: Fix an error message typo 2013-07-08 12:56:28 -04:00
Quentin Glidic
735302ea2d weston-launch: Set all groups for user
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>

https://bugs.freedesktop.org/show_bug.cgi?id=65933
2013-07-08 12:56:24 -04:00
Kristian Høgsberg
1a81abb1dd weston-launch: Don't exit on SIGTERM
Instead, forward signal to weston and wait for weston to clean up nicely.
Weston relies on weston-launch being around to shut down correctly,
so don't exit until we get the SIGCHLD from weston.  This make
killall weston-launch work properly.

https://bugs.freedesktop.org/show_bug.cgi?id=62910
2013-06-17 15:46:07 -04:00
Daniel Stone
c228e23b05 configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system.  This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.

Since this goes into config.h rather than the command line, ensure all
source is consistently including config.h before anything else,
including system libraries.  This doesn't need to be guarded by a
HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
modular transition.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>

[pq: rebased and converted more files]
2013-06-05 01:16:34 -04:00
Ander Conselvan de Oliveira
9bdfc48f09 weston-launch: Fix failure to exec weston due to initalized argv values
The array of arguments supplied to execv must be NULL terminated. If
unitialized values are used as pointers the exec call may fail with a
EFAULT error ("Bad address").

https://bugs.freedesktop.org/show_bug.cgi?id=64874
2013-05-22 16:39:36 -04:00
Rob Bradford
d33f2b065c weston-launch: Print explanation of why we failed to open the device 2013-05-20 16:55:12 -04:00
Quentin Glidic
ff3230952a weston-launch: Run weston in the user login shell
This patch brings back the user environment from the shell.
In the future, weston-launch could create the Wayland socket earlier, in
which case the user's shell could be used to run Wayland-specific tools
in the new Weston session.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2013-05-17 16:23:46 -04:00
Siddharth Heroor
d6be88b5e2 weston-launch: cleanup - return failures in main with EXIT_FAILURE
Signed-off-by: Siddharth Heroor <heroor@gmail.com>
2013-03-19 14:41:05 -04:00
Philipp Brüschweiler
7a3ec74cb6 weston-launch: return better value if weston dies because of a signal
Before this commit, weston-launch returned 0 if weston was killed by a
signal. This makes it hard to automatically test weston by using
weston-launch, as there is no way to know why weston was terminated.

This commit makes weston-launch return 10+N instead, where N is the code
of the signal that terminated weston. 10 was chosen because it allows a
script to distinguish it from the case that weston-launch itself was
killed by a signal (128+N), and does not overlap the standard exit codes
defined in sysexits.h.

Partial fix for https://bugs.freedesktop.org/show_bug.cgi?id=60935. I
can't reproduce the SIGHUP using the fbdev backend.

v3: better commit message.
2013-03-19 14:28:23 -04:00
Philipp Brüschweiler
ff253129c5 weston-launch: move function calls out of assert() 2013-03-19 14:28:01 -04:00
Kristian Høgsberg
272d243e00 weston-launch: Clear environment and set it up from scratch
With recent systemd[1] XDG_VTNR will leak through to pam, which ends up
setting a vtnr pam argument with the wrong value.  The fix is to clear
XDG_VTNR first, but what we should have been doing all along is resetting
the environment.

Thanks to Ray Strode for helping debug this.

[1] http://cgit.freedesktop.org/systemd/systemd/commit/?id=a8573ccc35a4efe8900be5d48c6c803670540c2b
2013-01-29 14:19:14 -05:00
Scott Moreau
cc9acfc75e weston-launch: Use "weston-launch" for --help instead of "weston".
The output of weston-launch --help was "Usage: weston [args...] ...".
This changes it to read "Usage: weston-launch [args...] ...".
2013-01-24 16:41:18 -05:00
Rob Bradford
40be7b467f weston-launch: Add some error reporting for weston-launch
This also avoids us passing (size_t)(-1 * sizeof(gid_t)) into malloc
2012-12-06 22:33:25 -05:00
John Kåre Alsaker
5b90d8f374 weston-launch: Check result of pam_start. 2012-10-16 11:26:00 -04:00
Tiago Vignatti
314db6edef weston-launch: be more descriptive with output messages
Specially the "either" word there is essential, so users don't confuse
thinking that both steps are needed.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-04-17 14:10:42 -04:00
Kristian Høgsberg
9e14091778 weston-launcher: Fix aliasing warnings 2012-04-10 01:26:18 -04:00
Benjamin Franzke
bfeda130de Introduce weston-launch
weston-launch starts weston and provides mechanism
for weston to set/drop drm master, open a tty,
and read input devices without being root.

Execution is allowed for local-active sessions
or users in the group weston-launch.
2012-04-06 14:01:19 +02:00