Commit graph

37729 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 17ec531ff0 man: describe better when remount-fs.service and gpt-auto-generator are active 2019-01-03 15:30:56 +01:00
Zbigniew Jędrzejewski-Szmek 9b69569d2c Pull in systemd-remount-fs.service only when required
Instead of enabling it unconditionally and then using ConditionPathExists=/etc/fstab,
and possibly masking this condition if it should be enabled for auto gpt stuff,
just pull it in explicitly when required.
2019-01-03 15:30:28 +01:00
Zbigniew Jędrzejewski-Szmek 2572957e45 fstab-generator: simplify return code generation
We just do a bunch of operations, and want to return the first failing error
code. Let's do this in the most straightforward way.
2019-01-03 15:30:28 +01:00
Zbigniew Jędrzejewski-Szmek 00bb366d11 fstab-generator: use generator_add_symlink() in one more place 2019-01-03 15:30:28 +01:00
Zbigniew Jędrzejewski-Szmek 5c176eb4bf shared/generator: allow absolute symlink target in generator_add_symlink()
Also remove the stray ".d" from comment and rename directory argument to "dir"
(we usually use "root" for arg_root, so using it here was misleading).
2019-01-03 15:30:25 +01:00
Zbigniew Jędrzejewski-Szmek 01a0f7d03e fstab-generator: move debug lines to a better place 2019-01-03 15:30:25 +01:00
Zbigniew Jędrzejewski-Szmek becccb5285 remount-fs: split out common pattern out to a function 2019-01-03 15:29:53 +01:00
Zbigniew Jędrzejewski-Szmek 6ea05ac99f
Merge pull request #10912 from poettering/gpt-root-rw
make sure to propagate GPT root partition r/w flag into mount r/w flag
2018-12-20 11:37:41 +01:00
Zbigniew Jędrzejewski-Szmek faf9e4426c
Merge pull request #11215 from poettering/gpt-auto-no-udev
gpt-auto-generator: don't wait for udev
2018-12-20 09:29:52 +01:00
Lennart Poettering f70e7f70c9 dissect: add some assert()s 2018-12-19 23:27:47 +01:00
Lennart Poettering 052eaf5c93 gpt-auto-generator: don't wait for udev
Generators run in a context where waiting for udev is not an option,
simply because it's not running there yet. Hence, let's not wait for it
in this case.

This is generally OK to do as we are operating on the root disk only
here, which should have been probed already by the time we come this
far.

An alternative fix might be to remove the udev dependency from image
dissection again in the long run (and thus replace reliance on
/dev/block/x:y somehow with something else).

Fixes: #11205
2018-12-19 23:27:47 +01:00
Chris Down 2141bedb39
Merge pull request #11212 from keszybz/mount-storm-revert
Revert the patches for mount-storm prevention for now
2018-12-19 12:11:15 +00:00
Zbigniew Jędrzejewski-Szmek ec8126d723 Revert "core/mount: minimize impact on mount storm."
This reverts commit 89f9752ea0.

This patch causes various problems during boot, where a "mount storm" occurs
naturally. Current approach is flakey, and it seems very risky to push a
feature like this which impacts boot right before a release. So let's revert
for now, and consider a more robust solution after later.

Fixes #11209.

> https://github.com/systemd/systemd/pull/11196#issuecomment-448523186:
"Reverting 89f9752ea0 and fcfb1f775e fixes this test."
2018-12-19 11:37:41 +01:00
Zbigniew Jędrzejewski-Szmek e36db50075 Revert "mount: disable mount-storm protection while mount unit is starting."
This reverts commit fcfb1f775e.
2018-12-19 11:32:17 +01:00
NeilBrown fcfb1f775e mount: disable mount-storm protection while mount unit is starting.
The starting of mount units requires that changes to
/proc/self/mountinfo be processed before the SIGCHILD from the
completion of /sbin/mount is processed, as described by the comment
  /* Note that due to the io event priority logic, we can be sure the new mountinfo is loaded
   * before we process the SIGCHLD for the mount command. */

The recently-added mount-storm protection can defeat this as it
will sometimes deliberately delay processing of /proc/self/mountinfo.

So we need to disable mount-storm protection when a mount unit is starting.
We do this by keeping a counter of the number of pending
mounts, and disabling the protection when this is non-zero.

Thanks to @asavah for finding and reporting this problem.
2018-12-19 00:44:19 +01:00
Lennart Poettering ff03aee4b7
Merge pull request #11201 from keszybz/more-news
Some git history rewriting and more news
2018-12-18 20:50:16 +01:00
Lennart Poettering be2e1823ef
Merge pull request #11182 from poettering/fileio-more-paranoia
More safety checks for fileio.c
2018-12-18 20:49:19 +01:00
Chris Down a361cc99ae
Merge pull request #11203 from keszybz/json-no-slash-escaping
json: do not unescape slashes
2018-12-18 16:08:27 +00:00
Zbigniew Jędrzejewski-Szmek 8edb6563b4 json: do not unescape slashes
Apparently this originated in PHP, so the json output could be directly
embedded in HTML script tags.
See https://stackoverflow.com/questions/1580647/json-why-are-forward-slashes-escaped.

Since the output of our tools is not intended directly for web page generation,
let's not do this unescaping. If needed, the consumer can always do escaping as
appropriate for the target format.
2018-12-18 15:21:37 +01:00
Zbigniew Jędrzejewski-Szmek 7f9d1aedec test-fileio: test safe_fgetc directly
Non-ascii chars are used so that we get both "positive" and "negative"
characters (on the arches where char is signed).
2018-12-18 15:03:22 +01:00
Lennart Poettering e3b6ae8d00 update TODO 2018-12-18 15:03:22 +01:00
Lennart Poettering 0d90bd9229 process-util: rework getenv_for_pid() to use read_nul_string() 2018-12-18 15:03:22 +01:00
Lennart Poettering 3946d5762f test: add test case for read_nul_string() 2018-12-18 15:03:22 +01:00
Lennart Poettering 91a306b813 fileio: let's minimize 'count' inc/dec calls
instead of increasing it and immediately after decreasing it again,
let's just increase it a bit later.
2018-12-18 15:03:21 +01:00
Lennart Poettering 41f11239c0 fileio: replace read_nul_string() by read_line() with a special flag
read_line() is a lot more careful and optimized than read_nul_string()
but does mostly the same thing. let's replace the latter by the former,
just with a special flag that toggles between the slightly different EOL
rules if both.
2018-12-18 15:03:05 +01:00
Lennart Poettering 2a7797e964 process-util: make get_process_environ() safer
Let's add a size limit, and let's use safe_fgetc().
2018-12-18 15:03:05 +01:00
Lennart Poettering 03a7dbeae0 tree-wide: port some code over to safe_fgetc() 2018-12-18 15:03:00 +01:00
Zbigniew Jędrzejewski-Szmek b1a082cd91 NEWS: add a note about symlink following in .wants and .requires
This ain't so easy to express without using too much technical language...

https://github.com/systemd/systemd/pull/10094#issuecomment-427407570
2018-12-18 15:02:24 +01:00
Zbigniew Jędrzejewski-Szmek e68a35a78d NEWS: add note about NNP=yes 2018-12-18 15:01:57 +01:00
Lennart Poettering 285a9b2749 fileio: add new safe_fgetc() helper call
We have very similar code whenever we call fgetc() in place, let's
replae it by a common implementation.
2018-12-18 14:55:34 +01:00
Zbigniew Jędrzejewski-Szmek 0e89eb474d Merge pull request #10221 from lucaswerkmeister/bash-completion
Merged locally to resolve a conflict. The redirection of error is required to
suppress "# Not showing unlisted system calls, ...".
2018-12-18 14:53:58 +01:00
Lennart Poettering 7d1353ccf2 update TODO 2018-12-18 14:47:46 +01:00
Lennart Poettering fd89051ec3 gpt-auto: propagate gpt partition ro/rw flag into root mount
This ensures that the read/write state of the root mount matches the
read/write flag in the GPT partition table entry.

This is only used as fallback in case no ro/rw flag is specified on the
kernel cmdline, and there's no entry for the root partition in
/etc/fstab.

This is missing functionality of the GPT auto logic, as without this the
root partition was always mounted read-only — when booting with zero
configuration in /etc/fstab and /proc/cmdline —, as we defaulted to
read-only behaviour for all mounts. Moreover we honoured the r/o flag in
the partition table for all other partition types, except for the root
partition.
2018-12-18 14:47:46 +01:00
Lennart Poettering c94b241777 gpt-auto: make arg_root_rw a tri-state
No change in behaviour, but let's track whether ro or rw are specified
on the kernel cmdline at all.
2018-12-18 14:47:46 +01:00
Lennart Poettering 59f13dd6f8 remount-fs: optionally remount / writable, if we are told through an env var 2018-12-18 14:47:44 +01:00
Lennart Poettering 58b86fdf1d remount-fs: split code for tracking PIDs in hashmap
Just some refactoring, no change in behaviour.
2018-12-18 14:47:06 +01:00
Lennart Poettering e0fe3a03ab remount-fs: use PATH_IN_SET() at one more place 2018-12-18 14:38:30 +01:00
Lennart Poettering 8a9c44edf9 gpt-auto: compare kernel cmdline args with proc_cmdline_key_streq() 2018-12-18 14:38:30 +01:00
Lennart Poettering e4abfc77c4
Merge pull request #11197 from keszybz/various-fixups
Various fixups
2018-12-18 14:35:00 +01:00
Lennart Poettering 6b256626c5
Merge pull request #11191 from poettering/hashmap-clear
rework hashmap_clear()
2018-12-18 14:34:39 +01:00
Lennart Poettering 64d7f7b4a1 units: set NoNewPrivileges= for all long-running services
Previously, setting this option by default was problematic due to
SELinux (as this would also prohibit the transition from PID1's label to
the service's label). However, this restriction has since been lifted,
hence let's start making use of this universally in our services.

On SELinux system this change should be synchronized with a policy
update that ensures that NNP-ful transitions from init_t to service
labels is permitted.

Fixes: #1219
2018-12-18 14:21:35 +01:00
Lennart Poettering 52ef7bbbe6 units: sort [Service] sections alphabetically 2018-12-18 14:21:35 +01:00
Zbigniew Jędrzejewski-Szmek 04c65645fa Revert "units: set NoNewPrivileges= for all long-running services"
This reverts commit 3ca9940cb9.

Let's split the commit in two: the sorting and the changes.
Because there's a requirement to update selinux policy, this change is
incompatible, strictly speaking. I expect that distributions might want to
revert this particular change. Let's make it easy.
2018-12-18 14:20:32 +01:00
Zbigniew Jędrzejewski-Szmek 459aec5c88
Merge pull request #11200 from poettering/mailmap-updates-240
updates for .mailmap and NEWS
2018-12-18 14:00:59 +01:00
Lennart Poettering b99b316497
Merge pull request #11194 from poettering/resolved-soa-parent
be more conservative with set of RRs to authenticate
2018-12-18 13:07:24 +01:00
Lennart Poettering 144d7f1dc6 NEWS: add one more item 2018-12-18 13:04:43 +01:00
Lennart Poettering c37e2358c9 NEWS: update contributors list, taking new .mailmap into account 2018-12-18 12:56:56 +01:00
Lennart Poettering 40f714d8f8 sort .mailmap alphabetically 2018-12-18 12:55:00 +01:00
Lennart Poettering a0795d48f2 update .mailmap a bit from v240 contributions 2018-12-18 12:53:58 +01:00
Zbigniew Jędrzejewski-Szmek 568ef98723 test-mountpoint-util: more debug info 2018-12-18 12:20:01 +01:00