Commit Graph
51698 Commits
Author SHA1 Message Date
Yu Watanabe 5dc0668802 sd-event: fix memleak when built without assertion
Fixes a bug introduced by baf3fdec27.

This also adds several assertions at the beginning of the function.

Fixes #34899.
2024-10-26 17:21:34 +02:00
Yu Watanabe f7804c1aa2 basic/missing: add short comment about when CLONE_NEWCGROUP is added 2024-10-26 13:59:19 +09:00
Integral ddb8a639d5 tree-wide: replace for loop with FOREACH_ELEMENT or FOREACH_ARRAY macros (#34893) 2024-10-26 07:10:22 +09:00
Yu Watanabe f7078de515 Merge pull request #34884 from poettering/run0-disconnect-fix
run: reconnect if our dbus connection is terminated
2024-10-26 02:50:48 +09:00
Yu Watanabe 6d6048b4cb Merge pull request #34881 from poettering/run0-ui-tweaks
run0: various UI tweaks
2024-10-26 02:49:48 +09:00
Ivan Kruglov 10a48938ef machine: operation should not send a response when 'done' callback set 2024-10-26 02:45:53 +09:00
Lennart Poettering c8f59296bf run: reconnect if our dbus connection is terminated
We must be prepared that systemd temporarily drops off the bus or
disconnects our direct connections (due to systemctl daemon-reexec or
so). Hence automatically reconnect when we watch the unit status, and
handle this case gracefully.

Fixes: #32906 #27204
2024-10-25 17:51:04 +02:00
Lennart Poettering ff4b6a1915 run: drop "-" prefix from command line when generating unit description
Let's not confuse users with the login shell indicator and drop it from
the description. This means a run0 session will now usually show up with
a description of "[run0] /bin/bash" rather than "[run0] -/bin/bash".
2024-10-25 17:32:19 +02:00
Lennart Poettering d9f68f48f7 run: prefix unit description with our own process name
I think we should try to communicate clearly if something is a run0
session, or a systemd-run invocation. Hence, let's initialize the
description so that the command is prefixed by
program_invocation_short_name.

Effectively this means that our run0 sessions now appear as services
with a description of "[run0] -/bin/bash"
2024-10-25 17:32:19 +02:00
Lennart Poettering 0310b2a60b run: tweak how we name our transient units
The current logic is a bit complex how systemd-run units are called. It
used to be just the unique ID of the dbus connection. Which was nice,
since its system-widely, uniquely assigned to us. But this didn't work
out well, due to direct connections to PID 1 and due to soft reboots.

We nowadays have a better ID to use though, with nicer properties: the
kernel manages a pidfd ID for every process after all, and it's globally
unique, for any process, and regardless of soft reboots. Hence use that
for naming preferably, and just keep one branch with a randomized name
as fallback.
2024-10-25 17:32:19 +02:00
Lennart Poettering 115fac3c29 run0: optionally show superhero emoji on each shell prompt
This makes use of the infra introduced in 229d4a9806 to indicate visually on each prompt that we are in superuser mode temporarily.
pick ad5de3222f userdbctl: add some basic client-side filtering
2024-10-25 17:31:06 +02:00
Lennart Poettering edd10ab29c run0: add options to force allocation of PTY or of pipe use
Fixes: #33033
2024-10-25 14:14:26 +02:00
Lennart Poettering 988053eac3 tree-wide: use isatty_safe() everywhere 2024-10-25 14:09:38 +02:00
Lennart Poettering c18ac81f17 Merge pull request #34877 from aafeijoo-suse/veritysetup-fixes
veritysetup-generator: minor man/code changes
2024-10-25 10:06:31 +02:00
Lennart Poettering c4363051e4 Merge pull request #34880 from poettering/change-user-on-pam-always
core: make sure that if PAMName= is set we always do the full user ch…
2024-10-25 09:22:03 +02:00
Lennart Poettering e4b4d9cc7a core: make sure that if PAMName= is set we always do the full user changing even if no user is specified explicitly
When PAMName= is set this should be enough to go through our entire user
changing story, so that PAM is definitely run, and environment variables
definitely pulled in and so on.

Previously, it would happen that under some circumstances we might no do
this when transitioning from root to root itself even though PAM was
enabled.

Fixes: #34682
2024-10-24 22:37:00 +02:00
Lennart Poettering 210fb8626f Merge pull request #34875 from poettering/userdbctl-filter
userdbctl: add some basic client-side filtering
2024-10-24 22:36:22 +02:00
Lennart Poettering 4167e9e210 user-util: tighten shell validation a tiny bit 2024-10-24 22:28:17 +02:00
Mike Yuan 4e69da071d Merge pull request #34799 from YHNdnzj/service-followups
core: follow-ups for live mount
2024-10-24 19:44:10 +02:00
Lennart Poettering 9bbc424a60 user-record: fix indentation 2024-10-24 10:17:35 +02:00
Lennart Poettering c17a76982a userdbctl: set shell/home cell type to TABLE_PATH
This only matters for sorting, and we currently don't support sorting by
path, hence this is of no real effect, but it certainly is more correct.
2024-10-24 10:17:35 +02:00
Lennart Poettering 2ea94b145e userdbctl: grey out nologin shell in tabular output 2024-10-24 10:17:35 +02:00
Lennart Poettering 8bc86b1944 userdbctl: optionally hide UID range boundaries in output 2024-10-24 10:17:35 +02:00
Lennart Poettering ad5de3222f userdbctl: add some basic client-side filtering
This adds some basic client-side user/group filtering to "userdbctl":

1. by uid/gid min/max
2. by user "disposition" (i.e. show only regular users with "userdbctl
   user -R")
3. by fuzzy name (i.e. search by substring/levenshtein of user name,
   real name, and other identifiers of the user/group record).

In the long run we also want to support this server side, but let's
start out with doing this client-side, since many backends won't support
server-side filtering anytime soon anyway, so we need it in either case.
2024-10-24 10:17:23 +02:00
Antonio Alvarez Feijoo 11de19f3da veritysetup-generator: remove unused code 2024-10-24 10:07:45 +02:00
Yu Watanabe 81d1fcce97 Merge pull request #27916 from yuwata/test-execute-credstore
test: update permission of credstore
2024-10-24 16:34:49 +09:00
Yu Watanabe 228e26ba03 Merge pull request #34834 from yuwata/protect-home-tmpfs-read-only
core/namespace: make ProtectHome=tmpfs makes /home and friends read-only as documented
2024-10-24 05:32:12 +09:00
Łukasz Stelmach 20bbf5ee4c core: don't forget about fallback_smack_process_label
Call setup_smack() also when only fallback_smack_process_label is set.

Fixes: 75689fb2d4
2024-10-24 03:24:29 +09:00
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
Yu Watanabe f0b974050d measure: fix typo
Follow-up for 0005411352.
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
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
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