platform/upstream/systemd.git
8 years agosocket-util: Run the fallback when the kernel complains about the null buffer (#3541)
Kai Ruhnau [Wed, 15 Jun 2016 10:33:24 +0000 (12:33 +0200)]
socket-util: Run the fallback when the kernel complains about the null buffer (#3541)

Calling recv with a NULL buffer returns EFAULT instead of EOPNOTSUPP on
older kernels (3.14).

Fixes #3407

Signed-off-by: Kai Ruhnau <kai.ruhnau@target-sg.com>
8 years agoMerge pull request #3540 from poettering/resolved-various
Zbigniew Jędrzejewski-Szmek [Wed, 15 Jun 2016 01:08:36 +0000 (21:08 -0400)]
Merge pull request #3540 from poettering/resolved-various

three resolved fixes

8 years agotree-wide: htonl() is weird, let's use htobe32() instead (#3538)
Lennart Poettering [Tue, 14 Jun 2016 23:26:01 +0000 (01:26 +0200)]
tree-wide: htonl() is weird, let's use htobe32() instead (#3538)

Super-important change, yeah!

8 years agoutil-lib: rework get_process_cmdline() (#3529)
Lennart Poettering [Tue, 14 Jun 2016 21:52:29 +0000 (23:52 +0200)]
util-lib: rework get_process_cmdline() (#3529)

This reworks get_process_cmdline() quite substantially, fixing the following:

- Fixes:
  https://github.com/systemd/systemd/pull/3512/commits/a4e3bf4d7ac2de51191ce136ee9361ba319e106c#r66837630

- The passed max_length is also applied to the "comm" name, if comm_fallback is
  set.

- The right thing happens if max_length == 1 is specified

- when the cmdline "foobar" is abbreviated to 6 characters the result is not
  "foobar" instead of "foo...".

- trailing whitespace are removed before the ... suffix is appended. The 7
  character abbreviation of "foo barz" is hence "foo..." instead of "foo ...".

- leading whitespace are suppressed from the cmdline

- a comprehensive test case is added

8 years agoMerge pull request #3539 from keszybz/udevadm-man-fix
Lennart Poettering [Tue, 14 Jun 2016 21:41:00 +0000 (23:41 +0200)]
Merge pull request #3539 from keszybz/udevadm-man-fix

Udevadm man fix

8 years agoresolved: in the ResolveHostname() bus call, accept IP addresses with scope
Lennart Poettering [Tue, 14 Jun 2016 21:37:16 +0000 (23:37 +0200)]
resolved: in the ResolveHostname() bus call, accept IP addresses with scope

When we get a literal IP address as string that includes a zone suffix, process
this properly and return the parsed ifindex back to the client, and include it
in the canonical name in case of a link-local IP address.

8 years agoresolved: make sure we initialize the ifindex of direct zone answers properly
Lennart Poettering [Tue, 14 Jun 2016 21:28:54 +0000 (23:28 +0200)]
resolved: make sure we initialize the ifindex of direct zone answers properly

Previously, after checking the local zone for a reply and finding one we'd not
initialize the answer ifindex from that. Let's fix that.

8 years agoresolve: port resolve tool to in_addr_ifindex_{from_string_auto|to_string}()
Lennart Poettering [Tue, 14 Jun 2016 21:27:30 +0000 (23:27 +0200)]
resolve: port resolve tool to in_addr_ifindex_{from_string_auto|to_string}()

We can reuse some code here, so let's do it.

8 years agoman: fix option letter in udevadm control -e
Zbigniew Jędrzejewski-Szmek [Tue, 14 Jun 2016 21:11:46 +0000 (17:11 -0400)]
man: fix option letter in udevadm control -e

-x never worked, so let's just correct the man page.

Fixes #3524.

8 years agoudevadm: trivial simplification
Zbigniew Jędrzejewski-Szmek [Tue, 14 Jun 2016 21:05:42 +0000 (17:05 -0400)]
udevadm: trivial simplification

8 years agonetworkd: Tunnel add support to configure key for VTI/VTI6 (#3532)
Susant Sahani [Tue, 14 Jun 2016 17:11:57 +0000 (22:41 +0530)]
networkd: Tunnel add support to configure key for VTI/VTI6 (#3532)

fixes #3298

8 years agoMerge pull request #3527 from poettering/systemctl-fixes
Daniel Mack [Tue, 14 Jun 2016 12:25:43 +0000 (14:25 +0200)]
Merge pull request #3527 from poettering/systemctl-fixes

Systemctl fixes

8 years agomanager: reduce complexity of unit_gc_sweep (#3507)
Lukáš Nykrýn [Tue, 14 Jun 2016 12:20:56 +0000 (14:20 +0200)]
manager: reduce complexity of unit_gc_sweep (#3507)

When unit is marked as UNSURE, we are trying to find if it state was
changed over and over again. So lets not go through the UNSURE states
again. Also when we find a GOOD unit lets propagate the GOOD state to
all units that this unit reference.

This is a problem on machines with a lot of initscripts with different
starting priority, since those units will reference each other and the
original algorithm might get to n! complexity.

Thanks HATAYAMA Daisuke for the expand_good_state code.

8 years agocore: on unified we don't need to check u->pids: we can use proper notifications...
Evgeny Vereshchagin [Tue, 14 Jun 2016 12:08:01 +0000 (15:08 +0300)]
core: on unified we don't need to check u->pids: we can use proper notifications (#3531)

Fixes: #3483

8 years agobuild: fix missing symbol for old kernel headers (#3530)
Andrew Jeddeloh [Tue, 14 Jun 2016 09:09:06 +0000 (02:09 -0700)]
build: fix missing symbol for old kernel headers (#3530)

Fix issue where IN6_ADDR_GEN_MODE_STABLE_PRIVACY is undefined but
IFLA_INET6_ADDR_GEN_MODE is defined and thus the former does not get
fixed in missing.h. This occurs with kernel headers new enough to have
the IFLA_INET6_ADDR_GEN_MODE but old enough to not yet have
IN6_ADDR_GEN_MODE_STABLE_PRIVACY (e.g. 3.18).

8 years agosystemctl: rework "systemctl status" a bit
Lennart Poettering [Mon, 13 Jun 2016 17:11:26 +0000 (19:11 +0200)]
systemctl: rework "systemctl status" a bit

This reworks "systemctl status" and "systemctl show" a bit. It removes the
definition of the `property_info` structure, because we can simply reuse the
existing UnitStatusInfo type for that.

The "could not be found" message is now printed by show_one() itself (and not
its caller), so that it is shown regardless by who the function is called.
(This makes it necessary to pass the unit name to the function.)

This also adds all properties found to a set, and then checks if any of the
properties passed via "--property=" is mising in it, if so, a proper error is
generated.

Support for checking the PID file of a unit is removed, as this cannot be done
reasonably client side (since the systemd instance we are talking to might sit
on another host)

Replaces: #3411
Fixes: #3425
Also see: #3504

8 years agosystemctl: fix assertion hit when showing state of a unit without control group
Lennart Poettering [Mon, 13 Jun 2016 16:54:36 +0000 (18:54 +0200)]
systemctl: fix assertion hit when showing state of a unit without control group

8 years agounit-name: remove spurious newline
Lennart Poettering [Mon, 13 Jun 2016 16:47:42 +0000 (18:47 +0200)]
unit-name: remove spurious newline

8 years agoMerge pull request #3491 from poettering/hwdb-acpi
Tom Gundersen [Mon, 13 Jun 2016 16:41:15 +0000 (18:41 +0200)]
Merge pull request #3491 from poettering/hwdb-acpi

hwdb: update UEFI/ACPI/PNP/EISA/EDID database from UEFI web site

8 years agoMerge pull request #3498 from poettering/syscall-filter-fixes
Lennart Poettering [Mon, 13 Jun 2016 14:54:21 +0000 (16:54 +0200)]
Merge pull request #3498 from poettering/syscall-filter-fixes

Syscall filter fixes, tighter nspawn seccomp sandbox by default

8 years agocore: parse `rd.rescue` and `rd.emergency` as initrd-specific shorthands (#3488)
Ivan Shapovalov [Mon, 13 Jun 2016 14:28:42 +0000 (18:28 +0400)]
core: parse `rd.rescue` and `rd.emergency` as initrd-specific shorthands (#3488)

Typing `rd.rescue` is easier than `rd.systemd.unit=rescue.target`.

8 years agoMerge pull request #3384 from keszybz/localed-keymap
Lennart Poettering [Mon, 13 Jun 2016 14:27:52 +0000 (16:27 +0200)]
Merge pull request #3384 from keszybz/localed-keymap

More verbose logging in localed, unit tests, and a few tweaks to keymap conversions

8 years agonspawn: lock down system call filter a bit
Lennart Poettering [Fri, 10 Jun 2016 16:04:02 +0000 (18:04 +0200)]
nspawn: lock down system call filter a bit

Let's block access to the kernel keyring and a number of obsolete system calls.
Also, update list of syscalls that may alter the system clock, and do raw IO
access. Filter ptrace() if CAP_SYS_PTRACE is not passed to the container and
acct() if CAP_SYS_PACCT is not passed.

This also changes things so that kexec(), some profiling calls, the swap calls
and quotactl() is never available to containers, not even if CAP_SYS_ADMIN is
passed. After all we currently permit CAP_SYS_ADMIN to containers by default,
but these calls should not be available, even then.

8 years agounits: tighten system call filters a bit
Lennart Poettering [Fri, 10 Jun 2016 16:00:12 +0000 (18:00 +0200)]
units: tighten system call filters a bit

Take away kernel keyring access, CPU emulation system calls and various debug
system calls from the various daemons we have.

8 years agocore: improve seccomp syscall grouping a bit
Lennart Poettering [Fri, 10 Jun 2016 15:43:38 +0000 (17:43 +0200)]
core: improve seccomp syscall grouping a bit

This adds three new seccomp syscall groups: @keyring for kernel keyring access,
@cpu-emulation for CPU emulation features, for exampe vm86() for dosemu and
suchlike, and @debug for ptrace() and related calls.

Also, the @clock group is updated with more syscalls that alter the system
clock. capset() is added to @privileged, and pciconfig_iobase() is added to
@raw-io.

Finally, @obsolete is a cleaned up. A number of syscalls that never existed on
Linux and have no number assigned on any architecture are removed, as they only
exist in the man pages and other operating sytems, but not in code at all.
create_module() is moved from @module to @obsolete, as it is an obsolete system
call. mem_getpolicy() is removed from the @obsolete list, as it is not
obsolete, but simply a NUMA API.

8 years agonspawn: order caps to retain alphabetically
Lennart Poettering [Fri, 10 Jun 2016 15:31:06 +0000 (17:31 +0200)]
nspawn: order caps to retain alphabetically

8 years agoupdate TODO
Lennart Poettering [Fri, 10 Jun 2016 15:30:35 +0000 (17:30 +0200)]
update TODO

8 years agoresolved: use single message for both dbus and signal calls (#3515)
Zbigniew Jędrzejewski-Szmek [Mon, 13 Jun 2016 14:24:48 +0000 (10:24 -0400)]
resolved: use single message for both dbus and signal calls (#3515)

Follow-up for #3502.

8 years agoMerge pull request #3520 from keszybz/add-release.md
Lennart Poettering [Mon, 13 Jun 2016 14:13:41 +0000 (16:13 +0200)]
Merge pull request #3520 from keszybz/add-release.md

Add RELEASE.md

8 years agoMerge pull request #3518 from keszybz/test-process-util
Lennart Poettering [Mon, 13 Jun 2016 14:01:44 +0000 (16:01 +0200)]
Merge pull request #3518 from keszybz/test-process-util

Enhance test-process-util to take the PID to look at

8 years agonetworkd: fix NULL pointer (#3523)
Susant Sahani [Mon, 13 Jun 2016 13:57:38 +0000 (19:27 +0530)]
networkd: fix NULL pointer (#3523)

Not every link has kind associated with it.

(gdb) r
Starting program: /home/sus/tt/systemd/systemd-networkd
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.23.1-7.fc24.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
vboxnet0: Gained IPv6LL
wlp3s0: Gained IPv6LL
enp0s25: Gained IPv6LL
Enumeration completed

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6e27ade in __strcmp_sse2_unaligned () from /lib64/libc.so.6
(gdb) bt
src/network/networkd-link.c:2008
src/network/networkd-link.c:2059
src/network/networkd-link.c:2442
m=0x555555704a30, userdata=0x55555570bfe0) at src/network/networkd-link.c:2497
at src/libsystemd/sd-netlink/sd-netlink.c:347
src/libsystemd/sd-netlink/sd-netlink.c:402
src/libsystemd/sd-netlink/sd-netlink.c:432
userdata=0x5555556f7470) at src/libsystemd/sd-netlink/sd-netlink.c:739
src/libsystemd/sd-event/sd-event.c:2275
src/libsystemd/sd-event/sd-event.c:2626
timeout=18446744073709551615) at src/libsystemd/sd-event/sd-event.c:2685
bus=0x5555556f9af0, name=0x555555692315 "org.freedesktop.network1",
timeout=30000000,
    check_idle=0x55555556ac84 <manager_check_idle>, userdata=0x5555556f6b20) at
src/shared/bus-util.c:134
src/network/networkd-manager.c:1128
src/network/networkd.c:127
(gdb) f 1
src/network/networkd-link.c:2008
2008            if (link->network->bridge || streq("bridge", link->kind)) {
(gdb) p link->kind
$1 = 0x0

8 years agonetworkd: route priority replace parsing config_parse_uint32 with safe_atou32 (#3522)
Susant Sahani [Mon, 13 Jun 2016 13:57:17 +0000 (19:27 +0530)]
networkd: route priority replace parsing config_parse_uint32 with safe_atou32 (#3522)

8 years agocore/execute: pass env vars to PAM session setup (#3503)
Jouke Witteveen [Mon, 13 Jun 2016 10:50:12 +0000 (12:50 +0200)]
core/execute: pass env vars to PAM session setup (#3503)

Move the merger of environment variables before setting up the PAM
session and pass the aggregate environment to PAM setup. This allows
control over the PAM session hooks through environment variables.

PAM session initiation may update the environment. On successful
initiation of a PAM session, we adopt the environment of the
PAM context.

8 years agosystemctl: disallow systemctl --user reboot (#3519)
Zbigniew Jędrzejewski-Szmek [Mon, 13 Jun 2016 04:57:28 +0000 (00:57 -0400)]
systemctl: disallow systemctl --user reboot (#3519)

... as well as halt/poweroff/kexec/suspend/hibernate/hybrid-sleep.
Running those commands will fail in user mode, but we try to set the wall
message first, which might even succeed for privileged users. Best to nip
the whole sequence in the bud.

https://github.com/systemd/systemd/pull/3453#issuecomment-225455156

8 years agoAdd RELEASE.md file which lists the steps needed for release
Zbigniew Jędrzejewski-Szmek [Tue, 31 May 2016 17:43:41 +0000 (13:43 -0400)]
Add RELEASE.md file which lists the steps needed for release

I put it in .github, so it doesn't stand out too much; after all
it's not interesting to most people.

8 years agoCONTRIBUTING: ask people to comment after after force-push
Zbigniew Jędrzejewski-Szmek [Tue, 31 May 2016 17:32:23 +0000 (13:32 -0400)]
CONTRIBUTING: ask people to comment after after force-push

8 years agoCONTRIBUTING: remove line wrapping
Zbigniew Jędrzejewski-Szmek [Tue, 31 May 2016 17:27:41 +0000 (13:27 -0400)]
CONTRIBUTING: remove line wrapping

GitHub displays this file poorly, because it preserves the newlines.
Let's try how things look without any wrapping.

8 years agoprocess-util: remove broken support for pid==0
Zbigniew Jędrzejewski-Szmek [Mon, 13 Jun 2016 00:57:41 +0000 (20:57 -0400)]
process-util: remove broken support for pid==0

Our functions that query /proc/pid/ support using pid==0 to mean
self. get_process_id also seemed to support that, but it was not implemented
correctly: the result should be in *uid, not returned, and also it gave
completely bogus result when called from get_process_gid(). But afaict,
get_process_{uid,gid} were never called with pid==0, so it's not an actual
bug. Remove the broken code to avoid confusion.

8 years agotest-process-util: allow pid to be specified on the command line
Zbigniew Jędrzejewski-Szmek [Sun, 12 Jun 2016 23:51:11 +0000 (19:51 -0400)]
test-process-util: allow pid to be specified on the command line

This makes it easy to test the query code on "ssh localhost"
and similar.

8 years agotest-process-util: rework the test function to take pid as argument
Zbigniew Jędrzejewski-Szmek [Sun, 12 Jun 2016 23:42:51 +0000 (19:42 -0400)]
test-process-util: rework the test function to take pid as argument

This fixes a bunch of copy&paste errors in the output.

8 years agoutil-lib: drop trailing non-printable characters from cmdline (#3512)
Max Prokhorov [Mon, 13 Jun 2016 01:13:42 +0000 (04:13 +0300)]
util-lib: drop trailing non-printable characters from cmdline (#3512)

If max_length is equal or greater than cmdline length all trailing non-printable
characters are dropped. If max_length is 0 it should do the same.

This should also fix cmdline truncation if the last character is not '\0'.

Fixes #3469.

8 years agohwdb: change the Logitech MX500 to 1100 dpi (#3517)
Peter Hutterer [Mon, 13 Jun 2016 00:52:48 +0000 (10:52 +1000)]
hwdb: change the Logitech MX500 to 1100 dpi (#3517)

https://bugs.freedesktop.org/show_bug.cgi?id=96225
and specifically the tech specs here:
http://support.logitech.com/en_us/product/corded-mouse-m500

8 years agoMerge pull request #3502 from poettering/resolved-flush-cache
Zbigniew Jędrzejewski-Szmek [Sun, 12 Jun 2016 22:28:30 +0000 (18:28 -0400)]
Merge pull request #3502 from poettering/resolved-flush-cache

resolved: allow clients request cache flushes

8 years agoMerge pull request #3453 from poettering/fix-3353
Zbigniew Jędrzejewski-Szmek [Sun, 12 Jun 2016 19:21:22 +0000 (15:21 -0400)]
Merge pull request #3453 from poettering/fix-3353

Fixes #3353.

8 years agonetworkd: more vlan cleanup (#3506)
Tobias Jungel [Sun, 12 Jun 2016 18:01:14 +0000 (20:01 +0200)]
networkd: more vlan cleanup (#3506)

use config_parse_vlanid to parse vlan for BridgeFDB entries

8 years agonetworkd: cleanup of bridge vlan code (#3505)
Tobias Jungel [Sun, 12 Jun 2016 17:59:21 +0000 (19:59 +0200)]
networkd: cleanup of bridge vlan code (#3505)

cleanup minor nitpicks mentioned in #3428

8 years agoFixed a small typo in a comment (#3514)
Alex Gaynor [Sun, 12 Jun 2016 14:42:13 +0000 (10:42 -0400)]
Fixed a small typo in a comment (#3514)

8 years agotest-keymap-util: use kbd-model-map/language-fallback-map from $(srcdir)
Zbigniew Jędrzejewski-Szmek [Sat, 4 Jun 2016 22:15:42 +0000 (18:15 -0400)]
test-keymap-util: use kbd-model-map/language-fallback-map from $(srcdir)

This adds (undocumented) environment variables SYSTEMD_KBD_MODEL_MAP
and SYSTEMD_LANGUAGE_FALLBACK_MAP, which, if set, override compiled-in
locations of those two files.

Instead of skipping tests when the maps are not installed, just use
the one from the source dir. We still cannot do the mappings the other
way if /usr/lib/kbd/keymaps is not present, so truncate the tests in
that case.

Also tweak the debug messages a bit to make it easier to see
which function is failing.

8 years agohwdb: update UEFI/ACPI/PNP/EISA/EDID database from UEFI web site
Federico Mena Quintero [Tue, 19 May 2015 23:35:02 +0000 (18:35 -0500)]
hwdb: update UEFI/ACPI/PNP/EISA/EDID database from UEFI web site

Let's hook up the ACPI database we maintain from the upstream UEFI sources.
This adds a tool to convert the database provided upstream to our native
format, similar to how this is handled for the PCI and USB databases.

Note that the upstream web site claims to offer an XLS download, but the actual
data made available is an HTML file in reality, just one with the ".xls"
suffix...

The data provided from the UEFI folks is not very high quality nor complete,
hence apply a patch after the conversion step that fixes up a few things and
adds in more entries from various sources. For example, the EDID ids maintained
by GNOME and other sources have been added too, as they all appear to use the
same ID namespace.

This also adds explicit support for 4 character ACPI ids, in addition to the
normal 3 character PNP ids.

Also fixes:

https://bugs.freedesktop.org/show_bug.cgi?id=90524

8 years agoresolved: move verification that link is unmanaged into the proper bus calls
Lennart Poettering [Fri, 10 Jun 2016 18:54:10 +0000 (20:54 +0200)]
resolved: move verification that link is unmanaged into the proper bus calls

Previously, we checked only for the various SetLinkXYZ() calls on the Manager
object exposed on the bus if the specified interface is managed/unmanaged by
networkd (as we don't permit overriding DNS configuration via bus calls if
networkd owns the device), but the equivalent SetXYZ() calls on the Link object
did not have such a check. Fix that by moving the appropriate check into the
latter, as the former just calls that anyway.

8 years agoresolved: also add a way to flush all caches via the bus
Lennart Poettering [Fri, 10 Jun 2016 18:40:30 +0000 (20:40 +0200)]
resolved: also add a way to flush all caches via the bus

And expose it in "resolve-tool --flush-caches".

8 years agoman: document what SIGUSR1 and SIGUSR2 do to resolved
Lennart Poettering [Fri, 10 Jun 2016 18:29:32 +0000 (20:29 +0200)]
man: document what SIGUSR1 and SIGUSR2 do to resolved

8 years agoresolved: flush all caches if SIGUSR2 is received
Lennart Poettering [Fri, 10 Jun 2016 18:23:49 +0000 (20:23 +0200)]
resolved: flush all caches if SIGUSR2 is received

8 years agonetworkd: fix bad memory access for routes that are note attached to a link yet ...
Lennart Poettering [Fri, 10 Jun 2016 21:26:24 +0000 (23:26 +0200)]
networkd: fix bad memory access for routes that are note attached to a link yet (#3499)

Corrects: 1b566071

Also see: https://github.com/systemd/systemd/pull/3478#issuecomment-225008542

8 years agoupdate TODO
Lennart Poettering [Fri, 10 Jun 2016 18:04:53 +0000 (20:04 +0200)]
update TODO

8 years agosystemctl: prolong timeout of "systemctl daemon-reload"
Lennart Poettering [Mon, 6 Jun 2016 19:48:08 +0000 (21:48 +0200)]
systemctl: prolong timeout of "systemctl daemon-reload"

Reloading or reexecuting PID 1 means the unit generators are rerun, which are
timed out at 90s. Make sure the method call asking for the reload is timed out
at twice that, so that the generators have 90s and the reload operation has 90s
too.

This reworks the daemon_reload() call in systemctl, and makes it exclusively
about reloading/reexecing. Previously it was used for other trivial method
calls too, which didn't really help readability. As the code paths are now
sufficiently different, split out the old code into a new function
trivial_method().

This call also does a similar change as
c8ad4efb277c3235d58789170af11bb3c847d655 but for the reload/reexec operation.

Fixes: #3353

8 years agosystemctl: don't suppress error code when handling legacy commands
Lennart Poettering [Mon, 6 Jun 2016 19:45:12 +0000 (21:45 +0200)]
systemctl: don't suppress error code when handling legacy commands

For legacy commands such as /sbin/halt or /sbin/poweroff we support legacy
fallbacks that talk via traditional SysV way with PID 1 to issue the desired
operation. We do this on any kind of error if the primary method of operation
fails. When this is the case we suppress any error message that is normally
generated, in order to not confuse the user. When suppressing this log message,
don't suppress the original error code, because there's really no reason to.

8 years agocore: disable colors when displaying cylon when systemd.log_color=off (#3495)
Franck Bui [Fri, 10 Jun 2016 16:33:15 +0000 (18:33 +0200)]
core: disable colors when displaying cylon when systemd.log_color=off (#3495)

8 years agoupdate TODO
Lennart Poettering [Fri, 10 Jun 2016 16:21:05 +0000 (18:21 +0200)]
update TODO

8 years agocore/execute: add the magic character '!' to allow privileged execution (#3493)
Alessandro Puccetti [Fri, 10 Jun 2016 16:19:54 +0000 (18:19 +0200)]
core/execute: add the magic character '!' to allow privileged execution (#3493)

This patch implements the new magic character '!'. By putting '!' in front
of a command, systemd executes it with full privileges ignoring paramters
such as User, Group, SupplementaryGroups, CapabilityBoundingSet,
AmbientCapabilities, SecureBits, SystemCallFilter, SELinuxContext,
AppArmorProfile, SmackProcessLabel, and RestrictAddressFamilies.

Fixes partially https://github.com/systemd/systemd/issues/3414
Related to https://github.com/coreos/rkt/issues/2482

Testing:
1. Create a user 'bob'
2. Create the unit file /etc/systemd/system/exec-perm.service
   (You can use the example below)
3. sudo systemctl start ext-perm.service
4. Verify that the commands starting with '!' were not executed as bob,
   4.1 Looking to the output of ls -l /tmp/exec-perm
   4.2 Each file contains the result of the id command.

`````````````````````````````````````````````````````````````````
[Unit]
Description=ext-perm

[Service]
Type=oneshot
TimeoutStartSec=0
User=bob
ExecStartPre=!/usr/bin/sh -c "/usr/bin/rm /tmp/exec-perm*" ;
    /usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-start-pre"
ExecStart=/usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-start" ;
    !/usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-star-2"
ExecStartPost=/usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-start-post"
ExecReload=/usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-reload"
ExecStop=!/usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-stop"
ExecStopPost=/usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-stop-post"

[Install]
WantedBy=multi-user.target]
`````````````````````````````````````````````````````````````````

8 years agorules: block - add scm block devices to whitelist (#3494)
Lennart Poettering [Fri, 10 Jun 2016 13:19:26 +0000 (15:19 +0200)]
rules: block - add scm block devices to whitelist (#3494)

Since the introduction of the whitelist in 60-persistent-storage.rules
block device symlinks are no longer created for scm block devices.

Add scm to the whitelist.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
8 years agonspawn: introduce --notify-ready=[no|yes] (#3474)
Alessandro Puccetti [Fri, 10 Jun 2016 11:09:06 +0000 (13:09 +0200)]
nspawn: introduce --notify-ready=[no|yes] (#3474)

This the patch implements a notificaiton mechanism from the init process
in the container to systemd-nspawn.
The switch --notify-ready=yes configures systemd-nspawn to wait the "READY=1"
message from the init process in the container to send its own to systemd.
--notify-ready=no is equivalent to the previous behavior before this patch,
systemd-nspawn notifies systemd with a "READY=1" message when the container is
created. This notificaiton mechanism uses socket file with path relative to the contanier
"/run/systemd/nspawn/notify". The default values it --notify-ready=no.
It is also possible to configure this mechanism from the .nspawn files using
NotifyReady. This parameter takes the same options of the command line switch.

Before this patch, systemd-nspawn notifies "ready" after the inner child was created,
regardless the status of the service running inside it. Now, with --notify-ready=yes,
systemd-nspawn notifies when the service is ready. This is really useful when
there are dependencies between different contaniers.

Fixes https://github.com/systemd/systemd/issues/1369
Based on the work from https://github.com/systemd/systemd/pull/3022

Testing:
Boot a OS inside a container with systemd-nspawn.
Note: modify the commands accordingly with your filesystem.

1. Create a filesystem where you can boot an OS.
2. sudo systemd-nspawn -D ${HOME}/distros/fedora-23/ sh
2.1. Create the unit file /etc/systemd/system/sleep.service inside the container
     (You can use the example below)
2.2. systemdctl enable sleep
2.3 exit
3. sudo systemd-run --service-type=notify --unit=notify-test
   ${HOME}/systemd/systemd-nspawn --notify-ready=yes
   -D ${HOME}/distros/fedora-23/ -b
4. In a different shell run "systemctl status notify-test"

When using --notify-ready=yes the service status is "activating" for 20 seconds
before being set to "active (running)". Instead, using --notify-ready=no
the service status is marked "active (running)" quickly, without waiting for
the 20 seconds.

This patch was also test with --private-users=yes, you can test it just adding it
at the end of the command at point 3.

------ sleep.service ------
[Unit]
Description=sleep
After=network.target

[Service]
Type=oneshot
ExecStart=/bin/sleep 20

[Install]
WantedBy=multi-user.target
------------ end ------------

8 years agoMerge pull request #3428 from toanju/networkd/brvlan
Lennart Poettering [Fri, 10 Jun 2016 11:04:44 +0000 (13:04 +0200)]
Merge pull request #3428 from toanju/networkd/brvlan

networkd: add support to configure VLAN on bridge ports

8 years agol10n: update belarusian translation (#3482)
Viktar Vaŭčkievič [Fri, 10 Jun 2016 10:36:10 +0000 (13:36 +0300)]
l10n: update belarusian translation (#3482)

8 years agonetworkd: fix dbus matchmac interface (#3485)
Andrew Jeddeloh [Fri, 10 Jun 2016 10:35:43 +0000 (03:35 -0700)]
networkd: fix dbus matchmac interface (#3485)

Fix issue where the *Network passed via userdata is being offset
by offsetof(Network, matchmac) leading to incorrect values being
exposed in dbus.

8 years agonetworkd: add support to configure VLAN on bridge ports
Tobias Jungel [Wed, 1 Jun 2016 13:18:21 +0000 (15:18 +0200)]
networkd: add support to configure VLAN on bridge ports

8 years agonetworkd-link: parse linkinfo to get kind
Tobias Jungel [Thu, 9 Jun 2016 11:44:31 +0000 (13:44 +0200)]
networkd-link: parse linkinfo to get kind

8 years agoMerge pull request #3456 from poettering/ipv6-ra-rename
Tom Gundersen [Thu, 9 Jun 2016 19:28:40 +0000 (21:28 +0200)]
Merge pull request #3456 from poettering/ipv6-ra-rename

networkd: rename IPv6AcceptRouterAdvertisements to IPv6AcceptRA

8 years agonetworkd: clean up vlan handling a bit (#3478)
Lennart Poettering [Thu, 9 Jun 2016 16:55:16 +0000 (18:55 +0200)]
networkd: clean up vlan handling a bit (#3478)

Let's add a generic parser for VLAN ids, which should become handy as
preparation for PR #3428. Let's also make sure we use uint16_t for the vlan ID
type everywhere, and that validity checks are already applied at the time of
parsing, and not only whne we about to prepare a netdev.

Also, establish a common definition VLANID_INVALID we can use for
non-initialized VLAN id fields.

8 years agoUpdated Turkish translation (#3477)
Muhammet Kara [Thu, 9 Jun 2016 15:43:18 +0000 (18:43 +0300)]
Updated Turkish translation (#3477)

8 years agobus_util: add support to map double (#3479)
Susant Sahani [Thu, 9 Jun 2016 15:41:35 +0000 (21:11 +0530)]
bus_util: add support to map double (#3479)

Now we don't support parsing double at map_basic.
when trying to  use bus_message_map_all_properties with a double
this fails. Let's add it.

8 years agoudev-builtin-blkid: fix GPT_FLAG_NO_AUTO check for ESP (#3450)
Lennart Poettering [Thu, 9 Jun 2016 08:51:20 +0000 (10:51 +0200)]
udev-builtin-blkid: fix GPT_FLAG_NO_AUTO check for ESP (#3450)

The flags check was accidentally placed in the ESP if block, but should be in
the root if block.

This corrects: 0238d4c660e732dd03ba0cdb54a29ec5870ee849

Fixes: #3440

Also see: #3441

8 years agoload-fragment: don't try to do a template instance replacement if we are not an insta...
Lennart Poettering [Thu, 9 Jun 2016 08:49:36 +0000 (10:49 +0200)]
load-fragment: don't try to do a template instance replacement if we are not an instance (#3451)

Corrects: 7aad67e7

Fixes: #3438

8 years agoMerge pull request #3432 from poettering/resolved-ll-ipv6
Martin Pitt [Thu, 9 Jun 2016 08:18:07 +0000 (10:18 +0200)]
Merge pull request #3432 from poettering/resolved-ll-ipv6

resolved: support IPv6 DNS servers on the local link

8 years agoexecute: check whether the specified fd is a tty before chowning/chmoding it (#3457)
Lennart Poettering [Thu, 9 Jun 2016 08:01:16 +0000 (10:01 +0200)]
execute: check whether the specified fd is a tty before chowning/chmoding  it (#3457)

Let's add an extra safety check before we chmod/chown a TTY to the right user,
as we might end up having connected something to STDIN/STDOUT that is actually
not a TTY, even though this might have been requested, due to permissive
StandardInput= settings or transient service activation with fds passed in.

Fixes:

https://bugs.freedesktop.org/show_bug.cgi?id=85255

8 years agoUpdate spanish po file (#3463)
Pablo Lezaeta Reyes [pˈaβ̞lo lˌe̞θaˈeta rˈejɛ] [Thu, 9 Jun 2016 07:38:17 +0000 (04:38 -0300)]
Update spanish po file (#3463)

8 years agounits: add a basic SystemCallFilter (#3471)
Topi Miettinen [Thu, 9 Jun 2016 07:32:04 +0000 (07:32 +0000)]
units: add a basic SystemCallFilter (#3471)

Add a line
SystemCallFilter=~@clock @module @mount @obsolete @raw-io ptrace
for daemons shipped by systemd. As an exception, systemd-timesyncd
needs @clock system calls and systemd-localed is not privileged.
ptrace(2) is blocked to prevent seccomp escapes.

8 years agoMerge pull request #3431 from poettering/network-fixes
Tom Gundersen [Wed, 8 Jun 2016 21:10:16 +0000 (23:10 +0200)]
Merge pull request #3431 from poettering/network-fixes

put limits on addresses and routers per link and per network

8 years agoMerge pull request #3470 from fbuihuu/logind-fix-ignore-inhibit
Lennart Poettering [Wed, 8 Jun 2016 18:38:55 +0000 (20:38 +0200)]
Merge pull request #3470 from fbuihuu/logind-fix-ignore-inhibit

Logind: fix handling of *KeyIgnoreInhibited options in logind.conf

8 years agologind: minor cleanup and use IN_SET() in manager_handle_action()
Franck Bui [Wed, 8 Jun 2016 16:16:42 +0000 (18:16 +0200)]
logind: minor cleanup and use IN_SET() in manager_handle_action()

8 years agologind: really handle *KeyIgnoreInhibited options in logind.conf
Franck Bui [Wed, 8 Jun 2016 16:08:56 +0000 (18:08 +0200)]
logind: really handle *KeyIgnoreInhibited options in logind.conf

8 years agounits: enable MemoryDenyWriteExecute (#3459)
Topi Miettinen [Wed, 8 Jun 2016 12:23:37 +0000 (12:23 +0000)]
units: enable MemoryDenyWriteExecute (#3459)

Secure daemons shipped by systemd by enabling MemoryDenyWriteExecute.

Closes: #3459

8 years agosysv-generator: remove more dead code (#3462)
Lennart Poettering [Wed, 8 Jun 2016 08:18:56 +0000 (10:18 +0200)]
sysv-generator: remove more dead code (#3462)

The changes in 788d2b088b13a2444b9eb2ea82c0cc57d9f0980f weren't complete, only
half the code that dealt with K links was removed. This is a follow-up patch
that removes the rest too.

No functional changes.

8 years agohwdb: selinuxify a bit (#3460)
Evgeny Vereshchagin [Tue, 7 Jun 2016 17:47:41 +0000 (20:47 +0300)]
hwdb: selinuxify a bit (#3460)

-bash-4.3# rm /etc/udev/hwdb.bin
-bash-4.3# systemd-hwdb update
-bash-4.3# ls -Z /etc/udev/hwdb.bin
system_u:object_r:systemd_hwdb_etc_t:s0 /etc/udev/hwdb.bin

Fixes: #3458

8 years agonetworkd: rename IPv6AcceptRouterAdvertisements to IPv6AcceptRA
Lennart Poettering [Tue, 7 Jun 2016 09:19:26 +0000 (11:19 +0200)]
networkd: rename IPv6AcceptRouterAdvertisements to IPv6AcceptRA

The long name is just too hard to type. We generally should avoid using
acronyms too liberally, if they aren't established enough, but it appears that
"RA" is known well enough. Internally we call the option "ipv6_accept_ra"
anyway, and the kernel also exposes it under this name. Hence, let's rename the
IPv6AcceptRouterAdvertisements= setting and the
[IPv6AcceptRouterAdvertisements] section to IPv6AcceptRA= and [IPv6AcceptRA].

The old setting IPv6AcceptRouterAdvertisements= is kept for compatibility with
older configuration. (However the section [IPv6AcceptRouterAdvertisements] is
not, as it was never available in a published version of systemd.

8 years agoMerge pull request #3394 from poettering/triple-tstamp
Lennart Poettering [Tue, 7 Jun 2016 09:13:39 +0000 (11:13 +0200)]
Merge pull request #3394 from poettering/triple-tstamp

timestamping improvements and IPv6 RA revamp

8 years agosd-netlink: fix deep recursion in message destruction (#3455)
David Herrmann [Tue, 7 Jun 2016 08:38:33 +0000 (10:38 +0200)]
sd-netlink: fix deep recursion in message destruction (#3455)

On larger systems we might very well see messages with thousands of parts.
When we free them, we must avoid recursing into each part, otherwise we
very likely get stack overflows.

Fix sd_netlink_message_unref() to use an iterative approach rather than
recursion (also avoid tail-recursion in case it is not optimized by the
compiler).

8 years agofstab-generator: don't process root= if it happens to be "gpt-auto" (#3452)
Lennart Poettering [Tue, 7 Jun 2016 08:23:20 +0000 (10:23 +0200)]
fstab-generator: don't process root= if it happens to be "gpt-auto" (#3452)

As that's handled by "gpt-auto-generator".

Fixes: #3404

8 years agoos-release: Add VERSION_CODENAME field (#3445)
Benjamin Drung [Mon, 6 Jun 2016 20:05:29 +0000 (22:05 +0200)]
os-release: Add VERSION_CODENAME field (#3445)

Debian and their derivatives (Ubuntu, Trisquel, etc.) use a code name
for their repositories. Thus record the code name in os-release for
processing.

Closes systemd/systemd#3429

8 years agocgtop: minimize aux variable scope
Lennart Poettering [Mon, 6 Jun 2016 20:04:33 +0000 (22:04 +0200)]
cgtop: minimize aux variable scope

8 years agocore: add minor comment
Lennart Poettering [Mon, 6 Jun 2016 20:03:31 +0000 (22:03 +0200)]
core: add minor comment

Let's explain #3444 briefly in the sources, too.

8 years agomount: make sure got into MOUNT_DEAD state after a successful umount (#3444)
michaelolbrich [Mon, 6 Jun 2016 19:59:51 +0000 (21:59 +0200)]
mount: make sure got into MOUNT_DEAD state after a successful umount (#3444)

Without this code the following can happen:
1. Open a file to keep a mount busy
2. Try to stop the corresponding mount unit with systemctl
   -> umount fails and the failure is remembered in mount->result
3. Close the file and umount the filesystem manually
   -> mount_dispatch_io() calls "mount_enter_dead(mount, MOUNT_SUCCESS)"
   -> Old error in mount->result is reused and the mount unit enters a
      failed state

Clear the old error result when 'mountinfo' reports a successful umount to
fix this.

8 years agonetwork: beef up ipv6 RA support considerably
Lennart Poettering [Thu, 2 Jun 2016 18:38:12 +0000 (20:38 +0200)]
network: beef up ipv6 RA support considerably

This reworks sd-ndisc and networkd substantially to support IPv6 RA much more
comprehensively. Since the API is extended quite a bit networkd has been ported
over too, and the patch is not as straight-forward as one could wish. The
rework includes:

- Support for DNSSL, RDNSS and RA routing options in sd-ndisc and networkd. Two
  new configuration options have been added to networkd to make this
  configurable.

- sd-ndisc now exposes an sd_ndisc_router object that encapsulates a full RA
  message, and has direct, friendly acessor functions for the singleton RA
  properties, as well as an iterative interface to iterate through known and
  unsupported options. The router object may either be retrieved from the wire,
  or generated from raw data. In many ways the sd-ndisc API now matches the
  sd-lldp API, except that no implicit database of seen data is kept. (Note
  that sd-ndisc actually had a half-written, but unused implementaiton of such
  a store, which is removed now.)

- sd-ndisc will now collect the reception timestamps of RA, which is useful to
  make sd_ndisc_router fully descriptive of what it covers.

Fixes: #1079

8 years agonetwork: use inet_ntop() rather than SD_NDISC_ADDRESS_FORMAT_VAL() when serializing
Lennart Poettering [Thu, 2 Jun 2016 18:35:13 +0000 (20:35 +0200)]
network: use inet_ntop() rather than SD_NDISC_ADDRESS_FORMAT_VAL() when serializing

Let's use the usual libc API for serializing IPv6 addresses, instead of the
NDISC-specific macro we should get rid of anyway.

8 years agoutil: make it easier to check whether in_addr or in6_addr addresses are NULL
Lennart Poettering [Thu, 2 Jun 2016 18:34:21 +0000 (20:34 +0200)]
util: make it easier to check whether in_addr or in6_addr addresses are NULL

8 years agoutil-lib: add accessors for unaligned native endian words
Lennart Poettering [Thu, 2 Jun 2016 16:12:16 +0000 (18:12 +0200)]
util-lib: add accessors for unaligned native endian words

8 years agoexit-status: update comments a bit
Lennart Poettering [Thu, 2 Jun 2016 15:56:59 +0000 (17:56 +0200)]
exit-status: update comments a bit

8 years agolldp: include sys/types.h in sd-lldp.h
Lennart Poettering [Thu, 2 Jun 2016 15:52:58 +0000 (17:52 +0200)]
lldp: include sys/types.h in sd-lldp.h

After all, we use clockid_t which is defined there.

8 years agolldp: minor coding style improvement
Lennart Poettering [Thu, 2 Jun 2016 15:52:32 +0000 (17:52 +0200)]
lldp: minor coding style improvement

8 years agolldp: add sd_lldp_get_event() call
Lennart Poettering [Thu, 2 Jun 2016 15:51:56 +0000 (17:51 +0200)]
lldp: add sd_lldp_get_event() call

sd-ndisc has something like this, let's add this for sd-lldp, too.