Commit Graph
82957 Commits
Author SHA1 Message Date
Lennart Poettering 864a5e9ded getty: support /run/issue.d/
By default agetty will not display /run/issue.d/ if /etc/issue exists.
This is quite unfortunate and has actually been fixed upstream in:

https://github.com/util-linux/util-linux/commit/508fb0e7ac103b68531a59db2a4473897853ab52

However, no release has been tagged with this yet, and it doesn't look
like this will happen any time soon. Hence, for now, let's add a
work-around and manually override the issue files to include.

This should be reverted once a new util-linux/agetty release has been
tagged, and found its way into the relevant distributions. Given this is
mostly about cosmetics we do not have to precisely sync the package
updates on this, but only roughly.
2025-07-03 16:46:28 +02:00
Zbigniew Jędrzejewski-Szmek 9f145c2a9a sd-event: extend comment about a flex member
Follow-up for dbef4dd4f2. Everything that that
commit says is true, but — at least for me — it wasn't obvious why the code is
correct and we can do fixed-size allocations like new(struct inotify_data, 1).
2025-07-03 16:35:40 +02:00
Zbigniew Jędrzejewski-Szmek 391b507257 sd-event: typedef struct inotify_data to InotifyData 2025-07-03 16:35:40 +02:00
Zbigniew Jędrzejewski-Szmek 7eb10d69df sd-event: typedef struct inode_data to InodeData
This is an internal definition, so use the usual CamelCase typedef.
2025-07-03 16:35:40 +02:00
Zbigniew Jędrzejewski-Szmek c9ea39689f sd-event: make some more bools non-bitfield
In sd_event_source.child, we have 5 bools. If we make them each take one byte,
the structure size increases. So let's do that for the three of them, and leave
the other two (less frequently used) squished into the last byte. This allows
more efficient code to be generated, without changing the size of the struct:

$ diff -u <(objdump -S build/src/shared/libsystemd-shared-258.so.0|awk '/^static void source_io_unregister/,/^\}/') \
          <(objdump -S build/src/shared/libsystemd-shared-258.so|awk '/^static void source_io_unregister/,/^\}/')

         s->io.registered = false;
-  34d46f:      48 8b 45 d8             mov    -0x28(%rbp),%rax
-  34d473:      0f b6 90 a4 00 00 00    movzbl 0xa4(%rax),%edx
-  34d47a:      83 e2 fe                and    $0xfffffffe,%edx
-  34d47d:      88 90 a4 00 00 00       mov    %dl,0xa4(%rax)
-  34d483:      eb 04                   jmp    34d489 <source_io_unregister+0x1ca>
+  34bffe:      48 8b 45 d8             mov    -0x28(%rbp),%rax
+  34c002:      c6 80 a4 00 00 00 00    movb   $0x0,0xa4(%rax)
+  34c009:      eb 04                   jmp    34c00f <source_io_unregister+0x1be>
                 return;
2025-07-03 16:33:33 +02:00
Zbigniew Jędrzejewski-Szmek ea51623345 sd-event: drop some bitfield specifiers from struct sd_event_source
This does not change the size of the structure, because the size is determined
by .child, which has a 128-byte siginfo_t field. But by dropping the specifiers
we let the compiler generate code that operates on full bytes instead of having
to play with bitmasks, see second diff below.

Also move the bools in .memory_pressure into a gap to save a few bytes on
initialization.

$ diff -U100 <(pahole build/src/shared/libsystemd-shared-258.so.0 | awk '/struct sd_event_source/,/^}/') \
             <(pahole build/src/shared/libsystemd-shared-258.so | awk '/struct sd_event_source/,/^}/')
--- /proc/self/fd/11	2025-06-08 13:16:55.614738334 +0200
+++ /proc/self/fd/12	2025-06-08 13:16:55.615738386 +0200
@@ -1,109 +1,109 @@
 struct sd_event_source {
 	WakeupType                 wakeup;               /*     0     4 */
 	unsigned int               n_ref;                /*     4     4 */
 	sd_event *                 event;                /*     8     8 */
 	void *                     userdata;             /*    16     8 */
 	sd_event_handler_t         prepare;              /*    24     8 */
 	char *                     description;          /*    32     8 */
 	EventSourceType            type;                 /*    40     4 */
        signed int                 enabled:3;            /*    44: 0  4 */
 	_Bool                      pending:1;            /*    44: 3  1 */
 	_Bool                      dispatching:1;        /*    44: 4  1 */
 	_Bool                      floating:1;           /*    44: 5  1 */
 	_Bool                      exit_on_failure:1;    /*    44: 6  1 */
 	_Bool                      ratelimited:1;        /*    44: 7  1 */

 	/* XXX 24 bits hole, try to pack */

 	int64_t                    priority;             /*    48     8 */
 	unsigned int               pending_index;        /*    56     4 */
 	unsigned int               prepare_index;        /*    60     4 */
 	/* --- cacheline 1 boundary (64 bytes) --- */
 	uint64_t                   pending_iteration;    /*    64     8 */
 	uint64_t                   prepare_iteration;    /*    72     8 */
 	sd_event_destroy_t         destroy_callback;     /*    80     8 */
 	sd_event_handler_t         ratelimit_expire_callback; /*    88     8 */
 	sd_event_source *          sources_next;         /*    96     8 */
 	sd_event_source *          sources_prev;         /*   104     8 */
 	RateLimit                  rate_limit;           /*   112    24 */
 	/* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
 	unsigned int               earliest_index;       /*   136     4 */
 	unsigned int               latest_index;         /*   140     4 */
 	union {
 		struct {
 			sd_event_io_handler_t callback;  /*   144     8 */
 			int        fd;                   /*   152     4 */
 			uint32_t   events;               /*   156     4 */
 			uint32_t   revents;              /*   160     4 */
-			_Bool      registered:1;         /*   164: 0  1 */
-			_Bool      owned:1;              /*   164: 1  1 */
+			_Bool      registered;           /*   164     1 */
+			_Bool      owned;                /*   165     1 */
 		} io;                                    /*   144    24 */
 		struct {
 			sd_event_time_handler_t callback; /*   144     8 */
 			usec_t     next;                 /*   152     8 */
 			usec_t     accuracy;             /*   160     8 */
 		} time;                                  /*   144    24 */
 		struct {
 			sd_event_signal_handler_t callback; /*   144     8 */
 			struct signalfd_siginfo siginfo; /*   152   128 */
 			/* --- cacheline 4 boundary (256 bytes) was 24 bytes ago --- */
 			int        sig;                  /*   280     4 */
 			_Bool      unblock;              /*   284     1 */
 		} signal;                                /*   144   144 */
 		struct {
 			sd_event_child_handler_t callback; /*   144     8 */
 			siginfo_t  siginfo;              /*   152   128 */
 			/* --- cacheline 4 boundary (256 bytes) was 24 bytes ago --- */
 			pid_t      pid;                  /*   280     4 */
 			int        options;              /*   284     4 */
 			int        pidfd;                /*   288     4 */
 			_Bool      registered:1;         /*   292: 0  1 */
 			_Bool      pidfd_owned:1;        /*   292: 1  1 */
 			_Bool      process_owned:1;      /*   292: 2  1 */
 			_Bool      exited:1;             /*   292: 3  1 */
 			_Bool      waited:1;             /*   292: 4  1 */
 		} child;                                 /*   144   152 */
 		struct {
 			sd_event_handler_t callback;     /*   144     8 */
 		} defer;                                 /*   144     8 */
 		struct {
 			sd_event_handler_t callback;     /*   144     8 */
 		} post;                                  /*   144     8 */
 		struct {
 			sd_event_handler_t callback;     /*   144     8 */
 			unsigned int prioq_index;        /*   152     4 */
 		} exit;                                  /*   144    16 */
 		struct {
 			sd_event_inotify_handler_t callback; /*   144     8 */
 			uint32_t   mask;                 /*   152     4 */

 			/* XXX 4 bytes hole, try to pack */

 			struct inode_data * inode_data;  /*   160     8 */
 			sd_event_source * by_inode_data_next; /*   168     8 */
 			sd_event_source * by_inode_data_prev; /*   176     8 */
 		} inotify;                               /*   144    40 */
 		struct {
 			int        fd;                   /*   144     4 */
+			_Bool      registered;           /*   148     1 */
+			_Bool      locked;               /*   149     1 */
+			_Bool      in_write_list;        /*   150     1 */

-			/* XXX 4 bytes hole, try to pack */
+			/* XXX 1 byte hole, try to pack */

 			sd_event_handler_t callback;     /*   152     8 */
 			void *     write_buffer;         /*   160     8 */
 			size_t     write_buffer_size;    /*   168     8 */
 			uint32_t   events;               /*   176     4 */
 			uint32_t   revents;              /*   180     4 */
 			sd_event_source * write_list_next; /*   184     8 */
 			/* --- cacheline 3 boundary (192 bytes) --- */
 			sd_event_source * write_list_prev; /*   192     8 */
-			_Bool      registered:1;         /*   200: 0  1 */
-			_Bool      locked:1;             /*   200: 1  1 */
-			_Bool      in_write_list:1;      /*   200: 2  1 */
-		} memory_pressure;                       /*   144    64 */
+		} memory_pressure;                       /*   144    56 */
 	};                                               /*   144   152 */

 	/* size: 296, cachelines: 5, members: 26 */
 	/* sum members: 292 */
 	/* sum bitfield members: 8 bits, bit holes: 1, sum bit holes: 24 bits */
 	/* last cacheline: 40 bytes */
 };

Example diff in assembly:

$ diff -u <(objdump -S build/src/shared/libsystemd-shared-258.so.0|awk '/^static void event_source_time_prioq_reshuffle/,/^\}/') \
          <(objdump -S build/src/shared/libsystemd-shared-258.so|awk '/^static void event_source_time_prioq_reshuffle/,/^\}/')

         d->needs_rearm = true;
-  34d80e:      48 8b 45 f8             mov    -0x8(%rbp),%rax
-  34d812:      0f b6 50 20             movzbl 0x20(%rax),%edx
-  34d816:      83 ca 01                or     $0x1,%edx
-  34d819:      88 50 20                mov    %dl,0x20(%rax)
-  34d81c:      eb 01                   jmp    34d81f <event_source_time_prioq_reshuffle+0x12c>
+  34d7c3:      48 8b 45 f8             mov    -0x8(%rbp),%rax
+  34d7c7:      c6 40 20 01             movb   $0x1,0x20(%rax)
+  34d7cb:      eb 01                   jmp    34d7ce <event_source_time_prioq_reshuffle+0x126>
                 return; /* no-op for an event source which is neither a timer nor ratelimited. */
-  34d81e:      90                      nop
+  34d7cd:      90                      nop
2025-07-03 16:17:42 +02:00
Yu Watanabe ea2c74744b ci: add test case for building without OpenSSL UI support 2025-07-03 22:10:57 +09:00
Yu Watanabe d1d16c624d openssl-util: allow to build with openssl without UI support
When OpenSSL is built without UI support, OPENSSL_NO_UI_CONSOLE is
defined. Or, even openssl is built with UI support, people may want to
build systemd without using OpenSSL's UI feature by specifying
-Dc_args='-DOPENSSL_NO_UI_CONSOLE=1'. This adds support for such cases.

Not tested, but hopefully, now systemd can be built with other ssl library,
like BoringSSL, which deos not support UIs.

Closes #38024.
2025-07-03 22:10:57 +09:00
DaanDeMeyer 1543c2385c fd-util: Move O_ACCMODE_STRICT to fd-util.h
We're still discussing whether we want to remove this or not, but
regardless of whether we end up removing it or not, it's something
we add ourselves and as such should not live in our headers that
override glibc headers, so let's move it to fd-util.h.
2025-07-03 14:28:14 +02:00
DaanDeMeyer cefec8f6ce fd-util: Move RAW_O_LARGEFILE definition to fd-util.h
This is not something that comes from glibc, but which we invent
ourselves. As such, it should not be part of our overrides of glibc
headers, but instead should be part of one of our own headers, so
let's move it to fd-util.h.

Follow up for 194a690181
2025-07-03 14:18:50 +02:00
Daan De Meyer 76e3cc469d Move missing_xyz.h for glibc headers to src/basic/include/ (#37960) 2025-07-03 13:47:46 +02:00
Zbigniew Jędrzejewski-Szmek 867cba15bc resolve: add converters for sshfp key types and algs
With the data center move in the Fedora project, the ssh keys have changed.
The list with numerical values is hard to read…

$ resolvectl -t sshfp query pkgs.fedoraproject.org
Old:
pkgs.fedoraproject.org IN SSHFP 1 1 18270c9131ef9664861f5aa675a981146573cce0 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP 1 2 b067e6eb4c3e2d0e8bb37d6799493b762131816fe979940bbe660470abe6efbb -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP 3 1 a1ad871a5eabe3027728d498a89895fb5bf5b290 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP 3 2 c3dc523f99bb5155ec87f40fd1aa198c68f349d75beeccf60e87b44c9b461907 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP 4 1 e1265f46012ee40967127e06cf5533b270568428 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP 4 2 acaa1ee6292d01f1ae7881fdf03aaf7d7b0814e34e94c3558a25e4d1aaab8f94 -- link: wlp0s20f3
New:
pkgs.fedoraproject.org IN SSHFP RSA     SHA-1   18270c9131ef9664861f5aa675a981146573cce0 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP RSA     SHA-256 b067e6eb4c3e2d0e8bb37d6799493b762131816fe979940bbe660470abe6efbb -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP ECDSA   SHA-1   a1ad871a5eabe3027728d498a89895fb5bf5b290 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP ECDSA   SHA-256 c3dc523f99bb5155ec87f40fd1aa198c68f349d75beeccf60e87b44c9b461907 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP Ed25519 SHA-1   e1265f46012ee40967127e06cf5533b270568428 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP Ed25519 SHA-256 acaa1ee6292d01f1ae7881fdf03aaf7d7b0814e34e94c3558a25e4d1aaab8f94 -- link: wlp0s20f3
2025-07-03 13:46:40 +02:00
Frede Braendstrup f1a00fcb97 fix: UnsetProperty example in systemd.link.xml 2025-07-03 18:37:03 +09:00
Daan De Meyer 67b2cb7769 test: Add tests for various varlink socket units
Let's make sure these socket units work as expected by stopping the
related services and making sure the services are started as expected
when a client connects to the corresponding socket.
2025-07-03 11:24:03 +02:00
Daan De Meyer ce06fad9c5 udev: Fix initializing varlink server from listen fd
manager_listen_fds() instructs sd_listen_fds_with_names() to unset
the environment which means that when sd_varlink_server_listen_auto()
is called from manager_start_varlink_server(), when it eventually calls
sd_listen_fds_with_names() it will return zero because the environment
has already been unset in manager_listen_fds().

Fix the issue by not using sd_varlink_server_listen_auto() but instead
keeping track of the varlink socket in manager_listen_fds() and returning
it and passing it to manager_start_varlink_server().
2025-07-03 11:22:34 +02:00
Daan De Meyer 0470754f9d login: Add varlink socket unit 2025-07-03 11:22:34 +02:00
Daan De Meyer 0eb59bd5ae login: Add missing newline between headers 2025-07-03 11:22:34 +02:00
Daan De Meyer b0ea79c5b5 network: Add varlink socket unit 2025-07-03 11:22:34 +02:00
Luca Boccassi a63f0ea73d test: allow to run test-local-addresses with IPv6 disabled by default, and assume RTA_VIA is always supported (#38039) 2025-07-03 09:58:02 +01:00
Yu Watanabe 34af1513d0 fuzz: avoid assertion for ExecContext.private_var_tmp triggered
Follow-up for 6156bec7a4.

Fixes #38037 and oss-fuzz#429112745.
2025-07-03 09:55:58 +01:00
Zbigniew Jędrzejewski-Szmek 8f0824f9db shared/bus-unit-util: define helper for CapabilityBoundingSet=/AmbientCapabilities= 2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 94abee6063 shared/bus-unit-util: define helper function for rlimits
Strictly speaking, we call startswith twice now. This duplication
shall be eliminated later.
2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 5c41755fe6 shared/bus-unit-util: define helper for StandardInputData= 2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 6bb4420100 shared/bus-unit-util: define helper for StandardInputText= 2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 375351d003 shared/bus-unit-util: define helper functions for StandardInput/Output/Error= 2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 32adb97cf1 shared/bus-unit-util: define helper for LogFilterPatterns= 2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 50dd808d69 shared/bus-unit-util: define helper for LogExtraFields= 2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 0b5b043733 TEST-54-CREDS: s/ImportCredentialEx/ImportCredential/ except for one place
This is a separate commit because the tests are supposed to pass with both
the old spelling and the new.
2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 4b98aeb6ef shared/bus-unit-util: add helper for ImportCredentialEx= and fix naming confusion
We add D-Bus properties like "*Ex" because we cannot change the D-Bus property
type without breaking backward comapatibility. But those names are only for
D-Bus, not for config file stanzas or the command-line parser. There, we can
change the type, or in other words, there is no type, just a free-form string
whose interpretation we can extend or change. Commit
831f208783 that added ProtectHostnameEx was
confused, because it added ImportCredentialEx in places where parsing of
ImportCredential should be have been extended.

On D-Bus, we send ImportCrednential in preference, and ImportCredentialEx only
when required. This way we send less bytes on the wire and support older
systems that don't understand the new property.

Partially resolves https://github.com/systemd/systemd/issues/37174.
2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 068c4c8677 shared/bus-unit-util: define helper for LoadCredential=/LoadCredentialEncrypted= 2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 82e009a212 shared/bus-unit-util: define helper for SetCredential=/SetCredentialEncrypted= 2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 7c4b4a93d6 shared/bus-unit-util: define helper function for EnvironmentFile= 2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 4eb516e319 shared/bus-unit-util: add helper for SocketBindAllow=/SocketBindDeny= 2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 513026c4bf shared/bus-unit-util: define helper for BPFProgram= 2025-07-03 10:37:34 +02:00
Zbigniew Jędrzejewski-Szmek 9f17f68bc5 shared/bus-unit-util: add helper for IPIngressFilterPath=/IPEgressFilterPath= 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek af33eb4bb7 shared/bus-unit-util: define helper function for IPAddressAllow=/IPAddressDeny= 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek 235c580d80 shared/bus-unit-util: define helper for IODeviceLatencyTargetSec= 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek 335f7c7f01 shared/bus-unit-util: define helper for IODeviceWeight= 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek 5852a3e673 shared/bus-unit-util: add helper for group io limits 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek 619d378f55 shared/bus-unit-util: define helper for DeviceAllow= 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek ff0bbeff3a basic/cgroup-util: align tables 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek b4cf928f24 shared/bus-unit-util: define helper function for CPUQuota=
Unfortunately we can't nicely fold it in with the other helpers, because
of the unusual naming mismatch: CPUQuota vs. CPUQuotaPerSecUSec.
2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek 40fcb3185d shared/bus-unit-util: define helper function for resource limits 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek 3704d0ad1b shared/bus-unit-util: define helper for Delegate= 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek ca197282fb shared/bus-unit-util: define helper for StartupAllowedMemoryNodes= and friends 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek 965489c935 shared/bus-unit-util: define helper for ManagedOOMMemoryPressureLimit= 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek 411b998da8 shared/bus-unit-util: fix appending of IODeviceLatencyTargetSec= 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek 010d2e42c2 shared/bus-unit-util: use common helper in one more place 2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek e47fb4abd2 Rename STRV_MAKE_EMPTY to just STRV_EMPTY
Even though this creates a stack allocation, it is not a function macro, so
drop the "make" from the name.
2025-07-03 10:37:33 +02:00
Zbigniew Jędrzejewski-Szmek d2a9a2aabf shared/bus-unit-util: drop spurious parentheses 2025-07-03 10:37:33 +02:00