1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
Commit Graph

37806 Commits

Author SHA1 Message Date
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
Zbigniew Jędrzejewski-Szmek
c512dfb9ac meson: print EFI CC configuration nicely
In 595343fb4c it was converted to an array.
This doesn't look good in the output. Let's convert it back to a string.
2018-12-18 12:20:01 +01:00
Zbigniew Jędrzejewski-Szmek
3fa3dc9e44 meson: rename two more variables from _c to _sources
_c is misleading because .h files should be included in those lists too
(this tells meson that the build outputs should be rebuilt if the header
files change).

Follow-up for 1437822638.
2018-12-18 12:19:52 +01:00
Zbigniew Jędrzejewski-Szmek
2811184a09 systemctl: add comment why whitespace in message is needed 2018-12-18 12:18:49 +01:00
Zbigniew Jędrzejewski-Szmek
8872c3a391 test-hashmap: add test to compare hashmap_free performance
The point here is to compare speed of hashmap_destroy with free and a different
freeing function, to the implementation details of hashmap_clear can be
evaluated.

Results:
current code:

/* test_hashmap_free (slow, 1048576 entries) */
string_hash_ops test took 2.494499s
custom_free_hash_ops test took 2.640449s

string_hash_ops test took 2.287734s
custom_free_hash_ops test took 2.557632s

string_hash_ops test took 2.299791s
custom_free_hash_ops test took 2.586975s

string_hash_ops test took 2.314099s
custom_free_hash_ops test took 2.589327s

string_hash_ops test took 2.319137s
custom_free_hash_ops test took 2.584038s

code with a patch which restores the "fast path" using:
    for (idx = skip_free_buckets(h, 0); idx != IDX_NIL; idx = skip_free_buckets(h, idx + 1))
in the case where both free_key and free_value are either free or NULL:

/* test_hashmap_free (slow, 1048576 entries) */
string_hash_ops test took 2.347013s
custom_free_hash_ops test took 2.585104s

string_hash_ops test took 2.311583s
custom_free_hash_ops test took 2.578388s

string_hash_ops test took 2.283658s
custom_free_hash_ops test took 2.621675s

string_hash_ops test took 2.334675s
custom_free_hash_ops test took 2.601568s

So the test is noisy, but there clearly is no significant difference with the
"fast path" restored. I'm surprised by this, but it shows that the current
"safe" implementation does not cause a performance loss.

When the code is compiled with optimization, those times are significantly
lower (e.g. 1.1s and 1.4s), but again, there is no difference with the "fast
path" restored.

The difference between string_hash_ops and custom_free_hash_ops is the
additional cost of global modification and the extra function call.
2018-12-18 12:04:08 +01:00
Zbigniew Jędrzejewski-Szmek
32ca29115e test-hashmap: use the usual function headers and print timing stats
This makes it slightly easier to watch for performance changes.
2018-12-18 12:04:04 +01:00
Zbigniew Jędrzejewski-Szmek
70b400d9c2 hashmap: use ternary op to shorten code 2018-12-18 12:04:00 +01:00
Filipe Brandenburger
7f09920585 lldp: add test coverage for sd_lldp_get_neighbors() with multiple neighbors
In particular, check that the order of the results is consistent.

This test coverage will be useful in order to refactor the compare_func
used while sorting the results.

When introduced, this test also uncovered a memory leak in sd_lldp_stop(),
which was then fixed by a separate commit using a specialized function
as destructor of the LLDP Hashmap.

Tested:
  $ ninja -C build/ test
  $ valgrind --leak-check=full build/test-lldp
2018-12-18 11:28:10 +01:00
Lennart Poettering
8ae1a821b3 sd-lldp: accept if a neighbor is already removed from the hashtable 2018-12-18 11:28:10 +01:00
Lennart Poettering
c380b84d8b hashmap: rework hashmap_clear() to be more defensive
Let's first remove an item from the hashmap and only then destroy it.
This makes sure that destructor functions can mdoify the hashtables in
their own codee and we won't be confused by that.
2018-12-18 11:28:10 +01:00
Lennart Poettering
6d72da2f3e resolved: mention which RRs we query when requesting them to authenticate some other RR 2018-12-18 11:25:21 +01:00
Lennart Poettering
d5acaa51db resolved: only attempt non-answer SOA RRs if they are parents of our query
There's no value in authenticating SOA RRs that are neither answer to
our question nor parent of our question (the latter being relevant so
that we have a TTL from the SOA field for negative caching of the actual
query).

By being to eager here, and trying to authenticate too much we run the
risk of creating cyclic deps between our transactions which then causes
the over-all authentication to fail.

Fixes: #9771
2018-12-18 11:25:21 +01:00
Lennart Poettering
1a126325eb timesync: fix serialization of IP address
Fixes: #11169
2018-12-18 00:59:14 +01:00
Lennart Poettering
98a7b55a53 NEWS: document the usern/mknod borkage in 4.18 a bit 2018-12-17 21:36:30 +01:00
Lennart Poettering
46b028f250 NEWS: add missing 'not' 2018-12-17 20:51:11 +01:00
Lennart Poettering
7db43ec32f docs: add missing section to ENVIRONMENT.md
No, this is not an env var understood by logind. Let's fix the
confusoin.
2018-12-17 20:48:22 +01:00
Lennart Poettering
4f9cf94c4a
Merge pull request #11144 from keszybz/dissect-image-fix
Fix for dissect-image use in nspawn
2018-12-17 19:36:36 +01:00
Michal Sekletar
4c70a4a748 core: do cgroup migration first and only then connect to journald
Fixes #11162
2018-12-17 19:22:30 +01:00
Lennart Poettering
500c65ad69
Merge pull request #11167 from yuwata/sd-resolve-typesafe
sd-resolve: introduce typesafe macros
2018-12-17 19:22:07 +01:00
Alexey Bogdanenko
8f9f3cb724 core: fix KeyringMode for user services
KeyringMode option is useful for user services. Also, documentation for the
option suggests that the option applies to user services. However, setting the
option to any of its allowed values has no effect.

This commit fixes that and removes EXEC_NEW_KEYRING flag. The flag is no longer
necessary: instead of checking if the flag is set we can check if keyring_mode
is not equal to EXEC_KEYRING_INHERIT.
2018-12-17 16:56:36 +01:00
Lennart Poettering
95cde1ed24
Merge pull request #11159 from keszybz/udev-typedef
Udev typedef and normal error reporting
2018-12-17 16:19:10 +01:00
Michal Sekletar
672773b63a journald: correctly attribute log messages also with cgroupsv1
With cgroupsv1 a zombie process is migrated to root cgroup in all
hierarchies. This was changed for unified hierarchy and /proc/PID/cgroup
reports cgroup to which process belonged before it exited.

Be more suspicious about cgroup path reported by the kernel and use
unit_id provided by the log client if the kernel reports that process is
running in the root cgroup.

Users tend to care the most about 'log->unit_id' mapping so systemctl
status can correctly report last log lines. Also we wouldn't be able to
infer anything useful from "/" path anyway.

See: 2e91fa7f6d
2018-12-17 15:16:11 +01:00
Lennart Poettering
a9238f6a33
Merge pull request #11184 from poettering/resolved-search-domains-max
resolve: bump max of dns servers/search domains
2018-12-17 15:15:45 +01:00
Tore Anderson
93158c77bc resolve: enable EDNS0 towards the 127.0.0.53 stub resolver
This appears to be necessary for client software to ensure the reponse data
is validated with DNSSEC. For example, `ssh -v -o VerifyHostKeyDNS=yes -o
StrictHostKeyChecking=yes redpilllinpro01.ring.nlnog.net` fails if EDNS0 is
not enabled. The debugging output reveals that the `SSHFP` records were
found in DNS, but were considered insecure.

Note that the patch intentionally does *not* enable EDNS0 in the
`/run/systemd/resolve/resolv.conf` file (the one that contains `nameserver`
entries for the upstream DNS servers), as it is impossible to know for
certain that all the upstream DNS servers handles EDNS0 correctly.
2018-12-17 15:15:18 +01:00