Commit graph

21039 commits

Author SHA1 Message Date
Lennart Poettering 03976f7b4a sd-bus: introduce new sd_bus_flush_close_unref() call
sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush()
(which writes all unwritten messages out) + sd_bus_close() (which
terminates the connection, releasing all unread messages) +
sd_bus_unref() (which frees the connection).

The combination of this call is used pretty frequently in systemd tools
right before exiting, and should also be relevant for most external
clients, and is hence useful to cover in a call of its own.

Previously the combination of the three calls was already done in the
_cleanup_bus_close_unref_ macro, but this was only available internally.

Also see #327
2015-07-03 19:49:03 +02:00
Lennart Poettering 200edc2bcf Merge pull request #473 from richardmaw-codethink/machinectl-import-earlier-than-3-15
util: fall back in rename_noreplace when renameat2 isn't implemented
2015-07-03 10:11:33 +02:00
Gerd Hoffmann a92a81d86a login: add rule for qemu's pci-bridge-seat
Qemu provides a separate pci-bridge exclusively for multi-seat setups.
The normal pci-pci bridge ("-device pci-bridge") has 1b36:0001. The new
pci-bridge-seat was specifically added to simplify guest-side
multiseat configuration.  It is identical to the normal pci-pci bridge,
except that it has a different id (1b36:000a) so we can match it and
configure multiseating automatically.

Make sure we always treat this as separate seat if we detect this, just
like other "Pluggable" devices.

(David: write commit-message)
2015-07-02 17:33:49 +02:00
Richard Maw 715d759905 util: fall back in rename_noreplace when renameat2 isn't implemented
According to README we only need 3.7, and while it may also make sense
to bump that requirement when appropriate, it's trivial to fall back
when renameat2 is not available.
2015-07-02 14:47:04 +01:00
Zbigniew Jędrzejewski-Szmek 92c4eaf76d Merge pull request #472 from keszybz/documentation-updates2
Documentation updates
2015-07-02 09:41:32 -04:00
Zbigniew Jędrzejewski-Szmek 4ef9c8527c Merge pull request #470 from marineam/escape
escape: fix exit code
2015-07-02 09:25:59 -04:00
Zbigniew Jędrzejewski-Szmek 512d86c92a Merge pull request #427 from keszybz/man-list-fixes
Update Makefile-man.am after recent changes and fix regeneration of Makefile-man.am
Fixes fallout from https://github.com/systemd/systemd/pull/282.
2015-07-02 09:24:04 -04:00
Zbigniew Jędrzejewski-Szmek 9407bc2d03 man: update sysctl example about netfilter
It turns out that since kernel 3.18 netfilter on bridged packets
is off anyway, so the example should be reworded (and the module
name updated).
2015-07-02 09:15:09 -04:00
Zbigniew Jędrzejewski-Szmek ea539eb659 man: information about available properties
https://bugzilla.redhat.com/show_bug.cgi?id=1144496
2015-07-02 09:15:09 -04:00
David Herrmann 0c9cc10dcc sd-bus: don't leak kdbus notifications
When we get notifications from the kernel, we always turn them into
synthetic dbus1 messages. This means, we do *not* consume the kdbus
message, and as such have to free the offset.

Right now, the translation-helpers told the caller that they consumed the
message, which is wrong. Fix this by explicitly releasing all kernel
messages that are translated.
2015-07-02 12:24:05 +02:00
Michael Marineau ff9c82cc39 escape: fix exit code
r == 0 indicates success, not failure
2015-07-01 23:46:42 -07:00
Daniel Mack 138879ccad Merge pull request #409 from teg/networkd-enslave-segfault
fix segfault when cancelling enslaving of links by netdevs
2015-07-01 19:26:01 -04:00
Daniel Mack c9b9e8e9e2 Merge pull request #466 from rivanvx/master
timedatectl: trim non-local RTC warning to 80 chars wide
2015-07-01 19:01:28 -04:00
Vedran Miletić ab59f4123a timedatectl: trim non-local RTC warning to 80 chars wide 2015-07-02 00:13:31 +02:00
Daniel Mack 02e9cc6207 Merge pull request #459 from ctrochalakis/reuse-port-before-bind
socket: Set SO_REUSEPORT before bind()
2015-07-01 16:52:02 -04:00
Daniel Mack 38b541c4f2 Merge pull request #419 from eworm-de/man-protecthome
man: ProtectHome= protects /root as well
2015-07-01 13:45:33 -04:00
Daniel Mack b6b3475533 Merge pull request #463 from dvdhrm/udev-run
udev: destroy manager before cleaning environment
2015-07-01 13:42:16 -04:00
David Herrmann 077fc5e260 udev: destroy manager before cleaning environment
Due to our _cleanup_ usage for the udev manager, it will be destroyed
after the "exit:" label has finished. Therefore, it is the last
destruction done in main(). This has two side-effects:
  - mac_selinux is destroyed before the udev manager is, possible causing
    use-after-free if the manager-cleanup accesses selinux data
  - log_close() is called *before* the manager is destroyed, possibly
    re-opening the log if you use --debug (and thus not re-applying the
    --debug option)

Avoid this by moving the manager-handling into a new function called
run(). This function will be left before we enter the "exit:" label in
main(), hence, the manager object will be destroyed early.
2015-07-01 19:30:24 +02:00
Kay Sievers 78d3e041a5 udevd: force --debug mode to stderr
https://github.com/systemd/systemd/issues/462
2015-07-01 19:20:59 +02:00
David Herrmann 3723263f49 bus-proxy: never apply policy when sending signals
Unlike dbus-daemon, the bus-proxy does not know the receiver of a
broadcast (as the kernel has exclusive access on the bus connections).
Hence, and "destination=" matches in dbus1 policies cannot be applied.

But kdbus does not place any restrictions on *SENDING* broadcasts, anyway.
The kernel never returns EPERM to KDBUS_CMD_SEND if KDBUS_MSG_SIGNAL is
set. Instead, receiver policies are checked. Hence, stop checking sender
policies for signals in bus-proxy and leave it up to the kernel.

This fixes some network-manager bus-proxy issues where NM uses weird
dst-based matches against interface-based matches. As we cannot perform
dst-based matches, our bus-proxy cannot properly implement this policy.
2015-07-01 18:32:51 +02:00
David Herrmann 0204c4bd69 login: re-use VT-sessions if they already exist
Right now, if you start a session via 'su' or 'sudo' from within a
session, we make sure to re-use the existing session instead of creating a
new one. We detect this by reading the session of the requesting PID.

However, with gnome-terminal running as a busname-unit, and as such
running outside the session of the user, this will no longer work.
Therefore, this patch makes sure to return the existing session of a VT if
you start a new one.

This has the side-effect, that you will re-use a session which your PID is
not part of. This works fine, but will break assumptions if the parent
session dies (and as such close your session even though you think you're
part of it). However, this should be perfectly fine. If you run multiple
logins on the same session, you should really know what you're doing. The
current way of silently accepting it but choosing the last registered
session is just weird.
2015-07-01 16:52:35 +02:00
Daniel Mack e15b038865 Merge pull request #460 from xnox/bootchart-warning
bootchart: do not report warning when disk is missing model.
2015-07-01 10:34:40 -04:00
Dimitri John Ledkov 4e5356169a bootchart: do not report warning when disk is missing model.
In VMs / virtio drives there is no model. Also don't print "Disk:
(null)" in output if no model is available.
2015-07-01 14:49:20 +01:00
Christos Trochalakis 54255c64e6 socket: Set SO_REUSEPORT before bind()
bind() fails if it is called before setting SO_REUSEPORT and another
process is already binded to the same addess.

A new reuse_port option has been introduced to socket_address_listen()
to set the option as part of socket initialization.
2015-07-01 16:43:03 +03:00
David Herrmann 0b2ec8a3bf sysv-generator: fix coding-style
Fix weird coding-style:
 - proper white-space
 - no if (func() >= 0) bail-outs
 - fix braces
 - avoid 'r' for anything but errno
 - init _cleanup_ variables unconditionally, even if not needed
2015-07-01 13:02:58 +02:00
David Herrmann e04658277d Revert "kmod-setup: don't print warning on -ENOSYS"
This partially reverts commit 78d298bbc5.
The changed coding-style is kept, but the ENOENT->ENOSYS conversion is
reverted.

kmod was fixed upstream to no longer return ENOSYS. Also see:
    https://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/commit/?id=114ec87c85c35a2bd3682f9f891e494127be6fb5

The kmod fix is marked for backport, so no reason to bump the kmod
version we depend on.
2015-07-01 12:58:03 +02:00
Martin Pitt 52a321d839 sysv-generator test: Fix random ordering failure
test_simple_escaped() sometimes fails with

AssertionError: Lists differ: ['foo\\x2b.service', 'foo-admin.service'] != ['foo-admin.service', 'foo\\x2b.service']

We don't need to assume any order here, so compare them as a set, not a list.
2015-07-01 07:34:23 +02:00
Kay Sievers 64ea3f926d Merge pull request #411 from teg/udev-simplify-exec-envp
udev: event - simplify udev_event_spawn() logic
2015-06-30 22:32:45 +02:00
David Herrmann dfab39b017 Merge pull request #398 from teg/netlink-container-rework
netlink container rework

Allocate containers as separate structs instead of individual arrays for each member field.
2015-06-30 22:15:55 +02:00
Martin Pitt a7e950bdd9 Merge pull request #434 from kaysievers/wip
udev: remove WAIT_FOR key
2015-06-30 20:33:15 +02:00
Kay Sievers f2b8052fb6 udev: remove WAIT_FOR key
This facility was never a proper solution, but only papered over
real bugs in the kernel. There are no known sysfs "timing bugs"
since a long time.
2015-06-30 19:57:40 +02:00
Christian Hesse 5833143708 man: ProtectHome= protects /root as well 2015-06-30 19:12:20 +02:00
Tom Gundersen 94f5683160 Merge pull request #430 from gmacario/fix-issue404-v2
bootchart: Ensure that /proc/schedstat is read entirely (v2)
2015-06-30 18:39:39 +02:00
Tom Gundersen b7a049dba5 Merge pull request #429 from richardmaw-codethink/nspawn-userns-uid-shift-autodetection-fix
nspawn: determine_uid_shift before forking
2015-06-30 18:24:14 +02:00
Tom Gundersen 2f280f17d9 Merge pull request #428 from richardmaw-codethink/nspawn-userns-remount-fail
nspawn: Don't remount with fewer options
2015-06-30 18:16:02 +02:00
Gianpaolo Macario c91d0fd2f4 bootchart: Ensure that /proc/schedstat is read entirely
On multi-core systems file /proc/schedstat may be
larger than 4096 bytes and pread() will only read part of it.

Fix issue https://github.com/systemd/systemd/issues/404
2015-06-30 15:09:02 +00:00
Lennart Poettering 96f9102ce0 Merge pull request #424 from endocode/iaguis/shutdown-log-null
core: handle --log-target=null when calling systemd-shutdown
2015-06-30 10:58:35 -04:00
Richard Maw 7fe2bb84c4 nspawn: determine_uid_shift before forking
It is needed in one branch of the fork, but calculated in another
branch.

Failing to do this means using --private-users without specifying a uid
shift always fails because it tries to shift the uid to UID_INVALID.
2015-06-30 14:05:58 +00:00
Richard Maw 3c59d4f21f nspawn: Don't remount with fewer options
When we do a MS_BIND mount, it inherits the flags of its parent mount.
When we do a remount, it sets the flags to exactly what is specified.
If we are in a user namespace then these mount points have their flags
locked, so you can't reduce the protection.

As a consequence, the default setup of mount_all doesn't work with user
namespaces. However if we ensure we add the mount flags of the parent
mount when remounting, then we aren't removing mount options, so we
aren't trying to unlock an option that we aren't allowed to.
2015-06-30 14:05:03 +00:00
Zbigniew Jędrzejewski-Szmek e4f42f9d1e build-sys: use wildcard glob in update-man-list again
The idea is that after adding a new man page, make update-man-list
will be used to regenerate part of the makefile. So the data already
present in the makefile cannot be used to do that.

Also, renames filter out generated xml files in make-man-rules.py
itself in order to make Makefile.am a bit simpler, and rename files
to dist_files to better reflect new meaning.
2015-06-30 09:56:44 -04:00
Zbigniew Jędrzejewski-Szmek c9aca73438 build-sys: update Makefile-man
Follow up for e6de49abfd.
2015-06-30 09:29:48 -04:00
Iago López Galeiras 10f00ff17b core: handle --log-target=null when calling systemd-shutdown
When shutting down, if systemd was started with --log-target=null,
systemd-shutdown was being called with --log-target=console.
2015-06-30 15:13:57 +02:00
Tom Gundersen 8914ea0e90 Merge pull request #412 from fsateler/sysv-invalid-names-v2
sysv-generator: detect invalid names and escape them V2
2015-06-29 23:30:14 +02:00
Daniel Mack 745b8fcca9 Merge pull request #413 from jaystrictor/manpages
man: remove repeated word "the" and polish
2015-06-29 22:23:25 +02:00
Jay Strict 1d3eaa9361 man: remove repeated word "the" and polish 2015-06-29 21:20:02 +02:00
Felipe Sateler 264581a2f1 sysv-generator: escape names when translating from sysv name
While the LSB suggests only [A-Za-z0-9], that doesn't prevent admins
from doing the wrong thing. Lets not generate invalid names in
that case.
2015-06-29 16:07:49 -03:00
Felipe Sateler 2c09a745eb sysv-generator: detect invalid provided unit names
Do not assume that a non-service unit type is a target.
2015-06-29 16:07:49 -03:00
Daniel Mack 2ab4c7c9f3 Merge pull request #410 from teg/docs-gitignore
docs: remove stale .gitignore
2015-06-29 20:02:14 +02:00
Tom Gundersen bbf3520673 udev: event - simplify udev_event_spawn() logic
Push the extraction of the envp + argv as close as possible to their use, to avoid code
duplication. As a sideeffect fix logging when delaing execution.
2015-06-29 19:51:04 +02:00
Tom Gundersen 72590bcb4e docs: remove stale .gitignore
This is no longer useful as the udev docs are gone.
2015-06-29 19:45:29 +02:00