Commit graph

20304 commits

Author SHA1 Message Date
Cristian Rodríguez 0dfb89d3c2 buildsys: Remove X_SERVER from AM_CPPFLAGS
It is a leftover from multi-seat-x wrapper which is long
gone.
2015-05-16 12:04:46 -04:00
Lukas Rusak 6b85708cfd zsh-completion: add missing completions for systemd-nspawn 2015-05-16 11:54:28 -04:00
Lukas Rusak b93f15cd05 zsh-completion: update -M completion for systemd-analyze 2015-05-16 11:54:28 -04:00
Lukas Rusak b3b9282d0c zsh-completion: add missing completions for machinectl
Appologies, I'm still getting used to this mailing list thing and using git send-email
2015-05-16 11:54:28 -04:00
Tom Gundersen cb49a4f2dd udevd: queue - update queue state when events are queued/freed
This way it is more obvious that the queue flag file is always
up-to-date. Moreover, we only have to touch/unlink it when the
first/last event is allocated/freed.
2015-05-16 10:31:33 +02:00
Tom Gundersen 738a790778 udevd: on_worker - distinguish between EINTR and EAGAIN
EAGAIN means there are no more messages to read, so give up. EINTR means we got interrupted
reading a message, so try again.
2015-05-16 01:14:48 +02:00
Tom Gundersen 9a73bd7cab udevd: worker - use loop_write() rather than send()
When notifying the main daemon about event completion, make sure the message is sent
successfully, and not interrupted.
2015-05-16 01:14:48 +02:00
Tom Gundersen 8c7e28a191 util: loop_write - accept 0-length message
write() can send empty messages, so make sure loop_write() can do the same.
2015-05-16 01:14:48 +02:00
Tom Gundersen 43d60b77a8 udevd: net - fix leak in .link config
Path, Driver and Type are now strv rather than strings, so free them properly.
2015-05-16 01:14:48 +02:00
Tom Gundersen 35927d13df udev-ctrl: make _unref() always return NULL
Bring this in line with the rest of the codebase.
2015-05-15 23:36:35 +02:00
Tom Gundersen b5acb956d1 units: make networkd pull in its own .busname unit
The daemon requires the busname unit to operate (on kdbus systems),
since it contains the policy that allows it to acquire its service
name.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=90287
2015-05-15 22:59:43 +02:00
Lennart Poettering a542c4dc43 tmpfiles: use lstat() instead of stat() when checking whether a file system object already exists 2015-05-15 21:48:20 +02:00
Lennart Poettering 7b135a7399 tmpfiles: don't fail if we cannot create a subvolume because a file system is read-only but a dir already exists anyway
https://bugs.freedesktop.org/show_bug.cgi?id=90281
2015-05-15 21:47:22 +02:00
Lennart Poettering 0fef704c6f CODING_STYLE: document that EXIT_FAILURE and EXIT_SUCCESS should be used 2015-05-15 21:34:14 +02:00
Lennart Poettering a5ecb0cec2 CODING_STYLE: document best practices when initializing structs 2015-05-15 21:06:40 +02:00
Lennart Poettering 5470c03b37 coredump: make sure we vacuum by default
Only if both keep_free and max_use are actually 0 we can shortcut things
and avoid vacuuming. If either are positive or -1 we need to execute the
vacuuming.

http://lists.freedesktop.org/archives/systemd-devel/2015-April/031382.html
2015-05-15 20:56:55 +02:00
Lennart Poettering 7693146dee socket-util: socket_address_parse() should not log errors on its own
Given that socket_address_parse() is mostly a "library" call it
shouldn't log on its own, but leave that to its caller.

This patch removes logging from the call in case IPv6 is not available
but and IPv6 address shall be parsed. Instead a new call
socket_address_parse_and_warn() is introduced which first invokes
socket_address_parse() and then logs if necessary.

This should fix "make check" on ipv6-less kernels:

http://lists.freedesktop.org/archives/systemd-devel/2015-April/031385.html
2015-05-15 20:15:59 +02:00
Martin Pitt 35b1078e1c core: Fix assertion with empty Exec*= paths
An Exec*= line with whitespace after modifiers, like

  ExecStart=- /bin/true

is considered to have an empty command path. This is as specified, but causes
systemd to crash with

  Assertion 'skip < l' failed at ../src/core/load-fragment.c:607, function config_parse_exec(). Aborting.
  Aborted (core dumped)

Fix this by logging an error instead and ignoring the invalid line.

Add corresponding test cases. Also add a test case for a completely empty value
which resets the command list.

https://launchpad.net/bugs/1454173
2015-05-15 20:02:44 +02:00
Cristian Rodríguez 6b71bab08d timedate: fix memory leak in timedated
$ /usr/lib/systemd/systemd-timedated (wait until auto-exit)

=================================================================
==396==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 928 byte(s) in 1 object(s) allocated from:
    #0 0x7f782f788db1 in __interceptor_calloc (/usr/lib64/libasan.so.2+0x96db1)
    #1 0x562a83ae60cf in bus_message_from_header src/libsystemd/sd-bus/bus-message.c:480
    #2 0x562a83ae6f5a in bus_message_from_malloc src/libsystemd/sd-bus/bus-message.c:576
    #3 0x562a83ad3cad in bus_socket_make_message src/libsystemd/sd-bus/bus-socket.c:915
    #4 0x562a83ad4cfc in bus_socket_read_message src/libsystemd/sd-bus/bus-socket.c:1051
    #5 0x562a83ab733f in bus_read_message src/libsystemd/sd-bus/sd-bus.c:1647
    #6 0x562a83ab98ea in sd_bus_call src/libsystemd/sd-bus/sd-bus.c:2038
    #7 0x562a83b1f46d in sd_bus_call_method src/libsystemd/sd-bus/bus-convenience.c:94
    #8 0x562a83aab3e1 in context_read_ntp src/timedate/timedated.c:192
    #9 0x562a83aae1af in main src/timedate/timedated.c:730
    #10 0x7f782eb238c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)

Indirect leak of 77 byte(s) in 1 object(s) allocated from:
    #0 0x7f782f788f6a in realloc (/usr/lib64/libasan.so.2+0x96f6a)
    #1 0x562a83ad418a in bus_socket_read_message src/libsystemd/sd-bus/bus-socket.c:963
    #2 0x562a83ab733f in bus_read_message src/libsystemd/sd-bus/sd-bus.c:1647
    #3 0x562a83ab98ea in sd_bus_call src/libsystemd/sd-bus/sd-bus.c:2038
    #4 0x562a83b1f46d in sd_bus_call_method src/libsystemd/sd-bus/bus-convenience.c:94
    #5 0x562a83aab3e1 in context_read_ntp src/timedate/timedated.c:192
    #6 0x562a83aae1af in main src/timedate/timedated.c:730
    #7 0x7f782eb238c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)

Indirect leak of 2 byte(s) in 1 object(s) allocated from:
    #0 0x7f782f75493f in strdup (/usr/lib64/libasan.so.2+0x6293f)
    #1 0x562a83b0229b in bus_message_parse_fields src/libsystemd/sd-bus/bus-message.c:5382
    #2 0x562a83ae7290 in bus_message_from_malloc src/libsystemd/sd-bus/bus-message.c:601
    #3 0x562a83ad3cad in bus_socket_make_message src/libsystemd/sd-bus/bus-socket.c:915
    #4 0x562a83ad4cfc in bus_socket_read_message src/libsystemd/sd-bus/bus-socket.c:1051
    #5 0x562a83ab733f in bus_read_message src/libsystemd/sd-bus/sd-bus.c:1647
    #6 0x562a83ab98ea in sd_bus_call src/libsystemd/sd-bus/sd-bus.c:2038
    #7 0x562a83b1f46d in sd_bus_call_method src/libsystemd/sd-bus/bus-convenience.c:94
    #8 0x562a83aab3e1 in context_read_ntp src/timedate/timedated.c:192
    #9 0x562a83aae1af in main src/timedate/timedated.c:730
    #10 0x7f782eb238c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)

SUMMARY: AddressSanitizer: 1007 byte(s) leaked in 3 allocation(s).

This is due to missing  _cleanup_bus_message_unref_ in context_read_ntp()
2015-05-15 20:00:22 +02:00
Łukasz Stelmach 008e7d393a .gitignore: add GNU GLOBAL files 2015-05-15 18:02:08 +02:00
Lennart Poettering 2929b4a6ad generator: use fflush_and_check() where appropriate 2015-05-15 17:06:59 +02:00
Davide Bettio a2c7f25aec core: don't consider umask for SocketMode=
https://bugs.freedesktop.org/show_bug.cgi?id=89248
2015-05-15 16:36:28 +02:00
Lennart Poettering 42706f47c9 CODING_STYLE: document alloca() DONTS 2015-05-15 15:47:37 +02:00
Dimitri John Ledkov 304b3079a2 core: Execute first boot presets in an enable-only preset-mode.
This means any existing enabled units well be preserved and no
pre-created symlinks will be removed. This is done on first boot, when
the assumption is that /etc is not populated at all (no machine-id
setup). For minimal containers that gives a significant first boot
speed up, approximately ~20ms / ~16% in my trials.
2015-05-15 12:49:33 +02:00
Lennart Poettering fe0272999c networkd: don't try to turn on ipv6 forwarding if kernel lacks IPv6 support
http://lists.freedesktop.org/archives/systemd-devel/2015-May/031598.html
2015-05-15 12:20:36 +02:00
Benedikt Morbach 5c82dd13e1 man: IPMasquerade only implies IPForward=ipv4
at least that's what the code does.
2015-05-15 12:18:05 +02:00
Benedikt Morbach 505c5f6de1 networkd: don't touch global forwarding setting
This reverts commit 43c6d5abac
(and a small part of 4046d8361c)

It turns out we don't actually need to set the global ip_forward setting.
The only relevant setting is the one on each interface.

What the global toggle actually does is switch forwarding on/off for all
currently present interfaces and change the default for new ones.

That means that by setting the global ip_forward we

  - Introduce a race condition, because if the interface with IPForward=yes
    is brought up after one with IPForward=no, both will have forwarding
    enabled, because the global switch turns it on for all interfaces.
    If the other interface comes up first networkd correctly sets forward=0
    and it doesn't get overridden.

  - Change the forwarding setting for interfaces that networkd is not
    configured to touch, even if the user disabled forwarding via sysctl,
    either globally or per-interface

As forwarding works fine without this, as long as all relevant interfacest
individually set IPForward=yes:  just drop it

This means that non-networkd interfaces use the global default while
networkd interfaces default to off if IPForward isn't given.
2015-05-15 12:13:35 +02:00
Jan Synacek 57ab2eabb8 systemctl: introduce --now for enable, disable and mask
https://bugs.freedesktop.org/show_bug.cgi?id=42940
2015-05-15 11:59:36 +02:00
Stefan Junker ce5b3ad450 nspawn: allow access to device nodes listed in --bind= and --bind-ro= switches
https://bugs.freedesktop.org/show_bug.cgi?id=90385
2015-05-14 22:51:05 +02:00
Lennart Poettering 0e85114376 test-bus-chat: various modernizations 2015-05-14 22:41:19 +02:00
Cristian Rodríguez 2f50a2d55b sd-bus: fix memory leak in test-bus-chat
Building with address sanitizer enabled on GCC 5.1.x a memory leak
is reported because we never close the bus, fix it by using
cleanup variable attribute.
2015-05-14 22:36:35 +02:00
Lennart Poettering 1dff320294 units: fix typo in systemd-resolved.service
There's no network.service unit, we actually mean network.target here.

Reported by Fco. Eduardo Ramírez.
2015-05-14 22:32:35 +02:00
Lennart Poettering 6e6c21c894 util: introduce memmem_safe() and make use of it
GNU memmem() requires a nonnull first parameter. Let's introduce
memmem_safe() that removes this restriction for zero-length parameters,
and make use of it where appropriate.

http://lists.freedesktop.org/archives/systemd-devel/2015-May/031705.html
2015-05-14 11:32:41 +02:00
Lennart Poettering aeb24f3081 util: use GNU comparison function prototype for qsort_safe() 2015-05-14 11:32:41 +02:00
Thomas Hindoe Paaboel Andersen 7185d80558 networkd: remove dead initialization 2015-05-13 23:44:20 +02:00
Lennart Poettering cbf60d0a7f core: only set event source name when we create an event source 2015-05-13 18:30:14 +02:00
Peter Lemenkov b4a855e9f6 journal: fix size comment
Looks like sizeof(struct Header) is 240 not 224
2015-05-13 17:58:34 +02:00
Lennart Poettering 1d13f648d0 util: add generic calls for prefixing a root directory to a path
So far a number of utilities implemented their own calls for this, unify
them in prefix_root() and prefix_roota(). The former uses heap memory,
the latter allocates from the stack via alloca().

Port over most users of a --root= logic.
2015-05-13 17:42:10 +02:00
Lennart Poettering 8b44a3d22c core: make exec code a bit more readable
Let's add a function that checks whether we need fs namespacing, to make
things easier to read, instead of using a humungous if expression...
2015-05-13 16:34:02 +02:00
Cristian Rodríguez f42348ace7 core: fix memory leak in manager_run_generators()
If systemd is built with GCC address sanitizer or leak sanitizer
the following memory leak ocurs:

May 12 02:02:46 linux.site systemd[326]: =================================================================
May 12 02:02:46 linux.site systemd[326]: ==326==ERROR: LeakSanitizer: detected memory leaks
May 12 02:02:46 linux.site systemd[326]: Direct leak of 101 byte(s) in 3 object(s) allocated from:
May 12 02:02:46 linux.site systemd[326]: #0 0x7fd1f504993f in strdup (/usr/lib64/libasan.so.2+0x6293f)
May 12 02:02:46 linux.site systemd[326]: #1 0x55d6ffac5336 in strv_new_ap src/shared/strv.c:163
May 12 02:02:46 linux.site systemd[326]: #2 0x55d6ffac56a9 in strv_new src/shared/strv.c:185
May 12 02:02:46 linux.site systemd[326]: #3 0x55d6ffa80272 in generator_paths src/shared/path-lookup.c:223
May 12 02:02:46 linux.site systemd[326]: #4 0x55d6ff9bdb0f in manager_run_generators src/core/manager.c:2828
May 12 02:02:46 linux.site systemd[326]: #5 0x55d6ff9b1a10 in manager_startup src/core/manager.c:1121
May 12 02:02:46 linux.site systemd[326]: #6 0x55d6ff9a78e3 in main src/core/main.c:1667
May 12 02:02:46 linux.site systemd[326]: #7 0x7fd1f394e8c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)
May 12 02:02:46 linux.site systemd[326]: Direct leak of 29 byte(s) in 1 object(s) allocated from:
May 12 02:02:46 linux.site systemd[326]: #0 0x7fd1f504993f in strdup (/usr/lib64/libasan.so.2+0x6293f)
May 12 02:02:46 linux.site systemd[326]: #1 0x55d6ffac5288 in strv_new_ap src/shared/strv.c:152
May 12 02:02:46 linux.site systemd[326]: #2 0x55d6ffac56a9 in strv_new src/shared/strv.c:185
May 12 02:02:46 linux.site systemd[326]: #3 0x55d6ffa80272 in generator_paths src/shared/path-lookup.c:223
May 12 02:02:46 linux.site systemd[326]: #4 0x55d6ff9bdb0f in manager_run_generators src/core/manager.c:2828
May 12 02:02:46 linux.site systemd[326]: #5 0x55d6ff9b1a10 in manager_startup src/core/manager.c:1121
May 12 02:02:46 linux.site systemd[326]: #6 0x55d6ff9a78e3 in main src/core/main.c:1667
May 12 02:02:46 linux.site systemd[326]: #7 0x7fd1f394e8c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)
May 12 02:02:46 linux.site systemd[326]: SUMMARY: AddressSanitizer: 130 byte(s) leaked in 4 allocation(s).

There is a leak due to the the use of cleanup_free instead _cleanup_strv_free_
2015-05-13 16:32:55 +02:00
Iago López Galeiras 875e1014dd nspawn: skip symlink to a combined cgroup hierarchy if it already exists
If a symlink to a combined cgroup hierarchy already exists and points to
the right path, skip it. This avoids an error when the cgroups are set
manually before calling nspawn.
2015-05-13 16:03:07 +02:00
Iago López Galeiras 54b4755f15 nspawn: only mount the cgroup root if it's not already mounted
This allows the user to set the cgroups manually before calling nspawn.
2015-05-13 15:56:59 +02:00
Dimitri John Ledkov f00929ad62 Default to /usr/bin/u?mount, configurable, rather than hard-coded /bin/u?mount. 2015-05-13 15:48:28 +02:00
Lennart Poettering 7ba2711d3f core: never create device depencies for /dev/root mounts
http://lists.freedesktop.org/archives/systemd-devel/2015-May/031658.html
2015-05-13 14:40:37 +02:00
Lennart Poettering 5a8af538ae nspawn: rework custom mount point order, and add support for overlayfs
Previously all bind mount mounts were applied in the order specified,
followed by all tmpfs mounts in the order specified. This is
problematic, if bind mounts shall be placed within tmpfs mounts.

This patch hence reworks the custom mount point logic, and alwas applies
them in strict prefix-first order. This means the order of mounts
specified on the command line becomes irrelevant, the right operation
will always be executed.

While we are at it this commit also adds native support for overlayfs
mounts, as supported by recent kernels.
2015-05-13 14:07:26 +02:00
Cristian Rodríguez 4df3277881 modules-load: fix memory leak
=================================================================
==64281==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7f623c961c4a in malloc (/usr/lib64/libasan.so.2+0x96c4a)
    #1 0x5651f79ad34e in malloc_multiply (/home/crrodriguez/scm/systemd/systemd-modules-load+0x2134e)
    #2 0x5651f79b02d6 in strjoin (/home/crrodriguez/scm/systemd/systemd-modules-load+0x242d6)
    #3 0x5651f79be1f5 in files_add (/home/crrodriguez/scm/systemd/systemd-modules-load+0x321f5)
    #4 0x5651f79be6a3 in conf_files_list_strv_internal (/home/crrodriguez/scm/systemd/systemd-modules-load+0x326a3)
    #5 0x5651f79bea24 in conf_files_list_nulstr (/home/crrodriguez/scm/systemd/systemd-modules-load+0x32a24)
    #6 0x5651f79ad01a in main (/home/crrodriguez/scm/systemd/systemd-modules-load+0x2101a)
    #7 0x7f623c11586f in __libc_start_main (/lib64/libc.so.6+0x2086f)

SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s).

This happens due to the wrong cleanup attribute is used (free vs strv_free)
2015-05-13 14:07:26 +02:00
Cristian Rodríguez a765f3443f shared: Use O_EXCL with O_TMPFILE in open_tmpfile
In this usecase, the file will never be materialized
with linkat().
2015-05-13 14:07:26 +02:00
Thomas Hindoe Paaboel Andersen 91077af69e fsck: add enum with fsck exit codes 2015-05-12 22:09:48 +02:00
Tom Gundersen ecb17862ad udevd: manager - move a few global variables into the Manager object 2015-05-12 19:16:43 +02:00
Tom Gundersen c0c6806bf9 udevd: pass a Manager objcet to event handlers
Stop relying on global variables in event handlers, and move them
all to a Manager object instead.
2015-05-12 19:16:43 +02:00