1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00
Commit Graph

50402 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
224e6c844d
Merge pull request #18989 from yuwata/ordered-set-put-strdup
ordered-set: make ordered_set_put_strdup() allocate OrderedSet object
2021-03-31 10:36:03 +02:00
Lennart Poettering
6020d00d7e repart: make sure CopyFiles= works with a / suffixed path
If we define a partition with CopyFiles=/efi/ this should just work.
However it previously didn't because basename() would return the
trailing slash.

Let's fix this by moving things to path_extract_{directory|filename}()
2021-03-31 10:35:45 +02:00
Lennart Poettering
e0b4bc239f machine-id-setup: support --image= mode 2021-03-31 10:35:31 +02:00
Lennart Poettering
f9d8325e69
Merge pull request #18971 from poettering/sysusers-creds
let's read LoadCredentials=/SetCredentials= style cred in sysusers/firstboot and when asking for passwords
2021-03-31 10:35:17 +02:00
Zbigniew Jędrzejewski-Szmek
4c31bfdf55
Merge pull request #18982 from keszybz/test-nss-users
Add a new test for user/group resolution in nss modules
2021-03-31 10:32:09 +02:00
Zbigniew Jędrzejewski-Szmek
b880ac2c15
Merge pull request #18958 from poettering/dissect-no-root
dissect-image: support images without rootfs but with /usr partition + support simple partition versioning via strverscmp() on part label
2021-03-31 10:31:32 +02:00
Luca Boccassi
834bab01f9 compress: support streaming lz4 without full input mmap
The advantage of stream compression is keeping a low memory profile,
but the lz4 stream compressor usage mmaps the whole file in memory.

Change it to read bits by bits, like the other stream compression
helpers.
2021-03-31 10:29:36 +02:00
Zbigniew Jędrzejewski-Szmek
bcceabcfc2
Merge pull request #18886 from anitazha/shutdownconsole
logging shutdown to /dev/console
2021-03-31 10:28:26 +02:00
Zbigniew Jędrzejewski-Szmek
87f9300d71
Merge pull request #18850 from yuwata/sd-device-monitor-cleanups
sd-device-monitor: trivial cleanups
2021-03-31 10:27:06 +02:00
Henri Chain
cb0e818f7c Introduce ExitType 2021-03-31 10:26:07 +02:00
Zbigniew Jędrzejewski-Szmek
82a335db83
Merge pull request #18777 from yuwata/network-set-ifname-to-engines
network: set ifname to dhcp4 client or friends
2021-03-31 10:25:23 +02:00
Lennart Poettering
938bdfc0fa
Merge pull request #19157 from keszybz/read-medium-sized-virtual-file
basic/fileio: fix reading of not-too-small virtual files
2021-03-30 22:59:02 +02:00
Lennart Poettering
9ca34cf5a4 NEWS: prep release date 2021-03-30 22:00:11 +02:00
Zbigniew Jędrzejewski-Szmek
bca895c4f4 test-fileio: test for read_full_virtual_file()
It was already called through other places, but indirectly.
Let's add some direct invocations.
2021-03-30 21:58:59 +02:00
Zbigniew Jędrzejewski-Szmek
2ac67221bb basic/fileio: fix reading of not-too-small virtual files
This code is trying to do two things: when reading a file with working
st.st_size, detect when the file size changes between the fstat() and our
allocation of the buffer based on the returned size, and the subsequent read().
When reading a file without st.st_size, read up to READ_FULL_BYTES_MAX.

But this second scenario was partially broken: we'd start with size = 4095, and
double the size up to three times, i.e. up to 32767. But we want to read up to
READ_FULL_BYTES_MAX.

So let's listentangle the two cases a bit: if a file returns non-zero st._size,
proceed as before. But if we don't know the size, let's immediately allocate
the buffer of maximum size of READ_FULL_BYTES_MAX. I think that allocating 4MB
and 1MB is going to take pretty much the same time as long as the memory is not
written to, so by allocating 1MB, 2MB, and 4MB, we wouldn't really be saving
anything internally, but wasting time on repeated reads, if the file is long
enough.

Also, don't do the seek if we know we're going to return an error immediately
after.

This should fix reading of any files in /proc, which all have size == 0. In
particular, various files read by coredump might be larger than 32767.

What about /sys? The file there return a fake value, usually 4096. So we'll
allocate a small buffer and read that.
2021-03-30 21:56:22 +02:00
Luca Boccassi
ae63987fac
Merge pull request #19149 from anitazha/oomdlogging
oomd: make it more clear when a kill happens
2021-03-30 19:01:01 +01:00
Luca Boccassi
c71bb61e8d
Merge pull request #19155 from keszybz/hwdb-contrib-v248
hwdb update + contrib list
2021-03-30 18:13:16 +01:00
Zbigniew Jędrzejewski-Szmek
f94a80ab59 oomd: fix iteration over candidates to kill 2021-03-30 14:45:22 +02:00
Anita Zhang
37a7e15968 oomd: make it more clear when a kill happens
Improve the logging to only print if systemd-oomd killed something. And
also print which cgroup was targeted.
Demote general swap above/pressure above messages to debug.

[zjs: fix some issuelets found in review]
2021-03-30 14:44:09 +02:00
Lennart Poettering
414f59dad7
Merge pull request #19131 from keszybz/resolvectl-warn-less
Suppress warnings in resolvectl about --type=
2021-03-30 13:29:55 +02:00
Zbigniew Jędrzejewski-Szmek
7960ba96d1 selinux: do not crash if policy becomes unavailable after reload
https://bugzilla.redhat.com/show_bug.cgi?id=1944171
This was in F33, systemd-246.13, but the logic in the code didn't change.

Thread 1 (Thread 0x7fb5f0341b80 (LWP 1974)):
№0  selabel_lookup_common (rec=0x0, translating=0, key=0x55f616ac4750 "/run/user/1000/systemd/units/invocation:systemd-tmpfiles-clean.service", type=40960) at label.c:167

'rec' is the handle that we passed.

№1  0x00007fb5f13ae87f in selabel_lookup_raw (rec=<optimized out>, con=con@entry=0x7fffef307380, key=key@entry=0x55f616ac4750 "/run/user/1000/systemd/units/invocation:systemd-tmpfiles-clean.service", type=type@entry=40960) at label.c:256
        lr = <optimized out>

'rec' is passed through as is to selabel_lookup_common().

№2  0x00007fb5f1561b2d in selinux_create_file_prepare_abspath (abspath=0x55f616ac4750 "/run/user/1000/systemd/units/invocation:systemd-tmpfiles-clean.service", mode=40960) at ../src/basic/selinux-util.c:368
        filecon = 0x0
        r = <optimized out>
        __PRETTY_FUNCTION__ = "selinux_create_file_prepare_abspath"
        __func__ = "selinux_create_file_prepare_abspath"

№3  0x00007fb5f1561ec3 in mac_selinux_create_file_prepare (path=<optimized out>, mode=40960) at ../src/basic/selinux-util.c:431
        r = 0
        abspath = 0x55f616ac4750 "/run/user/1000/systemd/units/invocation:systemd-tmpfiles-clean.service"
        __PRETTY_FUNCTION__ = "mac_selinux_create_file_prepare"

We checked label_hnd != NULL, but then we apparently called
avc_netlink_check_nb(), which reset label_hnd. Yay for global state!

№4  0x00007fb5f1549950 in symlink_atomic_label (from=0x55f6169d8b50 "69a8dcf7a7ac46b29306f2fddbed3edc", to=0x55f616ab8380 "/run/user/1000/systemd/units/invocation:systemd-tmpfiles-clean.service") at ../src/basic/label.c:55
        r = <optimized out>
        __PRETTY_FUNCTION__ = "symlink_atomic_label"

In the logs:

Mar 29 14:48:44 fedorapad.home systemd[1974]: selinux: avc:  received policyload notice (seqno=2)
Mar 29 14:48:44 fedorapad.home systemd[1974]: Failed to initialize SELinux labeling handle: No such file or directory
Mar 29 14:48:44 fedorapad.home systemd[1974]: selinux: avc:  received policyload notice (seqno=3)
Mar 29 14:48:44 fedorapad.home systemd[1974]: selinux: avc:  received setenforce notice (enforcing=0)
2021-03-30 13:24:12 +02:00
Zbigniew Jędrzejewski-Szmek
f8a6e1e523 hwdb: update fingerprint autosuspend rules 2021-03-30 13:17:59 +02:00
Zbigniew Jędrzejewski-Szmek
a22c7690d4 hwdb: update for v248
As usual, it seems to be additions and updates, no major removals.
2021-03-30 13:17:59 +02:00
Zbigniew Jędrzejewski-Szmek
8ce2255178 NEWS: update contributor list for v248 final 2021-03-30 13:17:59 +02:00
Zbigniew Jędrzejewski-Szmek
b242d2dec9 git-contrib: use non-breaking spaces in names
Some people have initials or abbreviated parts in the name and looks strange
when a line break occurs in the middle. Let's keep each name in one line.
2021-03-30 13:17:59 +02:00
Zbigniew Jędrzejewski-Szmek
75e53df7e3 mailmap: two more names 2021-03-30 13:17:58 +02:00
Luca Boccassi
063a43a1a7 Revert "fix wrong statement JOURNAL_FILE_FORMAT.md doc"
This reverts commit 119063d2b1.
2021-03-30 10:26:54 +02:00
Yangyang Shen
119063d2b1 fix wrong statement JOURNAL_FILE_FORMAT.md doc 2021-03-29 19:11:27 +02:00
Christian Hesse
46cfe8f50d units: make locale directory writable for systemd-localed
With 8f20232fcb systemd-localed supports
generating locales when required. This fails if the locale directory is
read-only, so make it writable.

Closes #19138
2021-03-29 12:33:36 +02:00
Fangrui Song
945317a4b6 sd-bus: set retain attribute on BUS_ERROR_MAP_ELF_REGISTER
LLD 13 and GNU ld 2.37 support -z start-stop-gc which allows garbage
collection of C identifier name sections despite the __start_/__stop_
references.  Simply set the retain attribute so that GCC 11 (if
configure-time binutils is 2.36 or newer)/Clang 13 will set the
SHF_GNU_RETAIN section attribute to prevent garbage collection.

Without the patch, there are linker errors like the following with -z
start-stop-gc.

```
ld: error: undefined symbol: __start_SYSTEMD_BUS_ERROR_MAP
>>> referenced by bus-error.c:93 (../src/libsystemd/sd-bus/bus-error.c:93)
>>>               sd-bus_bus-error.c.o:(bus_error_name_to_errno) in archive src/libsystemd/libsystemd_static.a
```
2021-03-29 12:31:42 +02:00
Zbigniew Jędrzejewski-Szmek
8a773a30ba
Merge pull request #19116 from keszybz/readvirtualfile-opt
Optimize read_full_virtual_file() and another coverity issue
2021-03-29 10:51:32 +02:00
Zbigniew Jędrzejewski-Szmek
200b4f3d80 resolvectl: suppress warning about --type for names with a dot
People don't generally type the trailing dot by mistake, so let's treat this as
indication that they want to resolve this particular hostname.
2021-03-26 21:24:36 +01:00
Zbigniew Jędrzejewski-Szmek
a81c7ac8d4
Merge pull request #19129 from keszybz/test-random-range
Test random_u64_range()
2021-03-26 20:22:29 +01:00
Luca Boccassi
a9dd1010f0 test-dhcp6-client: add one more assert on memory mapping
Same as 7489d0640a, one more case
that was missed.

Coverity CID #1394277
2021-03-26 20:17:35 +01:00
Zbigniew Jędrzejewski-Szmek
008adf875e
Merge pull request #19125 from keszybz/cat-config
config files: recommend systemd-analyze cat-config
2021-03-26 20:16:09 +01:00
Lennart Poettering
9ddf099f30 resolved: tweak how we signal authoritative answers
let's make sure we set the "aa" bit in the stub only if we answer with
fully authoritative data. For this ensure:

1. Either all data is synthetic, including all CNAME/DNAME redirects

2. Or all data comes from the local trust anchor or the local zones
   (i.e. not the network or the cache)

Follow-up for 4ad017cda5
2021-03-26 18:21:41 +01:00
Zbigniew Jędrzejewski-Szmek
bc52deda4b tests: drop calls to unsetenv SYSTEMD_MEMPOOL
Coverity was complaining that we don't check the return value, which we stopped
doing in 772e0a76f3.

But it seems that we don't want those calls at all. The test was originally
added with the call in a6ee01caf3, but I don't
see why we should override this. If the user wants to execute the test with
mempool disabled, we shouldn't ignore that.

Coverity CID#1444464, CID#1444466.
2021-03-26 15:54:58 +01:00
Zbigniew Jędrzejewski-Szmek
f1a8a66c35 basic/fileio: use malloc_usable_size() to use all allocated memory 2021-03-26 15:54:56 +01:00
Zbigniew Jędrzejewski-Szmek
a9899ff358 basic/fileio: optimize buffer sizes in read_full_virtual_file()
We'd proceed rather inefficiently: the initial buffer size was LINE_MAX/2,
i.e. only 1k. We can read 4k at the same cost.

Also, we'd try to allocate 1025, 2049, 4097 bytes, i.e. always one higher than
the power-of-two size. Effectively the allocation would be bigger, and we'd
waste the additional space. So let's allocate aligned to the power-of-two size.
size=4095, 8191, 16383, so we allocate 4k, 8k, 16k.
2021-03-26 15:53:50 +01:00
Zbigniew Jędrzejewski-Szmek
ca79564309 basic/fileio: simplify calculation of buffer size in read_full_virtual_file()
We'd first assign a value up to SSIZE_MAX, and then immediately check if we
have a value bigger than READ_FULL_BYTES_MAX. This wasn't exactly wrong, but a
bit roundabout. Let's immediately assign the value from the appropriate range
or error out.

Coverity CID#1450973.
2021-03-26 15:46:44 +01:00
David Tardon
cb6c4f37dc use the right member to define property 2021-03-26 14:44:01 +01:00
Zbigniew Jędrzejewski-Szmek
f2a8b8decf test-random-util: add stochastic test for random_u64_range() 2021-03-26 14:38:44 +01:00
Zbigniew Jędrzejewski-Szmek
93457c0c7a test-random-util: modernization 2021-03-26 14:28:24 +01:00
Zbigniew Jędrzejewski-Szmek
058946d1f9 resolvectl: do not warn about single hostnames for names we synthesize
https://github.com/systemd/systemd/pull/17535#discussion_r534005801
2021-03-26 14:19:05 +01:00
Zbigniew Jędrzejewski-Szmek
75c9d6b5cf resolved: split out function to determine the local llmnr hostname 2021-03-26 14:18:51 +01:00
Zbigniew Jędrzejewski-Szmek
20e994b392 resolvectl: reword note about "raw record types"
As noted in https://github.com/systemd/systemd/pull/17535#discussion_r534129256,
"raw" is misleading in this context. Let's use a more descriptive term.
2021-03-26 14:18:17 +01:00
Zbigniew Jędrzejewski-Szmek
e355fb6fb1 basic/log: fix log_trace()
log_trace() was always on. It's supposed to be opt-in.
2021-03-26 13:08:24 +01:00
Lennart Poettering
9f17a03ae8 update TODO 2021-03-26 12:22:17 +01:00
Lennart Poettering
8806bb4bc7 ask-password: when querying for a password, try to read from credential store first
This adds generic support for the SetCredential=/LoadCredential= logic
to our password querying infrastructure: if a password is requested by a
program that has a credential store configured via
$CREDENTIALS_DIRECTORY we'll look in it for a password.

The "systemd-ask-password" tool is updated with an option to specify the
credential to look for.
2021-03-26 12:21:56 +01:00
Lennart Poettering
f6ab6199a2 man: document in nspawn docs how to make use of the new firstboot/sysusers features 2021-03-26 12:21:37 +01:00