Commit graph

43140 commits

Author SHA1 Message Date
David Tardon 754d8b9c33 test: add a test for parse_fd() 2023-05-05 09:10:26 +02:00
David Tardon b8f83d7f0c fd-util: introduce parse_fd()
It's a simple wrapper for safe_atoi() that returns error if the parsed
fd is < 0 .
2023-05-05 08:54:28 +02:00
David Tardon 9f2f16a344 main: add missing return
Follow-up-for: 2b5107e162
2023-05-05 08:49:37 +02:00
Lennart Poettering 3aaa376342 execute: remove credentials dir again when empty
This is closely related to the previous commit: if the credentials dir
is empty and nothing mounted on it, let's remove it again.

This will in particular happen if we decided to not actually install the
mount we prepared for the credentials because it is empty. In that case
the mount point inode is already there, and with this we'll remove it.
Primary effect, users will see ENOENT rather than EACCESS when trying to
access it, which should be preferable, given we already handle that
nicely in our credential consumption code.

This should also be useful on systems where we lack any privs to create
mounts, and thus operate on a regular dir anyway.
2023-05-04 12:10:06 +02:00
Lennart Poettering 21dd1de659 execute: suppress credentials mount if empty
Let's avoid creating another mount in the system if it's empty anyway.

This is mostl a cosmetic thing in one (pretty common) special case: if
creds settings are used in a unit but no creds actually available to be
passed.

(While we are at it this also does one more minor optimization: it
adjusts the MS_RDONLY/MS_NOSUID/… flags of the source mount we are about
to MS_MOVE into the right place only if we actually really move it, and
if we instead unmount it again we won't bother with the flags either)
2023-05-04 12:10:01 +02:00
Arthur Shau 9107ef5637
run: change sd_bus_call_method to bus_call_method (#27518)
Migrates the sd_bus_call_method code in run.c to use bus-locator.h api
2023-05-04 09:41:10 +08:00
Yu Watanabe 6cb105b877 core: fix use of uninitialized value
Fixes https://github.com/systemd/systemd/pull/27504#issuecomment-1533354787.
2023-05-04 00:33:33 +01:00
Lennart Poettering b96cc40a95 cryptsetup: downgrade a bunch of log messages that to LOG_WARNING
In all these cases we ignore the failure, hence per our rule the log
level should be below LOG_ERR. Fix that.
2023-05-04 05:03:16 +09:00
Lennart Poettering ea0f3289a2 mount-util: simplify mount_switch_root() a bit
There's no need to fchdir() out of the rootfs and back into it around
the umount2(), hence don't.

This brings the logic closer to what the pivot_root() man page suggests.

While we are at it, always operate based on fds, once we opened the
original dir, and pass the path string along only for generating
messages (i.e. as "decoration").

Add tests for both code paths: the pivot_root() one and the MS_MOUNT.
2023-05-03 20:52:19 +01:00
Lennart Poettering 5d63c7eb83
Merge pull request #27450 from poettering/switch-root-modernize
pid1: modernize switch root logic a bit
2023-05-03 20:12:20 +02:00
Lennart Poettering ef25552e8b core: minor coding style modernization in mount.c 2023-05-03 18:26:39 +02:00
Lennart Poettering 0de3431871 sd-daemon: add sd_pid_notify_barrier() call and use it in systemd-notify
Previously we'd honour --pid= from the main notification we send, but
not from the barrier. This is confusing at best. Let's fix that.
2023-05-03 18:21:42 +02:00
Lennart Poettering ca71b1d966
Merge pull request #27510 from poettering/notify-barrier-pid-1-tweaks
pid 1 notify barrier handling tweaks
2023-05-03 18:21:14 +02:00
Lennart Poettering 09e766e70b notify: don't send EXIT_STATUS= notify message from systemd-notify
In 623a00020f code was added that our
various programs send a notification message with their exit status on
exit. This is great, but it becomes utterly confusing in systemd-notify,
whose primary purpose is to send such messages after all, and sending an
implicit one in addition to the primary one is particularly confusing,
when debugging things.

Let's hence just drop the implicit message. systemd-notify's exit status
is after all indicative primarily because sd_notify() failed, and hence
it's pretty pointless to then send that fact as another sd_notify()
message.

(Primary reason for this patch is simply that it confused the hell out
of me, when debugging sd_notify() issues)

Follow-up for: 623a00020f
2023-05-03 18:03:05 +02:00
Lennart Poettering 9a22b098d2 base-filesystem: unify common parts of base_filesystem_create_fd() branches
The error handling and fchmodat() invocation is pretty much the same in
the directory and symlink branches, hence make them the same.

No real change in behaviour. Just refactoring.
2023-05-03 17:55:55 +02:00
Lennart Poettering 8aefedce14 base-filesystem: add new helper base_filesystem_create_fd() that operates on an fd, instead of a path
This also changes the open flags from
O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW to
O_DIRECTORY|O_CLOEXEC. O_RDONLY is redundant, since O_RDONLY is zero
anyway, and O_DIRECTORY pins the acces mode enough: it doesn't allow
read()/write() anyway when specified. O_NONBLOCK is also pointless given
that O_DIRECTORY is specified, it has no meaning on directories. (It is
useful if we don't know much about the inode we are opening, and could
be a device node or fifo, but the O_DIRECTORY excludes that case.)

O_NOFOLLOW is dropped since there's really no point in blocking out the
initial entrypoint being a symlink. Once we pinned the the root of the
tree it might make sense to restrict symlink use below it, but for the
entrypoint itself it doesn't matter.
2023-05-03 17:55:55 +02:00
Lennart Poettering f2c1d491a5 switch-root: don't require /mnt/ when switching root into host OS
So far, we invoked pivot_root() specifying /mnt/ as second argument,
which then unmounted right-after. We'd create /mnt/ if needed. This
sucks, because it means /mnt/ must strictly be pre-created on immutable
images.

Remove this limitation, by using pivot_root() with "." as source and
target, which will result in two stacked mounts afterwards: the new one
underneath, the old one ontop. We can then simply unmount the top one,
and have what we want without needing any extra /mnt/ dir.

Since we don't need /mnt/ anymore we can get rid of the extra
unmount_old_root parameter and simply specify it as NULL if we don't
want the old mount to stick around.
2023-05-03 17:55:55 +02:00
Lennart Poettering 7b0a126751 manager: add debug logging about BARRIER=1 messages 2023-05-03 14:58:17 +02:00
Lennart Poettering 4627645442 manager: simplify manager_process_barrier_fd() a bit 2023-05-03 14:58:17 +02:00
Yu Watanabe a76dc1f3a0
Merge pull request #27504 from mrc0mmand/fuzz-manager-serialize
test: add a simple fuzzer for manager serialization
2023-05-03 21:45:26 +09:00
Zbigniew Jędrzejewski-Szmek 3f7e77fae1 test_ukify: fix two failing tests
Fixup for 22ad038ac6 and
3fc5eed470. It seems that the tests are
not executed properly in CI. Nevertheless, test-ukify appears in logs:

rpm-build:fedora-rawhide-x86_64:
 409/1191 systemd / test-ukify    OK   0.16s

This is strange.
2023-05-03 12:29:41 +02:00
Zbigniew Jędrzejewski-Szmek cb3b451e11 test_ukify: fix loop iteration
We'd try to access 'linux' or 'initrd' after failing to set it.
2023-05-03 12:29:41 +02:00
Zbigniew Jędrzejewski-Szmek d9c8f075af ukify: add missing header
This file is installed, so it should have the long header.
2023-05-03 12:29:41 +02:00
Zbigniew Jędrzejewski-Szmek 50f4add445 ukify: use UPPERCASE for parameter names
We generally nowadays use UPPERCASE for parameters in variuos help text.
Let's be consistent here too, and also drop duplicated 'usage:':
$ ukify -h
usage: ukify [options…] LINUX INITRD…
       ukify -h | --help

Build and sign Unified Kernel Images

positional arguments:
  LINUX                 vmlinuz file [.linux section]
  INITRD…               initrd files [.initrd section]
...
2023-05-03 12:29:41 +02:00
Zbigniew Jędrzejewski-Szmek d3533162d1 90-loaderentry: make sure that variables are set
We unconditionally use the variables later on, so let's make sure
that they were passed as expected.
2023-05-03 12:29:40 +02:00
Frantisek Sumsal 740831076c shared: reject empty attachment path 2023-05-03 10:09:53 +02:00
Frantisek Sumsal 1febf60f9d shared: ignore invalid valink socket fd when deserializing 2023-05-03 10:09:53 +02:00
Frantisek Sumsal 45b1017488 core: fix NULL pointer dereference during deserialization 2023-05-03 10:09:53 +02:00
Frantisek Sumsal 24e6759cbc test: add a simple fuzzer for manager serialization 2023-05-03 10:09:53 +02:00
Yu Watanabe 406004a6c3
Merge pull request #27499 from yuwata/sd-journal-fix-loop
sd-journal: check .next_entry_array_offset earlier
2023-05-03 13:30:47 +09:00
Yu Watanabe de6eb806ff Revert "sd-journal: introduce simple loop detection for entry array objects"
This reverts commit a8fbcc0e3c.

The commit is not necessary, as the invalid entry array object is
filtered earlier by the previous commit.
2023-05-03 06:41:25 +09:00
Yu Watanabe b5335da7a5 sd-journal: check .next_entry_array_offset earlier
Then, if it is invalid, refuse to use the entry array object.

Follow-up for a8fbcc0e3c.
Fixes #27489.
2023-05-03 06:41:21 +09:00
Jan Janssen ec232e4abd boot: Use correct memory type for allocations
We were using the wrong memory type when allocating pool memory. This
does not seem to cause a problem on x86, but the kernel will fail to
boot at least on ARM in QEMU.

This is caused by mixing different allocation types which ended up
breaking the kernel or EDK2 during boot services exit. Commit
2f3c3b0bee appears to fix this boot
failure because it was replacing the gnu-efi xpool_print with xasprintf
thereby unifying the allocation type.
But this same issue can also happen without this fix somehow when the
random-seed logic is in use.

Fixes: #27371
2023-05-02 22:38:15 +01:00
msizanoen1 845824acdd core: check for SERVICE_RELOAD_NOTIFY in manager_dbus_is_running
This ensures that systemd won't erronously disconnect from the system
bus in case a bus recheck is triggered immediately after the bus service
emits `RELOADING=1`.

This fixes an issue where systemd-logind sometimes randomly stops
receiving `UnitRemoved` after a system update.

This also handles SERVICE_RELOAD_SIGNAL just in case somebody ever
creates a D-Bus broker implementation that uses `Type=notify-reload`.
2023-05-03 00:14:35 +09:00
Lennart Poettering 5789c60973 journal: handle EADDRNOTAVAIL in two more cases gracefully
Follow-up for #27488.
2023-05-03 00:13:40 +09:00
Yu Watanabe c19b827802
Merge pull request #27493 from poettering/generate-sym-test-tweaks
fixes/additions for generate-sym-test
2023-05-03 00:12:48 +09:00
Mike Yuan 5e15fec23d
Merge pull request #27492 from poettering/base-filesystem-000
base-filesystem: create /proc, /sys, /dev mount points as 555
2023-05-02 20:53:35 +08:00
Luca Boccassi b8fba0cded generators: skip private tmpfs if /tmp does not exist
When spawning generators within a sandbox we want a private /tmp, but it
might not exist, and on some systems we might be unable to create it
because users want a BTRFS subvolume instead.

Fixes https://github.com/systemd/systemd/issues/27436
2023-05-02 12:28:09 +02:00
Daan De Meyer a3b076f641 tree-wide: Handle EADDRNOTAVAIL as journal corruption
Journal corruption is not only indicated by EBADMSG but also by
EADDRNOTAVAIL so treat that as corruption in a few more cases.
2023-05-02 12:17:41 +02:00
Lennart Poettering 2a10774caa mount-setup: use size_t when iterating through array indexes 2023-05-02 12:06:03 +02:00
Lennart Poettering 7243cefec1 base-filesystem: create /proc, /sys, /dev mount points as 0555
These inodes are going to be overmounted anyway, hence let's create them
with access mode 555, so that they are as close to being immutable as
regular UNIX access modes allow them to be. In other words: this takes
the "w" mode away for root. This of course usually has little effect --
unless CAP_DAC_OVERRIDE is dropped. But at the very least it makes the
point clear that inodes should be considered immutable.

(I intended to make this 0000 originally, but that doesn't work, as many
tools – including our own – have fallback paths that when they see
ENOENT in /proc/ they can handle this gracefully. But changing the mode
to 000 would turn this to EACCES - something they usually have no
fallback path for)
2023-05-02 12:06:03 +02:00
Lennart Poettering 6d3c20e1ff generate-sym-test: only look in .c and .h files
Otherwise it might find backup files and such, which triggered all kinds
of false positives (at least on my devel machine).
2023-05-02 11:30:51 +02:00
Lennart Poettering 4f65fbe990 generate-sym-test: search for missing symbols
This slightly extends the symbol file test and checks which symbols are
listed in one list but missing in the other. This is tremendously useful
to quickly determine which symbols wheren't exposed properly but should
have been.

(This is is implemented in pure C, no systemd helpers, to ensure we see
libsystemd.so API as any other tool would.)
2023-05-02 11:30:46 +02:00
Yu Watanabe ecf82f74b6
Merge pull request #27455 from yuwata/test-lib-sym
test: check all public functions are listed in .sym file
2023-05-02 04:45:30 +09:00
Jan Janssen 669f16acf7 stub: Relocate kernels below 4G for EFI handover
Old kernels can fail to boot when they are located above the 4G
boundary even if they claim to support it.

Fixes: #27472
2023-05-01 19:08:12 +02:00
Jan Janssen 6fd3ee6916 boot: Fix EFI_SIZE_TO_PAGES macro 2023-05-01 19:08:12 +02:00
Yu Watanabe a8fbcc0e3c sd-journal: introduce simple loop detection for entry array objects
If .next_entry_array_offset points to one of the previous entry or the
self entry, then the loop for entry array objects may run infinitely.
Let's assume that the offsets of each entry array object are in
increasing order, and check that in loop.

Fixes #27470.
2023-05-01 15:46:59 +09:00
Yu Watanabe 4c1b6e699f test: also test all _public_ functions are listed in .sym files
Co-authored-by: Frantisek Sumsal <frantisek@sumsal.cz>
2023-05-01 15:40:18 +09:00
Yu Watanabe e758735d33 sd-journal: tighten variable scope 2023-05-01 14:25:38 +09:00
Yu Watanabe d9b61db922 sd-journal: read entry array object again
Otherwise, the object may be invalidated by the previous call of
journal_file_move_to_object().
2023-05-01 14:25:38 +09:00
Yu Watanabe b72fd2af86 sd-journal: check validity of object type more strictly
Otherwise, the object with invalid type may pass check_object_header()
when the requested type is OBJECT_UNUSED.
2023-05-01 14:25:38 +09:00
Yu Watanabe 3092eaa72e sd-journal: add _OBJECT_TYPE_INVALID as usual 2023-05-01 14:25:38 +09:00
Yu Watanabe deb87cc80e sd-journal: align table 2023-05-01 14:25:38 +09:00
Yu Watanabe 5b895f56c6 sd-journal: check that the journal file is not stored in .newest_by_boot_id on free 2023-05-01 14:24:55 +09:00
Yu Watanabe f11de491ca sd-journal: unset prioq index on failure
Otherwise, potentially, the assertion in
journal_file_unlink_newest_by_bood_id() will be triggered.
2023-05-01 14:24:55 +09:00
Yu Watanabe e28d825127 sd-journal: fix use-after-free
As commented in the code, we need to replace the pointer to the key,
hence, hashmap_replace() must be used, instead of hashmap_update().

Fixes #27459.
2023-05-01 14:24:55 +09:00
Dan Streetman 9589824158 tpm2: move openssl-required ifdef code out of policy-building function 2023-05-01 00:52:28 +01:00
Yu Watanabe 9857de4f1c libsystemd: add missing _public_ attributes 2023-04-29 21:25:12 +09:00
Yu Watanabe 9857bc4cea libsystemd: drop _public_ attribute for non-exported functions 2023-04-29 21:25:08 +09:00
Luca Boccassi 708d63c0e7
Merge pull request #27451 from yuwata/core-path-trigger-notify
core/path: do not install new job in .trigger_notify()
2023-04-29 12:35:24 +01:00
Yu Watanabe 8c59feed5e missing_fs: also define struct file_clone_range
Follow-up for b640e274a7.

Addresses b640e274a7 (r110996661).
2023-04-29 07:03:09 +02:00
Yu Watanabe bc6377762c core/path: do not enqueue new job in .trigger_notify callback
Otherwise,
1. X.path triggered X.service, and the service has waiting start job,
2. systemctl stop X.service
3. the waiting start job is cancelled to install new stop job,
4. path_trigger_notify() is called, and may reinstall new start job,
5. the stop job cannot be installed, and triggeres assertion.

So, instead, let's add a defer event source, then enqueue the new start
job after the stop (or any other type) job finished.

Fixes https://github.com/systemd/systemd/issues/24577#issuecomment-1522628906.
2023-04-29 08:54:29 +09:00
Yu Watanabe 34a4e22e97 core/path: align table 2023-04-29 08:45:06 +09:00
Lennart Poettering c23e9b6a64 pid1: unify implemenation of /run/ disk space safety check a bit
reload/reexec currently used a separate implementation of the /run/ disk
space check, different from the one used for switch-root, even though
the code is mostly the same. The one difference is that the former
checks are authoritative, the latter are just informational (that's
because refusing a reload/reexec is relatively benign, but refusing a
switch-root quite troublesome, since this code is entered when it's
already "too late" to turn turn back, i.e. when the preparatory
transaction to initiate the switch root are already fully executed.

Let's share some code, and unify codepaths.

(This is preparation for later addition of a "userspace reboot" concept)

No change in behaviour, just refactoring.
2023-04-28 23:27:20 +01:00
Lennart Poettering 5ae89ef347 core/systemctl: when switching root default to /sysroot/
We hardcode the path the initrd uses to prepare the final mount point at
so many places, let's also imply it in "systemctl switch-root" if not
specified.

This adds the fallback both to systemctl and to PID 1 (this is because
both to — different – checks on the path).
2023-04-28 23:26:20 +01:00
Daan De Meyer 77b7026668 libsystemd: Add missing memory pressure functions to public symbols 2023-04-28 21:19:38 +02:00
Mike Yuan 0102857b52
Merge pull request #27445 from poettering/reflink-fix
remove duplication reflink ioctl invocation
2023-04-29 01:33:21 +08:00
Lennart Poettering 4b7fda8731 systemctl: rework 'if' to 'switch' statement 2023-04-29 01:23:24 +08:00
Luca Boccassi 398d858d1c
Merge pull request #27437 from mrc0mmand/pstore
test: add a couple of tests for systemd-pstore
2023-04-28 16:14:09 +01:00
Lennart Poettering 535358ad2e copy: shortcut reflink_range() to reflink() in some cases 2023-04-28 15:16:30 +02:00
Lennart Poettering 427ad121c2 copy: don't call clone ioctls twice
The btrfs name and the generic name have the same values, hence there's
no point in bothering with the former.
2023-04-28 15:10:24 +02:00
Luca Boccassi 91010bd6cc
Merge pull request #27440 from yuwata/reflink-follow-ups
copy: follow ups for reflink()
2023-04-28 11:34:41 +01:00
Frantisek Sumsal ad5980803a pstore: avoid opening the dmesg.txt file if not requested
Even with Storage=journal we would still attempt to open the final
dmesg.txt file which causes a lot of noise in the journal:

```
[    5.764111] H testsuite-82.sh[658]: + systemctl start systemd-pstore
[    5.806385] H systemd[1]: Starting modprobe@efi_pstore.service...
[    5.808656] H systemd[1]: modprobe@efi_pstore.service: Deactivated successfully.
[    5.808971] H systemd[1]: Finished modprobe@efi_pstore.service.
[    5.818845] H kernel: audit: type=1130 audit(1682630623.637:114): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=modprobe@efi_pstore comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? termin>
[    5.818865] H kernel: audit: type=1131 audit(1682630623.637:115): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=modprobe@efi_pstore comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? termin>
[    5.816052] H systemd[1]: Starting systemd-pstore.service...
[    5.840703] H systemd-pstore[806]: PStore dmesg-efi-168263062313014.
[    5.841239] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.841428] H systemd-pstore[806]: PStore dmesg-efi-168263062312014.
[    5.841575] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.841712] H systemd-pstore[806]: PStore dmesg-efi-168263062311014.
[    5.841839] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.841989] H systemd-pstore[806]: PStore dmesg-efi-168263062310014.
[    5.842141] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.842274] H systemd-pstore[806]: PStore dmesg-efi-168263062309014.
[    5.842423] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.842589] H systemd-pstore[806]: PStore dmesg-efi-168263062308014.
[    5.842722] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.842865] H systemd-pstore[806]: PStore dmesg-efi-168263062307014.
[    5.843003] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.843153] H systemd-pstore[806]: PStore dmesg-efi-168263062306014.
[    5.843280] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.843434] H systemd-pstore[806]: PStore dmesg-efi-168263062305014.
[    5.843570] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.843702] H systemd-pstore[806]: PStore dmesg-efi-168263062304014.
[    5.843831] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.843958] H systemd-pstore[806]: PStore dmesg-efi-168263062303014.
[    5.844093] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.844250] H systemd-pstore[806]: PStore dmesg-efi-168263062302014.
[    5.844412] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.844619] H systemd-pstore[806]: PStore dmesg-efi-168263062301014.
[    5.844781] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.844956] H systemd-pstore[806]: PStore dmesg-efi-168263062300014.
[    5.845168] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[    5.851101] H systemd[1]: Finished systemd-pstore.service.
```
2023-04-28 12:00:42 +02:00
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
Frantisek Sumsal a95d96a243 pstore: explicitly set the base when converting record ID 2023-04-28 11:41:52 +02: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
Yu Watanabe d6f96778b1 missing_fs: mention commit hash and version of ioctl commands introduced 2023-04-28 14:18:48 +09:00
Yu Watanabe 71e84b4be6 copy: rename reflink_full() -> reflink_range()
The commit b640e274a7 introduced reflink()
and reflink_full(). We usually name function xyz_full() for fully
parameterized version of xyz(), and xyz() is typically a inline alias of
xyz_full(). But in this case, reflink() and reflink_full() call
different ioctl().
Moreover, reflink_full() does partial reflink, while reflink() does full
file reflink. That's super confusing.
Let's rename reflink_full() to reflink_range(), the new name is
consistent with ioctl name, and should be fine.
2023-04-28 14:06:00 +09: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