Commit Graph
9479 Commits
Author SHA1 Message Date
Jan Engelhardt 240c4b0868 vconsole: match on vtcon events, not fbcon ones
I observe that upon loading of framebuffer drivers, I do not get the
desired system font, but the kernel-level defaults (usually
lib/fonts/font_8x16.c, but your mileage may vary depending on kernel
config and boot options).

The fbcon driver may be loaded at a time way before the first
framebuffer device is active, such that the vconsole setup helper
runs too early.

The existing rule is non-fitting. The going live of the fbcon kernel
component does not indicate the proper time at which to load the
visuals, which really ought to be done when a new vtcon object comes
into existence. (The font table is a per-vtcon property.)

(cherry picked from commit a52750d148)
(cherry picked from commit b83da13fff)
2015-03-27 13:55:23 -04:00
Michael Biebl 64a51989b9 vconsole: don't hard-code systemd-vconsole-setup binary path 2015-03-27 13:52:15 -04:00
Zbigniew Jędrzejewski-Szmek 317ca85db0 Revert "vconsole: match on vtcon events, not fbcon ones"
This reverts commit b71cdaca9b.

The file got renamed in the meanwhile.
2015-03-27 13:51:41 -04:00
Michal Schmidt 56979fdd6f core/namespace: fix path sorting
The comparison function we use for qsorting paths is overly indifferent.
Consider these 3 paths for sorting:
 /foo
 /bar
 /foo/foo
qsort() may compare:
 "/foo" with "/bar" => 0, indifference
 "/bar" with "/foo/foo" => 0, indifference
and assume transitively that "/foo" and "/foo/foo" are also indifferent.

But this is wrong, we want "/foo" sorted before "/foo/foo".
The comparison function must be transitive.

Use path_compare(), which behaves properly.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1184016
(cherry picked from commit a0827e2b12)
(cherry picked from commit 85a6fabdd3)
2015-03-23 02:37:20 -04:00
Michal Schmidt d3797cb2e6 shared: add path_compare(), an ordering path comparison
... and make path_equal() a simple wrapper around it.

(cherry picked from commit 2230852bd9)
(cherry picked from commit 533cc35f09)
2015-03-23 02:37:12 -04:00
Zbigniew Jędrzejewski-Szmek 347a55643e timedated: flip internal status after executing operation
timedated would set the internal status before calling out to systemd to do
the actual change. When the operation was refused because of a SELinux denial,
the state kept in timedated would get out of sync, and the second call from
timedatectl would appear to succeed.

https://bugzilla.redhat.com/show_bug.cgi?id=1014315

(cherry picked from commit 192b98b8fe)
(cherry picked from commit fb14f86a71)

[Amended to reverse the condition.]
2015-03-23 02:36:47 -04:00
Will Woods 78db230ae6 selinux: fix SEGV during switch-root if SELinux policy loaded
If you've got SELinux policy loaded, label_hnd is your labeling handle.
When systemd is shutting down, we free that handle via mac_selinux_finish().

But: switch_root() calls mkdir_p_label(), which tries to look up a label
using that freed handle, and so we get a bunch of garbage and eventually
SEGV in libselinux.

(This doesn't happen in the switch-root from initramfs to real root because
there's no SELinux policy loaded in initramfs, so label_hnd is NULL and we
never attempt any lookups.)

So: make sure that mac_selinux_finish() actually sets label_hnd to NULL, so
nobody tries to use it after it becomes invalid.

https://bugzilla.redhat.com/show_bug.cgi?id=1185604
(cherry picked from commit f5ce2b4958)
(cherry picked from commit 19e98bf405)
2015-03-23 02:32:24 -04:00
Mathieu Chevrier 3e3ed4d07d gpt-auto-generator: fix detection of /srv
https://bugs.freedesktop.org/show_bug.cgi?id=89226
(cherry picked from commit d736e4f3e7)
(cherry picked from commit 4bbc153799)
2015-03-23 02:32:12 -04:00
Umut Tezduyar Lindskog 81495a07be cgtop: fix assert when not on tty
systemd-cgtop --dept=1 -b -n 10 -d 0.1 | cat

Assertion 'new_length >= 3' failed at src/shared/util.c:3 \
595, function ellipsize_mem(). Aborting.
Aborted (core dumped)

(David: add comment)

(cherry picked from commit 510c4a0f1e)
(cherry picked from commit b964d7b573)
2015-03-23 02:31:18 -04:00
David Herrmann fb7406ef1e console: fix error-code inversion
The error-code propagated via sysview is always negative. Avoid
multiplying by -1 before returning it. Otherwise, we will return >0
instead of <0, which will not be detected as error by sysview-core.

(cherry picked from commit 84c3561c58)
(cherry picked from commit c04228cbd9)
2015-03-23 02:30:55 -04:00
Tom Gundersen 23190abc30 udevd: close race in udev settle
The udev-settle guarantees that udevd is no longer processing any of the
events casued by udev-trigger. The way this works is that it sends a
synchronous PING to udevd after udev-trigger has ran, and when that returns
it knows that udevd has started processing the events from udev-trigger.
udev-settle will then wait for the event queue to empty before returning.

However, there was a race here, as we would only update the /run state at
the beginning of the event loop, before reading out new events and before
processing the ping.

That means that if the first uevent arrived in the same event-loop iteration
as the PING, we would return the ping before updating the queue state in /run
(which would happen on the next iteration).

The race window here is tiny (as the /run state would probably get updated
before udev-settle got a chance to read /run), but still a possibility.

Fix the problem by updating the /run state as the last step before returning
the PING.

We must still update it at the beginning of the loop as well, otherwise we
risk being stuck in poll() with a stale state in /run.

Reported-by: Daniel Drake <drake@endlessm.com>
(cherry picked from commit db93e063bd)
(cherry picked from commit 0c9591e78e)
2015-03-23 02:30:02 -04:00
Zbigniew Jędrzejewski-Szmek efb07dbf84 sd-journal: return error when we cannot open a file
Lack of this caused journalctl not to display a hint about missing groups
properly when the user lacks permissions.

(cherry picked from commit 7b300be75e)
(cherry picked from commit 67c29191b0)
2015-03-23 02:29:19 -04:00
Zbigniew Jędrzejewski-Szmek 3e6b696431 login: fix copy-pasto in error path
CID #1256583.

(cherry picked from commit dcee01125d)
(cherry picked from commit c29a899e63)
2015-03-23 02:29:08 -04:00
Jan Engelhardt b71cdaca9b vconsole: match on vtcon events, not fbcon ones
I observe that upon loading of framebuffer drivers, I do not get the
desired system font, but the kernel-level defaults (usually
lib/fonts/font_8x16.c, but your mileage may vary depending on kernel
config and boot options).

The fbcon driver may be loaded at a time way before the first
framebuffer device is active, such that the vconsole setup helper
runs too early.

The existing rule is non-fitting. The going live of the fbcon kernel
component does not indicate the proper time at which to load the
visuals, which really ought to be done when a new vtcon object comes
into existence. (The font table is a per-vtcon property.)

(cherry picked from commit a52750d148)
(cherry picked from commit b83da13fff)

Conflicts:
	src/vconsole/90-vconsole.rules
2015-03-23 02:28:38 -04:00
Hannes Reinecke 7ab8dc0dd4 Allow up to 4096 simultaneous connections
On large system we hit the limit on 512 simultaneous dbus
connections, resulting in tons of annoying messages:

Too many concurrent connections, refusing

This patch raises the limit to 4096.

(cherry picked from commit cbecf9bf92)
(cherry picked from commit 7eaa810935)
2015-03-23 02:27:40 -04:00
Hannes Reinecke d53586d247 Remove the cap on epoll events
Currently the code will silently blank out events if there are more
then 512 epoll events, causing them never to be handled at all. This
patch removes the cap on the number of events for epoll_wait, thereby
avoiding this issue.

(cherry picked from commit 1c724e9e0e)
(cherry picked from commit c2695a243c)
2015-03-23 02:27:32 -04:00
John Paul Adrian Glaubitz bd476b3055 Use correct uname identifiers in arch_map for SuperH architecture
https://bugs.freedesktop.org/show_bug.cgi?id=89421
(cherry picked from commit 3a867c6a23)
(cherry picked from commit 9b6d110970)
2015-03-23 02:27:12 -04:00
Michal Schmidt 40fa3b1875 shared: handle unnamed sockets in socket_address_equal()
Make sure we don't inspect sun_path of unnamed sockets.
Since we cannot know if two unnamed sockets' adresses refer to the same
socket, just return false.

(cherry picked from commit 710708a54c)
(cherry picked from commit 04691e6f81)
2015-03-23 02:24:17 -04:00
Michal Schmidt cd9740bae3 core, shared: in deserializing, match same files reached via different paths
When dbus.socket is updated like this:
-ListenStream=/var/run/dbus/system_bus_socket
+ListenStream=/run/dbus/system_bus_socket
... and daemon-reload is performed, bad things happen.
During deserialization systemd does not recognize that the two paths
refer to the same named socket and replaces the socket file with a new
one. As a result, applications hang when they try talking to dbus.

Fix this by finding a match not only when the path names are equal, but
also when they point to the same inode.
In socket_address_equal() it is necessary to move the address size
comparison into the abstract sockets branch. For path name sockets the
comparison must not be done and for other families it is redundant
(their sizes are constant and checked by socket_address_verify()).

FIFOs and special files can also have multiple pathnames, so compare the
inodes for them as well. Note that previously the pathname checks used
streq_ptr(), but the paths cannot be NULL.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1186018
(cherry picked from commit c78e47a61f)
(cherry picked from commit 25e6978bb3)
2015-03-23 02:23:52 -04:00
Zbigniew Jędrzejewski-Szmek b53c70c883 shared/util: assume ac when /sys/class/power_supply is missing
On s390 (at least) /sys/class/power_supply is not present. We should
treat this like if this directory was empty, and not an error.

(cherry picked from commit 6d89003462)
(cherry picked from commit 0436d5c5f4)
2015-03-23 02:23:20 -04:00
Zbigniew Jędrzejewski-Szmek 0a11be8375 journal-remote: fix saving of binary fields
Binary fields were not processed properly, and resulting journal files
were non-conforming, resulting in an error ("Invalid field.") when reading.

https://bugs.freedesktop.org/show_bug.cgi?id=89391
(cherry picked from commit 09d801a82a)
(cherry picked from commit 91a3ba9064)
2015-03-23 02:22:54 -04:00
Cristian Rodríguez d3a64c1f3a shared: AFS is also a network filesystem
(cherry picked from commit ba89821c10)
(cherry picked from commit 3c350019fe)
2015-03-23 02:22:28 -04:00
Zbigniew Jędrzejewski-Szmek 946560fa72 sysctl: downgrade message about sysctl overrides to debug
Printing it at info level was tedious. We don't do that for any other
overrides.

(cherry picked from commit 7933e4266f)
(cherry picked from commit 2439dc6083)
2015-03-23 02:21:30 -04:00
Lennart Poettering 333e1f76f0 unit: use weaker dependencies between mount and device units in --user mode
When running in user mode unmounting of mount units when a device
vanishes is unlikely to work, and even if it would work is already done
by PID 1 anyway. HEnce, when creating implicit dependencies between
mount units and their backing devices, created a Wants= type dependency
in --user mode, but leave a BindsTo= dependency in --system mode.

(cherry picked from commit 5bd4b17360)
(cherry picked from commit fc9805756d)
2015-03-23 02:20:54 -04:00
Aaro Koskinen 4d2eb4f25d bootchart: svg: fix checking of list end
If we have less samples than expected, systemd-bootchart will crash.

(cherry picked from commit c1682f17a0)
(cherry picked from commit 668529dde3)
2015-03-23 02:20:31 -04:00
Zbigniew Jędrzejewski-Szmek 25b558800d systemctl: bump NOFILE only for systemctl_main
It is not necessary when running as telinit, etc.

https://bugzilla.redhat.com/show_bug.cgi?id=1184712
(cherry picked from commit 95d383ee47)
(cherry picked from commit 1df0ddca3a)
2015-03-23 02:20:17 -04:00
Michal Schmidt 120029c8c1 journal-remote: fix client_cert memory leak
Found by Valgrind while testing the previous memory leak fix.

(cherry picked from commit 32c3d7144c)
(cherry picked from commit 5852d2efbf)
2015-03-23 02:19:13 -04:00
Michal Schmidt 93a2ca67dd journal-remote: fix certificate status memory leak
The output of gnutls_certificate_verification_status_print() needs to be
freed.

Noticed this while staring at verify_cert_authorized() to see what could
possibly confuse gcc5 on armv7hl to segfault during compilation.

(cherry picked from commit 9c3cf9693a)
(cherry picked from commit 7057db8b36)
2015-03-23 02:19:01 -04:00
Zbigniew Jędrzejewski-Szmek b1cb97af13 core: make RuntimeDirectory honor SELinux labels
https://bugzilla.redhat.com/show_bug.cgi?id=1192726
(cherry picked from commit ca905b2fce)

Conflicts:
	src/core/execute.c
2015-03-23 02:16:31 -04:00
Lennart Poettering 5e0da7f600 exec: also evaluate working_directory_missing_ok when not applying chroots
(cherry picked from commit cf1d0302ae)

Conflicts:
	src/core/execute.c
2015-03-23 02:13:01 -04:00
Lennart Poettering 32283b968a core: disarm shutdown watchdog if we fail to set timeout
Better safe than sorry, if drivers are stupid, and reset immediately on
device closing if the timeout could not be initialized.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=777735
(cherry picked from commit c2cc6b9aef)
2015-03-23 02:10:49 -04:00
Lennart Poettering c17e9668d6 core: don't fail to run services in --user instances if $HOME is missing
Otherwise we cannot even invoke systemd-exit.service anymore, thus not
even exit.

https://bugs.freedesktop.org/show_bug.cgi?id=83100
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759320
(cherry picked from commit 4c08c8242a)

Conflicts:
	src/core/execute.c
2015-03-23 02:10:32 -04:00
Lennart Poettering 531201b4b6 core: don't watch for socket events when service is in SERVICE_STOP
If a service has an ExecStop= program that uses the socket the service was
activated by to tell it to terminate, then that should not be used as
trigger to start the service again.

http://lists.freedesktop.org/archives/systemd-devel/2015-February/028058.html
(cherry picked from commit d54ddab8cb)
2015-03-23 02:08:22 -04:00
Michael Olbrich 27834dd75b systemctl: don't update the reboot parameter if none is given
Otherwise systemd-reboot.service will remove the parameter that was set
before. This was broken in commit "b986229efe2cc96157aa14c37bab7843311bbef1
systemctl: bugfix for systemctl reboot command with argument"

(cherry picked from commit c31c4324c5)
2015-03-23 02:08:05 -04:00
Lennart Poettering e341873c56 core: correct a log message
The log message talks specifically about services, though it actually
applies to any kind of unit.

(cherry picked from commit 418761f586)

Conflicts:
	src/core/unit.c
2015-03-23 02:08:01 -04:00
Umut Tezduyar Lindskog 171335eb58 sysctl: consider --prefix while parsing the files
not while applying the parsed sysctl values. Otherwise
info "Overwriting earlier assignment of %s in file %s" is
visible many times even though the given --prefix doesn't
try to set the overridden value.

This also optimizes the startup tiny bit since we have udev
rules running on network devices and setting sysctl through
the rules.

(cherry picked from commit b99802f769)
2015-03-23 01:58:16 -04:00
Zbigniew Jędrzejewski-Szmek 4d97551673 shared/log: read /proc/cmdline only in daemons
http://lists.freedesktop.org/archives/systemd-devel/2015-February/027960.html
(cherry picked from commit ee46e55570)

Conflicts:
	src/shared/log.c
2015-03-23 01:54:10 -04:00
Ivan Shapovalov b4b97da010 systemctl: cat: fix error handling
- correctly check for local vs. remote transport
- return after receiving error from expand_names()

(cherry picked from commit 3e7eed8497)

Conflicts:
	src/systemctl/systemctl.c
2015-02-05 14:23:46 -05:00
Zbigniew Jędrzejewski-Szmek 795fcf13d2 systemctl: refuse --host with cat
This might be fixed one day, but for now it's better to fail.

https://bugzilla.redhat.com/show_bug.cgi?id=1186952
(cherry picked from commit 3e495a6651)

Conflicts:
	src/systemctl/systemctl.c
2015-02-05 14:18:51 -05:00
Zbigniew Jędrzejewski-Szmek 76b8ed8042 notify,firstboot,analyze,run: trim --help output to 80 lines
(cherry picked from commit b57b06258e)

Conflicts:
	src/notify/notify.c
	src/run/run.c
2015-02-05 14:16:08 -05:00
Zbigniew Jędrzejewski-Szmek f7b7a2c937 journalctl: trim --help to fit in 80 columns
Terminals tend to be 80 columns wide by default, and the help
text is only supposed to be a terse reminder anyway.

https://bugzilla.redhat.com/show_bug.cgi?id=1183771
(cherry picked from commit 40f0b71b06)

Conflicts:
	src/journal/journalctl.c
2015-02-05 14:14:03 -05:00
Zbigniew Jędrzejewski-Szmek 097e69a5fa sleep: do not use strappenda in var declaration
Based on e2cc6eca73.

https://bugzilla.redhat.com/show_bug.cgi?id=1147610
2015-02-05 14:09:34 -05:00
Martin Pitt 66eb624c22 cryptsetup: only warn on real key files
Simplify the check from commit 05f73ad to only apply the warning to regular
files instead of enumerating device nodes.

(cherry picked from commit 3f4d56a069)
2015-02-05 09:05:20 -05:00
Cristian Rodríguez 71e27642c3 cryptsetup: Do not warn If the key is /dev/*random
Using /dev/urandom as a key is valid for swap, do not
warn if this devices are world readable.

(cherry picked from commit 05f73ad22b)
2015-02-05 09:05:06 -05:00
Maxim Mikityanskiy de879b0c31 core: make setting the shutdown watchdog configuration via dbus work
https://bugs.freedesktop.org/show_bug.cgi?id=88284
(cherry picked from commit 81f5fc2d43)

Conflicts:
	src/core/main.c
2015-02-05 09:03:35 -05:00
Christian Seiler 8ce77d0b80 logind: remove per-user runtime dir again if setup fails
If setup of per-user runtime dir fails, clean up afterwards by removing
the directory before returning from the function, so we don't leave the
directory behind.

If this is not done, the second time the user logs in logind would
assume that the directory is already set up, even though it isn't.

(cherry picked from commit 4d858e7d9f)

Conflicts:
	src/login/logind-user.c
2015-02-05 08:56:54 -05:00
Zbigniew Jędrzejewski-Szmek f0e9c36257 system-update-generator: accept a dangling symlink
The offline update mechanism is explicitly designed to work with a
separate /var. systemd-update-generator is supposed to run early,
before filesystems are mounted, so it cannot check if the
/system-update symlink actually points to anything.

The update is run *after* filesystems are mounted, so it should be
able to access the target of the symlink without trouble.

https://bugzilla.redhat.com/show_bug.cgi?id=1178978
(cherry picked from commit 6b321a7901)
2015-02-05 08:56:11 -05:00
Sangjung Woo c0008e613b systemctl: bugfix for systemctl reboot command with argument
According to systemctl man page, 'systemctl reboot [arg]' should work
without any errors. However, it does not work because of 'Invalid number
of arguments' error, except for 'reboot [arg]'. This patch fixes the bug
so that both of commands work in exactly the same way.

(cherry picked from commit b986229efe)
2015-02-05 08:47:56 -05:00
Lennart Poettering 93d88c5b4d sd-bus: fix handling of double parameters in sd_bus_message_append()
We really need to use va_arg() with the right type here as uint64_t and
double might have the same size, but are passed differently as
arguments.

(cherry picked from commit 6cd37a5e59)
2015-02-05 08:46:12 -05:00
Zbigniew Jędrzejewski-Szmek a64a24640c core/cgroup: fix embarrassing typo
https://github.com/docker/docker/issues/10280
(cherry picked from commit a3bd89ea99)
2015-01-31 23:06:12 -05:00