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

50448 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
0ee994836c TEST-*: use spacing before redirection operator, but not after
<< EOF → <<EOF
> foo < bar → >foo <bar
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
4e20fe2795 TEST-*: make failure tests actually fail on failure
Here the intent was actually correct, and the tests still pass when the check
is made effective.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
61494724ee TEST-42-EXECSTOPPOST: un-invert test
Since we test for the file right below, it seems we expected the
command to succeed.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
b88ba6c761 tmpfiles: make handling of existing-but-different targets more consistent
create_fifo() was added in a2fc2f8dd3, and
would always ignore failure. The test was trying to fail in this case, but
we actually don't fail, which seems to be correct. We didn't notice before
because the test was ineffective.

To make things consistent, generally log at warning level, but don't propagate
the error. For symlinks, log at debug level, as before.

For 'e', failure is not propagated now. The test is adjusted to match.

I think warning is appropriate in most cases: we do not expect a device node to
be replaced by a different device node or even a non-device file. This would
most likely be an error somewhere. An exception is made for symlinks, which are
mismatched on purpose, for example /etc/resolv.conf. With this patch, we don't
get any warnings with the any of the 74 tmpfiles.d files, which suggests that
increasing the warning levels will not cause too many unexpected warnings. If
it turns out that there are valid cases where people have expected mismatches
for non-symlink types, we can always decrease the log levels again.
2021-04-08 20:16:37 +02:00
Zbigniew Jędrzejewski-Szmek
b065dfc8ed TEST-33-CLEAN-UNIT: fix broken test exposed by condition check fix 2021-04-08 11:46:07 +02:00
Zbigniew Jędrzejewski-Szmek
4e324ce42c TEST-22-TMPFILES: fix broken test exposed by condition check fix 2021-04-08 11:46:07 +02:00
Zbigniew Jędrzejewski-Szmek
ffa328f060 tests: make inverted tests actually count
"! test ..." does not cause the script to fail, even with set -e.
IIUC, bash treats this command as part of an expression line, as it
would if 'test ... && ...' was used. Failing expression lines do not
terminate the script.

This fixes the obvious cases by changing '! test' → 'test !'.
Then the inversion happens internally in test and bash will propagate
the failure.
2021-04-08 11:45:59 +02:00
Luca Boccassi
65d09d575c Bump test-random-util timeout
It is using log_trace, which we enabled in the CI, so now it's
slower and it is timing out. Bump the timeout from 30s to 120s.
2021-04-07 09:32:42 +02:00
Zbigniew Jędrzejewski-Szmek
3e3ab11b9e
Merge pull request #19135 from bluca/coredump_decode
coredump: parse build-id and .note.package
2021-04-07 07:41:16 +02:00
Luca Boccassi
a7ea0a460b Add markdown doc about coredump package metadata 2021-04-06 23:12:51 +01:00
Luca Boccassi
d1b5a0c691 coredumpctl: parse and print package metadata 2021-04-06 23:12:51 +01:00
Luca Boccassi
c546154a44 coredump: parse and append package metadata to journal message
Append 'package' and 'packageVersion' to the journal as discrete fields
COREDUMP_PKGMETA_PACKAGE and COREDUMP_PKGMETA_PACKAGEVERSION respectively,
and the full json blurb as COREDUMP_PKGMETA_JSON.
2021-04-06 23:12:51 +01:00
Luca Boccassi
95f7180773 coredump: parse .note.package ELF section
Parse the .note.package ELF section for each ELF object
contained in a core file, if present.
2021-04-06 22:53:54 +01:00
Luca Boccassi
965e095546 coredump: parse build-id out of core file
Parse the build-id of each ELF object contained in the core file
using the elfutils' libdwfl interface.
Add it to the journal.
2021-04-06 22:52:48 +01:00
Luca Boccassi
ee579e6454
Merge pull request #19215 from braewoods/main
hwdb: 60-keyboard:: Add quirks for 2 new HP laptops
2021-04-06 18:52:11 +01:00
Lennart Poettering
1b30720c1b tpm2-util: properly load tpm2 libraries befre unsealing
We forgot a call to dlopen_tpm2() in the unseal codepaths. As long as
automatic TPM2 device discovery was used that didn't matter, since in
that codepaths we'd have another call dlopen_tpm2(). But with an
explicitly configured TPM2 device things should work too, hence add the
missing call.

Fixes: #19206
2021-04-06 18:43:24 +02:00
Lennart Poettering
ff2cf6f8fe recovery-key: add some extra asserts
Let's ensure our key sizes calculations are correct.

This doesn't actually change anything, just adds more safety checks.
Inspired by #19203, but not a fix.
2021-04-06 18:42:30 +02:00
KoyamaSohei
da846b3031 resolve: copy rd flag from the query to response 2021-04-06 17:00:29 +02:00
Sibo Dong
f34173a048 bash-completion: localize words and cword variables
The words and cword variables are not localized in all Bash completion
scripts that call _init_completion.

cur, prev, words, and cword (and split if using the -s flag) are all
variables that should be localized in Bash completion scripts before
calling _init_completion (even if they don't otherwise appear in the
calling script). This is done for cur and prev, but not for words and
cword. Letting words and cword remain unlocalized may clobber variables
the user is using for other purposes, which is bad.

This issue can be resolved by declaring words and cword as local
variables.

Resolves #19188.
2021-04-06 16:15:13 +02:00
Luca Boccassi
7c20dd4b6e sysusers/firstboot: temporarily disable LoadCredential
Single-param LoadCredential= in units causes systemd v247/v248 to
assert when parsing. Disable it for now, until the fix is merged
in the stable trees, released and available (eg: in Debian
for the CI)

See: https://github.com/systemd/systemd/issues/19178
2021-04-06 12:02:42 +02:00
Lennart Poettering
f3e58b55de update 2021-04-06 11:48:37 +02:00
James Buren
5f6e4dc4f4 hwdb: 60-keyboard:: Add HP ProBook 455 G5 hotkey quirks
This enables all of the known hotkeys that were not working out of the
box on my test unit.
2021-04-06 02:18:26 -05:00
James Buren
98fa828f60 hwdb: 60-keyboard:: Add HP mt44 Mobile Thin Client hotkey quirks
This enables all of the known hotkeys that were not working out of the
box on my test unit.
2021-04-06 01:32:37 -05:00
Gibeom Gwon
fd11201b93 qrcode-util: set case-sensitive for generating QR codes
Until now, string treated case-insensitive, always converted to
uppercase. This can cause confusion such as user enter uppercased
recovery key.
2021-04-06 08:08:01 +02:00
Anita Zhang
afbcd90552 test-firewall-util: skip if iptables nat table does not exist 2021-04-06 08:01:27 +02:00
Zbigniew Jędrzejewski-Szmek
9d5ae3a121
Merge pull request #19126 from anitazha/oomdimprovements
systemd-oomd post-test week improvements
2021-04-06 07:59:59 +02:00
Frantisek Sumsal
34fde9f898 test: check if the unit file fuzzer corpora is up to date
This follows a similar pattern we already have in place for
networkd-related directives.
2021-04-05 14:41:05 +01:00
Anita Zhang
685b0985f0 oomd: threshold swap kill candidates to usages of more than 5%
In some instances, particularly with swap on zram, swap used will be high
while there is still a lot of memory available. FB OOMD handles this by
thresholding kills to X% of total swap usage. Let's do the same thing here.

Anecdotally with these thresholds and my laptop which is exclusively swap
on zram I can sit at 0K / 4G swap free with most of memory free and
systemd-oomd doesn't kill anything.

Partially addresses aggressive kill behavior from
https://bugzilla.redhat.com/show_bug.cgi?id=1941170
2021-04-05 02:04:49 -07:00
Anita Zhang
cb13961ada oomd: don't get pressure candidates on every interval
Only start collecting candidates for a memory pressure kill when we're
hitting the limit (but before the duration hitting that limit is
exceeded). This brings CPU util from ~1% to 0.3%.

Addresses CPU util from
https://bugzilla.redhat.com/show_bug.cgi?id=1941340
and
https://bugzilla.redhat.com/show_bug.cgi?id=1944646
2021-04-05 02:01:32 -07:00
Frantisek Sumsal
080a602771 fuzzer: add a test case for #19178 2021-04-03 10:38:06 +01:00
Luca Boccassi
1270e56526
Merge pull request #19179 from anitazha/buildandtest
test-oomd-util: fix running in mkosi
2021-04-02 17:56:13 +01:00
Viktor Mihajlovski
a496a238e8 udev: fix slot based network names on s390
The s390 PCI driver assigns the hotplug slot name from the
function_id attribute of the PCI device using a 8 char hexadecimal
format to match the underlying firmware/hypervisor notation.

Further, there's always a one-to-one mapping between a PCI
function and a hotplug slot, as individual functions can
hot plugged even for multi-function devices.

As the generic matching code will always try to parse the slot
name in /sys/bus/pci/slots as a positive decimal number, either
a wrong value might be produced for ID_NET_NAME_SLOT if
the slot name consists of decimal numbers only, or none at all
if a character in the range from 'a' to 'f' is encountered.

Additionally, the generic code assumes that two interfaces
share a hotplug slot, if they differ only in the function part
of the PCI address. E.g., for an interface with the PCI address
dddd:bb:aa.f, it will match the device to the first slot with
an address dddd:bb:aa. As more than one slot may have this address
for the s390 PCI driver, the wrong slot may be selected.

To resolve this we're adding a new naming schema version with the
flag NAMING_SLOT_FUNCTION_ID, which enables the correct matching
of hotplug slots if the device has an attribute named function_id.
The ID_NET_NAME_SLOT property will only be produced if there's
a file /sys/bus/pci/slots/<slotname> where <slotname> matches
the value of /sys/bus/pci/devices/.../function_id in 8 char
hex notation.

Fixes #19016
See also #19078
2021-04-02 18:08:23 +02:00
Zbigniew Jędrzejewski-Szmek
bd6ea22920
Merge pull request #18717 from yuwata/sd-device-monitor-introduce-more-filters
sd-device-monitor: introduce two new filters and use them in dissect-image.c
2021-04-02 15:53:16 +02:00
Carlo Teubner
6d3831cee5 docs: use current spelling "macOS" not "OS X" etc. 2021-04-02 10:53:26 +01:00
Yu Watanabe
0a8f9bc6bb dissect-image: move parent device check into device_is_partition()
Checking parent for enumerated devices is mostly redundant. Just for
safety.
2021-04-02 15:10:09 +09:00
Yu Watanabe
11368b694e dissect-image: also check devtype in device_is_partition()
This should be mostly redundant. Just for safety.
2021-04-02 15:10:09 +09:00
Yu Watanabe
210e1cd6e6 dissect-image: filter out enumerated or triggered devices without "partition" sysattr
This also adds more filters for device enumerator and monitor.
These newly added filters should be mostly redundant. But this hides
spurious error in sd_device_get_sysattr_value(). See,
https://github.com/systemd/systemd/pull/18684#discussion_r579700977
2021-04-02 15:10:09 +09:00
Yu Watanabe
def366933c test: add tests for filters of sd-device-monitor 2021-04-02 15:10:09 +09:00
Yu Watanabe
b8a0edbb2a sd-device-monitor: introduce sd_device_monitor_filter_add_match_parent() 2021-04-02 15:10:09 +09:00
Yu Watanabe
bcfe746ba7 sd-device-enumerator: also move match_parent() to device-util.[ch] 2021-04-02 15:10:09 +09:00
Yu Watanabe
d9b030b673 sd-device-monitor: introduce sd_device_monitor_filter_add_match_sysattr() 2021-04-02 15:10:09 +09:00
Yu Watanabe
ac790e8bfc sd-device-enumerator: move match_sysattr() to device-util.[ch]
It will be used by sd-device-monitor in later commits.
2021-04-02 15:10:07 +09:00
Yu Watanabe
112e6dd106 sd-device-monitor: split passes_filter() into two parts 2021-04-02 15:09:03 +09:00
Anita Zhang
080ca0d830 test-oomd-util: fix running in mkosi
When this test is run in mkosi, the previously tested cgroup that we write
xattrs into and the root cgroup are the same.

Since the root cgroup is a live cgroup anyways (vs. the test cgroups which are
remade each time) let's generate the expected preference values from reading
the xattrs instead of assuming it will be NONE.
2021-04-01 21:23:24 -07:00
Anita Zhang
a858355e4a oomd: force DefaultMemoryPressureDurationSec= to be greater than or equal 1 sec 2021-04-01 19:53:42 -07:00
Anita Zhang
14140b3544 oomd: delete unused variables 2021-04-01 19:53:13 -07:00
Anita Zhang
69c8f0255a oomd: rename last_hit_mem_pressure_limit -> mem_pressure_limit_hit_start
Since this is only changed the first time the limit is hit (and remains
set as long as the pressure remains over), I changed the name to better
reflect that.

Keeps consistent with "last_had_mem_reclaim" which is actually updated
every time there is reclaim activity.
2021-04-01 19:52:49 -07:00
Anita Zhang
df637ede7b oomd: rework memory reclaim detection logic
systemd-oomd only monitors and kills within a selected cgroup subtree
For memory pressure kills, this means it's unnecessary to get the
pgscan rate across all the monitored memory pressure cgroups.
The increase will show up whether we do a total sum or not, but since
we only care about the increase in the subtree we're about to target
for a kill, we can simplify the code a bit by not doing this total sum.
2021-04-01 19:51:54 -07:00
Anita Zhang
37d8020ccc oomd: refactor pgscan_rate calculation into helper 2021-04-01 19:45:24 -07:00
Anita Zhang
81d66fab34 oomd: split swap and mem pressure event timers
One thing that came out of the test week is that systoomd needs to poll
more frequently so as not to race with the kernel oom killer in
situations where memory is eaten quickly. Memory pressure counters are
lagging so it isn't worthwhile to change the current read rate; however swap
is not lagging and can be checked more frequently.

So let's split these into 2 different timer events. As a result, swap
now also doesn't have to be subject to the post-action (post-kill) delay
that we need for memory pressure events.

Addresses some of slowness to kill discussed in
https://bugzilla.redhat.com/show_bug.cgi?id=1941340
2021-04-01 19:44:14 -07:00