Chris Down [Thu, 28 Mar 2019 12:50:50 +0000 (12:50 +0000)]
cgroup: Implement default propagation of MemoryLow with DefaultMemoryLow
In cgroup v2 we have protection tunables -- currently MemoryLow and
MemoryMin (there will be more in future for other resources, too). The
design of these protection tunables requires not only intermediate
cgroups to propagate protections, but also the units at the leaf of that
resource's operation to accept it (by setting MemoryLow or MemoryMin).
This makes sense from an low-level API design perspective, but it's a
good idea to also have a higher-level abstraction that can, by default,
propagate these resources to children recursively. In this patch, this
happens by having descendants set memory.low to N if their ancestor has
DefaultMemoryLow=N -- assuming they don't set a separate MemoryLow
value.
Any affected unit can opt out of this propagation by manually setting
`MemoryLow` to some value in its unit configuration. A unit can also
stop further propagation by setting `DefaultMemoryLow=` with no
argument. This removes further propagation in the subtree, but has no
effect on the unit itself (for that, use `MemoryLow=0`).
Our use case in production is simplifying the configuration of machines
which heavily rely on memory protection tunables, but currently require
tweaking a huge number of unit files to make that a reality. This
directive makes that significantly less fragile, and decreases the risk
of misconfiguration.
After this patch is merged, I will implement DefaultMemoryMin= using the
same principles.
Lennart Poettering [Fri, 12 Apr 2019 11:59:30 +0000 (13:59 +0200)]
Merge pull request #12222 from yuwata/macsec
network: introduce MACsec
Lennart Poettering [Fri, 12 Apr 2019 11:51:53 +0000 (13:51 +0200)]
Merge pull request #12217 from keszybz/unlocked-operations
Refactor how we do unlocked file operations
Zbigniew Jędrzejewski-Szmek [Fri, 12 Apr 2019 10:12:18 +0000 (12:12 +0200)]
Merge pull request #12289 from poettering/news-pid-max
NEWS: explain the kernel.pid_max sysctl change
Lennart Poettering [Fri, 12 Apr 2019 10:01:41 +0000 (12:01 +0200)]
NEWS: document kernel.pid_max change
Lennart Poettering [Fri, 12 Apr 2019 10:01:23 +0000 (12:01 +0200)]
NEWS: fix typo
Zbigniew Jędrzejewski-Szmek [Thu, 4 Apr 2019 10:24:38 +0000 (12:24 +0200)]
Add fmemopen_unlocked() and use unlocked ops in fuzzers and some other tests
This might make things marginially faster. I didn't benchmark though.
Zbigniew Jędrzejewski-Szmek [Thu, 4 Apr 2019 09:46:44 +0000 (11:46 +0200)]
Add open_memstream_unlocked() wrapper
Zbigniew Jędrzejewski-Szmek [Thu, 4 Apr 2019 09:27:21 +0000 (11:27 +0200)]
core/smack-setup: add helper function for openat+fdopen
Unlocked operations are used in all three places. I don't see why just one was
special.
This also improves logging, since we don't just log the final component of the
path, but the full name.
Zbigniew Jędrzejewski-Szmek [Thu, 4 Apr 2019 09:27:08 +0000 (11:27 +0200)]
Add fdopen_unlocked() wrapper
Zbigniew Jędrzejewski-Szmek [Thu, 4 Apr 2019 09:02:11 +0000 (11:02 +0200)]
Make fopen_temporary and fopen_temporary_label unlocked
This is partially a refactoring, but also makes many more places use
unlocked operations implicitly, i.e. all users of fopen_temporary().
AFAICT, the uses are always for short-lived files which are not shared
externally, and are just used within the same context. Locking is not
necessary.
Zbigniew Jędrzejewski-Szmek [Thu, 4 Apr 2019 08:17:16 +0000 (10:17 +0200)]
Add fopen_unlocked() wrapper
Lennart Poettering [Fri, 12 Apr 2019 09:02:54 +0000 (11:02 +0200)]
Merge pull request #12221 from keszybz/test-cleanups
Script indentation cleanups
Lennart Poettering [Fri, 12 Apr 2019 08:56:53 +0000 (10:56 +0200)]
Merge pull request #12287 from keszybz/patches-for-coverity-warnings
Patches for coverity warnings
Anita Zhang [Wed, 10 Apr 2019 23:08:41 +0000 (16:08 -0700)]
seccomp: check more error codes from seccomp_load()
We noticed in our tests that occasionally SystemCallFilter= would
fail to set and the service would run with no syscall filtering.
Most of the time the same tests would apply the filter and fail
the service as expected. While it's not totally clear why this happens,
we noticed seccomp_load() in the systemd code base would fail open for
all errors except EPERM and EACCES.
ENOMEM, EINVAL, and EFAULT seem like reasonable values to add to the
error set based on what I gather from libseccomp code and man pages:
-ENOMEM: out of memory, failed to allocate space for a libseccomp structure, or would exceed a defined constant
-EINVAL: kernel isn't configured to support the operations, args are invalid (to seccomp_load(), seccomp(), or prctl())
-EFAULT: addresses passed as args are invalid
Zbigniew Jędrzejewski-Szmek [Fri, 12 Apr 2019 07:03:52 +0000 (09:03 +0200)]
core: vodify one more call to mkdir
CID #
1400460.
Zbigniew Jędrzejewski-Szmek [Fri, 12 Apr 2019 07:00:37 +0000 (09:00 +0200)]
test-exec-util: do not call setenv with NULL arg
The comment explains that $PATH might not be set in certain circumstances and
takes steps to handle this case. If we do that, let's assume that $PATH indeed
might be unset and not call setenv("PATH", NULL, 1). It is not clear from the
man page if that is allowed.
CID #
1400497.
Zbigniew Jędrzejewski-Szmek [Fri, 12 Apr 2019 06:55:39 +0000 (08:55 +0200)]
test-env-util: allow $PATH to be unset
Coverity was unhappy, because it doesn't know that $PATH is pretty much always
set. But let's not assume that in the test. CID #
1400496.
$ (unset PATH; build/test-env-util)
[1] 31658 segmentation fault (core dumped) ( unset PATH; build/test-env-util; )
Zbigniew Jędrzejewski-Szmek [Fri, 5 Apr 2019 12:14:45 +0000 (14:14 +0200)]
CODING_STYLE: adjust indentation rules, and add note about config loading
Zbigniew Jędrzejewski-Szmek [Fri, 5 Apr 2019 09:41:35 +0000 (11:41 +0200)]
shell-completion/zsh: add -*type*- headers
Since there's no file extension, emacs and other editors do not know that this is
supposed to be in shell syntax.
Zbigniew Jędrzejewski-Szmek [Fri, 5 Apr 2019 09:39:14 +0000 (11:39 +0200)]
shell-completion: use 4 space indentation too
The same as in other places, indentation levels were all over the place.
Zbigniew Jędrzejewski-Szmek [Thu, 4 Apr 2019 12:10:42 +0000 (14:10 +0200)]
scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)
Also remove the few vim config lines that were left. We should either have them
on all files, or none.
Also remove some strange stuff like '#!/bin/env bash', yikes.
Zbigniew Jędrzejewski-Szmek [Thu, 4 Apr 2019 13:06:34 +0000 (15:06 +0200)]
test: filter out messages when stripping binaries
We would get an error for every script, which is just noise.
Yu Watanabe [Fri, 5 Apr 2019 06:58:50 +0000 (15:58 +0900)]
test-network: add tests for MACsec
Yu Watanabe [Wed, 10 Apr 2019 06:53:30 +0000 (15:53 +0900)]
network: re-indent gperf files
Yu Watanabe [Wed, 10 Apr 2019 10:26:57 +0000 (19:26 +0900)]
network: warn when private key is stored in world readable files
Yu Watanabe [Fri, 5 Apr 2019 06:52:26 +0000 (15:52 +0900)]
network: add MACsecTransmitAssociation.UseForEncoding= setting
Yu Watanabe [Fri, 5 Apr 2019 06:33:52 +0000 (15:33 +0900)]
network: add MACsec*Association.Activate= setting
Yu Watanabe [Wed, 10 Apr 2019 09:07:10 +0000 (18:07 +0900)]
network: add MACsec*Association.KeyFile= setting
Yu Watanabe [Wed, 10 Apr 2019 08:53:30 +0000 (17:53 +0900)]
network: explicitly clear security key for macsec
Yu Watanabe [Wed, 10 Apr 2019 08:29:10 +0000 (17:29 +0900)]
network: support multiple security associations for macsec channels
Susant Sahani [Wed, 3 Apr 2019 11:27:36 +0000 (16:57 +0530)]
network: Introduce MACsec
Media Access Control Security (MACsec) is an 802.1AE IEEE
industry-standard security technology that provides secure
communication for all traffic on Ethernet links.
MACsec provides point-to-point security on Ethernet links between
directly connected nodes and is capable of identifying and preventing
most security threats, including denial of service, intrusion,
man-in-the-middle, masquerading, passive wiretapping, and playback attacks.
Closes #5754
Yu Watanabe [Fri, 5 Apr 2019 09:10:02 +0000 (18:10 +0900)]
linux: import if_macsec.h from kernel-5.0
MACsec is introduced since kernel-4.6. Let's support order kernels.
Yu Watanabe [Wed, 10 Apr 2019 09:03:42 +0000 (18:03 +0900)]
fileio: add READ_FULL_FILE_UNHEX flag
Similar to READ_FULL_FILE_UNBASE64, read data is decoded with
unhexmem().
Yu Watanabe [Wed, 10 Apr 2019 08:50:27 +0000 (17:50 +0900)]
util: extend unhexmem() to accept secure flag
When the flag is set, buffer is cleared on failure.
This is a continuation of
2432d09c7a7115004b16eb11bf81ffeeb32d15ad.
Lennart Poettering [Thu, 11 Apr 2019 17:01:03 +0000 (19:01 +0200)]
Merge pull request #12267 from keszybz/udev-settle-warning
Udev settle warning
Yu Watanabe [Wed, 10 Apr 2019 10:55:53 +0000 (19:55 +0900)]
tree-wide: drop several missing_*.h and import relevant headers from kernel-5.0
Lennart Poettering [Thu, 11 Apr 2019 16:58:43 +0000 (18:58 +0200)]
Merge pull request #12153 from benjarobin/killall-show-not-killed
shutdown/killall: Show in the console the processes not yet killed
Lennart Poettering [Thu, 11 Apr 2019 16:58:08 +0000 (18:58 +0200)]
Merge pull request #12226 from poettering/22bit-pids
sysctl: let's by default increase the numeric PID range from 2^16 to …
Lennart Poettering [Thu, 11 Apr 2019 16:57:47 +0000 (18:57 +0200)]
Merge pull request #12037 from poettering/oom-state
add cgroupv2 oom killer event handling to service management
Lennart Poettering [Thu, 11 Apr 2019 16:57:18 +0000 (18:57 +0200)]
Merge pull request #12219 from keszybz/bootctl-check-entries
bootctl: check entries when showing them
Zbigniew Jędrzejewski-Szmek [Thu, 11 Apr 2019 16:28:36 +0000 (18:28 +0200)]
NEWS: update contributors and date
Sebastian Krzyszkowiak [Thu, 11 Apr 2019 14:31:09 +0000 (16:31 +0200)]
hwdb: mark Apple Magic Trackpads as external
Applies only to USB - when connected via Bluetooth it already gets marked correctly.
Jonathan Lebon [Wed, 10 Apr 2019 21:28:15 +0000 (17:28 -0400)]
fstab-generator: use DefaultDependencies=no for /sysroot mounts
Otherwise we can end up with an ordering cycle. Since
d54bab90, all
local mounts now gain a default `Before=local-fs.target` dependency.
This doesn't make sense for `/sysroot` mounts in the initrd though,
since those happen later in the boot process.
Closes: #12231
Lennart Poettering [Thu, 11 Apr 2019 15:03:57 +0000 (17:03 +0200)]
Merge pull request #12279 from keszybz/sd-bus-long-signatures
sd-bus: properly handle messages with overlong signatures
Lennart Poettering [Thu, 11 Apr 2019 13:21:45 +0000 (15:21 +0200)]
Merge pull request #12274 from poettering/nss-fixlets
some nss module fixlets
Zbigniew Jędrzejewski-Szmek [Thu, 11 Apr 2019 12:07:22 +0000 (14:07 +0200)]
sd-bus: add define for the maximum name length
Less magic numbers in the code…
Zbigniew Jędrzejewski-Szmek [Thu, 11 Apr 2019 12:02:59 +0000 (14:02 +0200)]
sd-bus: add define for the maximum signature length
Less magic numbers in the code…
Zbigniew Jędrzejewski-Szmek [Thu, 11 Apr 2019 12:01:38 +0000 (14:01 +0200)]
bus-message: validate signature in gvariant messages
We would accept a message with 40k signature and spend a lot of time iterating
over the nested arrays. Let's just reject it early, as we do for !gvariant
messages.
Lennart Poettering [Thu, 11 Apr 2019 09:06:40 +0000 (11:06 +0200)]
nss-resolve: list more errors as cause for fallback
If dbus-daemon kicks us from the bus or hangs, we should fallback too.
Fixes: #12203
Lennart Poettering [Thu, 11 Apr 2019 09:00:22 +0000 (11:00 +0200)]
nss-resolve: simplify condition
Of course, if the error is NXDOMAIN then it's not one of the errors
listed for fallback, hence don't bother...
Lennart Poettering [Wed, 10 Apr 2019 19:56:37 +0000 (21:56 +0200)]
nss-mymachines: return NO_RECOVERY instead of NO_DATA when we fail to do D-Bus and similar
This makes more semantical sense and is what we do in nss-resolve in a
similar case, hence let's remove the differences here.
Lennart Poettering [Wed, 10 Apr 2019 19:40:49 +0000 (21:40 +0200)]
nss-myhostname: unify code that handles NOT_FOUND case
Just some minor rework to make this more like nss-resolve.
Lennart Poettering [Wed, 10 Apr 2019 19:57:44 +0000 (21:57 +0200)]
nss-resolve: resue a jump target
We can reuse "fail" here, since it does the same thing.
Lennart Poettering [Wed, 10 Apr 2019 19:27:16 +0000 (21:27 +0200)]
nss-resolve: return error properly
Lennart Poettering [Wed, 10 Apr 2019 19:26:46 +0000 (21:26 +0200)]
nss-resolve: drop unnecessary variable
We assign the same value to "ret" always, let's just return the value
literally.
Lennart Poettering [Thu, 11 Apr 2019 08:22:46 +0000 (10:22 +0200)]
Merge pull request #12271 from poettering/errno-accept-again
accept() errno fixes
Yu Watanabe [Thu, 11 Apr 2019 06:38:32 +0000 (15:38 +0900)]
test: make directory for drop-in config
Follow-up for
a2fbac5875776e9e327f30cf2a8b3070a4c1552a.
Zbigniew Jędrzejewski-Szmek [Thu, 11 Apr 2019 06:31:14 +0000 (08:31 +0200)]
Merge pull request #12270 from yuwata/test-set-longer-timeout
test: set longer timeout
Lennart Poettering [Wed, 10 Apr 2019 17:50:53 +0000 (19:50 +0200)]
tree-wide: port users over to use new ERRNO_IS_ACCEPT_AGAIN() call
Yu Watanabe [Wed, 10 Apr 2019 17:27:42 +0000 (02:27 +0900)]
test: set longer watchdog timeout for timedated
Lennart Poettering [Wed, 10 Apr 2019 17:40:40 +0000 (19:40 +0200)]
errno-util: add new ERRNO_IS_ACCEPT_AGAIN() test
This is modelled after the existing ERRNO_IS_RESOURCES() and in
particular ERRNO_IS_DISCONNECT(). It returns true for all transient
network errors that should be handled like EAGAIN whenever we call
accept() or accept4(). This is per documentation in the accept(2) man
page that explicitly says to do so in the its "RETURN VALUE" section.
The error list we cover is a bit more comprehensive, and based on
existing code of ours. For example EINTR is included too (since we need
that to cover cases where we call accept()/accept4() on a blocking
socket), and of course ERRNO_IS_DISCONNECT() is a bit more comprehensive
than the list in the man page too.
Lennart Poettering [Wed, 10 Apr 2019 17:39:12 +0000 (19:39 +0200)]
errno-util: rework ERRNO_IS_RESOURCE() from macro into static inline function
No technical reason, except that later on we want to add a new
ERRNO_IS() which uses the parameter twice and where we want to avoid
double evaluation, and where we'd like to keep things in the same style.
Lennart Poettering [Wed, 10 Apr 2019 17:38:37 +0000 (19:38 +0200)]
errno-util: add three more error codes to ERRNO_IS_DISCONNECT()
This is based on the recommendations in accept4() and the listed error
codes there.
Lennart Poettering [Wed, 10 Apr 2019 17:37:36 +0000 (19:37 +0200)]
tree-wide: voidify some socket calls
Lennart Poettering [Wed, 10 Apr 2019 17:36:40 +0000 (19:36 +0200)]
lgtm: complain about accept() [people should use accept4() instead, due to O_CLOEXEC]
Benjamin Robin [Mon, 8 Apr 2019 18:01:12 +0000 (20:01 +0200)]
core/killall: Add documentation about broadcast_signal()
Benjamin Robin [Sat, 6 Apr 2019 16:40:44 +0000 (18:40 +0200)]
core/killall: Log the process names not killed after 10s
Benjamin Robin [Wed, 3 Apr 2019 19:00:01 +0000 (21:00 +0200)]
shutdown: Bump sysctl kernel.printk log level in order to see info msg
Yu Watanabe [Wed, 10 Apr 2019 17:27:15 +0000 (02:27 +0900)]
test: set longer timeout for 'udevadm control'
Zbigniew Jędrzejewski-Szmek [Wed, 10 Apr 2019 09:52:47 +0000 (11:52 +0200)]
systemd-udev-settle.service: emit deprecation notice
Yu Watanabe [Wed, 10 Apr 2019 05:26:23 +0000 (14:26 +0900)]
network: fix use-of-uninitialized-value or null dereference
This fixes a bug introduced by
6ef5c881dd5568f08dc35013e24f7d857f36b207.
Fixes oss-fuzz#14157 and oss-fuzz#14158.
Zbigniew Jędrzejewski-Szmek [Wed, 10 Apr 2019 08:12:43 +0000 (10:12 +0200)]
man: add a page for systemd-udev-settle.service
Paul Menzel [Tue, 9 Apr 2019 16:37:46 +0000 (18:37 +0200)]
Update UEFI URLs (#12260)
* Use more secure https://www.uefi.org
http://www.uefi.org directs to https://uefi.org/, so this saves one
redirect.
$ curl -I http://www.uefi.org
HTTP/1.1 302 Found
Server: nginx
Date: Tue, 09 Apr 2019 14:54:46 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
X-Content-Type-Options: nosniff
Location: https://uefi.org/
Cache-Control: max-age=
1209600
Expires: Tue, 23 Apr 2019 14:54:46 GMT
Run the command below to update all occurrences.
git grep -l http://www.uefi.org | xargs sed -i 's,http://www.uefi.org,https://www.uefi.org,'
* Use https://uefi.org to save redirect
Save one redirect by using the target location.
$ curl -I https://www.uefi.org
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 09 Apr 2019 14:55:42 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
X-Content-Type-Options: nosniff
Location: https://uefi.org/
Cache-Control: max-age=
1209600
Expires: Tue, 23 Apr 2019 14:55:42 GMT
Run the command below to update all occurrences.
git grep -l https://www.uefi.org | xargs sed -i 's,https://www.uefi.org,https://uefi.org,'
Zbigniew Jędrzejewski-Szmek [Tue, 9 Apr 2019 09:56:52 +0000 (11:56 +0200)]
Merge pull request #12252 from keszybz/libmount-dont-unescape
Don't unescape paths from libmount
Lennart Poettering [Fri, 5 Apr 2019 13:38:16 +0000 (15:38 +0200)]
sysctl: let's by default increase the numeric PID range from 2^16 to 2^22
This should PID collisions a tiny bit less likely, and thus improve
security and robustness.
2^22 isn't particularly a lot either, but it's the current kernel
limitation.
Bumping this limit was suggested by Linus himself:
https://lwn.net/ml/linux-kernel/CAHk-=wiZ40LVjnXSi9iHLE_-ZBsWFGCgdmNiYZUXn1-V5YBg2g@mail.gmail.com/
Let's experiment with this in systemd upstream first. Downstreams and
users can after all still comment this easily.
Besides compat concern the most often heard issue with such high PIDs is
usability, since they are potentially hard to type. I am not entirely sure though
whether
4194304 (as largest new PID) is that much worse to type or to
copy than 65563.
This should also simplify management of per system tasks limits as by
this move the sysctl /proc/sys/kernel/threads-max becomes the primary
knob to control how many processes to have in parallel.
Lennart Poettering [Tue, 19 Mar 2019 19:16:29 +0000 (20:16 +0100)]
update TODO
Lennart Poettering [Tue, 19 Mar 2019 18:54:46 +0000 (19:54 +0100)]
test: add test case for new OOM logic
Lennart Poettering [Tue, 19 Mar 2019 18:54:08 +0000 (19:54 +0100)]
man: document new OOMPolicy= setting
Lennart Poettering [Tue, 19 Mar 2019 18:14:53 +0000 (19:14 +0100)]
catalog: add a new catalog entry explaining the new OOM killer event log msg
Lennart Poettering [Tue, 19 Mar 2019 18:05:19 +0000 (19:05 +0100)]
core: implement OOMPolicy= and watch cgroups for OOM killings
This adds a new per-service OOMPolicy= (along with a global
DefaultOOMPolicy=) that controls what to do if a process of the service
is killed by the kernel's OOM killer. It has three different values:
"continue" (old behaviour), "stop" (terminate the service), "kill" (let
the kernel kill all the service's processes).
On top of that, track OOM killer events per unit: generate a per-unit
structured, recognizable log message when we see an OOM killer event,
and put the service in a failure state if an OOM killer event was seen
and the selected policy was not "continue". A new "result" is defined
for this case: "oom-kill".
All of this relies on new cgroupv2 kernel functionality: the
"memory.events" notification interface and the "memory.oom.group"
attribute (which makes the kernel kill all cgroup processes
automatically).
Lennart Poettering [Tue, 19 Mar 2019 16:28:02 +0000 (17:28 +0100)]
service: beautify debug log message a bit
Lennart Poettering [Tue, 19 Mar 2019 16:17:31 +0000 (17:17 +0100)]
core: rename cgroup_inotify_wd → cgroup_control_inotify_wd
Let's rename the .cgroup_inotify_wd field of the Unit object to
.cgroup_control_inotify_wd. Let's similarly rename the hashmap
.cgroup_inotify_wd_unit of the Manager object to
.cgroup_control_inotify_wd_unit.
Why? As preparation for a later commit that allows us to watch the
"memory.events" cgroup attribute file in addition to the "cgroup.events"
file we already watch with the fields above. In that later commit we'll
add new fields "cgroup_memory_inotify_wd" to Unit and
"cgroup_memory_inotify_wd_unit" to Manager, that are used to watch these
other events file.
No change in behaviour. Just some renaming.
Lennart Poettering [Tue, 19 Mar 2019 12:01:12 +0000 (13:01 +0100)]
core: check for redundant operation before doing allocation
Lennart Poettering [Mon, 18 Mar 2019 19:21:11 +0000 (20:21 +0100)]
core: rearrange cgroup empty events a bit
So far the priorities for cgroup empty event handling were pretty weird.
The raw events (on cgroupsv2 from inotify, on cgroupsv1 from the agent
dgram socket) where scheduled at a lower priority than the cgroup empty
queue dispatcher. Let's swap that and ensure that we can coalesce events
more agressively: let's process the raw events at higher priority than
the cgroup empty event (which remains at the same prio).
Zbigniew Jędrzejewski-Szmek [Tue, 9 Apr 2019 08:52:52 +0000 (10:52 +0200)]
Merge pull request #12223 from yuwata/network-wireguard-preshared-key-file
network: add PresharedKeyFile= setting and make reading key file failure fatal
Zbigniew Jędrzejewski-Szmek [Fri, 5 Apr 2019 08:17:03 +0000 (10:17 +0200)]
pid1,shutdown: do not cunescape paths from libmount
The test added in previous commit shows that libmount does the unescaping
internally.
Zbigniew Jędrzejewski-Szmek [Fri, 5 Apr 2019 07:43:12 +0000 (09:43 +0200)]
test-libmount: let's see how libmount parses stuff
With libmount-2.33.1-3.fc30.x86_64 I get:
/* test_libmount_unescaping_one escaped space + utf8 */
from '729 38 0:59 / /tmp/\342\200\236zupa\\040z\304\231bowa\342\200\235 rw,relatime shared:395 - tmpfs die\\040Br\303\274he rw,seclabel'
source: 'die Brühe'
source: 'die Br\303\274he'
source: 'die Brühe'
expected: 'die Brühe'
target: '/tmp/„zupa zębowa”'
target: '/tmp/\342\200\236zupa z\304\231bowa\342\200\235'
target: '/tmp/„zupa zębowa”'
expected: '/tmp/„zupa zębowa”'
/* test_libmount_unescaping_one escaped newline */
from '729 38 0:59 / /tmp/x\\012y rw,relatime shared:395 - tmpfs newline rw,seclabel'
source: 'newline'
source: 'newline'
source: 'newline'
expected: 'newline'
target: '/tmp/x
y'
target: '/tmp/x\ny'
target: '/tmp/x
y'
expected: '/tmp/x
y'
/* test_libmount_unescaping_one empty source */
from '760 38 0:60 / /tmp/emptysource rw,relatime shared:410 - tmpfs rw,seclabel'
source: ''
source: ''
source: ''
expected: ''
target: '/tmp/emptysource'
target: '/tmp/emptysource'
target: '/tmp/emptysource'
expected: '/tmp/emptysource'
/* test_libmount_unescaping_one foo\rbar */
from '790 38 0:61 / /tmp/foo\rbar rw,relatime shared:425 - tmpfs tmpfs rw,seclabel'
source: 'tmpfs'
source: 'tmpfs'
source: 'tmpfs'
expected: 'tmpfs'
target: '/tmp/foo'
target: '/tmp/foo'
target: '/tmp/foo'
expected: 'n/a'
With https://github.com/karelzak/util-linux/issues/780 fixed, we get
/* test_libmount_unescaping_one foo\rbar */
from '790 38 0:61 / /tmp/foo\rbar rw,relatime shared:425 - tmpfs tmpfs rw,seclabel'
source: 'tmpfs'
source: 'tmpfs'
source: 'tmpfs'
expected: 'tmpfs'
target: '/tmp/foo
bar'
target: '/tmp/foo\rbar'
target: '/tmp/foo
bar'
expected: '/tmp/foo
bar'
welaq [Mon, 8 Apr 2019 19:03:26 +0000 (22:03 +0300)]
l10n: Updated Lithuanian translation
Yu Watanabe [Mon, 8 Apr 2019 15:13:56 +0000 (00:13 +0900)]
NEWS: mention PresharedKeyFile=
Yu Watanabe [Fri, 5 Apr 2019 08:52:29 +0000 (17:52 +0900)]
test-network: add tests for WireGuardPeer.PresharedKey= and PresharedKeyFile=
Yu Watanabe [Mon, 8 Apr 2019 15:11:43 +0000 (00:11 +0900)]
network: make wireguard_decode_key_and_warn() take uint8_t buf[static WG_KEY_LEN]
Yu Watanabe [Sun, 7 Apr 2019 18:48:57 +0000 (03:48 +0900)]
network: warn when wireguard keys are stored in world readable files
Yu Watanabe [Fri, 5 Apr 2019 08:33:09 +0000 (17:33 +0900)]
network: add WireGuardPeer.PresharedKeyFile= setting
Yu Watanabe [Sun, 7 Apr 2019 17:48:02 +0000 (02:48 +0900)]
network: clear wireguard keys on failure or on exit
Yu Watanabe [Fri, 5 Apr 2019 08:28:46 +0000 (17:28 +0900)]
network: make reading PrivateKeyFile= failure always fatal
This also refactor wireguard_read_key_file().
Yu Watanabe [Mon, 8 Apr 2019 14:40:22 +0000 (23:40 +0900)]
fileio: add READ_FULL_FILE_UNBASE64 flag for read_full_file_full()
Yu Watanabe [Mon, 8 Apr 2019 05:15:10 +0000 (14:15 +0900)]
fileio: read_full_file_full() also warns when file is world readable and secure flag is set
Yu Watanabe [Sun, 7 Apr 2019 18:48:30 +0000 (03:48 +0900)]
fileio: introduce warn_file_is_world_accessible()
Yu Watanabe [Sun, 7 Apr 2019 17:22:40 +0000 (02:22 +0900)]
util: introduce READ_FULL_FILE_SECURE flag for reading secure data