Commit Graph

21803 Commits

Author SHA1 Message Date
Yu Watanabe 0de4876496 core/socket: fix memleak in the error paths in usbffs_dispatch_eps() 2018-09-03 14:25:08 +09:00
Renaud Métrich fd790d6f09 journald: fixed assertion failure when system journal rotation fails (#9893) 2018-09-03 12:42:39 +09:00
Evgeny Vereshchagin a70f343cac tests: add a rudimentary fuzzer for server_process_syslog_message (#9979) 2018-09-03 12:18:26 +09:00
Yu Watanabe 645461f0cf
cryptsetup: do not define arg_sector_size if libgcrypt is v1.x (#9990)
Follow-up for #9936.
2018-09-01 23:47:46 +09:00
Yu Watanabe 0c09cb0e78
Merge pull request #9977 from sourcejedi/no-remount-superblock3
Namespace fixes
2018-09-01 23:18:01 +09:00
Alan Jenkins fcac12d150 namespace: remove redundant .has_prefix=false
The MountEntry's added for EMPTY_DIR work very similarly to the TMPFS ones.
In both cases, .has_prefix is false.  In fact, .has_prefix is false in
*all* the MountEntry's we add except for the access mounts (READONLY etc).

But EMPTY_DIR stuck out by explicitly setting .has_prefix = false.
Let's remove that.
2018-09-01 17:23:01 +09:00
Alan Jenkins 4a756839e6 namespace: we always use a root_directory now
We changed to always setup the new namespace in a separate directory
(commit 0722b35)
2018-09-01 17:23:01 +09:00
Alan Jenkins ad8e66dcc4 namespace: fix mode for TemporaryFileSystem=
... when no mount options are passed.

Change the code, to avoid the following failure in the newly added tests:

exec-temporaryfilesystem-rw.service: Executing: /usr/bin/sh -x -c
'[ "$(stat -c %a /var)" == 755 ]'
++ stat -c %a /var
+ '[' 1777 == 755 ']'
Received SIGCHLD from PID 30364 (sh).
Child 30364 (sh) died (code=exited, status=1/FAILURE)

(And I spotted an opportunity to use TAKE_PTR() at the end).
2018-09-01 17:22:14 +09:00
Alan Jenkins 69338c3dfb namespace: don't try to remount superblocks
We can't remount the underlying superblocks, if we are inside a user
namespace and running Linux <= 4.17.  We can only change the per-mount
flags (MS_REMOUNT | MS_BIND).

This type of mount() call can only change the per-mount flags, so we
don't have to worry about passing the right string options now.

Fixes #9914 ("Since 1beab8b was merged, systemd has been failing to start
systemd-resolved inside unprivileged containers" ... "Failed to re-mount
'/run/systemd/unit-root/dev' read-only: Operation not permitted").

> It's basically my fault :-). I pointed out we could remount read-only
> without MS_BIND when reviewing the PR that added TemporaryFilesystem=,
> and poettering suggested to change PrivateDevices= at the same time.
> I think it's safe to change back, and I don't expect anyone will notice
> a difference in behaviour.
>
> It just surprised me to realize that
> `TemporaryFilesystem=/tmp:size=10M,ro,nosuid` would not apply `ro` to the
> superblock (underlying filesystem), like mount -osize=10M,ro,nosuid does.
> Maybe a comment could note the kernel version (v4.18), that lets you
> remount without MS_BIND inside a user namespace.

This makes the code longer and I guess this function is still ugly, sorry.
One obstacle to cleaning it up is the interaction between
`PrivateDevices=yes` and `ReadOnlyPaths=/dev`.  I've added a test for the
existing behaviour, which I think is now the correct behaviour.
2018-08-30 11:17:16 +01:00
Yu Watanabe 7a3c343cb8 tree-wide: use '#pragma once' for header guard
Follow-up for a2b635eb39 (#9959).
2018-08-30 06:10:43 +03:00
Alan Jenkins 8f8112f916 resolve: update comment, avoid alarming wrongness
`systemd-resolved.service` runs as `User=systemd-resolved`, and uses certain
Capabilit{y,ies} magic. By my understanding, this means it is started with a
number of "privileges".  Indeed, `capabilities(7)` explains

> Linux divides  the  privileges  traditionally
> associated  with  superuser into distinct units, known as capabilities,
> which can be independently enabled and disabled."

This situation appears to contradict our current code comment which said

> If we are not running as root we assume all privileges are already dropped.

This appears to be a confusion in the comment only.  The rest of the code
tells a much clearer story.  (Don't ask me if the story is correct.
`capabilities(7)` scares me).  Let's tweak the comment to make it consistent
and avoid worrying readers about this.
2018-08-29 18:07:06 +02:00
Sjoerd Simons 9e2acd1d24 fd-util: accept that kcmp might fail with EPERM/EACCES
In a container the kcmp call might well be blocked; Accept that and fall
back to fstat in that case.
2018-08-29 17:53:00 +02:00
Samuel Morris c68867da32 systemctl: if no logind, don't try to schedule shutdown
If logind is not supported, don't try to schedule a shutdown,
immediately poweroff. This is the behavior indicated by the current
message given to the user, but the command is returning an error. I
believe this was broken on this commit:
7f96539d45
2018-08-29 17:51:53 +02:00
Zbigniew Jędrzejewski-Szmek 31e775ec38
Merge pull request #9959 from yuwata/small-fixes
tiny fixes and a cleanup
2018-08-29 17:47:00 +02:00
Yu Watanabe efa1463693 test: fix a memleak
Follow-up for #9901.

Fixes #9968.
2018-08-29 17:45:37 +02:00
Dimitri John Ledkov a9fc640671 cryptsetup: add support for sector-size= option (#9936)
Bug-Ubuntu: https://launchpad.net/bugs/1776626

Closes #8881.
2018-08-29 23:38:09 +09:00
Yu Watanabe a2b635eb39 sd-boot: fix header guard
Follow-up for a42d7cf165.
2018-08-29 23:05:15 +09:00
Yu Watanabe 3343021755 dynamic-user: drop unnecessary initialization 2018-08-29 23:04:26 +09:00
Zbigniew Jędrzejewski-Szmek 030836923d
Merge pull request #9901 from peterbaouoft/pr/preset_enable_multiple_instances
install: allow instantiated units to be enabled via presets
2018-08-29 14:22:27 +02:00
Yu Watanabe 22ac37aa00 string-table: do not ignore 'scope' argument 2018-08-28 12:40:25 +09:00
Yu Watanabe e094eb1188
Merge pull request #9950 from yuwata/macro-ref-unref
tree-wide: introduce macros to define *_ref() and *_unref() functions
2018-08-28 10:43:25 +09:00
Ruixin Bao 1e475a0ab4 install: small refactor to combine two function calls into one function
Combine consecutive function calls of install_info_discover and
install_info_may_process into one short helper function.
2018-08-27 23:56:31 +00:00
Ruixin Bao 4c9565eea5 install: allow instantiated units to be enabled via presets
This patch implements https://github.com/systemd/systemd/issues/9421.

The .preset file now is able to take a rule in the format of:(e.g)
enable foo@.service bar0 bar1 bar2

In the above example, when preset-all is called, all three instances of
foo@bar0.service, foo@bar1.service and foo@bar2.service will be enabled.

When preset is called on a single service(e.g: foo@bar1.service), only
the mentioned one(foo@bar1.service) will be enabled.

Tests are added for future regression.
2018-08-27 23:56:24 +00:00
Yu Watanabe 4005d3215e sd-device: sd_device_enumerator_get_subsystem_next() requests the device list is uptodate 2018-08-28 05:09:40 +09:00
Yu Watanabe 6116d2b275 sd-device: use structured initializers 2018-08-28 05:09:40 +09:00
Yu Watanabe 1c71f7f329 libsystemd: use DEFINE_ATOMIC_REF_UNREF_FUNC or frineds where applicable 2018-08-28 05:09:40 +09:00
Yu Watanabe 1d3044e275 refcnt: introduce DEFINE_ATOMIC_REF_UNREF_FUNC() macro and friends 2018-08-28 05:09:40 +09:00
Yu Watanabe 6b6e07415c sd-netlink: fix indentation 2018-08-28 05:09:40 +09:00
Yu Watanabe 61e21d4ca1 sd-hwdb: drop unused variable 2018-08-28 05:09:40 +09:00
Yu Watanabe 288ca7af8c dynamic-user: fix potential segfault 2018-08-28 05:09:00 +09:00
Zbigniew Jędrzejewski-Szmek 649010a53d
Merge pull request #9935 from pfl/dhcp6_pd_assignment_fix
Dhcp6 pd assignment fix
2018-08-27 14:49:11 +02:00
Thomas Haller 3301f9eb97 link: allocate correct number of bytes in ethtool_set_features()
sfeatures is a "struct ethtool_sfeatures". Use sizeof() on the correct
data type.

Since "struct ethtool_gstrings" is larger than "struct ethtool_sfeatures",
this had no serious consequences.

Fixes: 50725d10e3
2018-08-27 14:14:30 +02:00
Yu Watanabe 8301aa0bf1 tree-wide: use DEFINE_TRIVIAL_REF_UNREF_FUNC() macro or friends where applicable 2018-08-27 14:01:46 +09:00
Yu Watanabe a6a08596ef macro: introduce DEFINE_TRIVIAL_REF_UNREF_FUNC() macro and friends 2018-08-27 14:01:27 +09:00
Yu Watanabe cf4b2f9906 tree-wide: use unsigned for refcount 2018-08-27 13:48:04 +09:00
Patrik Flykt eb75b919e8 networkd-dhcp6: Improve logging on DHCPv6 PD assignment
Print out prefixes assigned to links in addition to the DHCPv6
prefix it was delegated from.
2018-08-24 09:53:46 -06:00
Patrik Flykt ef5df4e5c5 networkd-dhcp6: Fix logging of DHCPv6 prefix
Pretty-print log messages with DHCPv6 prefixes after the prefixes
have been set instead of some random unassigned stack values.
2018-08-24 09:53:46 -06:00
Patrik Flykt 37f52406d9 networkd-dhcp6: Fix PD prefix length for subnet assignment
When computing the next network prefix to assign, compute the next
prefix to allocate based on the intended /64 assignment, not the
given prefix length for the whole prefix, e.g. /48, given to
systemd-networkd.

Fixes #9626.
2018-08-24 09:53:46 -06:00
Patrik Flykt 3ec8303fdc networkd-dhcp6: Log warning with PD prefixes shorter than 48
Log a warning message in case the network prefix delegated is shorter
than /48.
2018-08-24 09:53:45 -06:00
Yu Watanabe 7ecc4799a9
dissect: rescan devices before creating partition list (#9930)
Fixes #9924 which is caused by 3c1f2cee0a.
2018-08-24 22:34:13 +09:00
Franck Bui 49679ff70f logind: make use of vtnr_from_tty() in seat_read_active_vt() (#9923)
No functional changes.
2018-08-24 16:20:51 +09:00
Yu Watanabe 593a5213ce
Merge pull request #9917 from keszybz/cleanups
Some unrelated fixups for recent PRs
2018-08-24 10:43:41 +09:00
Zbigniew Jędrzejewski-Szmek e6a2feb57d
Merge pull request #8135 from shawnl/arg_host
sd-bus: rework host handling
2018-08-23 13:46:54 +02:00
Zbigniew Jędrzejewski-Szmek e3bb989b6f network: adjust some error messages
The option is now called simply "Encapsulation=".

Also, "ignoring" is rather misleading, because we use to to mean that some line
is being ignored. Here the whole tunnel is dropped.
2018-08-23 11:43:28 +02:00
Zbigniew Jędrzejewski-Szmek ab4dd98476 network: reword some error messages
Use "falling back" instead of "fallback".

Also, it's not an application-specific machine ID, but rather an
application-and-machine-specific ID.  Let's call it "app-machine-speicific" for
short.
2018-08-23 11:32:55 +02:00
Zbigniew Jędrzejewski-Szmek 181c4ba750 test-socket-util: avoid "memleak" reported by valgrind
valgrind reports the allocation done in the short-lived child as a leak.
Let's restructure the code to avoid this.
2018-08-23 11:30:57 +02:00
Zbigniew Jędrzejewski-Szmek b5d6f7ead6 analyze: use temporary var to simplify code 2018-08-23 11:30:57 +02:00
Susant Sahani 53cb501a13 networkd and sd-netlink: add support for Generic netlink And FooOverUDP to IPIP tunnel
This work add support to generic netlink to sd-netlink.
See https://lwn.net/Articles/208755/

networkd: add support FooOverUDP support to IPIP tunnel netdev
https://lwn.net/Articles/614348/

Example conf:

/lib/systemd/network/1-fou-tunnel.netdev
```
[NetDev]
Name=fou-tun
Kind=fou

[FooOverUDP]
Port=5555
Protocol=4

```

/lib/systemd/network/ipip-tunnel.netdev
```
[NetDev]
Name=ipip-tun
Kind=ipip

[Tunnel]
Independent=true
Local=10.65.208.212
Remote=10.65.208.211
FooOverUDP=true
FOUDestinationPort=5555
```

$ ip -d link show ipip-tun
```
5: ipip-tun@NONE: <POINTOPOINT,NOARP> mtu 1472 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ipip 10.65.208.212 peer 10.65.208.211 promiscuity 0
    ipip remote 10.65.208.211 local 10.65.208.212 ttl inherit pmtudisc encap fou encap-sport auto encap-dport 5555 noencap-csum noencap-csum6 noencap-remcsum numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
```
2018-08-23 11:30:37 +02:00
Zbigniew Jędrzejewski-Szmek c07fe6d0df Merge pull request #9406 from yuwata/rfe-9228
Trivial conflict solved in merge and include net/if_arp.h added.
2018-08-23 11:11:13 +02:00
Susant Sahani 708c425d0a Networkd: Start DHCP server when link is up.
Closes #9479
2018-08-23 10:03:30 +02:00