1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00
Commit Graph

64232 Commits

Author SHA1 Message Date
Yu Watanabe
657152a459 network-generator: shorten code a bit 2023-04-28 18:50:47 +09:00
Yu Watanabe
75fd8ad008
Merge pull request #27424 from dtardon/auto-cleanup
More automatic cleanup
2023-04-28 18:46:36 +09:00
David Tardon
360179ea46 logind-session-dbus: use _cleanup_ 2023-04-28 09:29:04 +02:00
David Tardon
80e52052db logind-session-device: modernize session_device_free() 2023-04-28 09:29:03 +02:00
David Tardon
fc447921a8 homed-manager-bus: use _cleanup_ 2023-04-28 09:29:03 +02:00
David Tardon
7fb1cc85ab transaction: make transaction_free() static
... as it's not needed outside transaction.c anymore.
2023-04-28 09:28:25 +02:00
David Tardon
32620826cf manager: use _cleanup_ in manager_propagate_reload() 2023-04-28 09:27:37 +02:00
David Tardon
c7e3eb5dd5 manager: use _cleanup_ in manager_add_job() 2023-04-28 09:27:37 +02:00
David Tardon
542fe40845 transaction: introduce transaction_abort_and_free()
Will be used in following commits.
2023-04-28 09:26:20 +02:00
David Edmundson
c63dde8099 xdg-autostart-service: handle gnome autostart phase better on other desktops
Autostart files which contain the line gnome-autostart-phase are currently
completely skipped by systemd. This is because these are handled internally by
gnome startup through other means.

The problem is a number of desktop files that need to run on KDE too have this
flag set. Ideally they should just create systemd user units, but we're not at
this point universally yet.

This patch changes the logic so if the flag is set, we set NotShowIn-gnome,
which in turn would just not load decided at runtime.

As an optimisation if we would get conflicting OnlyShowIn lines we still
skip the file completely.

Example:
  $ rg 'Exec|Autostart-Phase' /etc/xdg/autostart/gnome-keyring-pkcs11.desktop
  Exec=/usr/bin/gnome-keyring-daemon --start --components=pkcs11
  X-GNOME-Autostart-Phase=PreDisplayServer

  $ cat '/tmp/xxx/app-gnome\x2dkeyring\x2dpkcs11@autostart.service'
  # Automatically generated by systemd-xdg-autostart-generator
  [Unit]
  SourcePath=/etc/xdg/autostart/gnome-keyring-pkcs11.desktop
  ...
  [Service]
  ...
  ExecCondition=/usr/lib/systemd/systemd-xdg-autostart-condition "Unity:MATE" "GNOME"

Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2023-04-28 12:32:53 +08:00
Daan De Meyer
b640e274a7 copy: Introduce reflink() and reflink_full()
The kernel has had filesystem independent reflink ioctls for a
while now, let's try to use them and fall back to the btrfs specific
ones if they're not supported.
2023-04-28 00:57:03 +01:00
David Tardon
12da8805e7 transaction: modernize transaction_free() 2023-04-27 21:42:38 +02:00
David Tardon
0a956e8e02 initctl: use _cleanup_ 2023-04-27 21:42:38 +02:00
David Tardon
70bbf65942 initctl: add assert 2023-04-27 21:42:38 +02:00
David Tardon
1cc3a1302f specifier: use _cleanup_ 2023-04-27 21:42:38 +02:00
David Tardon
3cbbefc2a7 path-util: use _cleanup_ 2023-04-27 21:42:38 +02:00
David Tardon
5ce8ce908d logind: rename function to avoid confusion 2023-04-27 21:42:38 +02:00
David Tardon
3d01bfa7db logind-core: drop unneeded check for NULL 2023-04-27 21:42:38 +02:00
David Tardon
737e0f12d9 logind-core: modernize button_free() 2023-04-27 21:42:38 +02:00
David Tardon
93eceb59e6 env-util: use more _cleanup_ in replace_env_argv() 2023-04-27 21:42:38 +02:00
David Tardon
cc09d8a5a1 env-util: use _cleanup_ in replace_env_argv() 2023-04-27 21:42:38 +02:00
David Tardon
5013d6def3 env-util: rename variable 2023-04-27 21:42:38 +02:00
David Tardon
480a7919bc env-util: use _cleanup_ in strv_env_delete() 2023-04-27 21:42:38 +02:00
Luca Boccassi
fafded0ce0
Merge pull request #27346 from poettering/pam-fixes
pam-systemd: be more careful with sharing bus connections
2023-04-27 20:31:57 +01:00
Lennart Poettering
dbecd3d6ee shutdown: paranoia – close all fds we might get passed in
We don't expect any fds (beyond 0…2) to be passed from the service
manager into systemd-shutdown, but let's better be safe then sorry.
2023-04-27 17:56:24 +01:00
Lennart Poettering
ba8d00e859 pam-systemd: disconnect bus connection when leaving session hook, even on error
This adds support for systematically destroying connections in
pam_sm_session_open() even on failure, so that under no circumstances
unserved dbus connection are around while the invoking process waits for
the session to end.  Previously we'd only do this on success, now do it
in all cases.

This matters since so far we suggested people hook pam_systemd into
their pam stacks prefixed with "-", so that login proceeds even if
pam_systemd fails. This however means that in an error case our
cached connection doesn't get disconnected even if the session then is
invoked. This fixes that.
2023-04-27 17:04:05 +02:00
Lennart Poettering
402014086d pam-util: include PID in PAM data field id
Let's systematically avoid sharing cached busses between processes (i.e.
from parent and child after fork()), by including the PID in the field
name.

With that we're never tempted to use a bus object the parent created in
the child.

(Note this is about *use*, not about *destruction*. Destruction needs to
be checked by other means.)
2023-04-27 17:02:49 +02:00
Franck Bui
fd34e27fb9 test: dont use anchor char '$' to match a part of a string
When anchoring the pattern using '$' regular expression operator it forces '=~'
operator to match the entire string.
2023-04-27 22:42:51 +08:00
Mike Yuan
82060b62c9
Merge pull request #25622 from YHNdnzj/tmpfiles-X-bit-support
tmpfiles: add conditionalized execute permission (X) support
2023-04-27 22:40:09 +08:00
Lennart Poettering
a84e741b36
Merge pull request #27376 from poettering/subcgroup
pid1: add DelegateSubgroup= option
2023-04-27 16:37:06 +02:00
Lennart Poettering
969f5f3cea test: extend test 19 to also verify DelegateSubgroup= works 2023-04-27 14:15:50 +02:00
Lennart Poettering
1a3704dcc3 nspawn: port over to /supervisor/ subcgroup being delegated to nspawn
Let's make use of the new DelegateSubgroup= feature and delegate the
/supervisor/ subcgroup already to nspawn, so that moving the supervisor
process there is unnecessary.
2023-04-27 12:18:32 +02:00
Lennart Poettering
f8371dbd56 udev: port to DelegateSubgroup= 2023-04-27 12:18:32 +02:00
Lennart Poettering
3975e3f8ae units: make system service manager create init.scope subcgroup for user service manager
This one is basically for free, since the service manager is already
prepared for being invoked in init.scope. Hence let's start it in the
right cgroup right-away.
2023-04-27 12:18:32 +02:00
Lennart Poettering
bcd9b98159 core: change ownership of subcgroup we create recursively, it shall be owned by the user delegated to
If we create a subcroup (regardless if the '.control' subgroup we
always created or one configured via DelegateSubgroup=) it's inside of
the delegated territory of the cgroup tree, hence it should be owned
fully by the unit's users. Hence do so.
2023-04-27 12:18:32 +02:00
Lennart Poettering
18c1e481b6 execute: don't apply journal + oomd xattrs to subcgroup
We don't need to apply the journal/oomd xattrs to the subcgroups we add,
since those daemons already look for the xattrs up the tree anyway.
Hence remove this.

This is in particular relevant as it means later changes to the xattr
don#t need to be replicated on the subcgroup either.
2023-04-27 12:18:32 +02:00
Lennart Poettering
a8b993dc11 core: add DelegateSubgroup= setting
This implements a minimal subset of #24961, but in a lot more
restrictive way: we only allow one level of subcgroup (as that's enough
to address the no-processes in inner cgroups rule), and does not change
anything about threaded cgroup logic or similar, or make any of this new
behaviour mandatory.

All this does is this: all non-control processes we invoke for a unit
we'll invoke in a subgroup by the specified name.

We'll later port all our current services that use cgroup delegation
over to this, i.e. user@.service, systemd-nspawn@.service and
systemd-udevd.service.
2023-04-27 12:18:32 +02:00
Lennart Poettering
1a56b0c05d cgroup: rework how we validate/escape cgroups
Let's clean up validation/escaping of cgroup names. i.e. split out code
that tests if name needs escaping. Return proper error codes, and extend
test a bit.
2023-04-27 12:17:58 +02:00
Mike Yuan
f582e61bc3
test: tmpfiles: add tests on conditionalized execute bit 2023-04-27 15:18:31 +08:00
Mike Yuan
26d98cdd78
tmpfiles: add conditionalized execute bit (X) support
According to setfacl(1), "the character X stands for
the execute permission if the file is a directory
or already has execute permission for some user."

After this commit, parse_acl() would return 3 acl
objects. The newly-added acl_exec object contains
entries that are subject to conditionalized execute
bit mangling. In tmpfiles, we would iterate the acl_exec
object, check the permission of the target files,
and remove the execute bit if necessary.

Here's an example entry:
A /tmp/test - - - - u:test:rwX

Closes #25114
2023-04-27 15:15:09 +08:00
Yu Watanabe
49c778e6bf
Merge pull request #27413 from yuwata/core-job-cleanups
core/job: cleanups for job ID
2023-04-27 12:29:29 +09:00
Lennart Poettering
e76b3d4ed2 units: restrict hugepages fs a bit
suid binaries and device nodes should not be placed there, hence forbid
it.

Of all the API VFS we mount from PID 1 or via a unit file this one is
the only one where we didn't add MS_NODEV/MS_NOSUID. Let's address that,
since there's really no reason why device nodes or suid binaries would
be placed in hugetlbfs.
2023-04-27 12:28:50 +09:00
Yu Watanabe
a02287eab3 core/service: make service_add_fd_store() always consume provided fd
No functional change, just refactoring.
2023-04-27 01:36:58 +01:00
Lennart Poettering
637d57ddfd image-policy: split out code that "extends" underspecified partition policy flags
When encoding partition policy flags we allow parts of the flags to be
"unspecified" (i.e. entirely zeros), which when actually checking the
policy we'll automatically consider equivalent to "any" (i.e. entirely
ones). This "extension" of the flags was so far done as part of
partition_policy_normalized_flags(). Let's split this logic out into a
new function partition_policy_flags_extend() that simply sets all bits
in a specific part of the flags field if they were entirely zeroes so
far.

When comparing policy objects for equivalence we so far used
partition_policy_normalized_flags() to compare the per-designator flags,
which thus meant that "underspecified" flags, and fully specified ones
that are set to "any" were considered equivalent. Which is great.
However, we forgot to do that for the fallback policy flags, the flags
that apply to all partitions for which no explicit policy flags are
specified.

Let's use the new partition_policy_flags_extend() call to compare them
in extended form, so that there two we can hide the difference between
"underspecified" and "any" flags.
2023-04-27 01:35:06 +01:00
Zbigniew Jędrzejewski-Szmek
048bcb9d1f man: use ukify more in systemd-measure examples
ukify supports signing with multiple keys, so show an example of this, and just
let ukify print the calls to systemd-measure that will be done.

This also does other small cleanups:
- Use more realistic names in examples
- Use $ as the prompt for commands that don't require root (most don't).
  Once we switch to operations that don't require a TPM, we should be able to get
  rid of the remaining calls that require root.
- Ellipsize or linebreak various parts
- Use --uname. We warn if it is not specified and we have to do autodetection, so
  let's nudge people towards including it rather than not.

Follow-up for e069c57f06.
2023-04-27 00:25:09 +01:00
Luca Boccassi
2df327f6f6
Merge pull request #26877 from yuwata/fuzz-journal-remote
fuzz-journal-remote: several cleanups
2023-04-27 00:05:01 +01:00
Luca Boccassi
66a0ee55d8
Merge pull request #27355 from fbuihuu/kbd-improve-vc2x11-conversion
locale: improve vc -> x11 keyboard conversion
2023-04-26 23:37:53 +01:00
Luca Boccassi
68b12e2d56
Merge pull request #27421 from bluca/coredump_filter
CoredumpFilter: fix stack overflow and invalid assignment with 'all'
2023-04-26 23:22:59 +01:00
Lennart Poettering
8c9f0d83c2 image-policy: correct two comments 2023-04-26 22:24:58 +02:00
Lennart Poettering
f351e951d3 update TODO 2023-04-26 22:21:19 +02:00