Commit graph

1817 commits

Author SHA1 Message Date
Kay Sievers 1b09f548c7 turn kdbus support into a runtime option
./configure --enable/disable-kdbus can be used to set the default
behavior regarding kdbus.

If no kdbus kernel support is available, dbus-dameon will be used.

With --enable-kdbus, the kernel command line option "kdbus=0" can
be used to disable kdbus.

With --disable-kdbus, the kernel command line option "kdbus=1" is
required to enable kdbus support.
2015-06-17 18:01:49 +02:00
Daniel Mack d6e5f3ad1f core: execute: fix regression in pam_setup()
Commit 72c0a2c25 ("everywhere: port everything to sigprocmask_many()
and friends") reworked code tree-wide to use the new sigprocmask_many()
helper. In this, it caused a regression in pam_setup, because it
dropped a line to initialize the 'ss' signal mask which is later used
in sigwait().

While at it, move the variable declaration to an inner scope.
2015-06-17 14:43:11 +02:00
Lennart Poettering 72c0a2c255 everywhere: port everything to sigprocmask_many() and friends
This ports a lot of manual code over to sigprocmask_many() and friends.

Also, we now consistly check for sigprocmask() failures with
assert_se(), since the call cannot realistically fail unless there's a
programming error.

Also encloses a few sd_event_add_signal() calls with (void) when we
ignore the return values for it knowingly.
2015-06-15 20:13:23 +02:00
David Herrmann 6113cec066 Merge pull request #189 from teg/rtnl-rename
Rename sd_rtnl to sd_netlink to prepare for further netlink-protocol support. Anything rtnl specific still uses the sd_rtnl prefix, but the generic parts (including the bus and message objects) are now called sd_netlink.
2015-06-14 13:07:20 +02:00
Tom Gundersen 1c4baffc18 sd-netlink: rename from sd-rtnl 2015-06-13 19:52:54 +02:00
keszybz eb56be2b93 Merge pull request #167 from keszybz/line-oriented-ima-setup
ima-setup: write policy one line at a time
2015-06-12 23:52:13 -04:00
Lennart Poettering c04754bcb6 selinux: whitespace fixes 2015-06-12 13:50:57 +02:00
Susant Sahani 034e10d7fb core: fix CID 996302
CID 996302:  Error handling issues  (CHECKED_RETURN)
2015-06-12 10:24:26 +05:30
David Herrmann ed810b68d3 Merge pull request #171 from teg/rtnl-broadcast-2
sd-rtnl: make joining broadcast groups implicit
2015-06-11 18:05:18 +02:00
Tom Gundersen 31710be527 sd-rtnl: make joining broadcast groups implicit 2015-06-11 17:47:40 +02:00
Daniel Mack 78d298bbc5 kmod-setup: don't print warning on -ENOSYS
-ENOSYS is returned from kmod_module_probe_insert_module() if a module isn't
available, not -ENOENT. Don't spit out a warning in that case unless the
warn_if_unavailable flag is set.

Also factor out the condition into an own variable for better readability.
2015-06-11 16:49:24 +02:00
Zbigniew Jędrzejewski-Szmek 92994160af ima-setup: write policy one line at a time
ima_write_policy() expects data to be written as one or more
rules, no more than PAGE_SIZE at a time. Easiest way to ensure
that we are not splitting rules is to read and write one line at
a time.

https://bugzilla.redhat.com/show_bug.cgi?id=1226948
2015-06-11 09:05:02 -04:00
Lennart Poettering d814f9904b kmod-setup: when we fail to load a kmod, log the error cause
(Also, downgrade message from LOG_ERROR to LOG_WARNING, after all we
don't care much and just proceed)
2015-06-11 12:13:58 +02:00
Werner Fink de1d4f9b5c core: Let two more booleans survive a daemon-reload
Without the boolean bus_name_good services as well as cgroup_realized
for units a unit of Type=dbus and ExecReload sending SIGHUP to $MAINPID
will be terminated if systemd will be daemon reloaded.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=746151
https://bugs.freedesktop.org/show_bug.cgi?id=78311
https://bugzilla.opensuse.org/show_bug.cgi?id=934077
2015-06-11 12:13:57 +02:00
Lennart Poettering 2a1288ff89 util: introduce CMSG_FOREACH() macro and make use of it everywhere
It's only marginally shorter then the usual for() loop, but certainly
more readable.
2015-06-10 19:29:47 +02:00
Zbigniew Jędrzejewski-Szmek b078b5a7ab Merge pull request #85 from keszybz/selinux-context 2015-06-10 10:20:50 -04:00
Lennart Poettering ce30c8dcb4 tree-wide: whenever we fork off a foreign child process reset signal mask/handlers
Also, when the child is potentially long-running make sure to set a
death signal.

Also, ignore the result of the reset operations explicitly by casting
them to (void).
2015-06-10 01:28:58 +02:00
Thomas Hindoe Paaboel Andersen 60053efbba core: log oom during killing spree
but don't do anything else. We still want to kill as much as
possible.

Coverity CID#996306
2015-06-09 22:07:27 +02:00
Zbigniew Jędrzejewski-Szmek 236f83afa9 bus-creds: always set SD_BUS_CREDS_PID when we set pid in the mask
Also reorder the code a bit to be easier to parse.
2015-06-09 09:13:35 -04:00
Thomas Hindoe Paaboel Andersen 920b52e490 tree-wide: remove spurious space 2015-06-08 23:11:26 +02:00
Daniel Mack 85c675538f kmod-setup: split warn flags
Traditionally, we used to warn about ipv6 being a module or being
unavailable. This was changed in b4aa82f16 ("kmod-setup: don't warn
when ipv6 can't be loaded") in a way that neither of the two conditions
will cause a log message.

Now, while running a setup without any IPv6 is completely fine and
shouldn't cause any warning, we should still warn about ipv6 being a
module instead of built-in.

To achieve this, split the boolean warn flag into two: one for a
feature not being built-in but shipped as a module, and one to
print an error when a module is entirely unavailable.

We will, however, still warn if kmod returns anything else than
-ENOENT in the attempt of loading the module, and at the very least,
turn the message into a debug log.
2015-06-08 20:39:23 +02:00
Kay Sievers 7437e0f53a Merge pull request #79 from zonque/fdo-87475
kmod-setup: don't warn when ipv6 can't be loaded (FDO bug #87475)
2015-06-05 21:02:47 +02:00
Daniel Mack b4aa82f168 kmod-setup: don't warn when ipv6 can't be loaded
Not having IPv6 is a valid setup. Let's not print a warning in that
case.

Addresses:

  https://bugs.freedesktop.org/show_bug.cgi?id=87475
2015-06-05 14:59:36 +02:00
Cristian Rodríguez 61b9b203fe core: Remove "old kernel" warning if PR_SET_CHILD_SUBREAPER fails
This made sense when systemd ran on older kernels, nowdays not so much.
2015-06-05 04:06:39 -03:00
David Herrmann 5c9e74f738 Merge pull request #73 from zonque/mountinfo
core/mount: skip incomplete mountinfo entries
2015-06-04 19:15:20 +02:00
Daniel Mack c0a7f8d3cb core/mount: skip incomplete mountinfo entries
Skip /proc/mountinfo entries for which libmount returns a NULL pointer
for 'source' or 'target'. This happened on Semaphore CI's build servers
when the test suite is run.
2015-06-04 19:00:46 +02:00
Zbigniew Jędrzejewski-Szmek 116b6c8687 Partially revert "ma-setup: simplify"
copy_bytes() tries to do the write in chunks, but ima kernel code
needs every rule to be written in one write. Writing the whole file
at once avoids the issue.

http://lists.freedesktop.org/archives/systemd-devel/2015-June/032623.html
http://sourceforge.net/p/linux-ima/mailman/message/34145236/
https://bugzilla.redhat.com/show_bug.cgi?id=1226948
2015-06-04 09:20:46 -04:00
Kay Sievers 6517217d49 kdbus: remove attach_flags_mask module parameter setting 2015-06-03 22:24:16 +02:00
Daniel Mack 22874a348f load-fragment: use UNESCAPE_RELAX flag to parse exec directives
The cunescape() helper function used to handle unknown escaping sequences
gracefully by copying them over verbatim.

Commit 527b7a42 ("util: rework cunescape(), improve error handling") added
a flag to make that behavior optional, and changed to default to error out
with -EINVAL otherwise.

However, config_parse_exec(), which is used to parse the
Exec{Start,Stop}{Post,Pre,} directives of unit files, was not changed along
with that commit, which means that directives with improperly escaped
command line strings are no longer parsed.

Relevant bugreports include:

  https://bugs.freedesktop.org/show_bug.cgi?id=90794
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787256

Fix this by passing UNESCAPE_RELAX to config_parse_exec() in order to
restore the original behavior.
2015-06-01 18:08:44 +02:00
Jason Pleau d38e01dc96 core/namespace: Protect /usr instead of /home with ProtectSystem=yes
A small typo in ee818b8 caused /home to be put in read-only instead of
/usr when ProtectSystem was enabled (ie: not set to "no").
2015-05-31 20:29:36 +02:00
Lennart Poettering 24882e06c1 util: split out signal-util.[ch] from util.[ch]
No functional changes.
2015-05-29 20:14:11 +02:00
Martin Pitt e26d6ce517 path-util: Change path_is_mount_point() symlink arg from bool to flags
This makes path_is_mount_point() consistent with fd_is_mount_point() wrt.
flags.
2015-05-29 17:42:44 +02:00
Jonathan Boulle d250afe73d fix extraneous space in equality check 2015-05-27 23:36:29 +02:00
Karel Zak bf1d7ba70a swap: use swapon -o
This patch simplify swapon usage in systemd. The command swapon(8)
since util-linux v2.26 supports "-o <list>". The idea is exactly the
same like for mount(8). The -o specifies options in fstab-compatible
way. For systemd it means that it does not have to care about things
like "discard" or another swapon specific options.

        swapon -o <options-from-fstab>

For backward compatibility the code cares about "Priority:" swap unit
field (for a case when Priority: is set, but pri= in the Options: is
missing).

References: http://lists.freedesktop.org/archives/systemd-devel/2014-October/023576.html
2015-05-25 17:06:15 +02:00
Lennart Poettering 9771b62d8b manager: fix finish_timestamp calculation
http://lists.freedesktop.org/archives/systemd-devel/2015-May/032100.html
2015-05-21 21:34:36 +02:00
Lennart Poettering 4c6d20dece device: never act on mount events for devices if device support is not available 2015-05-21 20:49:24 +02:00
Lennart Poettering 48894cd07c core: properly handle jobs that are suppressed to JOB_NOPs when propagating restarts 2015-05-21 20:49:24 +02:00
Lennart Poettering 050f727728 util: introduce PERSONALITY_INVALID as macro for 0xffffffffLU 2015-05-21 19:48:49 +02:00
Lennart Poettering 03cfe0d514 nspawn: finish user namespace support 2015-05-21 16:32:01 +02:00
Lennart Poettering 6458ec20b5 core,nspawn: unify code that moves the root dir 2015-05-20 14:38:12 +02:00
Lennart Poettering aad1976ffa core: don't consider boot-up finished if we are still reloading
http://lists.freedesktop.org/archives/systemd-devel/2015-May/032025.html
2015-05-19 19:26:53 +02:00
Lennart Poettering c6497ccb71 core: when propagating restart requests due to deps, downgrade restart to try-restart
Previously, if a service A depended on a service B via Requires=, and A
was not running and B restarted this would trigger a start of A as well,
since the restart was propagated as restart independently of the state
of A.

This patch ensures that a restart of B would be propagated as a
try-restart to A, thus not changing its state if it isn't up.

http://lists.freedesktop.org/archives/systemd-devel/2015-May/032061.html
2015-05-19 18:21:19 +02:00
Lennart Poettering 69301c1743 core: sd_bus_error() already checks for NULL, no need to duplicate check 2015-05-19 17:56:44 +02:00
Lennart Poettering ce74e76920 core: reinstate propagation of stop/restart jobs via RequsiteOf dependencies
This reverts the primary effect of be7d9ff730.

After all Requisite= should be close to Requires=, without the one
exception that it doesn't pull in dependencies on start. However,
reverse deps on stop/restart should be treated the same way as for
Restart=, and this is already documented in the man page, hence stick to
it.

http://lists.freedesktop.org/archives/systemd-devel/2015-May/032049.html
2015-05-19 17:48:12 +02:00
Lennart Poettering 394763f63c mount: properly check for mounts currently in /proc/self/mountinfo
http://lists.freedesktop.org/archives/systemd-devel/2015-May/032059.html
2015-05-19 17:19:27 +02:00
Lennart Poettering ed10fa8ce2 unit: drop support for pre-v44 job serialization
No distro ships that old systemd versions anyway, hence let's drop
support for live-upgrades for them. Offline updates are still supported.
And live-upgrades will only lose the job queue, hence basically still
work...
2015-05-19 16:41:14 +02:00
Lennart Poettering 67bfdc9771 core: also enforce ratelimiter if we stop a unit due to BindsTo=
This extends on bea355dac9, and extends
the ratelimiter to not only be used for StopWhenUnneeded=1 units but
also for units that have BindsTo= on a unit that is dead.

http://lists.freedesktop.org/archives/systemd-devel/2015-April/030224.html
2015-05-19 16:23:14 +02:00
Lennart Poettering f8a30ce524 core: use bitfield where possible 2015-05-19 16:03:01 +02:00
Lennart Poettering bea355dac9 core: enforce a ratelimiter when stopping units due to StopWhenUnneeded=1
Otherwise we might end up in an endless stop loop.

http://lists.freedesktop.org/archives/systemd-devel/2015-April/030224.html
2015-05-19 16:00:24 +02:00
Lennart Poettering f3b85044c8 unit: fix unit_check_unneeded() dependency iteration
Fixes a regression introduced in be7d9ff730.
2015-05-19 15:42:42 +02:00