]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 years agoMerge pull request #5960 from keszybz/journald-memleak
Evgeny Vereshchagin [Sat, 20 May 2017 22:41:48 +0000 (01:41 +0300)] 
Merge pull request #5960 from keszybz/journald-memleak

Journald and journal-remote memleak fixes

7 years agoDHCP: when adding static routes set scopes properly (#5982)
Daniel Wang [Sat, 20 May 2017 11:05:18 +0000 (04:05 -0700)] 
DHCP: when adding static routes set scopes properly (#5982)

DHCP responses could include static routes, but unfortunately not an
option to tell what scope to use. So it's important that the client sets
it properly.

This mimics what the `ip route add` command does when adding a static
route without an explicit scope:

* If the destination IP is on the local host, use scope `host`
* Otherwise if the gateway IP is null (direct route), use scope `link`
* If anything else, use the current default `global`.

Fixes #5979.

7 years agojournald: fix trivial memleak 5960/head
Zbigniew Jędrzejewski-Szmek [Fri, 19 May 2017 16:52:05 +0000 (12:52 -0400)] 
journald: fix trivial memleak

Fixes #5516.

7 years agoMerge pull request #5624 from glaubitz/x32
Lennart Poettering [Fri, 19 May 2017 17:17:57 +0000 (19:17 +0200)] 
Merge pull request #5624 from glaubitz/x32

Fix multiple issues with incorrect usage of format specifiers

7 years agojournald: process "binary" fields the same as text fields
Zbigniew Jędrzejewski-Szmek [Fri, 19 May 2017 15:59:47 +0000 (11:59 -0400)] 
journald: process "binary" fields the same as text fields

MESSAGE=data\n and MESSAGE\n40000000data\n are both valid serializations, so
they should be stored in the journal. Before, MESSAGE, SYSLOG_FACILITY,
SYSLOG_IDENTIFIER, PRIORITY, and OBJECT_PID would be only honoured if they were
given in the first form.

Fixed #5973.

7 years agojournald: properly process multiple entries in the same native packet
Zbigniew Jędrzejewski-Szmek [Sun, 14 May 2017 02:34:40 +0000 (22:34 -0400)] 
journald: properly process multiple entries in the same native packet

For all except the last entry in a single packet, we would dispatch the
message to the journal, but not forward it, nor perform proper cleanup.
Rewrite the code to process each entry in a helper function, and make
server_process_native_message() just call this function in a loop.

Fixes #5643.

v2:
- properly decrement *remaining when processing entry separator

7 years agoshared/logs-show: avoid printing "(null)" when timestamp is not specified
Zbigniew Jędrzejewski-Szmek [Sat, 13 May 2017 20:40:09 +0000 (16:40 -0400)] 
shared/logs-show: avoid printing "(null)" when timestamp is not specified

$ perl -e 'print("MESSAGE\n", pack("q<", 1), "A\n\nMESSAGE=test2\n")' > message.bin
$ systemd-journal-remote -o /tmp/out.journal message.bin
$ journalctl -o export --file /tmp/out.journal
__CURSOR=s=b16c464c2db44384b29e75a564d8388e;i=1;b=6b0be47627bd4932913dc126012c21c0;m=0;t=0;x=b04263a253e357a
__REALTIME_TIMESTAMP=0
__MONOTONIC_TIMESTAMP=0
_BOOT_ID=6b0be47627bd4932913dc126012c21c0
MESSAGE=A

$ journalctl -o verbose --file /tmp/out.journal
(null) [s=b16c464c2db44384b29e75a564d8388e;i=1;b=6b0be47627bd4932913dc126012c21c0;m=0;t=0;x=b04263a253e357a]
    MESSAGE=A

This is changed to
$ build/journalctl -o verbose --file /tmp/out.journal
(no timestamp) [s=b16c464c2db44384b29e75a564d8388e;i=1;b=6b0be47627bd4932913dc126012c21c0;m=0;t=0;x=b04263a253e357a]
    MESSAGE=A

We should deal gracefully with unexpected input.

7 years agojournal-remote: fix memleak of the name of the remote source
Zbigniew Jędrzejewski-Szmek [Sun, 14 May 2017 02:42:14 +0000 (22:42 -0400)] 
journal-remote: fix memleak of the name of the remote source

7 years agojournald: use unaligned_read instead of memcpy
Zbigniew Jędrzejewski-Szmek [Sun, 14 May 2017 02:42:08 +0000 (22:42 -0400)] 
journald: use unaligned_read instead of memcpy

7 years agoarchitecture: add Synopsys DesignWare ARC cores support (#5992)
Alexey Brodkin [Fri, 19 May 2017 14:55:24 +0000 (16:55 +0200)] 
architecture: add Synopsys DesignWare ARC cores support (#5992)

DesignWare ARC Processors are a family of 32-bit CPUs from Synopsys
used extensively in SoCs of different vendors.

7 years agohwdb: Fix mapping for home-key on Cube iWork8 air (#5994)
Hans de Goede [Fri, 19 May 2017 14:05:27 +0000 (16:05 +0200)] 
hwdb: Fix mapping for home-key on Cube iWork8 air (#5994)

The intent of the hwdb entry for the Cube iWork8 air tablet buttons is
to fix them being swapped. The kernel is using left-meta for the
home key (it is being treated as the windows key on keyboards, as it has
a windows logo on most x86 tablets).

Fix the hwdb entry to only swap the buttons and not change the keycode
emitted by the home key.

7 years agoFix includes (#5980)
Matija Skala [Fri, 19 May 2017 14:01:35 +0000 (16:01 +0200)] 
Fix includes (#5980)

Needed on musl.

7 years agotimesync/timesyncd-manager: fix format-specifier issue 5624/head
Matija Skala [Fri, 19 May 2017 12:36:40 +0000 (14:36 +0200)] 
timesync/timesyncd-manager: fix format-specifier issue

timex::time::tv_sec can have different sizes depending on the
host architecture. On x32 in particular, it is 8 bytes
long while the long int type is only 4 bytes  long. Hence,
using li as a format specifier will trigger a format
error. Thus, better use PRI_TIME instead of li which is
actually the right format specifier to use for time_t.

7 years agocore: open /proc/self/mountinfo early to allow mounts over /proc (#5985)
Timothée Ravier [Fri, 19 May 2017 12:38:40 +0000 (14:38 +0200)] 
core: open /proc/self/mountinfo early to allow mounts over /proc (#5985)

Enable masking the /proc folder using the 'InaccessiblePaths' unit
option.

This also slightly simplify mounts setup as the bind_remount_recursive
function will only open /proc/self/mountinfo once.

This is based on the suggestion at:
https://lists.freedesktop.org/archives/systemd-devel/2017-April/038634.html

7 years agotimesync/timesyncd-manager: fix format-specifier issues
Matija Skala [Fri, 19 May 2017 12:36:12 +0000 (14:36 +0200)] 
timesync/timesyncd-manager: fix format-specifier issues

timex::time::tv_usec and timex::freq can have different sizes
depending on the host architecture. On x32 in particular,
it is 8 bytes long while the long int type is only 4 bytes
long. Hence, using li as a format specifier will trigger
a format error. Thus, introduce a new format specifier
PRI_TIMEX which is defined as PRIi64 on x32 and li
everywhere else.

7 years agoudev/udevadm-monitor: fix format-specifier issue
John Paul Adrian Glaubitz [Wed, 22 Mar 2017 20:40:51 +0000 (21:40 +0100)] 
udev/udevadm-monitor: fix format-specifier issue

timespec::tv_nsec can have different sizes depending on the
host architecture. On x32 in particular, it is 8 bytes long
while the long int type is only 4 bytes long. Hence, using
ld as a format specifier will trigger a format error. Thus,
explicitly cast timespec::tv_nsec to nsec_t and use PRI_NSEC
as the format specifier to make sure the sizes for both match.

7 years agojournal/journald-console: fix format-specifier issue
John Paul Adrian Glaubitz [Wed, 22 Mar 2017 20:34:32 +0000 (21:34 +0100)] 
journal/journald-console: fix format-specifier issue

timespec::tv_nsec can have different sizes depending on the
host architecture. On x32 in particular, it is 8 bytes long
while the long int type is only 4 bytes long. Hence, using
ld as a format specifier will trigger a format error. Thus,
explicitly cast timespec::tv_nsec to nsec_t and use PRI_NSEC
as the format specifier to make sure the sizes for both match.

7 years agoman: fix typo m86k → m68k (#5993)
Lennart Poettering [Fri, 19 May 2017 09:37:30 +0000 (11:37 +0200)] 
man: fix typo m86k → m68k (#5993)

7 years agoMerge pull request #5598 from pfl/ndisc_prefix_delegation
Lennart Poettering [Fri, 19 May 2017 09:17:07 +0000 (11:17 +0200)] 
Merge pull request #5598 from pfl/ndisc_prefix_delegation

Initial Router Advertisment implementation

7 years agoudev: skip EVDEV_ABS override on devices without EV_ABS (#5984)
Peter Hutterer [Fri, 19 May 2017 08:56:29 +0000 (18:56 +1000)] 
udev: skip EVDEV_ABS override on devices without EV_ABS (#5984)

When we first handle a device with an EVDEV_ABS override, check if it has
EV_ABS bits. If not, print a warning and continue. This is required on devices
where the match string applies to multiple device nodes, not all of which may
have absolute axes.

Fixes https://github.com/systemd/systemd/issues/5079

7 years agoMerge pull request #5988 from poettering/man-and-gcc
Evgeny Vereshchagin [Fri, 19 May 2017 06:34:39 +0000 (09:34 +0300)] 
Merge pull request #5988 from poettering/man-and-gcc

minor man page and gcc fixes

7 years agoudev: turn off -Wformat-nonliteral for one safe case 5988/head
Lennart Poettering [Thu, 18 May 2017 16:25:02 +0000 (18:25 +0200)] 
udev: turn off -Wformat-nonliteral for one safe case

c20e6de897b2378bc3f936e1e265d2d2e2450a73 introduced a format string as
variable, but didn't turn off -Wformat-nonliteral warnings on it, thus
breaking the build. Let's fix that, by simply turning off the warning in
this case, as we know it's safe.

7 years agoman: extend documentation on sd_bus_add_match a bit()
Lennart Poettering [Thu, 18 May 2017 16:24:17 +0000 (18:24 +0200)] 
man: extend documentation on sd_bus_add_match a bit()

Explain briefly how the concept of "sd_bus_slot" works.

This recently came up on the mailing list, hence let's document this for
the next time.

7 years agosd-netlink: Make use of IN_SET (#5977)
Susant Sahani [Thu, 18 May 2017 10:56:36 +0000 (10:56 +0000)] 
sd-netlink: Make use of IN_SET (#5977)

7 years agogitignore: ignore /test-sd-dhcp-lease (#5983)
Daniel Wang [Thu, 18 May 2017 00:14:58 +0000 (17:14 -0700)] 
gitignore: ignore /test-sd-dhcp-lease (#5983)

7 years agoMerge pull request #5957 from keszybz/test-c++
Lennart Poettering [Wed, 17 May 2017 15:02:55 +0000 (17:02 +0200)] 
Merge pull request #5957 from keszybz/test-c++

Test compilation under C++

7 years agoudev: net_id add support for platform bus (ACPI, mostly arm64) devices (#5933)
Dimitri John Ledkov [Wed, 17 May 2017 13:28:35 +0000 (14:28 +0100)] 
udev: net_id add support for platform bus (ACPI, mostly arm64) devices (#5933)

Fixes: #5894
7 years agocalendarspec: parse unix timestamps (@...) (#5947)
Zbigniew Jędrzejewski-Szmek [Wed, 17 May 2017 09:40:49 +0000 (05:40 -0400)] 
calendarspec: parse unix timestamps (@...) (#5947)

Fixes #5810.

7 years agoMerge pull request #5883 from garyttierney/fix-selinux
Lennart Poettering [Wed, 17 May 2017 09:39:44 +0000 (11:39 +0200)] 
Merge pull request #5883 from garyttierney/fix-selinux

selinux: enable labeling and access checks for unprivileged users

7 years agomeson: do not use generate_gperfs.py for keyboard-keys-from-name.gperf (#5968)
Yu Watanabe [Tue, 16 May 2017 00:51:22 +0000 (09:51 +0900)] 
meson: do not use generate_gperfs.py for keyboard-keys-from-name.gperf (#5968)

Fixes #5967.

7 years agoAdd Lenovo UltraNav SK-8845 (#5963)
Charles Plessy [Mon, 15 May 2017 12:16:16 +0000 (21:16 +0900)] 
Add Lenovo UltraNav SK-8845 (#5963)

Closes #5952.

7 years agomeson: add rules for RA sources 5598/head
Zbigniew Jędrzejewski-Szmek [Thu, 11 May 2017 13:19:21 +0000 (09:19 -0400)] 
meson: add rules for RA sources

7 years agotest-ndisc-ra: Add Router Advertisement test cases
Patrik Flykt [Fri, 12 May 2017 13:48:39 +0000 (16:48 +0300)] 
test-ndisc-ra: Add Router Advertisement test cases

Add tests for prefix creation, router variable setting and finally
verify that a Router Advertisement is properly formatted when sending.
Also check that there is a Router Advertisment with zero lifetime
when Router Advertisement sending is stopped.

7 years agosd-radv: Receive Router Solicitations
Patrik Flykt [Fri, 12 May 2017 13:48:38 +0000 (16:48 +0300)] 
sd-radv: Receive Router Solicitations

Receive Router Solicitations and send a unicast Router Advertisment
in response. Refactor ICMPv6 packet handling code so that the common
ICMPv6 validation parts are reused between the existing router
discovery and the new functionality adding reception of Router
Solicitation messages.

7 years agosd-radv: Send Router Advertisments
Patrik Flykt [Fri, 12 May 2017 13:48:37 +0000 (16:48 +0300)] 
sd-radv: Send Router Advertisments

Create and remove the ICMPv6 Router Advertisement socket file
descriptor and implement Router Advertisment sending. As not
all options are mandatory, use IO vectors to point to the included
options and the prefix information.

7 years agoicmp6-util: Move multicast address definitions
Patrik Flykt [Fri, 12 May 2017 13:48:36 +0000 (16:48 +0300)] 
icmp6-util: Move multicast address definitions

As the Router Advertisment sending code needs these multicast
address definitions, move them to the header file.

7 years agoicmp6-util: Bind Router Advertisement socket
Patrik Flykt [Fri, 12 May 2017 13:48:35 +0000 (16:48 +0300)] 
icmp6-util: Bind Router Advertisement socket

Reuse and refactor the functionality already present for Router
Solicitations in order to create a socket for sending Router
Advertisements. Anticipate reception of incoming Router
Solicitations by setting the ICMPv6 filter accordingly. Also set
the unicast hop limit to 255 for ICMPv6 sockets as unicast Router
Advertisments are to be sent in response to Router Solicitations.

Update the Router Solicitation test case code with a function
definition in order to keep the test case working.

7 years agosd-radv: Implement Router Advertisement timeout handling
Patrik Flykt [Fri, 12 May 2017 13:48:34 +0000 (16:48 +0300)] 
sd-radv: Implement Router Advertisement timeout handling

Router Advertisements are sent uniformly distributed between a
minimum and maximum time according to RFC 4861, Section 6.2.4.
Default values from RFC 4861 are for now used as minimum and
maximum Router Advertisement timeouts.

When stopping, a Router Advertisement with a router lifetime set
to zero is sent in order to inform any nodes that the interface
on this host no longer is a router.

7 years agonetworkd-link.c: Add Router Advertisement starting and stopping
Patrik Flykt [Fri, 12 May 2017 13:48:33 +0000 (16:48 +0300)] 
networkd-link.c: Add Router Advertisement starting and stopping

Start and stop Router Advertisement sending once the link has acquired
a link-local IPv6 address.

7 years agonetworkd-radv: Helper function for Router Advertisement initialization
Patrik Flykt [Fri, 12 May 2017 13:48:32 +0000 (16:48 +0300)] 
networkd-radv: Helper function for Router Advertisement initialization

Add a helper function for configuring Router Advertisement on a
specific network link. Add the prefixes that are going to be advertised.

7 years agosd-radv: Add Router Advertisement functionality
Patrik Flykt [Fri, 12 May 2017 13:48:31 +0000 (16:48 +0300)] 
sd-radv: Add Router Advertisement functionality

Add Router Advertisement header files, data structures and core
functionality that is quite similar to other parts of networkd.

7 years agonetworkd: Add Router Advertisement variables
Patrik Flykt [Fri, 12 May 2017 13:48:30 +0000 (16:48 +0300)] 
networkd: Add Router Advertisement variables

Add variables for enabling Router Advertisements, router lifetime as
well as managed and other information flags indicating use of DHCPv6.
Add configuration of default router preferences as defined in RFC 4191.

IPv6PrefixDelegation in the [Network] section has to be set in order
to enable prefix delegation. The rest of the prefix delegation values
are stored in the [IPv6PrefixDelegation] section. The host will act as
a default router if it is given a non-zero lifetime with
RouterLifetimeSec. Managed and OtherInformation booleans set the level
of DHCPv6 support, and the RouterPreference configures the router's
preference between low, medium and high. Words 'normal' and 'default'
are added as synonyms for 'medium' just to make configuration simpler.

This adds a section like the following to .network configuration files:
[Network]
IPv6PrefixDelegation=true

[IPv6PrefixDelegation]
RouterLifetimeSec=2000
Managed=false
OtherInformation=true
RouterPreference=medium

7 years agonetworkd: Add IPv6Prefix sections to the network configuration files
Patrik Flykt [Fri, 12 May 2017 13:48:29 +0000 (16:48 +0300)] 
networkd: Add IPv6Prefix sections to the network configuration files

Support zero or more [IPv6Prefix] sections in the network configuration
files. Each section can have one Prefix=<subnet>[/<prefixlength>]
option, with the preferred and valid lifetimes specified by
ValidLifetimeSec and PreferredLifetimeSec measured in seconds, and
with onlink and address autoconfiguration booleans specified by
OnLink and AddressAutoconfiguration variables.

This adds a section like the following to .network configuration files:
[IPv6Prefix]
Prefix=2001:db8:dead:beef::/64
OnLink=true
AddressAutoconfiguration=true
ValidLifetimeSec=1500
PreferredLifetimeSec=1000

7 years agonetworkd: Add initial prefix handling for network configuration
Patrik Flykt [Fri, 12 May 2017 13:48:28 +0000 (16:48 +0300)] 
networkd: Add initial prefix handling for network configuration

Add initial code for handling prefixes in network configuration files.
Add hash map and list storing the information in systemd-networkd.

7 years agosd-radv: Add Router Advertisement prefix handling
Patrik Flykt [Fri, 12 May 2017 13:48:27 +0000 (16:48 +0300)] 
sd-radv: Add Router Advertisement prefix handling

Define Router Advertisement prefix structure. Add the Prefix
Information ICMPv6 option defined in RFC 4861 to the prefix
information structure, as it will simplify sending a Prefix
Information option later on. In order to handle endianness
correctly, the structure is redefined here instead of using
the one in netinet/icmp6.h.

Add functions to create and modify prefix information and set
default values as defined in RFC 4861, Section 6.2.1.

7 years agotest-bus-vtable: add SD_BUS_PROPERTY 5957/head
Zbigniew Jędrzejewski-Szmek [Sun, 14 May 2017 19:09:29 +0000 (15:09 -0400)] 
test-bus-vtable: add SD_BUS_PROPERTY

Without cc9daff228, this results in:

src/libsystemd/sd-bus/test-bus-vtable-cc.cc:56:1: sorry, unimplemented: non-trivial designated initializers not supported
 };
 ^

7 years agoMerge pull request #5961 from ronnychevalier/rc/conf-parser-strv-typo
Zbigniew Jędrzejewski-Szmek [Sun, 14 May 2017 14:31:12 +0000 (10:31 -0400)] 
Merge pull request #5961 from ronnychevalier/rc/conf-parser-strv-typo

conf-parser: fix wrong argument given to log_syntax_invalid_utf8

7 years agoenv-util: fix memory leak (#5962)
Ronny Chevalier [Sun, 14 May 2017 14:30:40 +0000 (16:30 +0200)] 
env-util: fix memory leak (#5962)

If cunescape succeeds, but the assignment is not valid, uce is not freed.

7 years agotest-conf-parser: add valid and invalid utf8 test for config_parse_path 5961/head
Ronny Chevalier [Sun, 14 May 2017 11:19:11 +0000 (13:19 +0200)] 
test-conf-parser: add valid and invalid utf8 test for config_parse_path

7 years agoconf-parser: fix wrong argument given to log_syntax_invalid_utf8
Ronny Chevalier [Sun, 14 May 2017 11:19:11 +0000 (13:19 +0200)] 
conf-parser: fix wrong argument given to log_syntax_invalid_utf8

The condition is on "word", hence we give word instead of rvalue.

An assert would be triggered if !utf8_is_valid(word) is true and
rvalue == NULL, since log_syntax_invalid_utf8 calls utf8_escape_invalid
which calls assert(str).

A test case has been added to test with valid and invalid utf8.

7 years agotests,meson: add test-bus-vtable, compiled as C and C++
Zbigniew Jędrzejewski-Szmek [Sat, 13 May 2017 17:23:28 +0000 (13:23 -0400)] 
tests,meson: add test-bus-vtable, compiled as C and C++

This test is mostly a compilation test that checks that various defines in
sd-bus-vtable.h are valid C++. The code is executed, but the results are not
checked (apart from sd-bus functions not returning an error). test-bus-objects
contains pretty extensive tests for this functionality.

The C++ version is only added to meson, since it's simpler there.
Because of the .cc extension, meson will compile the executable with c++.

This test is necessary to properly check the macros in sd-bus-vtable.h. Just
running the headers through g++ is not enough, because the macros are not
exercised.

Follow-up for #5941.

7 years agotest-ipv4ll: use assert_se consistently
Zbigniew Jędrzejewski-Szmek [Sat, 13 May 2017 15:47:36 +0000 (11:47 -0400)] 
test-ipv4ll: use assert_se consistently

We use assert_se in tests so that the asserts get evaluated even if compiled with NDEBUG.

7 years agotree-wide: drop assert.h includes
Zbigniew Jędrzejewski-Szmek [Sat, 13 May 2017 15:44:51 +0000 (11:44 -0400)] 
tree-wide: drop assert.h includes

We provide an independent reimplementation in macro.h, and that's the one
we want to use. Including the system header is unnecessary and confusing.

7 years agotests: make sure that our headers are valid c++
Zbigniew Jędrzejewski-Szmek [Fri, 12 May 2017 19:20:54 +0000 (15:20 -0400)] 
tests: make sure that our headers are valid c++

This adds a meson test because it fits nicely into the existing framework.
It should be enough to run this test once in a while, so I don't think it's
crucial to also have it under autotools.

7 years agoMerge pull request #5956 from eliasp/fix-typo-network-zones
Michael Biebl [Sat, 13 May 2017 19:07:04 +0000 (21:07 +0200)] 
Merge pull request #5956 from eliasp/fix-typo-network-zones

man: fix typo (`--network-zones` → `--network-zone`)

7 years agoman: fix typo (`--network-zones` → `--network-zone`) 5956/head
Elias Probst [Sat, 13 May 2017 18:55:03 +0000 (20:55 +0200)] 
man: fix typo (`--network-zones` → `--network-zone`)

7 years agonetwork: Implement DHCP Option 119 (Domain Search List) (#5932)
Daniel Wang [Sat, 13 May 2017 14:19:32 +0000 (07:19 -0700)] 
network: Implement DHCP Option 119 (Domain Search List) (#5932)

This adds a modified version of dhcp6_option_parse_domainname() that is
able to parse compressed domain names, borrowing the idea from
dns_packet_read_name(). It also adds pieces in networkd-link and
networkd-manager to properly save/load the added option field.

Resolves #2710.

7 years agoaudit-fd: check for CAP_AUDIT_WRITE before opening an audit socket 5883/head
Gary Tierney [Tue, 2 May 2017 20:05:32 +0000 (21:05 +0100)] 
audit-fd: check for CAP_AUDIT_WRITE before opening an audit socket

Adds a check to audit-fd.c to ensure that CAP_AUDIT_WRITE is present in
the set of effective capabilities before opening an audit netlink
socket.  This ensures that unprivileged systemd instances (MANAGER_USER)
don't try to log AVC permission checks with the audit subsystem when
CAP_AUDIT_WRITE is not present.

7 years agoRevert "selinux: split up mac_selinux_have() from mac_selinux_use()"
Gary Tierney [Tue, 2 May 2017 16:42:19 +0000 (17:42 +0100)] 
Revert "selinux: split up mac_selinux_have() from mac_selinux_use()"

This reverts commit 6355e75610a8d47fc3ba5ab8bd442172a2cfe574.

The previously mentioned commit inadvertently broke a lot of SELinux related
functionality for both unprivileged users and systemd instances running as
MANAGER_USER.  In particular, setting the correct SELinux context after a User=
directive is used would fail to work since we attempt to set the security
context after changing UID.  Additionally, it causes activated socket units to
be mislabeled for systemd --user processes since setsockcreatecon() would never
be called.

Reverting this fixes the issues with labeling outlined above, and reinstates
SELinux access checks on unprivileged user services.

7 years agoMerge pull request #5432 from keszybz/udev-logging
Lennart Poettering [Fri, 12 May 2017 13:22:46 +0000 (15:22 +0200)] 
Merge pull request #5432 from keszybz/udev-logging

udev logging separation

7 years agonss-resolve: drop the internal fallback to libnss_dns (#5945)
Zbigniew Jędrzejewski-Szmek [Fri, 12 May 2017 12:31:46 +0000 (08:31 -0400)] 
nss-resolve: drop the internal fallback to libnss_dns (#5945)

If we could not communicate with systemd-resolved, we would call into
libnss_dns. libnss_dns would return NOTFOUND for stuff like "localhost" and
other names resolved by nss-myhostname, which we would fall under the !UNAVAIL=
condition and cause resolution to fail. So the following recommended
configuration in nsswitch.conf would not work:

   hosts: resolve [!UNAVAIL=return] dns myhostname

Remove the internal fallback code completely so that the fallback logic
can be configured in nsswitch.conf.

Tested with
   hosts: resolve [!UNAVAIL=return] myhostname
and
   hosts: resolve [!UNAVAIL=return] dns myhostname

Fixes #5742.

7 years agoMerge pull request #5928 from keszybz/libidn2
Lennart Poettering [Fri, 12 May 2017 10:01:40 +0000 (12:01 +0200)] 
Merge pull request #5928 from keszybz/libidn2

Use idn2 instead of idn

7 years agoMerge pull request #5942 from keszybz/timestamp-writing
Lennart Poettering [Fri, 12 May 2017 10:00:24 +0000 (12:00 +0200)] 
Merge pull request #5942 from keszybz/timestamp-writing

Allow timestamp to be set by the file writing utility functions

7 years agoMerge pull request #5946 from evverx/test-sigbus-fixes
Lennart Poettering [Fri, 12 May 2017 09:58:13 +0000 (11:58 +0200)] 
Merge pull request #5946 from evverx/test-sigbus-fixes

test-sigbus: use posix_fallocate rather than fallocate

7 years agoREADME: update util-linux required compilation options (#5949)
Zbigniew Jędrzejewski-Szmek [Fri, 12 May 2017 08:49:48 +0000 (04:49 -0400)] 
README: update util-linux required compilation options (#5949)

Fixes #5563.

7 years agonetworkd: remove unused variables (#5948)
Zbigniew Jędrzejewski-Szmek [Fri, 12 May 2017 01:53:12 +0000 (21:53 -0400)] 
networkd: remove unused variables (#5948)

Fixup for 36423ff433.

7 years agotests: stop creating /TEST (#5943)
Evgeny Vereshchagin [Thu, 11 May 2017 22:56:39 +0000 (01:56 +0300)] 
tests: stop creating /TEST (#5943)

Closes #5856.

7 years agosd-bus: fix c++ compatibility (#5941)
Matthijs van Duin [Thu, 11 May 2017 22:55:26 +0000 (00:55 +0200)] 
sd-bus: fix c++ compatibility (#5941)

g++ annoyingly requires a non-empty struct-initializer to initialize all
struct members, in order of declaration.

Signed-off-by: Matthijs van Duin <matthijsvanduin@gmail.com>
7 years agoMerge pull request #5936 from ssahani/net-route
Zbigniew Jędrzejewski-Szmek [Thu, 11 May 2017 22:53:35 +0000 (18:53 -0400)] 
Merge pull request #5936 from ssahani/net-route

networkd: route replace parse prefix with generic in_addr_prefix_from_string

7 years agomkosi: switch over to libidn2 5928/head
Zbigniew Jędrzejewski-Szmek [Thu, 11 May 2017 02:09:45 +0000 (22:09 -0400)] 
mkosi: switch over to libidn2

7 years agoresolved: support libidn2 in addition to libidn
Zbigniew Jędrzejewski-Szmek [Wed, 10 May 2017 01:56:34 +0000 (21:56 -0400)] 
resolved: support libidn2 in addition to libidn

libidn2 2.0.0 supports IDNA2008, in contrast to libidn which supports IDNA2003.

https://bugzilla.redhat.com/show_bug.cgi?id=1449145
From that bug report:

Internationalized domain names exist for quite some time (IDNA2003), although
the protocols describing them have evolved in an incompatible way (IDNA2008).
These incompatibilities will prevent applications written for IDNA2003 to
access certain problematic domain names defined with IDNA2008, e.g., faß.de is
translated to domain xn--fa-hia.de with IDNA2008, while in IDNA2003 it is
translated to fass.de domain. That not only causes incompatibility problems,
but may be used as an attack vector to redirect users to different web sites.

v2:
- keep libidn support
- require libidn2 >= 2.0.0
v3:
- keep dns_name_apply_idna caller dumb, and keep the #ifdefs inside of the
  function.
- use both ±IDN and ±IDN2 in the version string

7 years agonetworkd: pretiffy message about invalid prefix 5936/head
Zbigniew Jędrzejewski-Szmek [Thu, 11 May 2017 18:00:25 +0000 (14:00 -0400)] 
networkd: pretiffy message about invalid prefix

We know how the field we are parsing is called, let's put this information in
the error message:
"Route Source= prefix is invalid, ignoring assignment: ..."
"Route Destination= prefix is invalid, ignoring assignment: ..."

7 years agoupdate-done: use newly added library function to write the file 5942/head
Zbigniew Jędrzejewski-Szmek [Thu, 11 May 2017 14:29:34 +0000 (10:29 -0400)] 
update-done: use newly added library function to write the file

Fixes #5861.

7 years agoMerge pull request #5893 from keszybz/memorydenywriteexecute
Lennart Poettering [Thu, 11 May 2017 17:42:42 +0000 (19:42 +0200)] 
Merge pull request #5893 from keszybz/memorydenywriteexecute

Add support for more arches for MemoryDenyWriteExecute

7 years agopid1: improve logging when failing to remount / ro (#5940)
Zbigniew Jędrzejewski-Szmek [Thu, 11 May 2017 16:12:41 +0000 (12:12 -0400)] 
pid1: improve logging when failing to remount / ro (#5940)

https://bugzilla.redhat.com/show_bug.cgi?id=1227736#c49

We counted how many filesystems could not be unmounted, but only for those
filesystems which we tried to unmount. Since we only remount / ro, without
attempting to unmount, we would emit a confusing error message:

Remounting '/' read-only with options 'seclabel,space_cache,subvolid=5,subvol=/'.
Remounting '/' read-only with options 'seclabel,space_cache,subvolid=5,subvol=/'.
Remounting '/' read-only with options 'seclabel,space_cache,subvolid=5,subvol=/'.
All filesystems unmounted.

Warn when remount-ro fails, and for filesystems which we won't try to unmount,
include the failure to remount-ro in n_failed.

A few minor cleanups:
- remove unecessary goto which jumps to the next line anyway
- always calculate n_failed, even if log_error is false. This causes no change
  in behaviour, but I think the code is easier to follow, since the log setting
  cannot influence other logic.

7 years agobasic/fileio: extend atomic file writing with timestamp setting
Zbigniew Jędrzejewski-Szmek [Thu, 11 May 2017 14:23:36 +0000 (10:23 -0400)] 
basic/fileio: extend atomic file writing with timestamp setting

There should be no functional change.

7 years agobusctl: monitor - only start printing messages once we have become a monitor (#5931)
Tom Gundersen [Thu, 11 May 2017 13:56:55 +0000 (15:56 +0200)] 
busctl: monitor - only start printing messages once we have become a monitor (#5931)

A connection becomes a monitor the moment it loses its unique name, so any
messages received before that should not be dumped to the console.

Currently, we print NameAcquired and NameLost for the unique name of the
peer that becomes the monitor, simply discard all messages until we
receive our NameLost signal.

7 years agocore: fix warning about unsigned variable (#5935)
Zbigniew Jędrzejewski-Szmek [Thu, 11 May 2017 06:15:28 +0000 (02:15 -0400)] 
core: fix warning about unsigned variable (#5935)

Fixup for d8c92e8bc7351f553936b5235e1922c18ebd817a.

7 years agonetworkd: route replace parse prefix with generic in_addr_prefix_from_string
Susant Sahani [Thu, 11 May 2017 04:42:54 +0000 (10:12 +0530)] 
networkd: route replace parse prefix with generic in_addr_prefix_from_string

7 years agohwdb: add the X200/X201 to the existing X201s entry (#5934)
Peter Hutterer [Thu, 11 May 2017 02:29:15 +0000 (12:29 +1000)] 
hwdb: add the X200/X201 to the existing X201s entry (#5934)

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

7 years agoman: fix LD_LIBRARY_PATH example in environment.d (#5929)
Ray Strode [Thu, 11 May 2017 02:23:54 +0000 (22:23 -0400)] 
man: fix LD_LIBRARY_PATH example in environment.d (#5929)

The example for LD_LIBRARY_PATH in the environment.d man page is wrong.

When setting LD_LIBRARY_PATH, the new directory usually needs to be at
the front so it overrides old directories.

In the example, the colon delimiter is correctly prepended to the front, but
the actual new path is erroneously appended to the end.

This commit moves it to the front where it belongs.

7 years agoudev: don't allow pointing stick sensitivities greater than 255 (#5927)
Peter Hutterer [Wed, 10 May 2017 19:22:00 +0000 (05:22 +1000)] 
udev: don't allow pointing stick sensitivities greater than 255 (#5927)

It gets truncated, so the result is that people mess with the const accel
because the sensitivity isn't the expected 300 but the too-low 45.

One example: https://bugs.freedesktop.org/show_bug.cgi?id=100965

7 years agoMerge pull request #5920 from fbuihuu/sysusers-disable-gshadow
Lennart Poettering [Wed, 10 May 2017 17:46:13 +0000 (19:46 +0200)] 
Merge pull request #5920 from fbuihuu/sysusers-disable-gshadow

Sysusers disable group shadow support

7 years agoseccomp: enable RestrictAddressFamilies on ppc64, autodetect SECCOMP_RESTRICT_ADDRESS... 5893/head
Zbigniew Jędrzejewski-Szmek [Tue, 9 May 2017 22:57:10 +0000 (18:57 -0400)] 
seccomp: enable RestrictAddressFamilies on ppc64, autodetect SECCOMP_RESTRICT_ADDRESS_FAMILIES_BROKEN

We expect that if socket() syscall is available, seccomp works for that
architecture.  So instead of explicitly listing all architectures where we know
it is not available, just assume it is broken if the number is not defined.
This should have the same effect, except that other architectures where it is
also broken will pass tests without further changes. (Architectures where the
filter should work, but does not work because of missing entries in
seccomp-util.c, will still fail.)

i386, s390, s390x are the exception — setting the filter fails, even though
socket() is available, so it needs to be special-cased
(https://github.com/systemd/systemd/issues/5215#issuecomment-277241488).

This remove the last define in seccomp-util.h that was only used in test-seccomp.c. Porting
the seccomp filter to new architectures should be simpler because now only two places need
to be modified.

RestrictAddressFamilies seems to work on ppc64[bl]e, so enable it (the tests pass).

7 years agosysusers: make use of cleanup(unlink_and_freep) in write_files() and its auxiliary... 5920/head
Franck Bui [Wed, 10 May 2017 12:28:41 +0000 (14:28 +0200)] 
sysusers: make use of cleanup(unlink_and_freep) in write_files() and its auxiliary helpers

No functional changes.

7 years agoautomount: ack automount requests even when already mounted (#5916)
Anchor Cat [Wed, 10 May 2017 11:23:58 +0000 (21:23 +1000)] 
automount: ack automount requests even when already mounted (#5916)

If a process accesses an autofs filesystem while systemd is in the
middle of starting the mount unit on top of it, it is possible for the
autofs_ptype_missing_direct request from the kernel to be received after
the mount unit has been fully started:

  systemd forks and execs mount             ...
            ...                     access autofs, blocks
  mount exits                               ...
  systemd receives SIGCHLD                  ...
            ...                     kernel sends request
  systemd receives request                  ...

systemd needs to respond to this request, otherwise the kernel will
continue to block access to the mount point.

7 years agounits: make descriptions of api filesystems less generic (#5914)
Zbigniew Jędrzejewski-Szmek [Wed, 10 May 2017 11:09:52 +0000 (07:09 -0400)] 
units: make descriptions of api filesystems less generic (#5914)

All those names were very generic. Fixes #5911.

7 years agotest-sigbus: skip the test under valgrind 5946/head
Evgeny Vereshchagin [Wed, 10 May 2017 08:54:52 +0000 (08:54 +0000)] 
test-sigbus: skip the test under valgrind

7 years agotest-sigbus: use posix_fallocate rather than fallocate
Evgeny Vereshchagin [Wed, 10 May 2017 08:47:39 +0000 (08:47 +0000)] 
test-sigbus: use posix_fallocate rather than fallocate

Some filesystems do not support fallocate, so we need to fall back on
something like posix_fallocate.

Closes #5833

7 years agosysusers: make group shadow support configurable
Franck Bui [Tue, 9 May 2017 12:02:37 +0000 (14:02 +0200)] 
sysusers: make group shadow support configurable

Some distros (openSUSE) don't have group shadow support enabled. This can lead
to the following error:

  # systemd-sysusers
  Creating group foofoo with gid 478.
  # systemd-sysusers
  # groupdel foofoo
  # systemd-sysusers
  Creating group foofoo with gid 478.
  Failed to write files: File exists

This patch adds --disable-gshadow option to configure. If used,
systemd-sysvusers won't consider /etc/gshadow.

7 years agosysusers: split make_files()
Franck Bui [Tue, 9 May 2017 07:37:37 +0000 (09:37 +0200)] 
sysusers: split make_files()

This patch extracts the code which is in charge to write the new users or
groups into temporary files and move it into 4 dedicated functions.

This part was previously inlined in makes_files() making this function quite
big and hard to read and maintain.

There should be no functional change.

7 years ago50-udev-default.rules.in: set correct group for mediaX/cecX (#5921)
Lennart Poettering [Tue, 9 May 2017 19:10:55 +0000 (21:10 +0200)] 
50-udev-default.rules.in: set correct group for mediaX/cecX (#5921)

The /dev/mediaX and /dev/cecX devices belong to the video group.
Add two default rules for that.

The /dev/cecX devices were introduced in kernel 4.8 in staging and moved
out of staging in 4.10. These devices support the HDMI CEC bus.

The /dev/mediaX devices are much older, but because they are not used very
frequently nobody got around to adding this rule to systemd. They let the
user control complex media pipelines.

7 years agosd-boot: added shim signature/MOK validation (#5702)
Max Resch [Tue, 9 May 2017 18:57:40 +0000 (20:57 +0200)] 
sd-boot: added shim signature/MOK validation (#5702)

Adds support for booting in a SecureBoot environment with shim as a
preloader. Install an appropriate UEFI security policy to check PE
signature of a chained kernel or UEFI application (using LoadImage())
against the MOK database maintained by shim, using shim's installed
BootServices.

Implementation details for installing the security policy are based on
code from the LinuxFoundation's SecureBoot PreLoader, part of efitools
licensed under LGPL 2.1

Current signed (by Microsoft) versions of shim (Versions 0.8 & 0.9)
so not install a security policy by themselves, future Versions of
shim might (a compile time switch exists in rectent git versions),
so in the future this PR might become unnecessary.

7 years agoMerge pull request #5619 from fbuihuu/fully-restore-unit-cgroup-state
Lennart Poettering [Tue, 9 May 2017 18:49:17 +0000 (20:49 +0200)] 
Merge pull request #5619 from fbuihuu/fully-restore-unit-cgroup-state

core: when deserializing a unit, fully restore its cgroup state

7 years agoMerge pull request #5420 from OpenDZ/tixxdz/namespace-fixes-v2
Lennart Poettering [Tue, 9 May 2017 18:42:32 +0000 (20:42 +0200)] 
Merge pull request #5420 from OpenDZ/tixxdz/namespace-fixes-v2

Namespace: RootImage= RootDirectory= and MountAPIVFS fixes

7 years agonetwork: add support for vlan confs(MVRP, reorder header, loose binding) (#5834)
Susant Sahani [Tue, 9 May 2017 18:25:11 +0000 (18:25 +0000)] 
network: add support for vlan confs(MVRP, reorder header, loose binding) (#5834)

7 years agoman: Clarify Restart= exception for systemctl stop (#5891)
Ted W [Tue, 9 May 2017 18:22:04 +0000 (13:22 -0500)] 
man: Clarify Restart= exception for systemctl stop (#5891)

7 years agoMerge pull request #5906 from keszybz/man-links
Lennart Poettering [Tue, 9 May 2017 18:12:52 +0000 (20:12 +0200)] 
Merge pull request #5906 from keszybz/man-links

man page link fixes

7 years agonetworkd: add IPv6ProxyNDP (#5913)
Hristo Venev [Tue, 9 May 2017 18:04:55 +0000 (19:04 +0100)] 
networkd: add IPv6ProxyNDP (#5913)

This allows enabling proxy_ndp even if no addresses are configured in
networkd, as well as disabling proxy_ndp from a drop-in.

7 years agonetworkd: add support to configure route protocol. (#5890)
Susant Sahani [Tue, 9 May 2017 18:01:25 +0000 (18:01 +0000)] 
networkd: add support to configure route protocol. (#5890)

Closes: #5889