platform/upstream/systemd.git
7 years agoMerge pull request #5168 from ddstreet/apply_format_helper
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 15:56:09 +0000 (10:56 -0500)]
Merge pull request #5168 from ddstreet/apply_format_helper

simplify udev_event_apply_format().

7 years agoMerge pull request #5177 from M0Rf30/master
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 15:51:56 +0000 (10:51 -0500)]
Merge pull request #5177 from M0Rf30/master

hwdb: quirk for kionix accelerometer on Asus TP500LB

7 years agoMerge pull request #5192 from keszybz/systemctl-ignore-sigterm
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 15:36:30 +0000 (10:36 -0500)]
Merge pull request #5192 from keszybz/systemctl-ignore-sigterm

Fix for initrd-switch-root failing and causing emergency.target to be started.

7 years agoutil-lib: Fix chase_symlinks() with absolute symlinks (#5185)
3chas3 [Tue, 31 Jan 2017 13:21:15 +0000 (08:21 -0500)]
util-lib: Fix chase_symlinks() with absolute symlinks (#5185)

If chase_symlinks() encouters an absolute symlink, it resets the todo
buffer to just the newly discovered symlink and discards any of the
remaining previous symlink path.  Regardless of whether or not the
symlink is absolute or relative, we need to preserve the remainder of
the path that has not yet been resolved.

7 years agobasic: check strdup result in khash_dup (#5176)
Evgeny Vereshchagin [Tue, 31 Jan 2017 07:27:14 +0000 (10:27 +0300)]
basic: check strdup result in khash_dup (#5176)

Fixes CID #1368249

7 years agoMerge pull request #5175 from keszybz/hostname-fallback
Martin Pitt [Tue, 31 Jan 2017 07:26:42 +0000 (08:26 +0100)]
Merge pull request #5175 from keszybz/hostname-fallback

Allow distributions to override the "localhost" fallback

7 years agoman: mention ConditionFirstBoot= in systemd-firstboot(1) (#5186)
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 07:25:19 +0000 (02:25 -0500)]
man: mention ConditionFirstBoot= in systemd-firstboot(1) (#5186)

7 years agounits: restore Before dependencies for systemd-vconsole-setup.service
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 05:34:33 +0000 (00:34 -0500)]
units: restore Before dependencies for systemd-vconsole-setup.service

When the service is run in the initramfs, it is possible for it to get started
and not be fast enough to exit before the root switch happens. It is started
multiple times (depending on the consoles being detected), and runs
asynchronously, so this is quite likely. It'll then get killed by killall(),
and systemd will consider the service failed. To avoid all this, just wait
for the service to terminate on it's own.

Before=initrd-switch-root.target should be good for the initramfs, and
Before=shutdown.tuarget should be good for the real system, although it's
unlikely to make any difference there.

7 years agosystemctl: ignore SIGTERM after switch root
Zbigniew Jędrzejewski-Szmek [Mon, 30 Jan 2017 18:06:10 +0000 (13:06 -0500)]
systemctl: ignore SIGTERM after switch root

https://bugzilla.redhat.com/show_bug.cgi?id=1414904#c14 and #c15.

7 years agounits: drop KillMode= from initrd-switch-root.service
Zbigniew Jędrzejewski-Szmek [Sun, 29 Jan 2017 17:45:51 +0000 (12:45 -0500)]
units: drop KillMode= from initrd-switch-root.service

The service already has DefaultDeps disabled, so systemd should not try to stop
it. And if it *does* get stopped, we don't want the zombie process around.
KillMode=none does not change anything in the killall() phase, and we already
use argv[0][0] = '@' to protect against that anyway. KillMode=none should not
be useful in normal operation, so let's leave it out.

7 years agosystemctl: always avoid being killed when doing switch-root
Zbigniew Jędrzejewski-Szmek [Sun, 29 Jan 2017 02:18:31 +0000 (21:18 -0500)]
systemctl: always avoid being killed when doing switch-root

The same logic as described in acc28e2e3037d689d6481e applies to any time we are
switching root, to just set the flag unconditionally.

7 years agojournal-gatewayd: return -EINVAL if ARG_TRUST and HAVE_GNUTLS (#5181)
Yi EungJun [Mon, 30 Jan 2017 15:24:06 +0000 (00:24 +0900)]
journal-gatewayd: return -EINVAL if ARG_TRUST and HAVE_GNUTLS (#5181)

This bug was introduced by 1aa1e59.

7 years agojournal-gatewayd: actually recognize -D as a synonym for --directory (#5180)
Ivan Shapovalov [Sun, 29 Jan 2017 19:33:37 +0000 (23:33 +0400)]
journal-gatewayd: actually recognize -D as a synonym for --directory (#5180)

7 years agohwdb: Asus TP500LB accelerometer support
M0Rf30 [Sat, 28 Jan 2017 22:48:55 +0000 (23:48 +0100)]
hwdb: Asus TP500LB accelerometer support

7 years agohwdb: references added to hwdb rules format, needed to write syntax-correctly rules
M0Rf30 [Sat, 28 Jan 2017 22:48:15 +0000 (23:48 +0100)]
hwdb: references added to hwdb rules format, needed to write syntax-correctly rules

7 years agohwdb: use -y option to udevadm trigger to correctly do sysname-match
M0Rf30 [Sat, 28 Jan 2017 12:49:40 +0000 (13:49 +0100)]
hwdb: use -y option to udevadm trigger to correctly do sysname-match

7 years agobuild-sys,hostnamed: allow distributions to override the "localhost" fallback
Zbigniew Jędrzejewski-Szmek [Sat, 28 Jan 2017 04:36:01 +0000 (23:36 -0500)]
build-sys,hostnamed: allow distributions to override the "localhost" fallback

A configure param is added to make this easy to change if distributions want
to differentiate on that. The default remains unchanged.

https://bugzilla.redhat.com/show_bug.cgi?id=1392925#c10

7 years agoconfigure: use lowercase for "nobody" and "system"
Zbigniew Jędrzejewski-Szmek [Sat, 28 Jan 2017 04:18:29 +0000 (23:18 -0500)]
configure: use lowercase for "nobody" and "system"

No reason to capitalize words which are not names. And "nobody" is
a user name, traditionally lowercase.

7 years agoudev-event: use in-place whitespace replacement
Dan Streetman [Thu, 26 Jan 2017 19:18:10 +0000 (14:18 -0500)]
udev-event: use in-place whitespace replacement

Instead of using a temp buffer to replace whitespace in variable
substitutions, just allow util_replace_whitespace to replace in-place.
Add a comment to util_replace_whitespace indicating it is used to replace
in-place, to prevent accidental future breakage.

7 years agoudev-event: refactor udev_event_apply_format
Dan Streetman [Thu, 26 Jan 2017 01:06:54 +0000 (20:06 -0500)]
udev-event: refactor udev_event_apply_format

Move the large case statement into its own function

7 years agozsh-completion: _journalctl fixes (#5165)
llua [Fri, 27 Jan 2017 12:50:40 +0000 (07:50 -0500)]
zsh-completion: _journalctl fixes (#5165)

allow _journalctl to work when the rcquotes option is set, broken in ba89f80620d619867b4838973785d529c5a959f6.
allow the completion of --file multiple times, which ba89f80620d619867b4838973785d529c5a959f6 claims is true.

Fixes #4842

7 years agotests: add tests for SYMLINK containing whitespace in variable (#5158)
Dan Streetman [Thu, 26 Jan 2017 01:24:52 +0000 (20:24 -0500)]
tests: add tests for SYMLINK containing whitespace in variable (#5158)

add udev-test.pl tests for whitespace in a substituted variable,
to verify the variable whitespace is replaced with underscores.

Tests for the change made by commit 0a10235ed453 ("udev-rules:
perform whitespace replacement for symlink subst values")

7 years agohwdb: add Razer DeathAdder Black Edition (#5157)
clearyf [Thu, 26 Jan 2017 01:20:17 +0000 (02:20 +0100)]
hwdb: add Razer DeathAdder Black Edition (#5157)

7 years agoMerge pull request #5152 from keszybz/strv-free
Evgeny Vereshchagin [Wed, 25 Jan 2017 13:31:11 +0000 (16:31 +0300)]
Merge pull request #5152 from keszybz/strv-free

Use strv_free where appropriate

7 years agobash-completion: add support for --now (#5155)
Jan Synacek [Wed, 25 Jan 2017 12:44:04 +0000 (13:44 +0100)]
bash-completion: add support for --now (#5155)

7 years agoresolve: fix strv memleak
Zbigniew Jędrzejewski-Szmek [Wed, 25 Jan 2017 03:27:21 +0000 (22:27 -0500)]
resolve: fix strv memleak

sd_bus_message_read_strv() returns a normal strv...

7 years agocore/execute: fix strv memleak
Zbigniew Jędrzejewski-Szmek [Wed, 25 Jan 2017 03:24:07 +0000 (22:24 -0500)]
core/execute: fix strv memleak

compile_read_write_paths() returns a normal strv from strv_copy(), and
setup_namespace() uses it read-only, so we should use strv_free to deallocate.

7 years agocore/dbus: fix two strv memleaks
Zbigniew Jędrzejewski-Szmek [Wed, 25 Jan 2017 03:21:16 +0000 (22:21 -0500)]
core/dbus: fix two strv memleaks

job_dbus_path and unit_dbus_path both allocate new strings, so we should use
strv_free.

7 years agocore: fix memleak in bus_exec_context_set_transient_property (#5143)
Evgeny Vereshchagin [Wed, 25 Jan 2017 02:53:50 +0000 (05:53 +0300)]
core: fix memleak in bus_exec_context_set_transient_property (#5143)

Fixes:
```sh
systemd-run --property EnvironmentFile=/some/environment/file /bin/sleep 30
```
```
 23 bytes in 1 blocks are definitely lost in loss record 1 of 7
    at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
    by 0x4E85488: malloc_multiply (alloc-util.h:70)
    by 0x4E85F19: strjoin_real (string-util.c:252)
    by 0x1AF741: bus_exec_context_set_transient_property (dbus-execute.c:1418)
    by 0x1A907C: bus_service_set_property (dbus-service.c:330)
    by 0x1A66DD: bus_unit_set_properties (dbus-unit.c:1456)
    by 0x19CF93: transient_unit_from_message (dbus-manager.c:892)
    by 0x19D388: method_start_transient_unit (dbus-manager.c:980)
    by 0x4F60544: method_callbacks_run (bus-objects.c:418)
    by 0x4F62D9D: object_find_and_run (bus-objects.c:1255)
    by 0x4F633CE: bus_process_object (bus-objects.c:1371)
    by 0x4F2CE1D: process_message (sd-bus.c:2563)
```
Closes: #5142

7 years agopo: Fix invalid date in Croatian translation (#5147)
Jakub Wilk [Wed, 25 Jan 2017 02:45:58 +0000 (03:45 +0100)]
po: Fix invalid date in Croatian translation (#5147)

7 years agotree-wide: remove consecutive duplicate words in comments (#5148)
Stefan Schweter [Wed, 25 Jan 2017 02:45:30 +0000 (03:45 +0100)]
tree-wide: remove consecutive duplicate words in comments (#5148)

7 years agovirt: update url to hypervisor top-level functional specification (#5149)
Stefan Schweter [Wed, 25 Jan 2017 02:44:59 +0000 (03:44 +0100)]
virt: update url to hypervisor top-level functional specification (#5149)

7 years agocatalog: make support URL to show in shipped catalog entries configurable (#5150)
Stefan Schweter [Wed, 25 Jan 2017 02:44:19 +0000 (03:44 +0100)]
catalog: make support URL to show in shipped catalog entries configurable (#5150)

7 years agocore: don't load dropin data multiple times for the same unit (#5139)
Franck Bui [Tue, 24 Jan 2017 13:29:57 +0000 (14:29 +0100)]
core: don't load dropin data multiple times for the same unit (#5139)

When an alias is loaded, we resolve this alias to its final unit first to load
the dropin data.

However if the final unit was already loaded, there's no point in reloading the
dropin data a second time.

This patch optimizes this case.

Also this allows the dropin loading code to assume that only units not yet
loaded are passed down. This assumption is not yet used but might be in the
future.

[zj: invert the condition in the if]

7 years agonetwork: accept colons in network interface names, normally used for alias interfaces...
peoronoob [Tue, 24 Jan 2017 03:26:41 +0000 (04:26 +0100)]
network: accept colons in network interface names, normally used for alias interfaces (#5117)

7 years agocore: improve error message when RefuseManualStart(Stop) is hit (#5132)
Jan Synacek [Tue, 24 Jan 2017 03:06:05 +0000 (04:06 +0100)]
core: improve error message when RefuseManualStart(Stop) is hit (#5132)

7 years agoload-fragment: fix comment to reflect changes made in 43eb109 (#5138)
Michal Sekletar [Tue, 24 Jan 2017 02:18:40 +0000 (03:18 +0100)]
load-fragment: fix comment to reflect changes made in 43eb109 (#5138)

7 years agoREADME: document CONFIG_USER_NS requirement for PrivateUsers (#5140)
Lucas Werkmeister [Tue, 24 Jan 2017 02:18:07 +0000 (03:18 +0100)]
README: document CONFIG_USER_NS requirement for PrivateUsers (#5140)

7 years agosd-network: fix memleak in dhcp6_lease_set_domains (#5113)
Evgeny Vereshchagin [Tue, 24 Jan 2017 02:12:58 +0000 (05:12 +0300)]
sd-network: fix memleak in dhcp6_lease_set_domains (#5113)

The simplest way to reproduce:
```diff
diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c
index bd289fa..4e14d8f 100644
--- a/src/libsystemd-network/test-dhcp6-client.c
+++ b/src/libsystemd-network/test-dhcp6-client.c
@@ -286,6 +286,8 @@ static int test_advertise_option(sd_event *e) {
                         assert_se(optlen == 11);
                         assert_se(dhcp6_lease_set_domains(lease, optval,
                                                           optlen) >= 0);
+                        assert_se(dhcp6_lease_set_domains(lease, optval,
+                                                          optlen) >= 0);
                         break;

                 case SD_DHCP6_OPTION_SNTP_SERVERS:
```

Fixes:
```
==27369==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x7f90e7d21160 in strdup (/lib64/libasan.so.3+0x5a160)
    #1 0x7f90e7467f69 in strv_extend src/basic/strv.c:552
    #2 0x5612fcc19379 in dhcp6_option_parse_domainname src/libsystemd-network/dhcp6-option.c:399
    #3 0x5612fcc1acdf in dhcp6_lease_set_domains src/libsystemd-network/sd-dhcp6-lease.c:225
    #4 0x5612fcc06b95 in test_advertise_option src/libsystemd-network/test-dhcp6-client.c:287
    #5 0x5612fcc0a987 in main src/libsystemd-network/test-dhcp6-client.c:761
    #6 0x7f90e6d46400 in __libc_start_main (/lib64/libc.so.6+0x20400)

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

7 years agosd-network: fix memleak in dhcp6_option_parse_domainname (#5114)
Evgeny Vereshchagin [Tue, 24 Jan 2017 02:11:59 +0000 (05:11 +0300)]
sd-network: fix memleak in dhcp6_option_parse_domainname (#5114)

The simplest way to reproduce:
```diff
diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c
index bd289fa..7b0a5ef 100644
--- a/src/libsystemd-network/test-dhcp6-client.c
+++ b/src/libsystemd-network/test-dhcp6-client.c
@@ -168,7 +168,7 @@ static uint8_t msg_advertise[198] = {
         0x00, 0x17, 0x00, 0x10, 0x20, 0x01, 0x0d, 0xb8,
         0xde, 0xad, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x00,
         0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x0b,
-        0x03, 0x6c, 0x61, 0x62, 0x05, 0x69, 0x6e, 0x74,
+        0x01, 0x6c, 0x01, 0x62, 0x00, 0x0a, 0x6e, 0x74,
         0x72, 0x61, 0x00, 0x00, 0x1f, 0x00, 0x10, 0x20,
         0x01, 0x0d, 0xb8, 0xde, 0xad, 0xbe, 0xef, 0x00,
         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
@@ -338,9 +338,7 @@ static int test_advertise_option(sd_event *e) {
         assert_se(!memcmp(addrs, &msg_advertise[124], r * 16));

         r = sd_dhcp6_lease_get_domains(lease, &domains);
-        assert_se(r == 1);
-        assert_se(!strcmp("lab.intra", domains[0]));
-        assert_se(domains[1] == NULL);
+        assert_se(r == -ENOENT);

         r = sd_dhcp6_lease_get_ntp_addrs(lease, &addrs);
         assert_se(r == 1);
```

Fixes:
```
=================================================================
==15043==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x7f13c8564160 in strdup (/lib64/libasan.so.3+0x5a160)
    #1 0x7f13c7caaf69 in strv_extend src/basic/strv.c:552
    #2 0x55f775787230 in dhcp6_option_parse_domainname src/libsystemd-network/dhcp6-option.c:399
    #3 0x55f775788b96 in dhcp6_lease_set_domains src/libsystemd-network/sd-dhcp6-lease.c:225
    #4 0x55f775774b95 in test_advertise_option src/libsystemd-network/test-dhcp6-client.c:287
    #5 0x55f77577883e in main src/libsystemd-network/test-dhcp6-client.c:759
    #6 0x7f13c7589400 in __libc_start_main (/lib64/libc.so.6+0x20400)

Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x7f13c8564160 in strdup (/lib64/libasan.so.3+0x5a160)
    #1 0x7f13c7caaf69 in strv_extend src/basic/strv.c:552
    #2 0x55f775787230 in dhcp6_option_parse_domainname src/libsystemd-network/dhcp6-option.c:399
    #3 0x55f775788b96 in dhcp6_lease_set_domains src/libsystemd-network/sd-dhcp6-lease.c:225
    #4 0x55f775781348 in client_parse_message src/libsystemd-network/sd-dhcp6-client.c:807
    #5 0x55f775781ba2 in client_receive_advertise src/libsystemd-network/sd-dhcp6-client.c:895
    #6 0x55f775782453 in client_receive_message src/libsystemd-network/sd-dhcp6-client.c:994
    #7 0x7f13c7e447f4 in source_dispatch src/libsystemd/sd-event/sd-event.c:2268
    #8 0x7f13c7e471b0 in sd_event_dispatch src/libsystemd/sd-event/sd-event.c:2627
    #9 0x7f13c7e47ab3 in sd_event_run src/libsystemd/sd-event/sd-event.c:2686
    #10 0x7f13c7e47c21 in sd_event_loop src/libsystemd/sd-event/sd-event.c:2706
    #11 0x55f77577863c in test_client_solicit src/libsystemd-network/test-dhcp6-client.c:737
    #12 0x55f77577884b in main src/libsystemd-network/test-dhcp6-client.c:760
    #13 0x7f13c7589400 in __libc_start_main (/lib64/libc.so.6+0x20400)

SUMMARY: AddressSanitizer: 8 byte(s) leaked in 2 allocation(s).
```

7 years agohwdb: mark Wacom touchpads as external (#5115)
Peter Hutterer [Tue, 24 Jan 2017 02:10:33 +0000 (12:10 +1000)]
hwdb: mark Wacom touchpads as external (#5115)

Wacom doesn't have any internal touchpads.

7 years agoMerge pull request #5112 from yuwata/fix-5105
Zbigniew Jędrzejewski-Szmek [Tue, 24 Jan 2017 01:20:13 +0000 (20:20 -0500)]
Merge pull request #5112 from yuwata/fix-5105

core: add missing unit_add_to_load_queue() to mount_setup_new_unit()

7 years agocore: add missing unit_add_to_load_queue() to mount_setup_new_unit()
Yu Watanabe [Fri, 20 Jan 2017 00:46:47 +0000 (09:46 +0900)]
core: add missing unit_add_to_load_queue() to mount_setup_new_unit()

unit_add_to_load_queue was present in the code before 03b8cfede9ff3441b1ec8ff5cdf6876294846aa4,
and was inadvertently dropped.

Fixes #5105

7 years agocore: minor error handling fix in mount_setup_new_unit()
Yu Watanabe [Fri, 20 Jan 2017 00:45:58 +0000 (09:45 +0900)]
core: minor error handling fix in mount_setup_new_unit()

The function mount_setup_new_unit() should return -ENOMEM
if at least one of `strdup` calls are failed.

7 years agoFixi caching in zsh completion (#5122)
Александр Тихонов [Sat, 21 Jan 2017 19:53:09 +0000 (23:53 +0400)]
Fixi caching in zsh completion (#5122)

I found several issues with zsh completion code:

1. typo in cache filename: "SYS_ALL_PROPRTIES", so cache just not loading from this file
2. cache stored in one file, despite user or system mode. So it can be loaded later in wrong mode
3. most serious problem: broken logic - it retrieves cache when _cache_invalid is true

How to reproduce: type "systemctl --user status <TAB>" and you will see user units. Then press
control+C and type "systemctl --system status <TAB>" in same session and you'll see user units again

7 years agoMerge pull request #5126 from namhyung/journalctl-completion
Zbigniew Jędrzejewski-Szmek [Sat, 21 Jan 2017 17:48:27 +0000 (12:48 -0500)]
Merge pull request #5126 from namhyung/journalctl-completion

bash_completion: Small update for journalctl completion.

7 years agobash_completion: journalctl: Complete -t option values
Namhyung Kim [Sat, 21 Jan 2017 07:38:23 +0000 (16:38 +0900)]
bash_completion: journalctl: Complete -t option values

The -t or --identifier requires a syslog identifier.

7 years agobash_completion: journalctl: add missing options
Namhyung Kim [Sat, 21 Jan 2017 07:36:20 +0000 (16:36 +0900)]
bash_completion: journalctl: add missing options

The --no-hostname and --vacuum-files were missing, add them.

7 years agoman: fix flag in systemd-run (#5107)
Rike-Benjamin Schuppner [Fri, 20 Jan 2017 00:10:30 +0000 (01:10 +0100)]
man: fix flag in systemd-run (#5107)

7 years agoman: fix typos (#5109)
Jakub Wilk [Thu, 19 Jan 2017 15:54:22 +0000 (16:54 +0100)]
man: fix typos (#5109)

7 years agoMerge pull request #5098 from evverx/fix-nspawn-notifications
Djalal Harouni [Wed, 18 Jan 2017 13:36:07 +0000 (14:36 +0100)]
Merge pull request #5098 from evverx/fix-nspawn-notifications

nspawn: change owner/group of /run/systemd/nspawn/notify to userns-root

7 years agoMerge pull request #4991 from poettering/seccomp-fix
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jan 2017 04:10:46 +0000 (23:10 -0500)]
Merge pull request #4991 from poettering/seccomp-fix

7 years agopid1: provide a more detailed error message when execution fails (#5074)
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jan 2017 03:38:55 +0000 (22:38 -0500)]
pid1: provide a more detailed error message when execution fails (#5074)

Fixes #5000.

7 years agoseccomp: minor simplifications for is_seccomp_available()
Lennart Poettering [Tue, 27 Dec 2016 15:50:02 +0000 (16:50 +0100)]
seccomp: minor simplifications for is_seccomp_available()

7 years agoseccomp: rework seccomp code, to improve compat with some archs
Lennart Poettering [Tue, 27 Dec 2016 14:28:25 +0000 (15:28 +0100)]
seccomp: rework seccomp code, to improve compat with some archs

This substantially reworks the seccomp code, to ensure better
compatibility with some architectures, including i386.

So far we relied on libseccomp's internal handling of the multiple
syscall ABIs supported on Linux. This is problematic however, as it does
not define clear semantics if an ABI is not able to support specific
seccomp rules we install.

This rework hence changes a couple of things:

- We no longer use seccomp_rule_add(), but only
  seccomp_rule_add_exact(), and fail the installation of a filter if the
  architecture doesn't support it.

- We no longer rely on adding multiple syscall architectures to a single filter,
  but instead install a separate filter for each syscall architecture
  supported. This way, we can install a strict filter for x86-64, while
  permitting a less strict filter for i386.

- All high-level filter additions are now moved from execute.c to
  seccomp-util.c, so that we can test them independently of the service
  execution logic.

- Tests have been added for all types of our seccomp filters.

- SystemCallFilters= and SystemCallArchitectures= are now implemented in
  independent filters and installation logic, as they semantically are
  very much independent of each other.

Fixes: #4575

7 years agoman: fix typo (#5093)
AsciiWolf [Tue, 17 Jan 2017 11:09:38 +0000 (12:09 +0100)]
man: fix typo (#5093)

7 years agotests: check that we can write to /run/systemd/nspawn/notify
Evgeny Vereshchagin [Tue, 17 Jan 2017 01:37:05 +0000 (01:37 +0000)]
tests: check that we can write to /run/systemd/nspawn/notify

See https://github.com/systemd/systemd/issues/4944

7 years agonspawn: change owner/group of /run/systemd/nspawn/notify to userns-root
Evgeny Vereshchagin [Tue, 17 Jan 2017 01:19:34 +0000 (01:19 +0000)]
nspawn: change owner/group of /run/systemd/nspawn/notify to userns-root

Fixes #4944

7 years agocore: make sure to init mount params before calling mount_is_extrinsic() (#5087)
Franck Bui [Mon, 16 Jan 2017 20:19:13 +0000 (21:19 +0100)]
core: make sure to init mount params before calling mount_is_extrinsic() (#5087)

When a new entry appears in /proc/self/mountinfo, mount_setup_unit()
allocated a new mount unit for it and starts initializing it.

mount_setup_unit() is also used to update a mount unit when a change happens in
/proc/self/mountinfo, for example a mountpoint can be remounted with additional
mount options.

This patch introduces 2 separate functions to deal with those 2 cases instead
of mount_setup_unit() dealing with both of them. The common code is small and
doing the split makes the code easier to read and less error prone if extended
later.

It also makes sure to initialize in both functions the mount parameters of the
mount unit before calling mount_is_extrinsic() since this function relies on
them.

Fixes: #4902

7 years agondisc: honor IPv6AcceptRA.UseDNS when parsing RA options (#5071)
Cédric Schieli [Mon, 16 Jan 2017 17:23:26 +0000 (18:23 +0100)]
ndisc: honor IPv6AcceptRA.UseDNS when parsing RA options (#5071)

RDNSS and DNSLL options received in RA are always used, possibly breaking the resolution of private domains hosted on a local DNS server. When setting UseDNS=no in a [IPv6AcceptRA] section of a .network file, both RDNSS and DNSLL options in received RA should be ignored.

Fixes: #5040

7 years agohwdb: add axis range corrections for Lenovo X1 Carbon 4th gen. / X1 Yoga (#5089)
Björn [Mon, 16 Jan 2017 17:19:04 +0000 (18:19 +0100)]
hwdb: add axis range corrections for Lenovo X1 Carbon 4th gen. / X1 Yoga (#5089)

The parameters were calculated on my X1 Yoga using touchpad-edge-detector; As as the device name indicates, the Touchpad is exactly the same as the X1 Carbon 4th gen.

7 years agoMerge pull request #5085 from keszybz/variables
Martin Pitt [Mon, 16 Jan 2017 06:56:53 +0000 (07:56 +0100)]
Merge pull request #5085 from keszybz/variables

Fixes for gcc and coverity warnings

7 years agohwdb: Include X220 for pointingstick sensitivity (#5083)
Earnestly [Mon, 16 Jan 2017 01:41:59 +0000 (01:41 +0000)]
hwdb: Include X220 for pointingstick sensitivity (#5083)

Without this the trackpoint is very difficult to manoeuvre until
manually correcting the sysfs serio1/sensitivity entry.

7 years agohwdb: add Logitech TrackMan Wheel (#5084)
kilian-k [Sun, 15 Jan 2017 22:21:33 +0000 (23:21 +0100)]
hwdb: add Logitech TrackMan Wheel (#5084)

7 years agonspawn: fix memleak
Zbigniew Jędrzejewski-Szmek [Sun, 15 Jan 2017 21:57:57 +0000 (16:57 -0500)]
nspawn: fix memleak

CID #1368262: fn is allocated with new, so it should be freed.

7 years agoshared/install-printf: fix memleak
Zbigniew Jędrzejewski-Szmek [Sun, 15 Jan 2017 18:42:53 +0000 (13:42 -0500)]
shared/install-printf: fix memleak

instance might be "", and that string would be leaked.

CID #1368264.

7 years agosystemctl: fix alignment with units in not-found state
Zbigniew Jędrzejewski-Szmek [Sun, 15 Jan 2017 18:38:43 +0000 (13:38 -0500)]
systemctl: fix alignment with units in not-found state

A fixed value (6 and later 5) was added back in 4deb3b93911, and
not updated when load_len was added later on.

Also the other 5 with 1 + 1 + 1 + 1 + 1 to make it easier to see
that this is about the column separators.

7 years agosystemctl: uninitalized variable
Zbigniew Jędrzejewski-Szmek [Sun, 15 Jan 2017 18:27:37 +0000 (13:27 -0500)]
systemctl: uninitalized variable

CID #1368270.

Easily reproduced with COLUMNS=50 ./systemctl --no-pager.

7 years agoprocess-util: rename char *r to ans and add comment
Zbigniew Jędrzejewski-Szmek [Sun, 15 Jan 2017 17:41:34 +0000 (12:41 -0500)]
process-util: rename char *r to ans and add comment

Add a comment about the return value and rename r to ans. r is
nowadays reserved for the integer return value, and char *r is confusing.

7 years agojournalctl: fix memleak
Zbigniew Jędrzejewski-Szmek [Sun, 15 Jan 2017 16:55:46 +0000 (11:55 -0500)]
journalctl: fix memleak

This is harmless, it would only happen if --verify-key is used multiple times.
But let's fix it for correctness.

CID ##1368415.

7 years agocryptsetup: fix unitialized variable
Zbigniew Jędrzejewski-Szmek [Sun, 15 Jan 2017 16:51:48 +0000 (11:51 -0500)]
cryptsetup: fix unitialized variable

CID #1368416.

Coverity web interface is back, yay!

7 years agoudev: fix variable assignment
Zbigniew Jędrzejewski-Szmek [Sun, 15 Jan 2017 03:00:48 +0000 (22:00 -0500)]
udev: fix variable assignment

gcc doesn't like &, even though &sbuf and buf are the same things afaiu.

Follow-up for e20a917105b.

7 years agojournalctl: expunge verification key from argv (#5081)
Lucas Werkmeister [Sun, 15 Jan 2017 04:03:00 +0000 (05:03 +0100)]
journalctl: expunge verification key from argv (#5081)

After parsing the --verify-key argument, overwrite it with null bytes.
This minimizes (but does not completely eliminate) the time frame within
which another process on the system can extract the verification key
from the journalctl command line.

7 years agoMerge pull request #4879 from poettering/systemd
Zbigniew Jędrzejewski-Szmek [Sun, 15 Jan 2017 00:48:04 +0000 (19:48 -0500)]
Merge pull request #4879 from poettering/systemd

7 years agoman: provide a basic guide to the `systemctl status` output (#4950)
Mark Stosberg [Wed, 21 Dec 2016 19:55:04 +0000 (14:55 -0500)]
man: provide a basic guide to the `systemctl status` output (#4950)

 - Show example of all `systemctl status` output and documents what possible
   "Loaded:", "Active" and "Enabled" values mean.

 - Documents what different colors of the dot mean.

 - Documents "gotcha" with load-on-demand behavior which will report units as
   "loaded" even if they are only loaded to show their status.
   (From @poettering: https://github.com/systemd/systemd/issues/5063#issuecomment-272115024 )

7 years agoMerge pull request #5069 from keszybz/fixlets
Lennart Poettering [Thu, 12 Jan 2017 09:19:30 +0000 (10:19 +0100)]
Merge pull request #5069 from keszybz/fixlets

Small fixes and enhancements to docs and code

7 years agoMerge pull request #5068 from keszybz/kernel-install-process-sub
Harald Hoyer [Thu, 12 Jan 2017 09:19:07 +0000 (10:19 +0100)]
Merge pull request #5068 from keszybz/kernel-install-process-sub

kernel-install: avoid process substitution

7 years agorpm triggers: do nothing if systemd is not running (#5065)
Zbigniew Jędrzejewski-Szmek [Thu, 12 Jan 2017 09:16:20 +0000 (04:16 -0500)]
rpm triggers: do nothing if systemd is not running (#5065)

If we are running in a chroot/container/..., we would print a useless warning about
not being able to communicate with systemd. Trying to do daemon-reload is pointless
in those cases, so let's just skip all actions in that case.

The check uses /run/system/system, as recommended by sd_booted(3).

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

7 years agosystemctl: remove duplicate entries showed by list-dependencies (#5049)
Franck Bui [Thu, 12 Jan 2017 02:37:15 +0000 (03:37 +0100)]
systemctl: remove duplicate entries showed by list-dependencies (#5049)

When a unit is part of several dependency constraints of another
unit, list-dependencies repeats the name of the dependency for each
dep constraint the unit is encountered.

For example:

 $ systemctl cat test-main.target
 # /etc/systemd/system/test-main.target
 [Unit]
 Description=Main Target

 $ systemctl cat test.target
 [Unit]
 Description=Sub target
 PartOf=test-main.target

 [Install]
 WantedBy=test-main.target

 $ systemctl enable test.target
 Created symlink from /etc/systemd/system/test-main.target.wants/test.target to /etc/systemd/system/test.target.

 $ systemctl show test-main.target | grep test.target
 Wants=test.target
 ConsistsOf=test.target
 [...]

 $ systemctl list-dependencies test-main.target
 test-main.target
 ● ├─test.target
 ● └─test.target

With this patch applied, dependencies are shown only once.

7 years agoMerge pull request #4837 from ddstreet/master
Zbigniew Jędrzejewski-Szmek [Wed, 11 Jan 2017 21:40:04 +0000 (16:40 -0500)]
Merge pull request #4837 from ddstreet/master

Replace spaces in expanded fields in SYMLINK properties by default.

7 years agoman: link to sd-j-{remote,upload} from journalctl(1)
Zbigniew Jędrzejewski-Szmek [Wed, 11 Jan 2017 20:48:15 +0000 (15:48 -0500)]
man: link to sd-j-{remote,upload} from journalctl(1)

7 years agoshell-completion: redirect all errors from systemctl to /dev/null
Zbigniew Jędrzejewski-Szmek [Wed, 11 Jan 2017 19:45:19 +0000 (14:45 -0500)]
shell-completion: redirect all errors from systemctl to /dev/null

Completion scripts should not generate errors, ever.

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

7 years agosocket-util: drop _pure_ from a function with an output parameter
Zbigniew Jędrzejewski-Szmek [Wed, 11 Jan 2017 19:09:47 +0000 (14:09 -0500)]
socket-util: drop _pure_ from a function with an output parameter

If it writes to memory, it's not pure, by definition.
Fixup for 882ac6e769c5c.

7 years agocore: add missing "=" in message
Zbigniew Jędrzejewski-Szmek [Wed, 11 Jan 2017 18:48:16 +0000 (13:48 -0500)]
core: add missing "=" in message

For consistency. Also drop "e.g." because it's somewhat redundant with the
ellipsis and the message is pretty long already.

Follow-up for 4d1fe20a585ca.

7 years agonetworkd: reorder gperf fields
Zbigniew Jędrzejewski-Szmek [Wed, 11 Jan 2017 18:40:10 +0000 (13:40 -0500)]
networkd: reorder gperf fields

In eb64b435ebb2a7cb1274d5 ActiveSlave/PrimarySlave were inserted in between
IPv6AcceptRA and IPv6AcceptRouterAdvertisements and the comment then didn't
make sense. It turns out that gperf does not understand C-style comments, and
that there's no comment syntax in the keywords section. The following was
generated:

      {"/* legacy alias for the above */"},
      {"Network.IPv6AcceptRA",                   config_parse_tristate,                          0,                             offsetof(Network, ipv6_accept_ra)},

In practice this wouldn't lead to problems because this fake pattern would be
hard to match, but it seems better to remove the comments altogether.

Readers of the .gperf file will have to look for the repeated output field to
notice legacy options. To make this easier, let's always keep the legacy option
second.

7 years agokernel-install: avoid process substitution
Michal Schmidt [Fri, 16 Dec 2016 17:14:47 +0000 (18:14 +0100)]
kernel-install: avoid process substitution

bash implements process substitution using /dev/fd/N (this is documented
in man bash). We'd like kernel-install to work in chrooted RPM
scriptlets without /dev.

We can use here-strings instead. bash uses temporary files to implement
those.

7 years agoMerge pull request #5009 from ian-kelling/ian-mnt-namespace-doc
Zbigniew Jędrzejewski-Szmek [Wed, 11 Jan 2017 20:23:00 +0000 (15:23 -0500)]
Merge pull request #5009 from ian-kelling/ian-mnt-namespace-doc

7 years agoDocument how restart actions work (#5052)
micah [Wed, 11 Jan 2017 20:07:35 +0000 (15:07 -0500)]
Document how restart actions work (#5052)

When a user is trying to understand what is going on with a restart action, it is useful to explicitly describe how the action is run. It may seem obvious, but it is helpful to be explicit so one knows there isn't a special ExecRestart= or similar option that they could be looking at.

7 years agohwdb: add correct metrics for Lenovo Thinkpad T430 (#5050)
sammynx [Wed, 11 Jan 2017 20:01:55 +0000 (21:01 +0100)]
hwdb: add correct metrics for Lenovo Thinkpad T430 (#5050)

7 years agoman: add more links to systemd-ask-password and systemd-tty-ask-password-agent
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jan 2017 18:51:06 +0000 (13:51 -0500)]
man: add more links to systemd-ask-password and systemd-tty-ask-password-agent

Loosely inspired by https://bugzilla.redhat.com/show_bug.cgi?id=1411134.

7 years agohwdb: update micmute YCODE on device node at DELL LATITUDE laptops for mic mute butto...
nikolaof [Wed, 11 Jan 2017 13:35:20 +0000 (15:35 +0200)]
hwdb: update micmute YCODE on device node at DELL LATITUDE laptops for mic mute button. (#5012)

7 years agoMerge pull request #5046 from stefanha/vsock
Lennart Poettering [Wed, 11 Jan 2017 09:53:59 +0000 (10:53 +0100)]
Merge pull request #5046 from stefanha/vsock

Add AF_VSOCK socket activation support

7 years agojournal-gatewayd: align closing braces (#5060)
Robert Kreuzer [Wed, 11 Jan 2017 09:50:58 +0000 (10:50 +0100)]
journal-gatewayd: align closing braces (#5060)

7 years agosparse: avoid clash with __bitwise and __force from 4.10 linux/types.h (#5061)
Lubomir Rintel [Wed, 11 Jan 2017 09:50:25 +0000 (10:50 +0100)]
sparse: avoid clash with __bitwise and __force from 4.10 linux/types.h (#5061)

It also used __bitwise and __force. It seems easier to rename
our versions since they are local to this one single header.

Also, undefine them afteerwards, so that we don't pollute the
preprocessor macro namespace.

7 years agocore: add AF_VSOCK support to socket units
Stefan Hajnoczi [Wed, 21 Dec 2016 17:02:08 +0000 (17:02 +0000)]
core: add AF_VSOCK support to socket units

Accept AF_VSOCK listen addresses in socket unit files.  Both guest and
host can now take advantage of socket activation.

The QEMU guest agent has recently been modified to support socket
activation and can run over AF_VSOCK with this patch.

7 years agosocket-util: add AF_VSOCK address family
Stefan Hajnoczi [Tue, 20 Dec 2016 14:24:27 +0000 (14:24 +0000)]
socket-util: add AF_VSOCK address family

The AF_VSOCK address family facilitates guest<->host communication on
VMware and KVM (virtio-vsock).  Adding support to systemd allows guest
agents to be launched through .socket unit files.  Today guest agents
are stand-alone daemons running inside guests that do not take advantage
of systemd socket activation.

7 years agosocket-util: introduce port argument in sockaddr_port()
Stefan Hajnoczi [Tue, 20 Dec 2016 14:10:54 +0000 (14:10 +0000)]
socket-util: introduce port argument in sockaddr_port()

sockaddr_port() either returns a >= 0 port number or a negative errno.
This works for AF_INET and AF_INET6 because port ranges are only 16-bit.

In AF_VSOCK ports are 32-bit so an int cannot represent all port number
and negative errnos.  Separate the port and the return code.

7 years agomissing.h: add AF_VSOCK bits
Stefan Hajnoczi [Tue, 10 Jan 2017 13:35:18 +0000 (13:35 +0000)]
missing.h: add AF_VSOCK bits

Ubuntu 14.04 (Trusty) kernel header packages ship without
<linux/vm_sockets.h>.  Only struct sockaddr_vm and VMADDR_CID_ANY will
be needed by systemd and they are simple enough to go in missing.h.

CentOS 7 <sys/socket.h> does not define AF_VSOCK.  Define it so the code
can compile although actual socket(2) calls may fail at runtime if the
address family isn't available.

7 years agocore: make sure to not call device_is_bound_by_mounts() when dev is null (#5033)
Franck Bui [Tue, 10 Jan 2017 08:11:34 +0000 (09:11 +0100)]
core: make sure to not call device_is_bound_by_mounts() when dev is null (#5033)

device_setup_unit() might be called (when an event happened in
/proc/self/mountinfo for example) with a null 'dev' parameter. This
indicates that the device has been unplugged but the corresponding
mountpoint is still visible in /proc/self/mountinfo.

This patch makes sure we don't call device_is_bound_by_mounts() in
this case.

Fixes: #5025

7 years agonetworkd: RouteMetric for IPv6 Stateless Autoconfiguration (#5045)
Susant Sahani [Tue, 10 Jan 2017 07:58:04 +0000 (13:28 +0530)]
networkd: RouteMetric for IPv6 Stateless Autoconfiguration (#5045)

Add support to set route metric for IPv6

Fixes: #5002