platform/upstream/systemd.git
5 years agoMerge pull request #9262 from ssahani/ignore-carrier-9111
Lennart Poettering [Fri, 15 Feb 2019 10:35:43 +0000 (11:35 +0100)]
Merge pull request #9262 from ssahani/ignore-carrier-9111

networkd: allow to retain configs even if carrier is lost

5 years agoresolved: use Cloudflare public DNS server as a default fallback alongside Google one
Ignat Korchagin [Wed, 6 Feb 2019 19:51:28 +0000 (19:51 +0000)]
resolved: use Cloudflare public DNS server as a default fallback alongside Google one

Cloudflare public DNS service is currently the fastest one according to
https://www.dnsperf.com/#!dns-resolvers. Why not improve the experience for
systemd users using this as a default fallback nameserver?

5 years agoMerge pull request #11617 from topimiettinen/backlight-handle-zero-file-load
Lennart Poettering [Fri, 15 Feb 2019 10:32:58 +0000 (11:32 +0100)]
Merge pull request #11617 from topimiettinen/backlight-handle-zero-file-load

backlight: handle loading truncated file

5 years agocore: export $PIDFILE env var for services, derived from PIDFile=
Lennart Poettering [Wed, 30 Jan 2019 16:39:09 +0000 (17:39 +0100)]
core: export $PIDFILE env var for services, derived from PIDFile=

5 years agoMerge pull request #11373 from tomty89/auto
Lennart Poettering [Fri, 15 Feb 2019 10:31:55 +0000 (11:31 +0100)]
Merge pull request #11373 from tomty89/auto

mount/generators: do not make unit wanted by its device unit

5 years agoMerge pull request #11382 from keszybz/udev-predictable-macs
Lennart Poettering [Fri, 15 Feb 2019 10:31:25 +0000 (11:31 +0100)]
Merge pull request #11382 from keszybz/udev-predictable-macs

Allow MACAddressPolicy=persistent for all virtual devices

5 years agoMerge pull request #11506 from bl33pbl0p/reload-fix
Lennart Poettering [Fri, 15 Feb 2019 10:31:00 +0000 (11:31 +0100)]
Merge pull request #11506 from bl33pbl0p/reload-fix

Return -EAGAIN instead of -EALREADY from unit_reload

5 years agorules: watch metadata changes on nbd devices
Tony Asleson [Fri, 8 Feb 2019 21:47:10 +0000 (15:47 -0600)]
rules: watch metadata changes on nbd devices

Include nbd* in match for watch option assignment.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
5 years agotest-network: add test for BindCarrier=
Yu Watanabe [Thu, 7 Feb 2019 05:22:23 +0000 (06:22 +0100)]
test-network: add test for BindCarrier=

5 years agologin: add a missing error check for session_set_leader()
Yu Watanabe [Thu, 14 Feb 2019 01:59:13 +0000 (10:59 +0900)]
login: add a missing error check for session_set_leader()

session_set_leader() may fail. If it fails, then manager_start_scope()
will trigger assertion.

This may be related to RHBZ#1663704.

5 years agoMerge pull request #11718 from yuwata/news-v241
Lennart Poettering [Fri, 15 Feb 2019 10:27:17 +0000 (11:27 +0100)]
Merge pull request #11718 from yuwata/news-v241

Update NEWS

5 years agoNEWS: add entry about 'udevadm trigger --wait-daemon'
Yu Watanabe [Fri, 15 Feb 2019 01:18:14 +0000 (10:18 +0900)]
NEWS: add entry about 'udevadm trigger --wait-daemon'

5 years agoNEWS: fix release date
Yu Watanabe [Fri, 15 Feb 2019 01:15:55 +0000 (10:15 +0900)]
NEWS: fix release date

5 years agomount: remove unused mount_is_auto and mount_is_automount
Tom Yan [Wed, 9 Jan 2019 16:19:43 +0000 (00:19 +0800)]
mount: remove unused mount_is_auto and mount_is_automount

5 years agomount/generators: do not make unit wanted by its device unit
Tom Yan [Wed, 9 Jan 2019 15:35:24 +0000 (23:35 +0800)]
mount/generators: do not make unit wanted by its device unit

As device units will be reloaded by systemd whenever the corresponding device generates a "changed" event, if the mount unit / cryptsetup service is wanted by its device unit, the former can be restarted by systemd unexpectedly after the user stopped them explicitly. It is not sensible at all and can be considered dangerous. Neither is the behaviour conventional (as `auto` in fstab should only affect behaviour on boot and `mount -a`) or ever documented at all (not even in systemd, see systemd.mount(5) and crypttab(5)).

5 years agoRevert "README: remove Coverity Scan badge"
Evgeny Vereshchagin [Thu, 14 Feb 2019 11:04:01 +0000 (14:04 +0300)]
Revert "README: remove Coverity Scan badge"

This reverts commit 49a881e5143cf87e6a02718e92008e12c3334ac0.

5 years agoMerge pull request #11714 from poettering/final-news-241 v241
Zbigniew Jędrzejewski-Szmek [Thu, 14 Feb 2019 10:11:58 +0000 (11:11 +0100)]
Merge pull request #11714 from poettering/final-news-241

final preps for v241

5 years agoupdate hwdb
Lennart Poettering [Thu, 14 Feb 2019 10:03:06 +0000 (11:03 +0100)]
update hwdb

5 years agoNEWS: update for final v241
Lennart Poettering [Thu, 14 Feb 2019 09:58:06 +0000 (10:58 +0100)]
NEWS: update for final v241

5 years agosd-bus: if we receive an invalid dbus message, ignore and proceeed
Lennart Poettering [Wed, 13 Feb 2019 15:51:22 +0000 (16:51 +0100)]
sd-bus: if we receive an invalid dbus message, ignore and proceeed

dbus-daemon might have a slightly different idea of what a valid msg is
than us (for example regarding valid msg and field sizes). Let's hence
try to proceed if we can and thus drop messages rather than fail the
connection if we fail to validate a message.

Hopefully the differences in what is considered valid are not visible
for real-life usecases, but are specific to exploit attempts only.

5 years agoMerge pull request #11704 from yuwata/fix-oss-fuzz-12980
Zbigniew Jędrzejewski-Szmek [Wed, 13 Feb 2019 22:27:12 +0000 (23:27 +0100)]
Merge pull request #11704 from yuwata/fix-oss-fuzz-12980

udev-rule: make rule_add_key() return negative errno when too much tokens

5 years agosd-hwdb: fix matching for characters with an ord > 127
Peter Hutterer [Fri, 8 Feb 2019 00:30:48 +0000 (10:30 +1000)]
sd-hwdb: fix matching for characters with an ord > 127

Devices like the "Microsoft Microsoft® 2.4GHz Transceiver v9.0 Mouse" contain
characters higher than 127. That ® is correctly stored in the hwdb and passed
into the search field during query, but the comparison fails.

Our search string is a const char *, trie_string() returns a const char * but
the current character is cast to uint8_t. This causes anything over 127 to
fail the match. Fix this, we're dealing with characters everywhere here after
all.

5 years agoMerge pull request #11487 from poettering/unprotect-errno
Zbigniew Jędrzejewski-Szmek [Wed, 13 Feb 2019 22:18:13 +0000 (23:18 +0100)]
Merge pull request #11487 from poettering/unprotect-errno

Make sure NSS modules can change errno if they want

5 years agoudev: check whether systemd is running, and do not use cg_kill() if not
Yu Watanabe [Wed, 6 Feb 2019 18:34:13 +0000 (19:34 +0100)]
udev: check whether systemd is running, and do not use cg_kill() if not

Fixes #11645.

5 years agoMerge pull request #11423 from ssahani/issue-9890
Zbigniew Jędrzejewski-Szmek [Wed, 13 Feb 2019 15:37:11 +0000 (16:37 +0100)]
Merge pull request #11423 from ssahani/issue-9890

networkd: honour LinkLocalAddressing

5 years agoMerge pull request #11707 from keszybz/man-directives-spring-cleaning
Lennart Poettering [Wed, 13 Feb 2019 15:35:00 +0000 (16:35 +0100)]
Merge pull request #11707 from keszybz/man-directives-spring-cleaning

systemd.directives(7) spring cleaning

5 years agoman: move sd-login(5) udev tags to the udev section
Zbigniew Jędrzejewski-Szmek [Wed, 13 Feb 2019 10:11:30 +0000 (11:11 +0100)]
man: move sd-login(5) udev tags to the udev section

They are not udev systax exactly, but it seems better to keep them
there.

5 years agoman: add a new section for EFI variables
Zbigniew Jędrzejewski-Szmek [Wed, 13 Feb 2019 10:09:02 +0000 (11:09 +0100)]
man: add a new section for EFI variables

We should probably refer to them from other man pages
for programs which use them, since right now all refs are
in systemd-boot(7). But creating the section is a good step
anyway.

5 years agoman: add a new directives section for .nspawn
Zbigniew Jędrzejewski-Szmek [Wed, 13 Feb 2019 09:57:49 +0000 (10:57 +0100)]
man: add a new directives section for .nspawn

They is quite a bit of those directives and they were in "MISCELLANEOUS" because
they don't quite fit anywhere. When the OCI-compat stuff is merged, there'll
be even more, so let's make a separate section for them.

5 years agoman: move all config file options to one section
Zbigniew Jędrzejewski-Szmek [Wed, 13 Feb 2019 09:49:47 +0000 (10:49 +0100)]
man: move all config file options to one section

We had "SYSTEM MANAGER DIRECTIVES" which was a misnomer already, because
it also listed user manager stuff. Let's make this a more general section
and move the items for other services there too (from "MISCELANENOUS").

5 years agoman: move os-release, machine-info, vconsole.conf vars to envvar section
Zbigniew Jędrzejewski-Szmek [Wed, 13 Feb 2019 09:36:26 +0000 (10:36 +0100)]
man: move os-release, machine-info, vconsole.conf vars to envvar section

Strictly speaking, those are not environment variables, but they are compatible
and people think about them like this. Moving them makes them easier to find.

5 years agoman: use <constant> for SD_BUS_ERROR_* and SD_BUS_NAME_* constants
Zbigniew Jędrzejewski-Szmek [Wed, 13 Feb 2019 09:27:36 +0000 (10:27 +0100)]
man: use <constant> for SD_BUS_ERROR_* and SD_BUS_NAME_* constants

This moves them to the right section in systemd.directives.

5 years agoman: use <varname> for pam configuration options
Zbigniew Jędrzejewski-Szmek [Wed, 13 Feb 2019 09:24:40 +0000 (10:24 +0100)]
man: use <varname> for pam configuration options

It seems to fit the role better, and also the formatting in systemd.directives
is fixes.

5 years agoman: fix markup and grammar for FOU{Source,Destination}Port=
Zbigniew Jędrzejewski-Szmek [Wed, 13 Feb 2019 09:22:18 +0000 (10:22 +0100)]
man: fix markup and grammar for FOU{Source,Destination}Port=

5 years agoman: move entries to the right section in systemd.directives
Zbigniew Jędrzejewski-Szmek [Wed, 13 Feb 2019 09:17:49 +0000 (10:17 +0100)]
man: move entries to the right section in systemd.directives

They were in "miscellaneuos" because of the missing class= assignment.
Probably introduced when the split into sections was done.

5 years agotest: add testcase for oss-fuzz#12980
Yu Watanabe [Tue, 12 Feb 2019 19:16:30 +0000 (04:16 +0900)]
test: add testcase for oss-fuzz#12980

5 years agoudev-rule: make rule_add_key() return negative errno when too much tokens
Yu Watanabe [Tue, 12 Feb 2019 19:13:49 +0000 (04:13 +0900)]
udev-rule: make rule_add_key() return negative errno when too much tokens

As OPTIONS= rule introduce multiple tokens.

Fixes oss-fuzz#12980.

5 years agotest-network: add tests for LinkLocalAddressing=
Yu Watanabe [Tue, 12 Feb 2019 01:28:49 +0000 (10:28 +0900)]
test-network: add tests for LinkLocalAddressing=

5 years agonetworkd: honour LinkLocalAddressing
Susant Sahani [Mon, 11 Feb 2019 12:28:23 +0000 (17:58 +0530)]
networkd: honour LinkLocalAddressing

Closes #9890

5 years agotest: replace echo with socat
Frantisek Sumsal [Tue, 29 Jan 2019 18:33:15 +0000 (19:33 +0100)]
test: replace echo with socat

The original version of the test used netcat along with a standard
AF_UNIX socket, which caused issues across different netcat
implementations. The AF_UNIX socket was then replaced by a FIFO with a
simple echo, which, however, suffers from the same issue (some echo
implementations don't check if the write() was successful).

Let's revert back to the AF_UNIX socket, but replace netcat with socat,
which, hopefully, resolves the main issue.

Relevant commit: 9b45c2bf02a43e3e1b42de1ab0c3fe29c64dc5f5

5 years agocore: when we uninstall a job, add unit to dbus queue
Alberts Muktupāvels [Tue, 12 Feb 2019 01:00:21 +0000 (03:00 +0200)]
core: when we uninstall a job, add unit to dbus queue

Commit e6d05912cb1785d8c75eb40545beb8a7c6753cb9 added unit to dbus
queue on job install. Do same on job uninstall to make sure we get
PropertiesChanged signal.

5 years agoUpdate mount.c
Stephan E [Tue, 12 Feb 2019 13:27:04 +0000 (14:27 +0100)]
Update mount.c

typo in output

5 years agohwdb: Fix rotation for Nuvision Solo 10 Draw (#11686)
Lance [Tue, 12 Feb 2019 14:21:45 +0000 (06:21 -0800)]
hwdb: Fix rotation for Nuvision Solo 10 Draw (#11686)

Model number TM101W610L

This fixes issue #11683

Also add proper label for other Nuvision tablet.

5 years agohwdb: Add accelerometer mount matrix for ASUS MeMO Pad 7 (ME176C)
Stephan Gerhold [Sat, 9 Feb 2019 20:17:18 +0000 (21:17 +0100)]
hwdb: Add accelerometer mount matrix for ASUS MeMO Pad 7 (ME176C)

5 years agotest-json: do not pass ephemeral array as intializer to JSON_BUILD_STRV
Zbigniew Jędrzejewski-Szmek [Sun, 10 Feb 2019 17:31:54 +0000 (18:31 +0100)]
test-json: do not pass ephemeral array as intializer to JSON_BUILD_STRV

Fixes #11600.

The code was effectively doing:
  json_build(..., ({ char **_x = ((char**) ((const char*[]) {"one", "two", "three", "four", NULL })); _x; }));
but there was no guarantee that the storage for the array that _x points to
survives pass the end of the block. Essentially, STRV_MAKE cannot be used
inline inside of a block like this.

5 years agorule-syntax-check: allow PROGRAM as an assignment
Jan Synacek [Wed, 30 Jan 2019 11:22:41 +0000 (12:22 +0100)]
rule-syntax-check: allow PROGRAM as an assignment

5 years agoboot/efi: use a wildcard section copy for final EFI generation
YiFei Zhu [Sat, 26 Jan 2019 16:51:27 +0000 (10:51 -0600)]
boot/efi: use a wildcard section copy for final EFI generation

The GNU gold linker uses the section name `.rela.dyn` instead of
`.rela` for containing the relocation information. If this section
is not copied systemd-boot can crash.

Efitools started using wildcard section copies in their commit
b98d381b, and these wildcard sections are the only difference between
systemd-boot's section copy list and theirs. This patch add the
wildcard section `.rel*` to our objcopy, as it should include all
other wildcards assuming a recent GNU objcopy. Redundant arguments
for sections that would be matched by this wildcard are removed.

This patch has been tested on EDK II UEFI v2.70 Firmware on QEMU, and
Lenovo 0.5120 UEFI 2.40 Firmware on bare metal.

Fixes: #11541

5 years agosemaphore: keep build settings in the repository
Evgeny Vereshchagin [Tue, 29 Jan 2019 02:44:02 +0000 (03:44 +0100)]
semaphore: keep build settings in the repository

It should make it easier to tweak them without having access to
SemaphoreCI itself (I'm glad I'm an admin there now but it shouldn't
be necessary to be an admin to add a couple of kludges :-)). More
importantly, changes to the settings will go through review and
be tested before they're applied globally potentially breaking
Semaphore as it happened two days ago.

I'll point Semaphore CI to these scripts once the PR is merged.

5 years agoman: mention vlan devices inherit the MAC address of the physical interface
Yu Watanabe [Tue, 29 Jan 2019 14:28:52 +0000 (15:28 +0100)]
man: mention vlan devices inherit the MAC address of the physical interface

Follow-up for bc48c51f72d86c6f690724f251892da5657116ac.

Closes #4783.

[zj: tweak grammar a bit.]

5 years agotest-network: use dnsmasq with --dhcp-alternate-port option to test DHCP.ListenPort=
Yu Watanabe [Sat, 9 Feb 2019 12:14:16 +0000 (21:14 +0900)]
test-network: use dnsmasq with --dhcp-alternate-port option to test DHCP.ListenPort=

Fixes #11675.

5 years agoMerge pull request #11647 from thom311/hashmap-avoid-compiler-warning
Zbigniew Jędrzejewski-Szmek [Fri, 8 Feb 2019 17:25:23 +0000 (18:25 +0100)]
Merge pull request #11647 from thom311/hashmap-avoid-compiler-warning

Hashmap avoid compiler warning

5 years agorpm: use sh compatible redirects
Jan Engelhardt [Fri, 8 Feb 2019 14:35:55 +0000 (15:35 +0100)]
rpm: use sh compatible redirects

&> is bash-specific. Switch to something that will work with dash
and pbosh.

5 years agotest-network: add testcases for IgnoreCarrierLoss=
Yu Watanabe [Wed, 6 Feb 2019 11:45:56 +0000 (12:45 +0100)]
test-network: add testcases for IgnoreCarrierLoss=

5 years agonss: unportect errno before writing to NSS' *errnop
Lennart Poettering [Fri, 18 Jan 2019 19:13:55 +0000 (20:13 +0100)]
nss: unportect errno before writing to NSS' *errnop

Fixes: #11321

5 years agoutil.h: add new UNPROTECT_ERRNO macro
Lennart Poettering [Fri, 18 Jan 2019 19:04:13 +0000 (20:04 +0100)]
util.h: add new UNPROTECT_ERRNO macro

THis is inspired by #11395, but much simpler.

5 years agoautomount: don't pass non-blocking pipe to kernel.
NeilBrown [Thu, 7 Feb 2019 22:44:06 +0000 (09:44 +1100)]
automount: don't pass non-blocking pipe to kernel.

Creating a pipe with O_NONBLOCK causes both the read and the write end to
be marked as non-blocking.
The "write" end is passed to the kernel autofs module, and it does not
expect a non-blocking pipe.  If it gets -EAGAIN when trying to write
(which is unlikely, but not completely impossible), it will close the
write end of the pipe, which leads to unexpected errors.

So change the code to only set O_NONBLOCK on the "read" end of the
pipe.  This is the only end that systemd interacts with, so the only end
it should be configuring.

5 years agoMerge pull request #11578 from keszybz/gcc-9-fixes
Lennart Poettering [Thu, 7 Feb 2019 14:25:05 +0000 (15:25 +0100)]
Merge pull request #11578 from keszybz/gcc-9-fixes

Packed struct alignment workarounds for gcc-9

5 years agoMerge pull request #11655 from yuwata/fix-11652
Lennart Poettering [Thu, 7 Feb 2019 14:01:31 +0000 (15:01 +0100)]
Merge pull request #11655 from yuwata/fix-11652

sd-device: fix device_copy_properties()

5 years agoMerge pull request #11659 from yuwata/fix-11643
Lennart Poettering [Thu, 7 Feb 2019 13:54:07 +0000 (14:54 +0100)]
Merge pull request #11659 from yuwata/fix-11643

import: fix invalid error check and use after free

5 years agoMerge pull request #11663 from yuwata/follow-up-10712
Lennart Poettering [Thu, 7 Feb 2019 13:46:35 +0000 (14:46 +0100)]
Merge pull request #11663 from yuwata/follow-up-10712

core: make PIDFile= accept empty assignment

5 years agosd-daemon: make sd_booted() return negative errno on unexpected error
Yu Watanabe [Wed, 6 Feb 2019 18:07:34 +0000 (19:07 +0100)]
sd-daemon: make sd_booted() return negative errno on unexpected error

5 years agocore/dbus-service: empty assignment to PIDFile= resets the value
Yu Watanabe [Wed, 6 Feb 2019 16:52:41 +0000 (17:52 +0100)]
core/dbus-service: empty assignment to PIDFile= resets the value

Follow-up for a9353a5c5b512f107955e56a9812724f40b841d3.

5 years agocore/dbus-service: write PIDFile= setting to transient unit file
Yu Watanabe [Wed, 6 Feb 2019 16:44:59 +0000 (17:44 +0100)]
core/dbus-service: write PIDFile= setting to transient unit file

Follow-up for a9353a5c5b512f107955e56a9812724f40b841d3.

5 years agocore/load-fragment: empty assignment to PIDFile= resets the value
Yu Watanabe [Wed, 6 Feb 2019 16:41:26 +0000 (17:41 +0100)]
core/load-fragment: empty assignment to PIDFile= resets the value

Follow-up for a9353a5c5b512f107955e56a9812724f40b841d3.

5 years agocurl-util: fix use after free
Yu Watanabe [Wed, 6 Feb 2019 15:18:58 +0000 (16:18 +0100)]
curl-util: fix use after free

This fixes a bug introduced by c3e658004a66115fa09abcf602d573e65e577aa9.

5 years agopull: fix invalid error check
Yu Watanabe [Wed, 6 Feb 2019 15:17:59 +0000 (16:17 +0100)]
pull: fix invalid error check

This fixes a bug introduced by 0d94088e4e9e00f5ca9afdb8e68c94558fe23268.

5 years agotest-network: ignore tunnel devices automatically added by kernel
Yu Watanabe [Wed, 6 Feb 2019 11:02:15 +0000 (12:02 +0100)]
test-network: ignore tunnel devices automatically added by kernel

Fixes #10934.

5 years agonetworkd: Allow to retain configs even if carrier is lost
Susant Sahani [Fri, 1 Jun 2018 09:34:49 +0000 (15:04 +0530)]
networkd: Allow to retain configs even if carrier is lost

When there is bad link in the network the carrier goes up/down.
This makes networkd stops all the clients and drop config.
But if the remote router/dhcpserver running a prevention
of DHCP Starvation attack or DHCP Flood attack it does not allow
networkd to take a DHCP lease resulting failure in configuration.
This patch allows to keep the client running and keep the conf
also for this scenario.

Closes #9111

5 years agoMerge pull request #11656 from yuwata/test-network-routing-policy-rule-check-kernel
Frantisek Sumsal [Wed, 6 Feb 2019 10:14:11 +0000 (11:14 +0100)]
Merge pull request #11656 from yuwata/test-network-routing-policy-rule-check-kernel

test-network: check port range and ipproto attributs are supported by kernel and ip command

5 years agotest-network: check port range and ipproto attributes are supported by kernel and...
Yu Watanabe [Wed, 6 Feb 2019 08:27:28 +0000 (09:27 +0100)]
test-network: check port range and ipproto attributes are supported by kernel and ip command

5 years agotest: add a test case for issue #11652
Yu Watanabe [Wed, 6 Feb 2019 07:43:34 +0000 (08:43 +0100)]
test: add a test case for issue #11652

5 years agosd-device: fix device_copy_properties()
Yu Watanabe [Wed, 6 Feb 2019 07:36:48 +0000 (08:36 +0100)]
sd-device: fix device_copy_properties()

This fixes a bug introduced by a3ce813697bcc1c4644e097a2f1cd0459326d6ee.

Fixes #11652.

5 years agotest-sizeof: print the alignments too
Zbigniew Jędrzejewski-Szmek [Tue, 5 Feb 2019 17:56:41 +0000 (18:56 +0100)]
test-sizeof: print the alignments too

5 years agoefivars: remove direct access to unaligned structure members
Zbigniew Jędrzejewski-Szmek [Tue, 5 Feb 2019 16:35:39 +0000 (17:35 +0100)]
efivars: remove direct access to unaligned structure members

Most of the accesses *were* aligned. The only one that definetely wasn't was to
drive_path->part_start and drive_path->part_size, because those both expect
8 byte alignment, and are at offsets 4 and 12 in the packed structure.

Because of the way that device_path structure is defined and used, we expect
that device_path.length is always two-byte aligned.

This adds asserts in various places to ensure the proper alignment, and uses
memcpy in other places where the alignment might be off.

5 years agoefivars: make sure that _packed_ structure members are actually aligned as expected
Zbigniew Jędrzejewski-Szmek [Tue, 5 Feb 2019 16:05:56 +0000 (17:05 +0100)]
efivars: make sure that _packed_ structure members are actually aligned as expected

When looking for the terminating double-NUL, don't just read the memory
until the terminator is found, but use the information we got about the
buffer size.

The length parameter passed to utf16_to_utf8() would include the terminator, so
the converted string would end up with two terminators (the original one
converted to "utf8", still 0, and then the one that was always added anyway).
Instead let's pass just the length of the actual data to utf16_to_utf8().

5 years agoudevadm info: "-a" should enumerate sysfs attributes, not envs (#11642)
Mantas Mikulėnas [Tue, 5 Feb 2019 04:30:49 +0000 (06:30 +0200)]
udevadm info: "-a" should enumerate sysfs attributes, not envs (#11642)

This fixes a bug introduced by 13aca847695f49afeb93367ecdad76035fa6c139.

5 years agotest-resolve: increase timeout to 120s
Zbigniew Jędrzejewski-Szmek [Sun, 27 Jan 2019 17:43:41 +0000 (18:43 +0100)]
test-resolve: increase timeout to 120s

The test queries some domain names. If the DNS servers are unreachable,
e.g. in a rawhide container I get the total runtime of 24.5s usually, but
sometimes slightly longer, enough to reach the default timeout of 30s.

5 years agojournal: drop _packed_ attribute in a few places
Zbigniew Jędrzejewski-Szmek [Sun, 27 Jan 2019 17:04:22 +0000 (18:04 +0100)]
journal: drop _packed_ attribute in a few places

The justification is the safe as for the grandparent commit.

5 years agotest-util: drop _packed_ attribute
Zbigniew Jędrzejewski-Szmek [Sun, 27 Jan 2019 16:13:42 +0000 (17:13 +0100)]
test-util: drop _packed_ attribute

gcc-9 warns:
../src/test/test-util.c:147:19: note: in expansion of macro ‘container_of’
  147 |         assert_se(container_of(&myval.v1, struct mytype, v1) == &myval);
      |                   ^~~~~~~~~~~~

I don't think packing matters here for the test of container_of(), so let's
just remove it.

5 years agolibsystemd-network: remove _packed_ attribute to appease the compiler
Zbigniew Jędrzejewski-Szmek [Sun, 27 Jan 2019 16:09:21 +0000 (17:09 +0100)]
libsystemd-network: remove _packed_ attribute to appease the compiler

gcc-9 warns whenever the elements of a structure defined with _packed_ are used:

../src/network/networkd-dhcp6.c: In function ‘dhcp6_pd_prefix_assign’:
../src/network/networkd-dhcp6.c:92:53: warning: taking address of packed member of ‘struct <anonymous>’ may result in an unaligned pointer value [-Waddress-of-packed-member]
   92 |         r = manager_dhcp6_prefix_add(link->manager, &p->opt.in6_addr, link);
      |                                                     ^~~~~~~~~~~~~~~~

And the compiler is right, because in principle the alignment could be wrong.
In this particular case it is not, because the structure is carefully defined
not to have holes. Let's remove _packed_ and use compile-time asserts to verify
that the offsets are not changed.

5 years agoanalyze security: fix recursive call of syscall_names_in_filter()
Yu Watanabe [Fri, 1 Feb 2019 10:49:24 +0000 (11:49 +0100)]
analyze security: fix recursive call of syscall_names_in_filter()

When `syscall_names_in_filter()` is called in itself, it is already
examined with `whitelist`. Or, in other words, `syscall_names_in_filter()`
returns bad or good in boolean. So, the returned value should not be
compared with `whitelist` again.

This replaces #11302.

5 years agoportable: document /etc/machine-id and /etc/resolv.conf
Дамјан Георгиевски [Thu, 31 Jan 2019 13:28:59 +0000 (14:28 +0100)]
portable: document /etc/machine-id and /etc/resolv.conf

… requirement for portable service images.

systemd will mount the host machine-id and resolv.conf at these
locations, so for read-only images these must exist in the image,
because they can't be created.

5 years agohwdb: Add support for Gemini NC14 keyboard
Jonathan McDowell [Thu, 31 Jan 2019 13:32:24 +0000 (13:32 +0000)]
hwdb: Add support for Gemini NC14 keyboard

5 years agomachinectl: fix argument index in error log
Yu Watanabe [Sat, 2 Feb 2019 14:03:17 +0000 (15:03 +0100)]
machinectl: fix argument index in error log

Fixes #11628.

5 years agoMerge pull request #11641 from ffontaine/master
Lennart Poettering [Mon, 4 Feb 2019 10:02:54 +0000 (11:02 +0100)]
Merge pull request #11641 from ffontaine/master

fix build without BRIDGE_VLAN_INFO_RANGE_END or IFA_F_NOPREFIXROUTE

5 years agoMerge pull request #11621 from yuwata/man-ref-systemd-system-conf
Lennart Poettering [Mon, 4 Feb 2019 09:46:45 +0000 (10:46 +0100)]
Merge pull request #11621 from yuwata/man-ref-systemd-system-conf

man: add and fix references

5 years agoNEWS fix boolean value for meson options
Christian Hesse [Mon, 4 Feb 2019 09:34:11 +0000 (10:34 +0100)]
NEWS fix boolean value for meson options

Valid boolean values for meson are 'true' and 'false',
not 'yes' and 'no'.

5 years agohashmap: always set key output argument of internal_hashmap_first_key_and_value()
Thomas Haller [Mon, 4 Feb 2019 08:36:17 +0000 (09:36 +0100)]
hashmap: always set key output argument of internal_hashmap_first_key_and_value()

internal_hashmap_first_key_and_value() returns the first value, or %NULL
if the hashmap is empty.

However, hashmaps may contain %NULL values. That means, a caller getting
%NULL doesn't know whether the hashmap is empty or whether the first
value is %NULL.

For example, a caller may be tempted to do something like:

    if ((val = hashmap_steal_first_key_and_value (h, (void **) key))) {
         // process first entry.
    }

But this is only correct if the caller made sure that the hash is either
not empty or contains no NULL values.

Anyway, since a %NULL return value can signal an empty hash or a %NULL
value, it seems error prone to leave the key output argument
uninitialized in situations that the caller cannot clearly distinguish
(without making additional assumptions).

5 years agohashmap: avoid uninitialized variable warning in internal_hashmap_clear()
Thomas Haller [Sun, 3 Feb 2019 11:56:24 +0000 (12:56 +0100)]
hashmap: avoid uninitialized variable warning in internal_hashmap_clear()

GCC 8.2 with LTO and -O2 emits a false warning:

    src/basic/hashmap.c: In function 'internal_hashmap_free.constprop':
    src/basic/hashmap.c:898:33: error: 'k' may be used uninitialized in this function [-Werror=maybe-uninitialized]
                      free_key(k);
                      ^

Avoid it by initializing the variable.

5 years agohwdb: Add key-mapping for GPIO-keys on HP stream 7 tablet (#11631)
Hans de Goede [Sun, 3 Feb 2019 22:58:39 +0000 (23:58 +0100)]
hwdb: Add key-mapping for GPIO-keys on HP stream 7 tablet (#11631)

The HP stream 7 ACPI tables contains a gpio-keys entry for a non connected
GPIO causing spurious events, this commit maps this key to unknown to
disable it.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=202279
5 years agoAdd another entry for MX Master to 70-mouse.hwdb (#11633)
Claudius Ellsel [Sun, 3 Feb 2019 22:39:34 +0000 (23:39 +0100)]
Add another entry for MX Master to 70-mouse.hwdb (#11633)

5 years agonetworkd-dhcp6.c: fix build without IFA_F_NOPREFIXROUTE
Fabrice Fontaine [Sun, 3 Feb 2019 17:38:10 +0000 (18:38 +0100)]
networkd-dhcp6.c: fix build without IFA_F_NOPREFIXROUTE

systemd fails to build on kernel without IFA_F_NOPREFIXROUTE
since 9714c02

So put include missing_network.h

Fixes:
 - http://autobuild.buildroot.org/results/970b09e1d49b53dff12a07ca4ad424ef9dd29a69

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
5 years agonetworkd-address.c: fix build without IFA_F_NOPREFIXROUTE
Fabrice Fontaine [Sun, 3 Feb 2019 17:33:39 +0000 (18:33 +0100)]
networkd-address.c: fix build without IFA_F_NOPREFIXROUTE

systemd fails to build on kernel without IFA_F_NOPREFIXROUTE
since 9714c02

So put include missing_network.h

Fixes:
 - http://autobuild.buildroot.org/results/970b09e1d49b53dff12a07ca4ad424ef9dd29a69

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
5 years agonetworkd-ndisc.c: fix build without IFA_F_NOPREFIXROUTE
Fabrice Fontaine [Sun, 3 Feb 2019 17:28:16 +0000 (18:28 +0100)]
networkd-ndisc.c: fix build without IFA_F_NOPREFIXROUTE

systemd fails to build on kernel without IFA_F_NOPREFIXROUTE
since 9714c02

So put include missing_network.h

Fixes:
 - http://autobuild.buildroot.org/results/970b09e1d49b53dff12a07ca4ad424ef9dd29a69

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
5 years agonetworkd-brvlan.c: fix build without BRIDGE_VLAN_INFO_RANGE_END
Fabrice Fontaine [Sun, 3 Feb 2019 16:32:46 +0000 (17:32 +0100)]
networkd-brvlan.c: fix build without BRIDGE_VLAN_INFO_RANGE_END

systemd fails to build on kernel without BRIDGE_VLAN_INFO_RANGE_END
since 9714c02

So put include missing_if_bridge.h

Fixes:
 - http://autobuild.buildroot.org/results/970b09e1d49b53dff12a07ca4ad424ef9dd29a69

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
5 years agoMerge pull request #11637 from yuwata/fix-test-network
Frantisek Sumsal [Sun, 3 Feb 2019 12:33:47 +0000 (13:33 +0100)]
Merge pull request #11637 from yuwata/fix-test-network

test-network: fix test_dhcp_server() and test_ipv6_prefix_delegation()

5 years agotravis: stop using the official upstream-systemd-ci repository
Evgeny Vereshchagin [Sun, 3 Feb 2019 05:07:23 +0000 (06:07 +0100)]
travis: stop using the official upstream-systemd-ci repository

Turns out the key for the repository hasn't been propagated properly
so let's restore the kludge that was removed in https://github.com/systemd/systemd/pull/11582.
Of course it's ugly but at least it works.

The issue was kind of reported to the maintainers of the repository
in https://github.com/systemd/systemd/pull/11531#issuecomment-460023474.

5 years agotest-network: add or drop whitespace
Yu Watanabe [Sun, 3 Feb 2019 03:37:51 +0000 (04:37 +0100)]
test-network: add or drop whitespace

5 years agotest-network: fix test_dhcp_server() and test_ipv6_prefix_delegation()
Yu Watanabe [Sun, 3 Feb 2019 03:36:36 +0000 (04:36 +0100)]
test-network: fix test_dhcp_server() and test_ipv6_prefix_delegation()

The tests have been broken since 30d3b54ebad41082e99cabbee815cb113aa0b5c4.

5 years agoDetect file truncation earlier in a few places
Topi Miettinen [Fri, 1 Feb 2019 21:52:00 +0000 (23:52 +0200)]
Detect file truncation earlier in a few places

Users of read_one_line_file() for APIVFS entries are ignored as they are
assumed to never get truncated.