Commit graph

12208 commits

Author SHA1 Message Date
Lennart Poettering baa89da40a cgroup: when referencing cgroup controller trees allow omission of the path 2013-09-26 20:20:30 +02:00
Zbigniew Jędrzejewski-Szmek 2b3ab29de4 Move part of logind.c into a separate file
liblogind-core.la was underlinked, missing a few functions
defined in logind.c. They are moved to a new file, logind-core.c,
and this file is linked into liblogind-core.la.
In addition, logind-acl.c is attached to the liblogind-core.la,
instead of systemd-logind directly.
2013-09-26 11:12:04 +02:00
Zbigniew Jędrzejewski-Szmek bd16acf35e Move functions around to fix underlinking in test-machine-tables 2013-09-26 11:12:04 +02:00
Zbigniew Jędrzejewski-Szmek 732bfe09ae build-sys: add ./configure --enable-address-sanitizer
Enabling address sanitizer seems like a useful thing, but is quite
tricky. Proper flags have to be passed to CPPFLAGS, CFLAGS and
LDFLAGS, but passing them on the commandline doesn't work because
we tests are done with ld directly, and not with libtool like in
real linking. We might want to fix this, but let's add a handy
way to enable address checking anyway.
2013-09-26 11:12:04 +02:00
Zbigniew Jędrzejewski-Szmek 5843c5ebb4 journald: accept EPOLLERR from /dev/kmsg
Also print out unexpected epoll events explictly.
2013-09-26 11:12:04 +02:00
Zbigniew Jędrzejewski-Szmek 8097ab4f0c test-hashmap: fix access to uninitialized memory 2013-09-26 11:12:03 +02:00
Zbigniew Jędrzejewski-Szmek f546241b6d execute.c: little modernization 2013-09-26 11:12:03 +02:00
Lennart Poettering fecffe5d0a util: add macro for iterating through all prefixes of a path
Syntactic sugar in a macro PATH_FOREACH_PREFIX.
2013-09-25 21:04:35 +02:00
Jimmie Tauriainen bc5fb0809e keymap: Add Samsung Ativ 9 Plus
https://launchpad.net/bugs/1229936
2013-09-25 07:30:23 +02:00
Lennart Poettering 13b84ec7df cgroup: if we do a cgroup operation then do something on all supported controllers
Previously we did operations like attach, trim or migrate only on the
controllers that were enabled for a specific unit. With this changes we
will now do them for all supproted controllers, and fall back to all
possible prefix paths if the specified paths do not exist.

This fixes issues if a controller is being disabled for a unit where it
was previously enabled, and makes sure that all processes stay as "far
down" the tree as groups exist.
2013-09-25 03:38:17 +02:00
Dave Reisner 8bd94f7a03 journalctl(1): s/adm/systemd-journal/ 2013-09-24 14:39:40 -04:00
Lukas Nykryn a6dbecc4e2 logind: return -EINVAL when PID is wrong
dbus-send --print-reply --system --dest=org.freedesktop.login1
/org/freedesktop/login1 org.freedesktop.login1.Manager.GetUserByPID
uint32:0
causes
systemd-logind[29843]: Assertion 'pid >= 1' failed at
src/login/logind.c:938, function manager_get_user_by_pid(). Aborting.
2013-09-24 17:00:33 +02:00
Kay Sievers ee9c9500ab TODO: add header back 2013-09-24 15:47:42 +02:00
Kay Sievers 540fd137af hwdb: update 2013-09-24 15:47:12 +02:00
Kay Sievers c51d84dc09 support acpi firmware performance data (FPDT)
Prefer firmware-provided performance data over loader-exported ones; if
ACPI data is available, always use it, otherwise try to read the loader
data.

The firmware-provided variables start at the time the first EFI image
is executed and end when the operating system exits the boot services;
the (loader) time calculated in systemd-analyze increases.
2013-09-24 15:43:41 +02:00
Kay Sievers 036ae95ac4 shared: device-nodes - add include guard 2013-09-24 15:34:57 +02:00
Kay Sievers fb8f3f9869 TODO: update 2013-09-24 15:34:57 +02:00
Lennart Poettering e58cec11e6 cgroup: always enable memory.use_hierarchy= for all cgroups in the memory hierarchy
The non-hierarchial mode contradicts the whole idea of a cgroup tree so
let's not support this. In the future the kernel will only support the
hierarchial logic anyway.
2013-09-23 16:02:31 -05:00
Eelco Dolstra a0f708053b Fix obsolete references to systemd-random-seed-load.service
This service was merged with systemd-random-seed-save.service in
c35b956d34.
2013-09-23 11:41:30 +02:00
Dave Reisner d808ca6414 completion/systemctl: add missing list-sockets verb 2013-09-20 14:48:43 -04:00
Mantas Mikulėnas 6c60569550 logind: put correct user object paths in introspection data
Sync with user_bus_path() in logind-user-dbus.c
2013-09-20 14:08:26 -04:00
Zbigniew Jędrzejewski-Szmek 1bee43de64 man: mention --runtime where appropriate
https://bugzilla.redhat.com/show_bug.cgi?id=1009956
2013-09-19 18:42:15 -05:00
Martin Pitt 42a9de1c25 keymap: Fix wrong assignments to F23
These days, F21/F22/F23 mean Touchpad toggle/on/off. Clean up other assignments
to that from ancient times which belong to keys like "Auto Brightness" (which
doesn't have a keycode and is usually hardwired) or some "launch vendor tool"
key.

https://bugs.freedesktop.org/show_bug.cgi?id=62953
2013-09-19 16:43:43 -05:00
Dave Reisner 184ecaf794 systemctl: Avoid ellipsizing when piping output 2013-09-19 17:39:49 -04:00
Zbigniew Jędrzejewski-Szmek 1e5413f74f Add more tests and fix capability logging 2013-09-19 16:22:59 -05:00
Zbigniew Jędrzejewski-Szmek 1864b0e395 build-sys: don't build python modules after --without-python
The modules should build just fine, but AM_PATH_PYTHON sets
pkgpyexecdir for us. Without that variable we don't know where to
install modules. In addition libtool tries an empty rpath, breaking
the build. Those issues could be fixed or worked around, but we
probably don't have many people who want to avoid using python binary,
but want to compile python modules. If such uses ever come up, this
issue should be revisited.
2013-09-19 14:58:21 -04:00
Dave Reisner cecf24e7f0 fix grammatical error 2013-09-19 14:55:35 -04:00
Dave Reisner d2421337f6 nspawn: be less liberal about creating bind mount destinations
Previously, if a file's bind mount destination didn't exist, nspawn
would blindly create a directory, and the subsequent bind mount would
fail. Examine the filetype of the source and ensure that, if the
destination does not exist, that it is created appropriately.

Also go one step further and ensure that the filetypes of the source
and destination match.
2013-09-19 14:48:43 -04:00
Dave Reisner e7363c59d6 test-utf8: add more tests for public functions 2013-09-19 11:50:36 -04:00
Dave Reisner 8f6ce71fe7 device-nodes: move device node specific code to own file
In the process, rename udev_encode_string which is poorly named for what
it does. It deals specifically with encoding names that udev creates and
has its own rules: utf8 is valid but some ascii is not (e.g. path
separators), and everything else is simply escaped. Rename it to
encode_devnode_name.
2013-09-19 11:50:34 -04:00
Dave Reisner 7991ac34ab shared/utf8: merge implementations, remove cruft
This unifies the utf8 handling code which was previously duplicated in
udev and systemd.
2013-09-19 11:49:03 -04:00
Dave Reisner 894a156de7 udev-builtin-blkid: export ID_PART_TABLE_UUID 2013-09-19 11:38:48 -04:00
Andrey Borzenkov f4d213c15b clarify $ escaping in Exec* lines
Explain that literal $ can be passed by doubling it.
2013-09-19 10:22:10 -05:00
David Strauss c22428fb73 Spelling fix from later revision of committed patch from Shawn Landden <shawn@churchofgit.com>. 2013-09-18 15:46:51 -05:00
Zbigniew Jędrzejewski-Szmek 4ec29144dd Fix capability logging when effective caps are 0
Shawn Landen> Doesn't this also skip the last '0' when it is all '0's?
              You need to keep the last one.
2013-09-18 11:43:29 -05:00
Colin Walters 72fd713962 polkit: Avoid race condition in scraping /proc
If a calling process execve()s a setuid program, it can appear to be
uid 0.  Since we're receiving requests over DBus, avoid this by simply
passing system-bus-name as a subject.
2013-09-18 11:06:04 -05:00
Zbigniew Jędrzejewski-Szmek 00f117a599 logs-show.c: fix enum type in function declaration 2013-09-18 11:00:51 -05:00
Zbigniew Jędrzejewski-Szmek 0a7b53bdd2 util: restore get_process_capeff behaviour
69ab8088 unified parsing of status files and removed the logic of
skipping extra '0's when getting the effective capabilities. Restore
that logic, so that the same capabilities are always mapped to the
same strings in the journal.
2013-09-17 18:37:32 -05:00
Zbigniew Jędrzejewski-Szmek 1dc2ced464 Remove six unused variables and add annotation
clang FTW!
2013-09-17 19:08:51 -04:00
David Herrmann 831dedef66 logind: fix build for ARM with sizeof(dev_t) > sizeof(void*)
Unfortunately on ARM-32 systems dev_t can be 64bit and thus we cannot
store it easily in void* keys for hashtables. Fix that by passing a
pointer to the dev_t variable instead.
2013-09-17 19:08:51 -04:00
Lennart Poettering 3db604b907 gpt-auto-generator: do not assume that /dev/block/%u:%u is useable
The generator might run before udev, and udev sets up the /dev/block/
symlinks, hence we cannot use them from the gpt generator. Instead,
manually translate a major/minor to a device node.
2013-09-17 18:04:40 -05:00
Lennart Poettering ef5bfcf668 backlight,random-seed: move state files into /var/lib/systemd
Let's not scatter (private) files in /var around, let's place them all
in /var/lib/systemd and below.
2013-09-17 17:28:35 -05:00
David Herrmann d7bd01b547 logind: implement generic multi-session
This enables the multi-session capability for seats that don't have VTs.
For legacy seats with VTs, everything stays the same. However, all other
seats now also get the multi-session capability.

The only feature that was missing was session-switching. As logind can
force a session-switch and signal that via the "Active" property, we only
need a way to allow synchronized/delayed session switches. Compositors
need to cleanup some devices before acknowledging the session switch.
Therefore, we use the session-devices to give compositors a chance to
block a session-switch until they cleaned everything up.

If you activate a session on a seat without VTs, we send a PauseDevice
signal to the active session for every active device. Only once the
session acknowledged all these with a PauseDeviceComplete() call, we
perform the final session switch.

One important note is that delayed session-switching is meant for
backwards compatibility. New compositors or other sessions should really
try to deal correctly with forced session switches! They only need to
handle EACCES/EPERM from syscalls and treat them as "PauseDevice" signal.

Following logind patches will add a timeout to session-switches which
forces the switch if the active session does not react in a timely
fashion. Moreover, explicit ForceActivate() calls might also be supported.
Hence, sessions must not crash if their devices get paused.
2013-09-17 17:15:30 -05:00
David Herrmann 118ecf3242 logind: introduce session-devices
A session-device is a device that is bound to a seat and used by a
session-controller to run the session. This currently includes DRM, fbdev
and evdev devices. A session-device can be created via RequestDevice() on
the dbus API of the session. You can drop it via ReleaseDevice() again.
Once the session is destroyed or you drop control of the session, all
session-devices are automatically destroyed.

Session devices follow the session "active" state. A device can be
active/running or inactive/paused. Whenever a session is not the active
session, no session-device of it can be active. That is, if a session is
not in foreground, all session-devices are paused.
Whenever a session becomes active, all devices are resumed/activated by
logind. If it fails, a device may stay paused.

With every session-device you request, you also get a file-descriptor
back. logind keeps a copy of this fd and uses kernel specific calls to
pause/resume the file-descriptors. For example, a DRM fd is muted
by logind as long as a given session is not active. Hence, the fd of the
application is also muted. Once the session gets active, logind unmutes
the fd and the application will get DRM access again.
This, however, requires kernel support. DRM devices provide DRM-Master for
synchronization, evdev devices have EVIOCREVOKE (pending on
linux-input-ML). fbdev devices do not provide such synchronization methods
(and never will).
Note that for evdev devices, we call EVIOCREVOKE once a session gets
inactive. However, this cannot be undone (the fd is still valid but mostly
unusable). So we reopen a new fd once the session is activated and send it
together with the ResumeDevice() signal.

With this infrastructure in place, compositors can now run without
CAP_SYS_ADMIN (that is, without being root). They use RequestControl() to
acquire a session and listen for devices via udev_monitor. For every
device they want to open, they call RequestDevice() on logind. This
returns a fd which they can use now. They no longer have to open the
devices themselves or call any privileged ioctls. This is all done by
logind.
Session-switches are still bound to VTs. Hence, compositors will get
notified via the usual VT mechanisms and can cleanup their state. Once the
VT switch is acknowledged as usual, logind will get notified via sysfs and
pause the old-session's devices and resume the devices of the new session.

To allow using this infrastructure with systems without VTs, we provide
notification signals. logind sends PauseDevice("force") dbus signals to
the current session controller for every device that it pauses. And it
sends ResumeDevice signals for every device that it resumes. For
seats with VTs this is sent _after_ the VT switch is acknowledged. Because
the compositor already acknowledged that it cleaned-up all devices.
However, for seats without VTs, this is used to notify the active
compositor that the session is about to be deactivated. That is, logind
sends PauseDevice("force") for each active device and then performs the
session-switch. The session-switch changes the "Active" property of the
session which can be monitored by the compositor. The new session is
activated and the ResumeDevice events are sent.

For seats without VTs, this is a forced session-switch. As this is not
backwards-compatible (xserver actually crashes, weston drops the related
devices, ..) we also provide an acknowledged session-switch. Note that
this is never used for sessions with VTs. You use the acknowledged
VT-switch on these seats.

An acknowledged session switch sends PauseDevice("pause") instead of
PauseDevice("force") to the active session. It schedules a short timeout
and waits for the session to acknowledge each of them with
PauseDeviceComplete(). Once all are acknowledged, or the session ran out
of time, a PauseDevice("force") is sent for all remaining active devices
and the session switch is performed.
Note that this is only partially implemented, yet, as we don't allow
multi-session without VTs, yet. A follow up commit will hook it up and
implemented the acknowledgements+timeout.

The implementation is quite simple. We use major/minor exclusively to
identify devices on the bus. On RequestDevice() we retrieve the
udev_device from the major/minor and search for an existing "Device"
object. If no exists, we create it. This guarantees us that we are
notified whenever the device changes seats or is removed.

We create a new SessionDevice object and link it to the related Session
and Device. Session->devices is a hashtable to lookup SessionDevice
objects via major/minor. Device->session_devices is a linked list so we
can release all linked session-devices once a device vanishes.

Now we only have to hook this up in seat_set_active() so we correctly
change device states during session-switches. As mentioned earlier, these
are forced state-changes as VTs are currently used exclusively for
multi-session implementations.

Everything else are hooks to release all session-devices once the
controller changes or a session is closed or removed.
2013-09-17 17:15:30 -05:00
Lennart Poettering 360e09ea9a Update TODO 2013-09-17 17:15:30 -05:00
Kay Sievers 491d152dbd libudev: add missing 'global' to symbol export 2013-09-17 17:09:46 -05:00
Lennart Poettering 4608af4333 journald: avoid NSS in journald
In order to avoid a deadlock between journald looking up the
"systemd-journal" group name, and nscd (or anyother NSS backing daemon)
logging something back to the journal avoid all NSS in journald the same
way as we avoid it from PID 1.

With this change we rely on the kernel file system logic to adjust the
group of created journal files via the SETGID bit on the journal
directory. To ensure that it is always set, even after the user created
it with a simply "mkdir" on the shell we fix it up via tmpfiles on boot.
2013-09-17 16:55:37 -05:00
Lennart Poettering 265ffa1e05 tmpfiles: add a new "m" line type that adjusts user/group/mode of a file if it exists 2013-09-17 16:55:37 -05:00
Zbigniew Jędrzejewski-Szmek d8a1100346 test-fileio: assume that Buffers may be missing 2013-09-17 15:50:49 -05:00
Zbigniew Jędrzejewski-Szmek e9e506ed43 Make test-login and test-sleep output debugging
Without a call to log_parse_environment(), things
like SYSTEMD_LOG_LEVEL do not work.
2013-09-17 16:44:38 -04:00