1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 09:56:51 +03:00
Commit Graph

14248 Commits

Author SHA1 Message Date
Lennart Poettering
bc432dc7eb core: rework cgroup mask propagation
Previously a cgroup setting down tree would result in cgroup membership
additions being propagated up the tree and to the siblings, however a
unit could never lose cgroup memberships again. With this change we'll
make sure that both cgroup additions and removals propagate properly.
2014-02-17 15:49:21 +01:00
Zbigniew Jędrzejewski-Szmek
b1e90ec515 Pass log config from systemd to systemd-shutdown
If PID 1 debug logging is enabled, it is nice to keep those settings
when switching to systemd-shutdown binary, independently of whether
this was done through /proc/cmdline options, or through runtime
manipulations.
2014-02-17 02:26:22 -05:00
Zbigniew Jędrzejewski-Szmek
fb4729006a Some modernizations 2014-02-17 02:26:22 -05:00
Zbigniew Jędrzejewski-Szmek
141a79f491 Extract looping over /proc/cmdline into a shared function
In cryptsetup-generator automatic cleanup had to be replaced
with manual cleanup, and the code gets a bit longer. But existing
code had the issue that it returned negative values from main(),
which was wrong, so should be reworked anyway.
2014-02-17 02:26:22 -05:00
Djalal Harouni
8fe63cd4f1 logind: close race on session state during logins
At login there is a small race window where session_get_state() will
return SESSION_ACTIVE instead of SESSION_OPENING. This must be fixed
since during that time there are calls to session_save() to save
session states and we want to write the correct state.

When we queue the start scope and service jobs, we wait for both of them
to finish before calling and continue processing in:
"session_jobs_reply() => session_send_create_reply()"
to create the session fifo and notify clients.

However, in the match_job_removed() D-Bus signal, we may hit situations
where the scope job has successfully finished and we are still waiting
for the user service job to finish. During that time the
"session->scope_job" will be freed and set to NULL, this makes
session_get_state() return SESSION_ACTIVE before it is really active, it
should return SESSION_OPENING since we are still waiting for the service
job to finish in order to create the session fifo.

To fix this, we also check if the session fifo fd was created, if so then
the session has entered the SESSION_ACTIVE state, if not then it is still
in the SESSION_OPENING state and it is waiting for the scope and service
jobs to finish.
2014-02-17 02:26:22 -05:00
Tom Gundersen
9fadd4cabf sd-dhcp: silently ignore malformed packets
This fixes a regression introduced in e5002702.
2014-02-16 23:28:19 +01:00
Tom Gundersen
489e4fbb8c sd-rtnl: do not require ifindex to be set for SETLINK messages
The kernel will then look up the ifindex itself based on the name.
This should be used very carefully as it is racey.

[This was a left-over hunk from my previous nspawn patch.]
2014-02-16 23:17:19 +01:00
Thomas Hindoe Paaboel Andersen
6cd6fdb228 TODO: remove done item
strv_append was removed in e3e45d4f82
2014-02-16 22:58:24 +01:00
Thomas Hindoe Paaboel Andersen
32457153f4 nspawn: typo fix in help 2014-02-16 22:15:24 +01:00
Tom Gundersen
ab046dde6f nspawn: add new --network-bridge= switch
This adds the host side of the veth link to the given bridge.

Also refactor the creation of the veth interfaces a bit to set it up
from the host rather than the container. This simplifies the addition
to the bridge, but otherwise the behavior is unchanged.
2014-02-16 21:40:28 +01:00
Djalal Harouni
1733a00f62 Add white space between _XZ_FEATURE_ and _SECCOMP_FEATURE_ 2014-02-16 11:44:16 -05:00
Simon Peeters
a3e648ccbb bus: fix match_parse for unquoted matches 2014-02-16 11:24:15 -05:00
Yuxuan Shui
e3025da104 core: check for return value from get_process_state
Fix for commit e10c9985bb.
2014-02-16 11:09:51 -05:00
Kay Sievers
5d31974e44 README: mention libudev's requirement 2014-02-15 17:21:49 +01:00
Tom Gundersen
080ab27621 sd-dhcp: network - don't hardcode ports
We want to reuse these functions for the server library too.
2014-02-15 12:14:45 +01:00
Tom Gundersen
818dc5e72a sd-rtnl: always include linux/rtnetlink.h 2014-02-15 12:14:45 +01:00
Tom Gundersen
0bfedf143c sd-dhcp: minimum options size is part of the protocol 2014-02-15 12:14:45 +01:00
Tom Gundersen
e500270271 sd-dhcp-client: explicitly handle raw and udp messages
Split the recevie_message callback into _raw and _udp parts and a generic
DHCPMessage handler.

Also always verify the xid/MAC, rather than only for udp messages.
2014-02-15 12:14:45 +01:00
Tom Gundersen
ee3a6a51e5 sd-rtnl: message_open_container - don't take a 'size' argument
We can always know the size based on the type, so let's do this inside the library.
2014-02-15 12:14:45 +01:00
Tom Gundersen
a7b74db6e7 sd-rtnl: link flags - don't allow change = 0
The kernel will happily treat 0x0 as 0xffffffff, but it is for backwards
compatibility only, so let's not perpetuate this.
2014-02-15 12:14:45 +01:00
Zbigniew Jędrzejewski-Szmek
93b5eaec70 Fix prototype of get_process_state 2014-02-14 23:15:42 -05:00
Kay Sievers
ecea04731c util: fix mismatching function signature 2014-02-15 04:30:27 +01:00
Jason St. John
b200a92cdc man: use spaces instead of tabs
Several sections of the man pages included intermixed tabs and spaces;
this commit replaces all tabs with spaces.
2014-02-14 22:08:10 -05:00
Zbigniew Jędrzejewski-Szmek
6db2742802 man: replace STDOUT with standard output, etc.
Actually 'STDOUT' is something that doesn't appear anywhere: in the
stdlib we have 'stdin', and there's only the constant STDOUT_FILENO,
so there's no reason to use capitals. When refering to code,
STDOUT/STDOUT/STDERR are replaced with stdin/stdout/stderr, and in
other places they are replaced with normal phrases like standard
output, etc.
2014-02-14 22:03:40 -05:00
Jason St. John
bcddd5bf80 man: fix grammatical errors and other formatting issues
* standardize capitalization of STDIN, STDOUT, and STDERR
* reword some sentences for clarity
* reflow some very long lines to be shorter than ~80 characters
* add some missing <literal>, <constant>, <varname>, <option>, and <filename> tags
2014-02-14 22:03:40 -05:00
Yuxuan Shui
e10c9985bb core: fix detection of dead processes
Commit 5ba6985b moves the UNIT_VTABLE(u)->sigchld_event before systemd
actually reaps the zombie. Which leads to service_load_pid_file accepting
zombie as a valid pid.

This fixes timeouts like:
[ 2746.602243] systemd[1]: chronyd.service stop-sigterm timed out. Killing.
[ 2836.852545] systemd[1]: chronyd.service still around after SIGKILL. Ignoring.
[ 2927.102187] systemd[1]: chronyd.service stop-final-sigterm timed out. Killing.
[ 3017.352560] systemd[1]: chronyd.service still around after final SIGKILL. Entering failed mode.
2014-02-14 20:47:52 -05:00
Ronny Chevalier
f928d3263d test: add basic seccomp tests 2014-02-14 19:00:32 -05:00
Zbigniew Jędrzejewski-Szmek
8f9c6fe5ff units: systemd-logind fails hard without dbus
That is, without --enable-kdbus and kdbus running.

With --enable-kdbus things are more complicated, because dbus might be
necessary, if kdbus is missing at runtime. If it is not necessary,
the socket will be started, which is not imporant, but not the service.
2014-02-14 19:00:32 -05:00
Zbigniew Jędrzejewski-Szmek
8a8332f77e test: print the important commands to make debugging easier 2014-02-14 19:00:32 -05:00
Zbigniew Jędrzejewski-Szmek
b8667ee416 test: make the image bigger
I got some errors about lack of disk space... 100MB either way
shouldn't matter.
2014-02-14 19:00:26 -05:00
Lennart Poettering
262d10e6bd nspawn: if we don't find bash, try sh 2014-02-14 16:41:03 +01:00
Lennart Poettering
af1082b04a update TODO 2014-02-14 16:40:52 +01:00
Lennart Poettering
6b9132a9c4 nspawn: don't accept just any tree to execute
When invoked without -D in an arbitrary directory we should not try to
execute anything, make some validity checks first.
2014-02-14 16:35:18 +01:00
Lennart Poettering
9fccdb0f64 man: always place <programlisting> and </programlisting> in a line with actual sources, so that we don't get spurious newlines in the man page output 2014-02-14 15:56:19 +01:00
Djalal Harouni
6046278f40 localectl: log error if bus_map_all_properties() fails 2014-02-14 02:19:42 +01:00
Lennart Poettering
3a33e61d2d service: when we complain about a notify message we cannot map to main pid because we don't know anything about the main pid, do so at debug level 2014-02-14 02:05:40 +01:00
Lennart Poettering
336c6e4690 service: if we don't know the main pid of a service, we cannot accept any notification messages 2014-02-14 02:04:09 +01:00
Simon Peeters
9f137db070 build-sys: fix for "recipe for target 'dbus1-generator-install-hook' failed" 2014-02-14 01:52:40 +01:00
Dave Reisner
29e254f7f0 man: systemd.service(5): clarify behavior of SuccessExitStatus
The behavior of this is a little cryptic in that $MAINPID must exit as
a direct result of receiving a signal in order for a listed signal to
be considered a success condition.
2014-02-14 01:40:52 +01:00
Michael Marineau
112cfb1814 shared: include root when canonicalizing conf paths
The conf_files_list family accepts an alternate root path to prefix all
directories in the list but path_strv_canonicalize_uniq doesn't use it.
This results in the suspicious behavior of resolving directory symlinks
based on the contents of / instead of the alternate root.

This adds a prefix argument to path_strv_canonicalize which will now
prepend the prefix, if given, to every path in the list. To avoid
answering what a relative path means when called with a root prefix
path_strv_canonicalize is now path_strv_canonicalize_absolute and only
considers absolute paths. Fortunately all users of already call
path_strv_canonicalize with a list of absolute paths.
2014-02-14 00:58:00 +01:00
Djalal Harouni
b58b227a53 logind: make sure to terminate systemd user on logouts
Currently if the user logs out, the GC may never call user_stop(),
this will not terminate the systemd user and (sd-pam) of that user.

To fix this, remove the USER_CLOSING state check that is blocking the
GC from calling user_stop(). Since if user_check_gc() returns false
this means that all the sessions of the user were removed which will
make user_get_state() return USER_CLOSING.

Conclusion: that test will never be statisfied.

So we remove the USER_CLOSING check and replace it with a check inside
user_stop() this way we know that user_stop() has already queued stop
jobs, no need to redo.

This ensures that the GC will get its two steps correctly as pointed out
by Lennart:
http://lists.freedesktop.org/archives/systemd-devel/2014-February/016825.html

Note: this also fixes another bug that prevents creating the user
private dbus socket which will break communications with the user
manager.
2014-02-13 21:07:13 +01:00
Lennart Poettering
24fb111207 nspawn: make socket(AF_NETLINK, *, NETLINK_AUDIT) fail with EAFNOTSUPPORT in containers
The kernel still doesn't support audit in containers, so let's make use
of seccomp and simply turn it off entirely. We can get rid of this big
as soon as the kernel is fixed again.
2014-02-13 20:30:02 +01:00
Lennart Poettering
69c79d3c32 nspawn: add new --network-veth switch to add a virtual ethernet link to the host 2014-02-13 18:47:53 +01:00
Lennart Poettering
31a4e15384 rtnl: support adding VETH_INFO_PEER containers into rtnl messages 2014-02-13 18:47:53 +01:00
Dave Reisner
5a1aece581 systemctl: fix exit statuses from is-active/is-failed
This was inadvertantly disturbed in e3e0314b when glob support was
added.
2014-02-13 10:14:31 -05:00
Lennart Poettering
c8a202b7d4 everywhere: always use O_CLOEXEC where it makes sense 2014-02-13 14:59:56 +01:00
Lennart Poettering
955d98c9c1 everywhere: make use of new0() and macro() macros, and stop using perror() 2014-02-13 14:45:51 +01:00
Lennart Poettering
7e2270246b nspawn: check with udev before we take possession of an interface 2014-02-13 14:38:02 +01:00
Lennart Poettering
b88eb17a7a nspawn: no need to subscribe to netlink messages if we just want to execute one operation 2014-02-13 14:08:16 +01:00
Lennart Poettering
a42c8b54b1 nspawn: --private-network should imply CAP_NET_ADMIN 2014-02-13 14:07:59 +01:00