1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 23:21:22 +03:00
Commit Graph

50985 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
3968ccd0cd core: fix crash in BPFProgram parsing
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33270.
2021-05-05 17:15:04 +02:00
Zbigniew Jędrzejewski-Szmek
07b3075fad basic/log: use SYNTHETIC_ERRNO in one more place 2021-05-05 17:15:04 +02:00
Zbigniew Jędrzejewski-Szmek
a687f50009 core: use the same pattern for extract_first_word() checks
No functional change, but there is no reason to write it too verbosely
or in different orders.
2021-05-05 17:15:04 +02:00
Zbigniew Jędrzejewski-Szmek
d762abece9 core: fix potential crash in BPFProgram= 2021-05-05 17:15:04 +02:00
Zbigniew Jędrzejewski-Szmek
cc87b3f68f core: fix crash in parsing of SocketBind{Allow,Deny}=
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33876.
2021-05-05 17:14:58 +02:00
Luca Boccassi
73e799387f
Merge pull request #19505 from jwrdegoede/hwdb-2-accel-quirks
hwdb: Add 2 new accel quirks
2021-05-05 11:38:28 +01:00
Zbigniew Jędrzejewski-Szmek
b086a89695
Merge pull request #19453 from keszybz/consider-instance-aliases
Consider instance aliases
2021-05-05 11:23:42 +02:00
Zbigniew Jędrzejewski-Szmek
4c4c250563
Merge pull request #19454 from keszybz/assorted-cleanups
Assorted cleanups
2021-05-05 11:06:33 +02:00
Zbigniew Jędrzejewski-Szmek
ea0d33e2af tests: use "H" as the hostname
"systemd-testsuite" gets in the way when grepping for "testsuite-*.sh".
Also, the name doesn't matter for anything, so let's just use something
very short to save space.
2021-05-05 11:04:59 +02:00
Zbigniew Jędrzejewski-Szmek
41b2d7ac1d TEST-15: add test for template aliases 2021-05-04 17:59:34 +02:00
Zbigniew Jędrzejewski-Szmek
fd22838734 basic/unit-file: fix detection of instance aliases
We had the following scenario:
under /etc/systemd/system/
- foo@.service
- bar@tty12.servicefoo@tty12.service
- multi-user.target.wants/foo@tty12.service

Existing code did not "know" that foo@tty12.service has alias bar@tty12.service:
$ systemctl show -P Names foo@tty12.service
foo@tty12.service

Since multi-user.target is always loaded, we would load foo@tty12.service.
When trying to load bar@tty12.service, it would (correctly) detect that
bar@tty12.service is an alias for foo@tty12.service, and try to merge the
bar@tty12.service unit into the foo@tty12.service. This would fail, because
foo@tty12.service was already loaded, and only about-to-be-loaded units can
be merged.

With the patch we consider bar@tty12.service an alias of foo@tty12.service
immediately, so the issue does not occur:
$ systemctl show -P Names foo@tty12.service
foo@tty12.service bar@tty12.service

Fixes #19409.

This turned in a bigger rewrite. The logic add "the main name and all aliases"
was implemented twice, slightly different in both cases. I split that part out
to a new function. The result about the same length, but hopefully a bit easier
to read.

Logging output is also improved a bit. Some left-over debug logs have been
removed or cleaned up.

This is a fairly big change, but (with the addition in the following commit),
we have pretty good coverage of this logic.
2021-05-04 17:59:34 +02:00
Hans de Goede
bda6bfa5c1 hwdb: Add accel orientation quirk for the Toshiba WT8-B tablet
Add a quirk to fix the accelerometer orientation on the Toshiba WT8-B
tablet.
2021-05-04 17:38:33 +02:00
Hans de Goede
e0883f5350 hwdb: Add accel orientation quirk for the Glavey TM800A550L tablet
Add a quirk to fix the accelerometer orientation on the Glavey TM800A550L
tablet.
2021-05-04 17:36:52 +02:00
Yu Watanabe
8fc1efa88f hostnamectl: fix hyperlink in "Operating System" field
This fixes a bug introduced by 822be62fb2.

Before this, if terminal width is not enough, the all subsequent lines
are included in the hyperlink.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1955475.
2021-05-04 15:27:20 +02:00
Yu Watanabe
296c13dec4 tree-wide: fix typo 2021-05-04 15:03:04 +02:00
Zbigniew Jędrzejewski-Szmek
edb83bceec core/automount: drop unecessary cast 2021-05-04 14:57:49 +02:00
Zbigniew Jędrzejewski-Szmek
4c1f9343b2 core/cgroup: remove some unnecessary variables 2021-05-04 14:57:49 +02:00
Zbigniew Jędrzejewski-Szmek
905a0abd22 basic/log: directly initialize iovec arrays
It doesn't change much, but removes a bunch of explicit size and index handling
and unnecessary initializations.
2021-05-04 14:57:49 +02:00
Zbigniew Jędrzejewski-Szmek
2f9d1da95a basic/io-util: move iterator variable declarations into loop headers 2021-05-04 14:57:49 +02:00
Zbigniew Jędrzejewski-Szmek
cf1e6e6260 resolved: directly initialize iovec array 2021-05-04 14:57:49 +02:00
Zbigniew Jędrzejewski-Szmek
32f65484d7 basic/io-util: invert return value from IOVEC_INCREMENT()
We would try to return a value that could be nonzero only if the kernel
reported writing more bytes than we gave to it, hopefully a rare occurence.
Instead, assert that this doesn't happen.

Instead, return true if we got to the end of the iovec array. The caller
can use this information to know that the whole iovec array was written.
This allows one loop to be dropped in write_to_syslog().

Also drop _unlikely_: this function is called with very short arrays, and
it *is* likely that we trigger this condition. Let's just let the compiler
generate normal code without giving it a potentially false hint.
2021-05-04 14:57:49 +02:00
Zbigniew Jędrzejewski-Szmek
0f6bb1ed05 core: remove spurious % in dump string 2021-05-04 14:22:58 +02:00
Zbigniew Jędrzejewski-Szmek
806a93623c core/cgroup: use assert_se() more 2021-05-04 14:22:58 +02:00
Zbigniew Jędrzejewski-Szmek
431733b866 core: minor simplification 2021-05-04 14:22:58 +02:00
Zbigniew Jędrzejewski-Szmek
7e92ab4eb8 meson: make one check shorter 2021-05-04 14:22:58 +02:00
Zbigniew Jędrzejewski-Szmek
32464e18b4 test-unit-file: enable colors
There's quite a lot of output and it's much easier to grok this way.
2021-05-04 13:36:05 +02:00
Zbigniew Jędrzejewski-Szmek
6aac02ff1a TEST-15: add forgotten file cleanup 2021-05-04 13:36:05 +02:00
Zbigniew Jędrzejewski-Szmek
998df7ce0d manager: emit a message when we fail to create manager because /run is not set up
$ SYSTEMD_LOG_LEVEL=debug build/systemd --test --user
...
Failed to lookup RuntimeDirectory path: No such device or address   <---- this line is new
Failed to allocate manager object: No such device or address

We would fail and only say "Failed to allocate manager object: ENODEV" which is
not entirely self-explanatory. Let's add a better log message.
2021-05-04 13:36:05 +02:00
Zbigniew Jędrzejewski-Szmek
5169595ec3 TEST-15: use ${:?} and shorten things a bit 2021-05-04 13:36:05 +02:00
Zbigniew Jędrzejewski-Szmek
c0d4409219 test: properly catch tests error with no /testok or empty /failed
When editing this function in 7bf20e48bd, I couldn't
decide whether to initialize ret at the top and only reset it on success, or
whether to assign a value in each branch. In the end I did neither ;( So if the
test finished without creating any of the result files, we would echo a
message, but return "success".

But there was bigger confusion with /failed: some tests create it empty, some
don't. I think we may want to do away pre-creation of /failed completely, and
assume the test failed unless /testok is found. But I'm leaving that for later
rework. For now let's just make sure we report return success only if /testok
or /skipped is found.
2021-05-04 13:36:05 +02:00
imayoda
d7ffd4f334 Add correct rotation support for Mediacom Winpad 7.0 W700
this patch enables correct bios detection and matrix for the aforementioned tiny tablet (touchscreen support commit pending now in kernel) 
thnx
2021-05-03 20:19:36 +02:00
Jakub Warczarek
572c55ee3c hostnamectl: deprecate set-* methods and expose getters by only using nouns in commands 2021-05-03 20:19:19 +02:00
Ryan Hendrickson
c2503e359a core: apply LogLevelMax to messages about units
This commit applies the filtering imposed by LogLevelMax on a unit's
processes to messages logged by PID1 about the unit as well.

The target use case for this feature is a service that runs on a timer
many times an hour, where the system administrator decides that writing
a generic success message to the journal every few minutes or seconds
adds no diagnostic value and isn't worth the clutter or disk I/O.
2021-05-03 17:48:41 +02:00
Lennart Poettering
16ecdf3c80
Merge pull request #19403 from nmeyerhans/dmi-entries
virt: differentiate Amazon EC2 bare-metal from VM instances using SMBIOS data
2021-05-03 17:48:13 +02:00
Luca Adrian L
19d25fdec1
Document the need to do journalctl --flush for persistent logging (#19481)
Document the need to do journalctl --flush for persistent logging. (fixes #19480)

Co-authored-by: Luca Lindhorst <l.lindhorst@wut.de>
2021-05-03 17:08:25 +02:00
Luca Boccassi
d4d7127d94 Revert "sysusers/firstboot: temporarily disable LoadCredential"
This reverts commit 7c20dd4b6e.

Debian has now been updated to patch the issue, so SemaphoreCI should
no longer fail. The fix has also been backported to the affected
stable branches.
2021-05-03 12:16:35 +09:00
Yu Watanabe
7afc8abdf3
Merge pull request #19487 from mrc0mmand/test-all-services-in-TEST-01
test: don't mask "supporting" services in TEST-01-BASIC
2021-05-03 12:15:29 +09:00
Frantisek Sumsal
d49b881eaf test: fix a yet another pipefail + pipe race
Basically the same scenario as in
a33e2692e1, where `awk` exits as soon
as it finds a match, thus sending SIGPIPE to `ldd` if it's not fast
enough. That, in combination with `set -o pipefail` causes random &
unexpected fails, like:

```
No journal files were found.
-rw-r----- 1 root root 16777216 Apr 30 10:31
/var/tmp/TEST-01-BASIC_sanitizers-nspawn/system.journal
TEST-01-BASIC RUN: Basic systemd setup [OK]
systemd is not linked against the ASan DSO
gcc does this by default, for clang compile with -shared-libasan
make: *** [Makefile:2: clean-again] Error 1
make: Leaving directory '/build/test/TEST-01-BASIC'
```
2021-05-01 15:05:16 +09:00
Yu Watanabe
0c9cdcb9d4
Merge pull request #19476 from yuwata/network-can
network: several CAN device related updates
2021-05-01 15:03:22 +09:00
Yu Watanabe
bff97a251d
Merge pull request #18904 from yuwata/udev-watch
udev: several inotify watch fixups
2021-05-01 15:02:43 +09:00
Frantisek Sumsal
0868f6d4e6 test: explicitly pull resolved/networkd in TEST-01-BASIC
to give them at least a basic coverage.
2021-04-30 22:21:29 +02:00
Noah Meyerhans
ce35037928 Use BIOS characteristics to distinguish EC2 bare-metal from VMs
DMI vendor information fields do not provide enough information for us to
distinguish between Amazon EC2 virtual machines and bare-metal instances.
SMBIOS provides a BIOS Information
table (https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.4.0.pdf
Ch. 7) that provides a field to indicate that the current machine is a virtual
machine.  On EC2 virtual machine instances, this field is set, while bare-metal
instances leave this unset, so we inspect the field via the kernel's
/sys/firemware/dmi/entries interface.

Fixes #18929
2021-04-30 12:26:22 -07:00
Bertrand Jacquin
382a46d129 machine-id-setup: generate machine-id from DMI product ID on Amazon EC2
Amazon EC2 Nitro hypervisor is technically based on KVM[1].

[1] https://aws.amazon.com/ec2/faqs/
2021-04-30 12:26:22 -07:00
Frantisek Sumsal
7776b22521 test: don't mask "supporting" services in TEST-01-BASIC
This got lost during one of the code de-duplication attempts.
2021-04-30 21:02:41 +02:00
Bertrand Jacquin
b6eca3731d virt: detect Amazon EC2 Nitro instance
Amazon EC2 Nitro hypervisor is technically based on KVM[1], which
systemd-detect-virt identify propely from CPUID. However the lack of
CPUID on aarch64 (A1, T4 instance type) prevents a correct
identification, impacting hostnamectl and systemd-random-seed. Instead
it's possible to identify virtualization from DMI vendor ID.

Prior to this commit:
  # hostnamectl
     Static hostname: n/a
  Transient hostname: ip-10-97-8-12
           Icon name: computer
          Machine ID: 8e3772fbcfa3dd6f330a12ff5df5a63b
             Boot ID: b7b7e2fe0079448db664839df59f9817
    Operating System: Gentoo/Linux
              Kernel: Linux 5.4.69-longterm
        Architecture: arm64

After this commit:
  # hostnamectl
     Static hostname: n/a
  Transient hostname: ip-10-97-8-12
           Icon name: computer-vm
             Chassis: vm
          Machine ID: 8e3772fbcfa3dd6f330a12ff5df5a63b
             Boot ID: bd04da57084e41078f20541101867113
      Virtualization: amazon
    Operating System: Gentoo/Linux
              Kernel: Linux 5.4.69-longterm
        Architecture: arm64

[1] https://aws.amazon.com/ec2/faqs/
2021-04-30 09:31:34 -07:00
Yu Watanabe
c068a17f6a sd-bus: fix vtable named argument logic
Fixes #19468.
2021-04-30 17:06:29 +01:00
Yu Watanabe
b43669a4b1 test: add a simple test for udev watch 2021-04-30 19:42:09 +09:00
Yu Watanabe
e63916ab29 test: generate debugging logs for udev tests 2021-04-30 19:42:09 +09:00
Yu Watanabe
e1e56f3443 test: run udev tests after currently queued events are finished 2021-04-30 19:42:09 +09:00
Yu Watanabe
e7f781e473 udev,sd_device: also save map from device ID to watch handle in /run/udev/watch
Previously, watch handle is saved in the udev databse. But in most cases,
the handle saved in the database is not updated. Especially, when udevd
is restarted, the inotify watch is restarted, but the database is not
updated.

Moreover, it is not necessary to save watch handle in the database, as
the handle is only take a effect during udevd is running, and the value
is meaningless when udevd is restarted.

So, this makes the opposite map from device ID to watch handle is saved
in /run/udev/watch as a symbolic link, and the handle not saved in the
database anymore.

Fixes #18525.
2021-04-30 19:41:41 +09:00