Commit Graph
40306 Commits
Author SHA1 Message Date
Yu Watanabe 82c5487894 test: skip one test for iszero_safe() on i386 without SSE2
We do not provide any numerical libraries, and iszero_safe() is only
used in parsing or formatting JSON. Hence, it is not necessary for us to
request that the function provides the same result on different systems.

Fixes #25044.
2022-10-19 00:09:44 +02:00
Luca Boccassi af4117037b Merge pull request #25004 from keszybz/transient-drop-ins
Allow drop-ins for transient units
2022-10-18 11:49:29 +02:00
Zbigniew Jędrzejewski-Szmek 9e11abe817 Merge pull request #25007 from keszybz/rename-dbus-dump
manager: rename dbus method
2022-10-18 11:34:16 +02:00
Ted X. Toth 29dbc62d74 manager: use target process context to set socket context
Use target process context to set socket context when using SELinuxContextFromNet
not systemd's context. Currently when using the SELinuxContextFromNet option for
a socket activated services, systemd calls getcon_raw which returns init_t and
uses the resulting context to compute the context to be passed to the
setsockcreatecon call. A socket of type init_t is created and listened on and
this means that SELinux policy cannot be written to control which processes
(SELinux types) can connect to the socket since the ref policy allows all
'types' to connect to sockets of the type init_t. When security accessors see
that any process can connect to a socket this raises serious concerns. I have
spoken with SELinux contributors in person and on the mailing list and the
consensus is that the best solution is to use the target executables context
when computing the sockets context in all cases.

[zjs review/comment:

This removes the branch that was added in 16115b0a7b.
16115b0a7b did two things: it had the branch here
in 'socket_determine_selinux_label()' and a code in 'exec_child()' to call
'label_get_child_mls_label(socket_fd, command->path, &label)'.

Before this patch, the flow was:
'''
mac_selinux_get_child_mls_label:
  peercon = getpeercon_raw(socket_fd);
  if (!exec_label)
     exec_label = getfilecon_raw(exe);

socket_open_fds:
  if (params->selinux_context_net)                 #
     label = mac_selinux_get_our_label();          #  this part is removed
  else                                             #
     label = mac_selinux_get_create_label_from_exe(path);
  socket_address_listen_in_cgroup(s, &p->address, label);

exec_child():
   exec_context = mac_selinux_get_child_mls_label(fd, executable, context->selinux_context);
   setexeccon(exec_context);
'''
]
2022-10-18 11:31:22 +02:00
Zbigniew Jędrzejewski-Szmek b08d86dc4a analyze: use DumpUnitsMatchingPatternsByFileDescriptor
Similarly to DumpByFileDescriptor vs Dump,
DumpUnitsMatchingPatternsByFileDescriptor is used in preference. Dissimilarly,
a fallback to DumpUnitsMatchingPatterns is not done on error, because there is
no need for backwards compatibility.

The code is still more verbose than I'd like, but there are four different code
paths with slightly different rules in each case, so it's hard to make this all
very brief. Since we have a separate file dedicated to making those calls, the
verbose-but-easy-to-follow implementation should be OK.

Closes #24989.

I only did a quick test that all both variants works locally and over ssh.
2022-10-18 08:45:45 +02:00
Zbigniew Jędrzejewski-Szmek 8ff92848a6 Merge pull request #24777 from medhefgo/stub
stub: Use LoadImage/StartImage
2022-10-18 07:36:20 +02:00
Luca Boccassi 6a0907b8a3 Merge pull request #25035 from keszybz/manager-method-names
Manager method names
2022-10-17 23:11:13 +02:00
Zbigniew Jędrzejewski-Szmek 725a28fe77 Merge pull request #24992 from yuwata/sd-device-monitor-receive-buffer
sd-device-monitor: dynamically allocate receive buffer
2022-10-17 20:49:18 +02:00
Luca Boccassi 7a329f2bac Merge pull request #25036 from keszybz/plurals
Remove usage of "noun(s)" in messages and docs
2022-10-17 17:12:16 +02:00
David Edmundson 9739bcfd85 xdg-autostart-service: Add comments to tilde expansion, use path_join()
Follow-ups for https://github.com/systemd/systemd/pull/24658
2022-10-17 16:42:39 +02:00
Zbigniew Jędrzejewski-Szmek 02df2981b5 meson: drop repeated output in error message 2022-10-17 15:10:53 +02:00
Zbigniew Jędrzejewski-Szmek 0923b4253c tree-wide: replace "plural(s)" by "plurals"
(s) is just ugly with a vibe of DOS. In most cases just using the normal plural
form is more natural and gramatically correct.

There are some log_debug() statements left, and texts in foreign licenses or
headers. Those are not touched on purpose.
2022-10-17 15:10:53 +02:00
Zbigniew Jędrzejewski-Szmek f6cce15bb3 manager: add DumpUnitsMatchingPatternsByFileDescriptor() 2022-10-17 15:00:53 +02:00
Jan Janssen 09da51f8e9 boot: Rework shim image verification
This moves the shim security arch override to the new
ReinstallProtocolInterface based interface. This also has the benefit to
reduce the time window in which we have this override active and also
actually removes it, which was not previously done.

The shim hooks themselves are also modernized too. The upcalls should
really not be neccessary if shim is happy with the provided binary.
2022-10-17 14:49:11 +02:00
Yu Watanabe efbd4b3ca8 sd-device-monitor: dynamically allocate receive buffer
If udevd broadcasts a processed device with huge amount of properties,
then clients cannot receive the device.

Fixes #24987.
2022-10-17 21:49:08 +09:00
Jan Janssen 6731a102da stub: Allow loading unsigned kernel images 2022-10-17 14:48:28 +02:00
Jan Janssen 0e3c374e8c boot: Use proper security arch protocol names
This is how the Platform Intregration Specification defines these.
2022-10-17 14:47:42 +02:00
Jan Janssen dcde6ae165 boot: Remove unused parameters from pe_kernel_info
Only the compat entry address is used now. This also now only returns
the compat entry address. If the image is native we do not need to try
calling into the entry address again as we would already have done so
from StartImage (and failed).
2022-10-17 14:47:42 +02:00
Jan Janssen a529d8182e stub: Use LoadImage/StartImage to start the kernel
This is the proper way to start any EFI binary. The fact this even ever
worked was because the kernel does not have any PE relocations.

The only downside is that the embedded kernel image has to be signed and
trusted by the firmware under secure boot. A future commit will try to
deal with that.
2022-10-17 14:47:39 +02:00
Jan Janssen bfc075fa6b stub: Rename image parameter
This is really the parent image for the kernel that is to be run.
Renaming it as such prevents confusion with any image handles that are
about to be created.
2022-10-17 14:41:26 +02:00
Lennart Poettering 714c586943 cryptsetup: drop redundant parens/drop ternary op
A ternary op is a bit weird to use if we end up assigning a variable to
itself in one of the branches. Hence use a plain if check.
2022-10-17 13:52:54 +02:00
Zbigniew Jędrzejewski-Szmek 535b7fcb44 core: simplify the return convention in manager_load_unit()
This function was returning 0 or 1 on success. It has many callers, and it
wasn't clear if any of them care about the distinction. It turns out they don't
and the return values were done for convenience because manager_load_unit_prepare()
returns 0 or 1. Let's invert the code in the static function to follow the usual
pattern where 0 means "no work was done" and 1 means "work was done", and make
the non-static function always return 0 to make the code easier to read, and
also add comments that explain what is happening.

No functional change.
2022-10-17 13:50:16 +02:00
Zbigniew Jędrzejewski-Szmek 4b6a2b3f58 core: modernize style of return param naming 2022-10-17 13:50:16 +02:00
Zbigniew Jędrzejewski-Szmek c39d018774 Merge pull request #24919 from anitazha/varlinkserialize
varlink/pid1 fixes for systemd-oomd (addresses #20330)
2022-10-17 13:44:28 +02:00
Lennart Poettering 8d9295bbf5 pcrphase: fix --help text
We don't take a command, we just take a "word" which we'll extend into
PCR 11.
2022-10-17 12:39:33 +02:00
Lennart Poettering 047273e6e8 pcrphase: add two additional phases
This adds two more phases to the PCR boot phase logic: "sysinit" +
"final".

The "sysinit" one is placed between sysinit.target and basic.target.
It's good to have a milestone in this place, since this is after all
file systems/LUKS volumes are in place (which sooner or later should
result in measurements of their own) and before services are started
(where we should be able to rely on them to be complete).

This is particularly useful to make certain secrets available for
mounting secondary file systems, but making them unavailable later.

This breaks API in a way (as measurements during runtime will change),
but given that the pcrphase stuff wasn't realeased yet should be OK.
2022-10-17 12:09:43 +02:00
Luca Boccassi 42fadfb168 Merge pull request #24938 from msizanoen1/journald-harden-clock-jump
journald: harden against forward clock jumps before unclean shutdown
2022-10-17 12:00:02 +02:00
Daan De Meyer 3f5225d7f3 qrcode-util: Add support for libqrencode 3.0
They didn't actually change API between major versions, so let's
support the previous version as well so we can add CentOS 8 Stream
back to CI.
2022-10-17 08:45:16 +02:00
Jan Janssen d388f3d723 stub: Fix booting with old kernels
This fixes a regression introduced in e1636807 that removed setting this
value as it seemingly was not used by the kernel and would actively
break above 4G boots. But old kernels (4.18 in particular) will not boot
properly if it is not filled out by us.
The original issue was using the truncated value to then jump into the
kernel entry point, which we do not do anymore. So setting this value
again on newer kernels is fine.
2022-10-17 08:43:01 +02:00
Lennart Poettering 235ae69cbe gpt-auto: rename all functions that operate on a DissectedPartition object add_partition_xyz()
The function for handling regular mounts based on DissectedPartition
objects is called add_partition_mount(), so let's follow this scheme for
all other functions that handle them, too. This nicely separates out the
low-level functions (which get split up args) from the high-level
functions (which get a DissectedPartition object): the latter are called
add_partition_xyz() the former just add_xyz().

This makes naming a bit more systematic. No change in behaviour.
2022-10-17 08:07:58 +02:00
Lennart Poettering e8ede6f57e generator: modernize generator_open_unit_file() 2022-10-17 08:06:55 +02:00
Lennart Poettering 06648fa991 gpt-auto-generator: use our usual ret_xyz parameter naming 2022-10-17 08:05:05 +02:00
Lennart Poettering b6fd88a511 cryptsetup: use errno-flavoured logging where we have an errno 2022-10-17 08:02:03 +02:00
Lennart Poettering 75b1d269cb tpm2-util: fix parameter name 2022-10-17 08:00:04 +02:00
msizanoen1 5bc787fa53 journal: fix indentation in managed_journal_file_open_reliably 2022-10-16 21:07:33 +07:00
msizanoen1 383d9155a2 journald: harden against forward clock jumps before unclean shutdown
Try harder to inherit the sequence number and ID from the old journal
file before rotating it away.

This helps the libsystemd journal file selection code make better decisions
even in the face of massive incorrect forward clock jumps prior to an
unclean shutdown.
2022-10-16 21:07:33 +07:00
Zbigniew Jędrzejewski-Szmek 1f83244641 manager: allow transient units to have drop-ins
In https://github.com/containers/podman/issues/16107, starting of a transient
slice unit fails because there's a "global" drop-in
/usr/lib/systemd/user/slice.d/10-oomd-per-slice-defaults.conf (provided by
systemd-oomd-defaults package to install some default oomd policy). This means
that the unit_is_pristine() check fails and starting of the unit is forbidden.

It seems pretty clear to me that dropins at any other level then the unit
should be ignored in this check: we now have multiple layers of drop-ins
(for each level of the cgroup path, and also "global" ones for a specific
unit type). If we install a "global" drop-in, we wouldn't be able to start
any transient units of that type, which seems undesired.

In principle we could reject dropins at the unit level, but I don't think that
is useful. The whole reason for drop-ins is that they are "add ons", and there
isn't any particular reason to disallow them for transient units. It would also
make things harder to implement and describe: one place for drop-ins is good,
but another is bad. (And as a corner case: for instanciated units, a drop-in
in the template would be acceptable, but a instance-specific drop-in bad?)

Thus, $subject.

While at it, adjust the message. All the conditions in unit_is_pristine()
essentially mean that it wasn't loaded (e.g. it might be in an error state),
and that it doesn't have a fragment path (now that drop-ins are acceptable).
If there's a job for it, it necessarilly must have been loaded. If it is
merged into another unit, it also was loaded and found to be an alias.
Based on the discussion in the bugs, it seems that the current message
is far from obvious ;)

Fixes https://github.com/containers/podman/issues/16107,
https://bugzilla.redhat.com/show_bug.cgi?id=2133792.
2022-10-16 14:20:58 +02:00
Celeste Liu 09925036cf seccomp: add riscv_flush_icache to allow list
This system call is harmless because it only enforces ordering between stores
and instruction cache fetch.

fixed #24991
Related: https://github.com/felixonmars/archriscv-packages/issues/1840

Signed-off-by: Celeste Liu <CoelacanthusHex@gmail.com>
2022-10-16 12:40:00 +02:00
Yu Watanabe 3e15bed410 udev: drop unused source file
Follow-up for 5bbcfbaa11.
2022-10-15 20:41:23 +09:00
Lennart Poettering c8428d2d06 seccomp: drop per arch conditionalization in filter groups
We list plenty of arch-specific syscalls in our filter groups, treat the
s390 syscalls the same.

We handle gracefully anyway if some syscall doesn't exist locally on the
kernel or arch, let's rely on it. This has the benefit that
"systemd-analyze" will comprehensively tell you the syscalls filtered on
any arch for any arch.

And less conditionalization is good anyway.
2022-10-15 00:00:16 +02:00
Pyfisch ba4a5eff6e Document two systemd-repart options in man page
Note --private-key and --certificate options for configuring
verity signature partitions in the listing of options.

Adjust one error message referring to the --certificate option.
2022-10-14 22:00:43 +02:00
Thomas Blume d72f4a3897 basic/mountpoint-util: skip dependency on quota services for some filesystems 2022-10-14 20:57:30 +02:00
Luca Boccassi d2be5f641d Merge pull request #25002 from poettering/install-type-fix
install: make InstallChangeType enum a proper enum
2022-10-14 20:56:44 +02:00
Anita Zhang 284212893b core: only allow systemd-oomd to use SubscribeManagedOOMCGroups
Attempt to address
https://github.com/systemd/systemd/issues/20330#issuecomment-1210028422.

Summary of the comment: Unprivileged users can potentially cause a denial of
service during systemd-oomd unit subscriptions by spamming requests to
SubscribeManagedOOMCGroups. As systemd-oomd.service is the only unit that
should be accessing this method, add a check on the caller's unit name to deter
them from successfully using this method.
2022-10-14 09:57:59 -07:00
Anita Zhang 008798e90c core: serialize/deserialize varlink sockets for pid1
Fixes #20330
2022-10-14 09:54:05 -07:00
Zbigniew Jędrzejewski-Szmek 293b9aa3eb manager: rename dbus method
Fixes #24989.
2022-10-14 18:31:33 +02:00
Yu Watanabe f6e88aac2c elf-util: drop assertion for metadata in report_module_metadata()
Fixes a bug introduced by 1a0281a3eb.

Fixes RHBZ#2134741 (https://bugzilla.redhat.com/show_bug.cgi?id=2134741).
2022-10-14 18:08:11 +02:00
msizanoen1 417cbcd6be shared/logs-show: do not overwrite journal time in export format with source timestamps
Using _SOURCE_{MONOTONIC,REALTIME}_TIMESTAMP in place of the results of
sd_journal_get_{monotonic,realtime}_usecs in export formats might cause
internal inconsistency of realtime timestamp values within a journal export,
violating the export file format and causing systemd-journal-remote to
mass-generate journal files.

Fix this by using the real journal timestamps for
__{REALTIME,MONOTONIC}_TIMESTAMP.
2022-10-14 18:05:04 +02:00
Zbigniew Jędrzejewski-Szmek b146a7345b manager: reformat boolean expression in unit_is_pristine()
Not not IN_SET(…) is just too much for my poor brain. Let's invert
the expression to make it easier to undertand.
2022-10-14 15:13:57 +02:00
Yu Watanabe 2ce39d78b8 udev-builtin-kmod: support to run without arguments
If no module name is provided, then try to load modules based on the
device modealias.

Previously, MODALIAS property is passed as an argument, but it may
contain quotation. Hence, unfortunately the modalias may be modified
and cannot load expected modules.

Fixes #24715.
2022-10-14 21:32:24 +09:00