1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00
Commit Graph

77111 Commits

Author SHA1 Message Date
Yu Watanabe
5811a0117c core/namespace: replace MOUNT_PRIVATE_TMP_READ_ONLY with MOUNT_PRIVATE_TMP with .read_only = true 2024-10-24 03:05:06 +09:00
Yu Watanabe
d69ee5acdc core/namespace: coding style cleanups 2024-10-24 03:05:06 +09:00
Yu Watanabe
0cc496b2d2 core/namespace: honor MountEntry.read_only, .options, and so on in static entries
Otherwise, ProtectHome=tmpfs makes /home/ and friends not read-only.
Also, mount options for /run/ specified in MountAPIVFS=yes are not
applied.

The function append_static_mounts() was introduced in
5327c910d2, but at that time, there were
neither .read_only nor .options in the struct. But, when later the
struct is extended, the function was not updated and they were not
copied from the static table.
The fields has been used in static tables since
e4da7d8c79, and also in
94293d65cd.

Fixes #34825.
2024-10-24 02:59:46 +09:00
Integral
b6b8527cd1
refactor: replace sizeof in loop with ELEMENTSOF & FOREACH_ELEMENT (#34863) 2024-10-23 10:32:02 +02:00
Lennart Poettering
4d5d574906 update TODO 2024-10-23 10:27:04 +02:00
Yu Watanabe
967c586e9c man/network: fix typo
Follow-up for 1f5a052963.
2024-10-23 17:25:37 +09:00
Yu Watanabe
f0b974050d measure: fix typo
Follow-up for 0005411352.
2024-10-23 17:25:37 +09:00
Yu Watanabe
82d8a2c810 TEST-55-OOMD: fix typo
Follow-up for 63d4c4271c.
2024-10-23 17:25:37 +09:00
Lennart Poettering
efaa5e0539
Merge pull request #34850 from poettering/openat-report-new-tweaks
openat_report_new() tweaks
2024-10-23 10:25:18 +02:00
Ronan Pigott
c7c9e3c7c0 network: adjust log message about DNR
The only possible error return in this position is -ENODATA, which is
not interesting.
2024-10-23 10:24:39 +02:00
Lennart Poettering
53c5073858
Merge pull request #34861 from poettering/can-idle
logind: introduce CanIdle/CanLock properties on logind session dbus objects
2024-10-23 10:24:23 +02:00
Luca Boccassi
dfe68da9c4 mkosi: update debian commit reference
* 07a294d0c6 Do not mask systemd-gpt-auto-generator in upstream CI builds
* 5636398bf7 Backport patch to fix test failures with tzdata 2024b-1
* 354ded4946 Update changelog for 256.7-2 release
* e38c7c5345 Backport fixes for upstream autopkgtest suite
* 249676834c Disable utmp support, not y2038 safe
* 822d44da42 initramfs-tools: support missing /etc/udev/udev.conf
* ad71ebf700 systemd-boot: depend on systemd for kernel-install
* 5bf7008ef8 d/systemd.postinst: do not restart systemd-binfmt.service if masked
* 58d5aa1b41 d/rules: mask systemd-gpt-auto-generator on Ubuntu
* 481987d85c Update changelog for 256.7-1 release
* ce7f3d4b43 Revert "autopkgtest: skip TEST-64-UDEV-STORAGE due to qemu crash"
* 7007e73b22 Mark dependencies on clang and bpftool as :native
*   0e120cf704 Update upstream source from tag 'upstream/256.7'
|\
| * 914aae055c New upstream version 256.7
* fcea89cb00 d/t/upstream: honor /etc/apt configured by autopkgtest
2024-10-23 15:21:25 +09:00
Mike Yuan
810d94b429
Merge pull request #34860 from enr0n/varlinkctl-fixes
Fix varlinkctl output with `--more`
2024-10-22 23:46:33 +02:00
Luca Boccassi
5ff6841c23 logind: allow read/write to char-hvc devices
virtio console uses /dev/hvc* so we need access to write wall
messages
2024-10-22 23:44:47 +02:00
Mike Yuan
f19afb2177
core: clean up errors for live mounting
* Use SD_BUS_ERROR_NOT_SUPPORTED where appropriate
* Use Service object in service_can_live_mount()
* Include errno in bus error message
2024-10-22 19:52:24 +02:00
Mike Yuan
f5b0e4f92e
core/service: fix one wording 2024-10-22 19:51:02 +02:00
Mike Yuan
78270121c3
core/service: add missing serialization for Service.live_mount_result 2024-10-22 19:51:01 +02:00
Mike Yuan
20366875f9
core/service: call service_enter_running() if live mount fails
service_enter_running() would re-arm timer for RuntimeMaxSec=,
hence it should be called instead of disabling timer completely
when live mount operation fails, in a similar fashion as
service_enter_reload_by_notify().
2024-10-22 19:51:01 +02:00
Mike Yuan
a6eeca9a00
core/service: introduce service_live_mount_finish()
that combines updating Service.live_mount_result and
service_mount_request_reply()
2024-10-22 19:19:47 +02:00
Mike Yuan
a53e92a17c
core/service: place occurrences of SERVICE_MOUNTING closer to reload states 2024-10-22 19:19:47 +02:00
Mike Yuan
b8fa230596
core/unit: put the reload job back to queue if unit is refreshing 2024-10-22 19:19:46 +02:00
Mike Yuan
c240f293b8
shared/bus-util: debug log when falling back to session bus
Follow-up for d0316b7a0d
2024-10-22 19:19:46 +02:00
Mike Yuan
d845254b7f
basic/fs-util: move unlink_tempfilep() to tmpfile-util 2024-10-22 19:19:39 +02:00
Mike Yuan
7e40b51a2e
man/org.freedesktop.systemd1: complete version info for ManagedOOMMemoryPressureDurationUSec
Follow-up for 63d4c4271c

Some unit types were left out.
2024-10-22 19:12:27 +02:00
Lennart Poettering
1bf9e308eb logind: also check session class in session_get_idle_hint() 2024-10-22 18:44:05 +02:00
Lennart Poettering
4096fcde09 logind: use RET_GATHER() at one more place 2024-10-22 18:44:05 +02:00
Lennart Poettering
bd91f23acf logind: add CanIdle + CanLock dbus properties to session object
Clients should be able to know if the idle logic is available on a
session without secondary knowledge about the session class. Let's hence
expose a property for that.

Similar for the screen lock concept.

Fixes: #34844
2024-10-22 18:44:05 +02:00
Nick Rosbrook
ebc8b9e45b varlinkctl: set SD_JSON_FORMAT_FLUSH when --more is set
This makes it possible to process continuous replies with jq etc.
2024-10-22 12:09:55 -04:00
Nick Rosbrook
c89b578f33 varlinkctl: do not clobber format flags in verb_call
Currently, when SD_JSON_FORMAT_OFF is set in verb_call, the json format
flags are set to SD_JSON_FORMAT_PRETTY_AUTO|SD_JSON_FORMAT_COLOR_AUTO,
rather than or'ing those flags in. This means that other flags that may
have been set, e.g. SD_JSON_FORMAT_SEQ when --more is set, will be
clobbered.

Fix this by masking SD_JSON_FORMAT_OFF out, and then or'ing the new
flags in.
2024-10-22 12:09:41 -04:00
Lennart Poettering
119252343e
Merge pull request #34848 from yuwata/network-dhcpv6-do-not-request-ia-pd-on-info-req
network/dhcp6: do not request IA_PD on information requesting mode
2024-10-22 18:00:12 +02:00
Ronan Pigott
afdb38a39f resolved: validate noerror response for CNAMEs
CNAME doesn't exist at the zone apex. When we get an unsigned noerror
response to a direct query for a CNAME record, we don't yet know if this
name is zone apex. We already request the correct DS record in this
case, but previously skipped it at validation time, causing the answer
to appear bogus. Make sure to also consider the DS record for the query
name for negative replies.
2024-10-22 17:59:05 +02:00
Lennart Poettering
b9633ebb2a fs-util: move attempts counter in openat_report_new() into loop 2024-10-22 17:51:26 +02:00
Lennart Poettering
4ffecbbbee label: move label_ops_reset() up a bit
Let#s move it close to label_ops_set(), since it is somewhat symmetric
to it.
2024-10-22 17:51:26 +02:00
Lennart Poettering
4e4ed4b64d label: add missing assert() to label_ops_set() 2024-10-22 17:51:26 +02:00
Lennart Poettering
3a7ae4ba62 shared: get rid of fileio-label.[ch]
Move the renaming function to reboot-util.h (since it writes out
/run/nologin at shutdown), and let's get rid of fileio-label.[ch] now
that it serves no purpose anymore.
2024-10-22 17:51:26 +02:00
Lennart Poettering
aec1262a2e fileio: port write_string_file_full() to openat_report_new()
This brings two benefits: we will label the created file only if it is
actually created, and we can correctly delete any file we create again
on failure.
2024-10-22 17:51:26 +02:00
Lennart Poettering
8eeb870971 fileio: port write_string_file() to LabelOps, and thus add WRITE_STRING_FILE_LABEL flag
Given that we have the LabelOps abstraction these days, we can teach
write_string_file() to use it, which means we can get rid of
fileio-label.[ch] as a separate concept.

(The only reason that fileio-label.[ch] exists independently of
fileio.[ch] was that the former linekd to libselinux potentially, and
thus had to be in src/shared/ while the other always was in src/basic/.
But the LabelOps vtable provides us with a nice work-around)
2024-10-22 17:51:26 +02:00
Lennart Poettering
4946dd4197 fs-util: tweak how openat_report_new() operates when O_CREAT is used on a dangling symlink
One of the big mistakes of Linux is that when you create a file with
open() and O_CREAT and the file already exists as dangling symlink that
the symlink will be followed and the file created that it points to.
This has resulted in many vulnerabilities, and triggered the creation of
the O_MOFOLLOW flag, addressing the problem.

O_NOFOLLOW is less than ideal in many ways, but in particular one: when
actually creating a file it makes sense to set, because it is a problem
to follow final symlinks in that case. But if the file is already
existing, it actually does make sense to follow the symlinks. With
openat_report_new() we distinguish these two cases anyway (the whole
function exists only to distinguish the create and the exists-already
case after all), hence let's do something about this: let's simply never
create files "through symlinks".

This can be implemented very easily: just pass O_NOFOLLOW to the 2nd
openat() call, where we actually create files.

And then basically remove 0dd82dab91
again, because we don't need to care anymore, we already will see ELOOP
when we touch a symlink.

Note that this change means that openat_report_new() will thus start to
deviate from plain openat() behaviour in this one small detail: when
actually creating files we will *never* follow the symlink. That should
be a systematic improvement of security.

Fixes: #34088
2024-10-22 17:51:26 +02:00
Lennart Poettering
64053bed08 fs-util: always call label post ops in xopenat_full(), in both success and error path
For SELinux it is essential that we reset the file creation label both
in the success and in the error path, hence do so.

Moreover, when calling the label post ops do it if possible with the
opened fd of the inode itself, rather than always going via its path,
simply to reduce the attack surface.
2024-10-22 17:51:26 +02:00
Lennart Poettering
da3d81cccd fs-util: don't second guess openat_report_new() return values
If openat_report_new() fails, then 'made_file' will be false, as no file
was created, hence there's no need to skip the unlinkat() explicitly
early, given that we check for 'made_file' anyway in the error path. The
extra error code checks are hence entirely redundant.
2024-10-22 17:51:26 +02:00
Lennart Poettering
d49449c89b label: tweak LabelOps post() hook to take "created" boolean
We have two distinct implementations of the post hook.

1. For SELinux we just reset the selinux label we told the kernel
   earlier to use for new inodes.

2. For SMACK we might apply an xattr to the specified file.

The two calls are quite different: the first call we want to call in all
cases (failure or success), the latter only if we actually managed to
create an inode, in which case it is called on the inode.
2024-10-22 17:51:26 +02:00
Lennart Poettering
652371a3c1 fs-util: always go through the unlink cleanup paths in xopenat_full()
We didn't go through it at all if label_ops_post() failed.
2024-10-22 17:45:41 +02:00
Lennart Poettering
12620ca1fb fs-util: remove misplaced RET_NERRNO() 2024-10-22 17:45:41 +02:00
Daan De Meyer
a95aacc851
Merge pull request #34851 from DaanDeMeyer/medium
bus-util: Return ENOMEDIUM if XDG_RUNTIME_DIR is unset
2024-10-22 13:37:59 +02:00
Yu Watanabe
aa7507ea4a TEST-02-UNITTESTS: reuse $TEST_MATCH_SUBTEST to specify unit tests to be run
Then, we can easily test specific unit tests in qemu or container.
2024-10-22 20:14:33 +09:00
Yu Watanabe
c443f6924f test-execute: update permission of credstore
Follow-up for 40fb9eebbc.
2024-10-22 20:14:33 +09:00
Daan De Meyer
d64a5b30f1 bus-util: Fix bus_log_connect_error() 2024-10-22 12:32:02 +02:00
Daan De Meyer
d0316b7a0d bus-util: Special case when DBUS_SESSION_BUS_ADDRESS is set and XDG_RUNTIME_DIR isn't
We noticed some failures because we have code that connects to user
managers by setting DBUS_SESSION_BUS_ADDRESS without setting XDG_RUNTIME_DIR.
If that's the case, connect to the user session bus instead of the
private manager bus as we can't connect to the latter if XDG_RUNTIME_DIR
is not set.
2024-10-22 11:17:40 +02:00
Daan De Meyer
c5698fe907 bus-util: Return ENOMEDIUM if XDG_RUNTIME_DIR is unset
bus_log_connect_error() checks for ENOMEDIUM, not ENXIO.
2024-10-22 10:59:27 +02:00
Lennart Poettering
35f51be4f8
Merge pull request #34761 from ikruglov/ikruglov/io-systemd-Machine-GetAddresses
machine: add Addresses, OSRelease, and UIDShift fields in varlink io.systemd.Machine.List output
2024-10-22 09:06:56 +02:00