]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #31531 from poettering/verity-userspace-optional
authorLennart Poettering <lennart@poettering.net>
Wed, 28 Feb 2024 21:04:58 +0000 (22:04 +0100)
committerGitHub <noreply@github.com>
Wed, 28 Feb 2024 21:04:58 +0000 (22:04 +0100)
dissect: make use of userspace verity keyring optional

38 files changed:
NEWS
docs/ENVIRONMENT.md
man/kernel-command-line.xml
man/systemd-battery-check.service.xml
man/systemd-network-generator.service.xml
man/systemd-udevd.service.xml
man/systemd-update-done.service.xml
man/systemd.net-naming-scheme.xml
man/systemd.unit.xml
meson.build
meson_options.txt
src/basic/env-util.c
src/basic/env-util.h
src/basic/initrd-util.c
src/basic/locale-util.c
src/basic/log.c
src/basic/terminal-util.c
src/battery-check/battery-check.c
src/core/main.c
src/fstab-generator/fstab-generator.c
src/libsystemd/sd-device/sd-device.c
src/libsystemd/sd-event/sd-event.c
src/network/generator/network-generator.c
src/nss-resolve/nss-resolve.c
src/nss-systemd/nss-systemd.c
src/nss-systemd/userdb-glue.c
src/shared/condition.c
src/shared/creds-util.c
src/shared/dissect-image.c
src/shared/efi-loader.c
src/shared/netif-naming-scheme.c
src/shared/pager.c
src/shared/ptyfwd.c
src/shared/seccomp-util.c
src/sysusers/sysusers.c
src/test/test-nss-hosts.c
src/tpm2-setup/tpm2-generator.c
units/systemd-battery-check.service.in

diff --git a/NEWS b/NEWS
index e7b673d650037da4d49593a3ef0e557b40f9d6a2..cd9965aaded523b5666fd849b753b44e54b9c06b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1390,7 +1390,7 @@ CHANGES WITH 254:
           user is notified (graphically via Plymouth – if available – as well
           as in text form on the console), and the system is turned off after a
           10s delay. The feature can be disabled by passing
-          systemd.battery-check=0 through the kernel command line.
+          systemd.battery_check=0 through the kernel command line.
 
         * The 'passwdqc' library is now supported as an alternative to the
           'pwquality' library and can be selected at build time.
@@ -3718,7 +3718,7 @@ CHANGES WITH 250:
           interfaces. The Kind= setting in .netdev file accepts "ipoib". And
           systemd.netdev files gained the [IPoIB] section.
 
-        * systemd-networkd and systemd-udevd now support net.ifname-policy=
+        * systemd-networkd and systemd-udevd now support net.ifname_policy=
           option on the kernel command-line. This is implemented through the
           systemd-network-generator service that automatically generates
           appropriate .link, .network, and .netdev files.
@@ -4290,7 +4290,7 @@ CHANGES WITH 249:
           - Invalid characters in interface names are replaced with "_".
 
           The new version of the net naming scheme is "v249". The previous
-          scheme can be selected via the "net.naming-scheme=v247" kernel
+          scheme can be selected via the "net.naming_scheme=v247" kernel
           command line parameter.
 
         * sd-bus' sd_bus_is_ready() and sd_bus_is_open() calls now accept a
@@ -5821,7 +5821,7 @@ CHANGES WITH 247:
           bridge. Since this is a naming scheme incompatibility on systems that
           possess hardware like this it has been introduced as new naming
           scheme "v247". The previous scheme can be selected via the
-          "net.naming-scheme=v245" kernel command line parameter.
+          "net.naming_scheme=v245" kernel command line parameter.
 
         * ConditionFirstBoot= semantics have been modified to be safe towards
           abnormal system power-off during first boot. Specifically, the
@@ -6034,12 +6034,12 @@ CHANGES WITH 246:
           added, which may be used to turn off automatic activation of swap
           devices listed in /etc/fstab.
 
-        * New kernel command line options systemd.condition-needs-update= and
-          systemd.condition-first-boot= have been added, which override the
+        * New kernel command line options systemd.condition_needs_update= and
+          systemd.condition_first_boot= have been added, which override the
           result of the ConditionNeedsUpdate= and ConditionFirstBoot=
           conditions.
 
-        * A new kernel command line option systemd.clock-usec= has been added
+        * A new kernel command line option systemd.clock_usec= has been added
           that allows setting the system clock to the specified time in µs
           since Jan 1st, 1970 early during boot. This is in particular useful
           in order to make test cases more reliable.
@@ -6726,7 +6726,7 @@ CHANGES WITH 245:
           multiple containers whose names all begin with the same prefix. Since
           this changes the primary interface names pointing to containers if
           truncation happens, the old scheme may still be requested by
-          selecting an older naming scheme, via the net.naming-scheme= kernel
+          selecting an older naming scheme, via the net.naming_scheme= kernel
           command line option.
 
         * PrivateUsers= in service files now works in services run by the
@@ -7256,9 +7256,9 @@ CHANGES WITH 243:
           Moreover, the "en" prefix was dropped from the ID_NET_NAME_ONBOARD
           udev property.
 
-          Those two changes form a new net.naming-policy-scheme= entry.
-          Distributions which want to preserve naming stability may want to set
-          the -Ddefault-net-naming-scheme= configuration option.
+          Those two changes form a new net.naming_scheme= entry.  Distributions
+          which want to preserve naming stability may want to set the
+          -Ddefault-net-naming-scheme= configuration option.
 
         * systemd-networkd now supports MACsec, nlmon, IPVTAP and Xfrm
           interfaces natively.
@@ -8333,7 +8333,7 @@ CHANGES WITH 240:
           name as argument.
 
         * systemd-udevd's network naming logic now understands a new
-          net.naming-scheme= kernel command line switch, which may be used to
+          net.naming_scheme= kernel command line switch, which may be used to
           pick a specific version of the naming scheme. This helps stabilizing
           interface names even as systemd/udev are updated and the naming logic
           is improved.
index 1af6f569ded1afa3b23dc38b055ea3d6ce27110b..302ca67b576d4bbee0c94ff3eb54f82d534c9999 100644 (file)
@@ -252,7 +252,7 @@ All tools:
   when determining stable network interface names. This may be used to revert
   to naming schemes of older udev versions, in order to provide more stable
   naming across updates. This environment variable takes precedence over the
-  kernel command line option `net.naming-scheme=`, except if the value is
+  kernel command line option `net.naming_scheme=`, except if the value is
   prefixed with `:` in which case the kernel command line option takes
   precedence, if it is specified as well.
 
index 47ec00a794d5d751afa23f85c46f5f745f34e973..72003d86f2fd16d0e87caf064aa923d83aff88b8 100644 (file)
         <term><varname>udev.blockdev_read_only</varname></term>
         <term><varname>rd.udev.blockdev_read_only</varname></term>
         <term><varname>net.ifnames=</varname></term>
-        <term><varname>net.naming-scheme=</varname></term>
+        <term><varname>net.naming_scheme=</varname></term>
 
         <listitem>
           <para>Parameters understood by the device event managing
         <citerefentry><refentrytitle>systemd-homed-firstboot.service</refentrytitle><manvolnum>1</manvolnum></citerefentry>
         will not query the user for basic system settings, even if the system boots up for the first time and
         the relevant settings are not initialized yet. Not to be confused with
-        <varname>systemd.condition-first-boot=</varname> (see below), which overrides the result of the
+        <varname>systemd.condition_first_boot=</varname> (see below), which overrides the result of the
         <varname>ConditionFirstBoot=</varname> unit file condition, and thus controls more than just
         <filename>systemd-firstboot.service</filename> behaviour.</para>
 
       </varlistentry>
 
       <varlistentry>
-        <term><varname>systemd.condition-needs-update=</varname></term>
+        <term><varname>systemd.condition_needs_update=</varname></term>
 
         <listitem><para>Takes a boolean argument. If specified, overrides the result of
         <varname>ConditionNeedsUpdate=</varname> unit condition checks. See
       </varlistentry>
 
       <varlistentry>
-        <term><varname>systemd.condition-first-boot=</varname></term>
+        <term><varname>systemd.condition_first_boot=</varname></term>
 
         <listitem><para>Takes a boolean argument. If specified, overrides the result of
         <varname>ConditionFirstBoot=</varname> unit condition checks. See
       </varlistentry>
 
       <varlistentry>
-        <term><varname>systemd.clock-usec=</varname></term>
+        <term><varname>systemd.clock_usec=</varname></term>
 
         <listitem><para>Takes a decimal, numeric timestamp in μs since January 1st 1970, 00:00am, to set the
         system clock to. The system time is set to the specified timestamp early during boot. It is not
       </varlistentry>
 
       <varlistentry>
-        <term><varname>systemd.random-seed=</varname></term>
+        <term><varname>systemd.random_seed=</varname></term>
 
         <listitem><para>Takes a base64 encoded random seed value to credit with full entropy to the kernel's
         random pool during early service manager initialization. This option is useful in testing
 
         <xi:include href="version-info.xml" xpointer="v254"/></listitem>
       </varlistentry>
+
+      <varlistentry>
+        <term><varname>systemd.battery_check=</varname></term>
+
+        <listitem><para>Accepts a boolean argument. If false the boot-time battery charge check implemented
+        by
+        <citerefentry><refentrytitle>systemd-battery-check.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+        is disabled.</para>
+
+        <xi:include href="version-info.xml" xpointer="v254"/></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><varname>ifname=</varname></term>
+        <term><varname>net.ifname_policy=</varname></term>
+
+        <listitem><para>Controls interface naming policies, implemented by
+        <citerefentry><refentrytitle>systemd-network-generator.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
+
+        <xi:include href="version-info.xml" xpointer="v245"/></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><varname>systemd.tpm2_wait=</varname></term>
+
+        <listitem><para>Controls whether to wait for a TPM2 device at boot, implemented by
+        <citerefentry><refentrytitle>systemd-tpm2-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
+
+        <xi:include href="version-info.xml" xpointer="v256"/></listitem>
+      </varlistentry>
+
     </variablelist>
   </refsect1>
 
index 698e9d7c3f4af66c14523823f0f05e6b04d8c166..a5f564b888f1e0c9944027c356ae411103e53a7e 100644 (file)
@@ -66,7 +66,7 @@
 
     <variablelist class='kernel-commandline-options'>
       <varlistentry>
-        <term><varname>systemd.battery-check=<replaceable>BOOL</replaceable></varname></term>
+        <term><varname>systemd.battery_check=<replaceable>BOOL</replaceable></varname></term>
 
         <listitem>
           <para>Takes a boolean. If specified with false, <command>systemd-battery-check</command> command
index 1d498cbf1dd1e80013340d035ca6f9baea45466f..59d608028a70a0659859103356ea2f2ca6558a12 100644 (file)
@@ -76,7 +76,7 @@
 
       <varlistentry>
         <term><varname>ifname=</varname></term>
-        <term><varname>net.ifname-policy=</varname></term>
+        <term><varname>net.ifname_policy=</varname></term>
         <listitem>
           <para>Translated into
           <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>
index b63ee4bb7715fbe24d41104e12aa02d28cbd2462..c781765e1cf80f73e3923519373cf38f94269d1a 100644 (file)
         </listitem>
       </varlistentry>
       <varlistentry>
-        <term><varname>net.naming-scheme=</varname></term>
+        <term><varname>net.naming_scheme=</varname></term>
         <listitem>
           <para>Network interfaces are renamed to give them predictable names when possible (unless
           <varname>net.ifnames=0</varname> is specified, see above). With this kernel command line option it
         </listitem>
       </varlistentry>
       <varlistentry>
-        <term><varname>net.ifname-policy=<replaceable>policy1</replaceable>[,<replaceable>policy2</replaceable>,…][,<replaceable>MAC</replaceable>]</varname></term>
+        <term><varname>net.ifname_policy=<replaceable>policy1</replaceable>[,<replaceable>policy2</replaceable>,…][,<replaceable>MAC</replaceable>]</varname></term>
         <listitem>
           <para>Specifies naming policies applied when renaming network interfaces. Takes a list of
           policies and an optional MAC address separated with comma. Each policy value must be one of
           enabled.</para>
 
           <para>Example:
-          <programlisting>net.ifname-policy=keep,kernel,path,slot,onboard,01:23:45:67:89:ab
-net.ifname-policy=keep,kernel,path,slot,onboard,mac</programlisting>
+          <programlisting>net.ifname_policy=keep,kernel,path,slot,onboard,01:23:45:67:89:ab
+net.ifname_policy=keep,kernel,path,slot,onboard,mac</programlisting>
           This is mostly equivalent to creating the following .link files:
           <programlisting># 91-name-policy-with-mac.link
 [Match]
index 46bb2f41c886a076dfc88ccd7f3abb13443be139..6b863ecff3a871722ec0b6aa9cec5f4f12d6acc3 100644 (file)
@@ -58,7 +58,7 @@
     <citerefentry project='man-pages'><refentrytitle>touch</refentrytitle><manvolnum>1</manvolnum></citerefentry>
     on it.</para>
 
-    <para>Note that if the <varname>systemd.condition-needs-update=</varname> kernel command line option is
+    <para>Note that if the <varname>systemd.condition_needs_update=</varname> kernel command line option is
     used it overrides the <varname>ConditionNeedsUpdate=</varname> unit condition checks. In that case
     <filename>systemd-update-done.service</filename> will not reset the condition state until a follow-up
     reboot where the kernel switch is not specified anymore.</para>
index 09df42aea27808be0993fe6626df67ae6ac91a2c..2fec1055b7017a0253b23710ef9cbfaef1546d0d 100644 (file)
@@ -38,7 +38,7 @@
     implemented version, but it is also possible to set one of the older versions to preserve
     compatibility. This may be useful for example for distributions, which may introduce new versions of
     systemd in stable releases without changing the naming scheme. The naming scheme may also be overridden
-    using the <varname>net.naming-scheme=</varname> kernel command line switch, see
+    using the <varname>net.naming_scheme=</varname> kernel command line switch, see
     <citerefentry><refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
     Available naming schemes are described below.</para>
 
     <title>History</title>
 
     <para>The following "naming schemes" have been defined (which may be chosen at system boot-up time via
-    the <varname>net.naming-scheme=</varname> kernel command line switch, see above):</para>
+    the <varname>net.naming_scheme=</varname> kernel command line switch, see above):</para>
 
     <variablelist>
         <varlistentry>
index 46184f5b7e76e38867aa5634c9ff70cd2c594d5b..7c11598a941528a7d7aa12708ea917d69e182292 100644 (file)
           to make sure they run before the stamp file's modification time gets reset indicating a completed
           update.</para>
 
-          <para>If the <varname>systemd.condition-needs-update=</varname> option is specified on the kernel
+          <para>If the <varname>systemd.condition_needs_update=</varname> option is specified on the kernel
           command line (taking a boolean), it will override the result of this condition check, taking
           precedence over any file modification time checks. If the kernel command line option is used,
           <filename>systemd-update-done.service</filename> will not have immediate effect on any following
           <varname>Wants=</varname>. This ensures that in a case of an aborted first boot, these units will
           be re-run during the next system startup.</para>
 
-          <para>If the <varname>systemd.condition-first-boot=</varname> option is specified on the kernel
+          <para>If the <varname>systemd.condition_first_boot=</varname> option is specified on the kernel
           command line (taking a boolean), it will override the result of this condition check, taking
           precedence over <filename>/etc/machine-id</filename> existence checks.</para>
 
index 10404cebd60728f6ba1e04f1352f6c2575b9988f..e27e944caff7cf063f816cf64e6f78673c62a4da 100644 (file)
@@ -2757,8 +2757,8 @@ summary({
         'default LLMNR mode' :              default_llmnr,
         'default DNS servers' :             dns_servers.split(' '),
         'default NTP servers' :             ntp_servers.split(' '),
-        'default net.naming-scheme value' : default_net_naming_scheme,
-        'default KillUserProcesses value' : kill_user_processes,
+        'default net.naming_scheme= value': default_net_naming_scheme,
+        'default KillUserProcesses= value': kill_user_processes,
         'default locale' :                  default_locale,
         'default nspawn locale' :           nspawn_locale,
         'default status unit format' :      status_unit_format_default,
index 51434f74b3bbbd1889c0c6f6403adb710e7653d2..e9a5f18cd63f10758b22a503a52a68a1bf413e0b 100644 (file)
@@ -230,9 +230,9 @@ option('default-hierarchy', type : 'combo',
        choices : ['legacy', 'hybrid', 'unified'], deprecated : true,
        description : '''This option is deprecated and will be removed in a future release''')
 option('extra-net-naming-schemes', type : 'string',
-       description : 'comma-separated list of extra net.naming-scheme= definitions')
+       description : 'comma-separated list of extra net.naming_scheme= definitions')
 option('default-net-naming-scheme', type : 'string', value : 'latest',
-       description : 'default net.naming-scheme= value')
+       description : 'default net.naming_scheme= value')
 option('status-unit-format-default', type : 'combo',
        choices : ['auto', 'description', 'name', 'combined'],
        description : 'use unit name or description in messages by default')
index 3bb265465700f0d9a3adeb00f3858f3c2be856d8..7608f90a4a691190e8c35247cb1ce2fe587c658b 100644 (file)
@@ -963,7 +963,7 @@ int getenv_bool(const char *p) {
         return parse_boolean(e);
 }
 
-int getenv_bool_secure(const char *p) {
+int secure_getenv_bool(const char *p) {
         const char *e;
 
         e = secure_getenv(p);
@@ -973,7 +973,7 @@ int getenv_bool_secure(const char *p) {
         return parse_boolean(e);
 }
 
-int getenv_uint64_secure(const char *p, uint64_t *ret) {
+int secure_getenv_uint64(const char *p, uint64_t *ret) {
         const char *e;
 
         assert(p);
index 15d867a3d9aff47f198b5810da12dd9041e0ed2c..6610ca8ca16c0670b3efe07f3e2f860e52d3b2d1 100644 (file)
@@ -62,9 +62,9 @@ static inline char* strv_env_get(char * const *x, const char *n) {
 char *strv_env_pairs_get(char **l, const char *name) _pure_;
 
 int getenv_bool(const char *p);
-int getenv_bool_secure(const char *p);
+int secure_getenv_bool(const char *p);
 
-int getenv_uint64_secure(const char *p, uint64_t *ret);
+int secure_getenv_uint64(const char *p, uint64_t *ret);
 
 /* Like setenv, but calls unsetenv if value == NULL. */
 int set_unset_env(const char *name, const char *value, bool overwrite);
index 03ccfbe48321b347c137e0c06d084aa9430f2b5c..d3aa933977a9c8bcd1cddbc2b0bd93dbaf4570d9 100644 (file)
@@ -21,7 +21,7 @@ bool in_initrd(void) {
          * This can be overridden by setting SYSTEMD_IN_INITRD=0|1.
          */
 
-        r = getenv_bool_secure("SYSTEMD_IN_INITRD");
+        r = secure_getenv_bool("SYSTEMD_IN_INITRD");
         if (r < 0 && r != -ENXIO)
                 log_debug_errno(r, "Failed to parse $SYSTEMD_IN_INITRD, ignoring: %m");
 
index e6da5dbc631d07eb753c5a7a7f423b1ba0e53d68..23565273dd2fceb61dbed0c3e852de22edc21644 100644 (file)
@@ -295,7 +295,7 @@ bool is_locale_utf8(void) {
         if (cached_answer >= 0)
                 goto out;
 
-        r = getenv_bool_secure("SYSTEMD_UTF8");
+        r = secure_getenv_bool("SYSTEMD_UTF8");
         if (r >= 0) {
                 cached_answer = r;
                 goto out;
index 7ddca92afa8a3bd9b1aabb50fe66aedc18233b1a..172a2c8ada086cbf4d3ea98c671c5b92ee4e5556 100644 (file)
@@ -1674,7 +1674,7 @@ bool log_context_enabled(void) {
         if (saved_log_context_enabled >= 0)
                 return saved_log_context_enabled;
 
-        r = getenv_bool_secure("SYSTEMD_ENABLE_LOG_CONTEXT");
+        r = secure_getenv_bool("SYSTEMD_ENABLE_LOG_CONTEXT");
         if (r < 0 && r != -ENXIO)
                 log_debug_errno(r, "Failed to parse $SYSTEMD_ENABLE_LOG_CONTEXT, ignoring: %m");
 
index 4c1824bc83f52a9fa0393587fde06c55ef2b17e1..8b5a9fa8c68ffbb266683ee95ffb1656858ee9e8 100644 (file)
@@ -1581,6 +1581,7 @@ typedef enum BackgroundColorState {
         BACKGROUND_RED,
         BACKGROUND_GREEN,
         BACKGROUND_BLUE,
+        BACKGROUND_STRING_TERMINATOR,
 } BackgroundColorState;
 
 typedef struct BackgroundColorContext {
@@ -1672,7 +1673,9 @@ static int scan_background_color_response(
                                         return 1; /* success! */
 
                                 context->state = BACKGROUND_TEXT;
-                        } else {
+                        } else if (c == '\x1b')
+                                context->state = context->blue_bits > 0 ? BACKGROUND_STRING_TERMINATOR : BACKGROUND_TEXT;
+                        else {
                                 int d = unhexchar(c);
                                 if (d < 0 || context->blue_bits >= sizeof(context->blue)*8)
                                         context->state = BACKGROUND_TEXT;
@@ -1682,10 +1685,18 @@ static int scan_background_color_response(
                                 }
                         }
                         break;
+
+                case BACKGROUND_STRING_TERMINATOR:
+                        if (c == '\\')
+                                return 1; /* success! */
+
+                        context->state = c == ']' ? BACKGROUND_ESCAPE : BACKGROUND_TEXT;
+                        break;
+
                 }
 
                 /* Reset any colors we might have picked up */
-                if (context->state == BACKGROUND_TEXT) {
+                if (IN_SET(context->state, BACKGROUND_TEXT, BACKGROUND_ESCAPE)) {
                         /* reset color */
                         context->red = context->green = context->blue = 0;
                         context->red_bits = context->green_bits = context->blue_bits = 0;
@@ -1744,6 +1755,10 @@ int get_default_background_color(double *ret_red, double *ret_green, double *ret
                 r = fd_wait_for_event(STDIN_FILENO, POLLIN, usec_sub_unsigned(end, n));
                 if (r < 0)
                         goto finish;
+                if (r == 0) {
+                        r = -EOPNOTSUPP;
+                        goto finish;
+                }
 
                 ssize_t l;
                 l = read(STDIN_FILENO, buf, sizeof(buf) - buf_full);
index 03628c8b921494db79ab083fea66b5dc0d37490b..1563147b7b673c101c33121e4b8ddd2521bdf23a 100644 (file)
@@ -123,9 +123,9 @@ static int run(int argc, char *argv[]) {
 
         log_setup();
 
-        r = proc_cmdline_get_bool("systemd.battery-check", PROC_CMDLINE_STRIP_RD_PREFIX|PROC_CMDLINE_TRUE_WHEN_MISSING, &arg_doit);
+        r = proc_cmdline_get_bool("systemd.battery_check", PROC_CMDLINE_STRIP_RD_PREFIX|PROC_CMDLINE_TRUE_WHEN_MISSING, &arg_doit);
         if (r < 0)
-                log_warning_errno(r, "Failed to parse systemd.battery-check= kernel command line option, ignoring: %m");
+                log_warning_errno(r, "Failed to parse systemd.battery_check= kernel command line option, ignoring: %m");
 
         r = parse_argv(argc, argv);
         if (r <= 0)
index be6d07b333ca429259ad3dd210891930dd49913d..fa0dc3191acb0fbde6c9b2209e147cf884aa52cb 100644 (file)
@@ -2202,9 +2202,9 @@ static void log_execution_mode(bool *ret_first_boot) {
                         /* Let's check whether we are in first boot. First, check if an override was
                          * specified on the kernel command line. If yes, we honour that. */
 
-                        r = proc_cmdline_get_bool("systemd.condition-first-boot", /* flags = */ 0, &first_boot);
+                        r = proc_cmdline_get_bool("systemd.condition_first_boot", /* flags = */ 0, &first_boot);
                         if (r < 0)
-                                log_debug_errno(r, "Failed to parse systemd.condition-first-boot= kernel command line argument, ignoring: %m");
+                                log_debug_errno(r, "Failed to parse systemd.condition_first_boot= kernel command line argument, ignoring: %m");
 
                         if (r > 0)
                                 log_full(first_boot ? LOG_INFO : LOG_DEBUG,
index 3a1d2f38dbb173ad56c3ae5702563b83b8713abb..7a235c5bf46d6d2b69fb21b89f0012933959ba69 100644 (file)
@@ -824,7 +824,7 @@ static bool sysfs_check(void) {
         int r;
 
         if (cached < 0) {
-                r = getenv_bool_secure("SYSTEMD_SYSFS_CHECK");
+                r = secure_getenv_bool("SYSTEMD_SYSFS_CHECK");
                 if (r < 0 && r != -ENXIO)
                         log_debug_errno(r, "Failed to parse $SYSTEMD_SYSFS_CHECK, ignoring: %m");
                 cached = r != 0;
index bfc2a8a9ca531884db9935c73ca6e420cbad7f0a..9a340157380be3fd715d3cac31b5a45c1f1ea83c 100644 (file)
@@ -214,7 +214,7 @@ int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
                 /* Only operate on sysfs, i.e. refuse going down into /sys/fs/cgroup/ or similar places where
                  * things are not arranged as kobjects in kernel, and hence don't necessarily have
                  * kobject/attribute structure. */
-                r = getenv_bool_secure("SYSTEMD_DEVICE_VERIFY_SYSFS");
+                r = secure_getenv_bool("SYSTEMD_DEVICE_VERIFY_SYSFS");
                 if (r < 0 && r != -ENXIO)
                         log_debug_errno(r, "Failed to parse $SYSTEMD_DEVICE_VERIFY_SYSFS value: %m");
                 if (r != 0) {
index 338609b186905d81519c382e5070e793377f67b8..c651d5950268087f20d7a17f00dfea38209a53dd 100644 (file)
@@ -1574,7 +1574,7 @@ static int child_exit_callback(sd_event_source *s, const siginfo_t *si, void *us
 
 static bool shall_use_pidfd(void) {
         /* Mostly relevant for debugging, i.e. this is used in test-event.c to test the event loop once with and once without pidfd */
-        return getenv_bool_secure("SYSTEMD_PIDFD") != 0;
+        return secure_getenv_bool("SYSTEMD_PIDFD") != 0;
 }
 
 _public_ int sd_event_add_child(
index 48527a2c73dfc7dbad1e01abdd315699edafaf7e..106e10a5752543c4e26b19ed13478343b3f23fb1 100644 (file)
@@ -27,7 +27,7 @@
 
   # .link
   ifname=<interface>:<MAC>
-  net.ifname-policy=policy1[,policy2,...][,<MAC>] # This is an original rule, not supported by other tools.
+  net.ifname_policy=policy1[,policy2,...][,<MAC>] # This is an original rule, not supported by other tools.
 
   # .netdev
   vlan=<vlanname>:<phydevice>
@@ -1114,7 +1114,7 @@ static int parse_cmdline_ifname_policy(Context *context, const char *key, const
         assert(context);
         assert(key);
 
-        /* net.ifname-policy=policy1[,policy2,...][,<MAC>] */
+        /* net.ifname_policy=policy1[,policy2,...][,<MAC>] */
 
         if (proc_cmdline_value_missing(key, value))
                 return -EINVAL;
@@ -1172,23 +1172,23 @@ int parse_cmdline_item(const char *key, const char *value, void *data) {
 
         assert(key);
 
-        if (streq(key, "ip"))
+        if (proc_cmdline_key_streq(key, "ip"))
                 return parse_cmdline_ip(context, key, value);
-        if (streq(key, "rd.route"))
+        if (proc_cmdline_key_streq(key, "rd.route"))
                 return parse_cmdline_rd_route(context, key, value);
-        if (streq(key, "nameserver"))
+        if (proc_cmdline_key_streq(key, "nameserver"))
                 return parse_cmdline_nameserver(context, key, value);
-        if (streq(key, "rd.peerdns"))
+        if (proc_cmdline_key_streq(key, "rd.peerdns"))
                 return parse_cmdline_rd_peerdns(context, key, value);
-        if (streq(key, "vlan"))
+        if (proc_cmdline_key_streq(key, "vlan"))
                 return parse_cmdline_vlan(context, key, value);
-        if (streq(key, "bridge"))
+        if (proc_cmdline_key_streq(key, "bridge"))
                 return parse_cmdline_bridge(context, key, value);
-        if (streq(key, "bond"))
+        if (proc_cmdline_key_streq(key, "bond"))
                 return parse_cmdline_bond(context, key, value);
-        if (streq(key, "ifname"))
+        if (proc_cmdline_key_streq(key, "ifname"))
                 return parse_cmdline_ifname(context, key, value);
-        if (streq(key, "net.ifname-policy"))
+        if (proc_cmdline_key_streq(key, "net.ifname_policy"))
                 return parse_cmdline_ifname_policy(context, key, value);
 
         return 0;
index ce8c0640043eab653b68e833b3735cbd2ed17004..3cefb6394c8336419e6aa843aba3bb85dc86ce47 100644 (file)
@@ -202,9 +202,10 @@ static uint64_t query_flag(
                 const char *name,
                 const int value,
                 uint64_t flag) {
+
         int r;
 
-        r = getenv_bool_secure(name);
+        r = secure_getenv_bool(name);
         if (r >= 0)
                 return r == value ? flag : 0;
         if (r != -ENXIO)
index 1d6e25399f626701a1de643a5d457f1c06088d08..8e8d4cf1cb6651ca104a4487861b82365d400894 100644 (file)
@@ -306,7 +306,7 @@ enum nss_status _nss_systemd_getpwnam_r(
                 return NSS_STATUS_NOTFOUND;
 
         /* Synthesize entries for the root and nobody users, in case they are missing in /etc/passwd */
-        if (getenv_bool_secure("SYSTEMD_NSS_BYPASS_SYNTHETIC") <= 0) {
+        if (secure_getenv_bool("SYSTEMD_NSS_BYPASS_SYNTHETIC") <= 0) {
 
                 if (streq(name, root_passwd.pw_name))
                         return copy_synthesized_passwd(pwd, &root_passwd,
@@ -354,7 +354,7 @@ enum nss_status _nss_systemd_getpwuid_r(
                 return NSS_STATUS_NOTFOUND;
 
         /* Synthesize data for the root user and for nobody in case they are missing from /etc/passwd */
-        if (getenv_bool_secure("SYSTEMD_NSS_BYPASS_SYNTHETIC") <= 0) {
+        if (secure_getenv_bool("SYSTEMD_NSS_BYPASS_SYNTHETIC") <= 0) {
 
                 if (uid == root_passwd.pw_uid)
                         return copy_synthesized_passwd(pwd, &root_passwd,
@@ -403,7 +403,7 @@ enum nss_status _nss_systemd_getspnam_r(
                 return NSS_STATUS_NOTFOUND;
 
         /* Synthesize entries for the root and nobody users, in case they are missing in /etc/passwd */
-        if (getenv_bool_secure("SYSTEMD_NSS_BYPASS_SYNTHETIC") <= 0) {
+        if (secure_getenv_bool("SYSTEMD_NSS_BYPASS_SYNTHETIC") <= 0) {
 
                 if (streq(name, root_spwd.sp_namp))
                         return copy_synthesized_spwd(spwd, &root_spwd, buffer, buflen, errnop);
@@ -450,7 +450,7 @@ enum nss_status _nss_systemd_getgrnam_r(
                 return NSS_STATUS_NOTFOUND;
 
         /* Synthesize records for root and nobody, in case they are missing from /etc/group */
-        if (getenv_bool_secure("SYSTEMD_NSS_BYPASS_SYNTHETIC") <= 0) {
+        if (secure_getenv_bool("SYSTEMD_NSS_BYPASS_SYNTHETIC") <= 0) {
 
                 if (streq(name, root_group.gr_name))
                         return copy_synthesized_group(gr, &root_group, buffer, buflen, errnop);
@@ -494,7 +494,7 @@ enum nss_status _nss_systemd_getgrgid_r(
                 return NSS_STATUS_NOTFOUND;
 
         /* Synthesize records for root and nobody, in case they are missing from /etc/group */
-        if (getenv_bool_secure("SYSTEMD_NSS_BYPASS_SYNTHETIC") <= 0) {
+        if (secure_getenv_bool("SYSTEMD_NSS_BYPASS_SYNTHETIC") <= 0) {
 
                 if (gid == root_group.gr_gid)
                         return copy_synthesized_group(gr, &root_group, buffer, buflen, errnop);
@@ -539,7 +539,7 @@ enum nss_status _nss_systemd_getsgnam_r(
                 return NSS_STATUS_NOTFOUND;
 
         /* Synthesize records for root and nobody, in case they are missing from /etc/group */
-        if (getenv_bool_secure("SYSTEMD_NSS_BYPASS_SYNTHETIC") <= 0) {
+        if (secure_getenv_bool("SYSTEMD_NSS_BYPASS_SYNTHETIC") <= 0) {
 
                 if (streq(name, root_sgrp.sg_namp))
                         return copy_synthesized_sgrp(sgrp, &root_sgrp, buffer, buflen, errnop);
index c69667d6607c3a376ba194929b4c402824e4e008..b02d89a20bc600c8450fcf53f2a2bdac9599b5b5 100644 (file)
@@ -14,7 +14,7 @@ UserDBFlags nss_glue_userdb_flags(void) {
         UserDBFlags flags = USERDB_EXCLUDE_NSS;
 
         /* Make sure that we don't go in circles when allocating a dynamic UID by checking our own database */
-        if (getenv_bool_secure("SYSTEMD_NSS_DYNAMIC_BYPASS") > 0)
+        if (secure_getenv_bool("SYSTEMD_NSS_DYNAMIC_BYPASS") > 0)
                 flags |= USERDB_EXCLUDE_DYNAMIC_USER;
 
         return flags;
index 385ceee332b44e92300c7268bc9b2a45938dae8d..b7d2248b94be0744d315b680fc55f6933c0094e2 100644 (file)
@@ -751,9 +751,9 @@ static int condition_test_needs_update(Condition *c, char **env) {
         assert(c->parameter);
         assert(c->type == CONDITION_NEEDS_UPDATE);
 
-        r = proc_cmdline_get_bool("systemd.condition-needs-update", /* flags = */ 0, &b);
+        r = proc_cmdline_get_bool("systemd.condition_needs_update", /* flags = */ 0, &b);
         if (r < 0)
-                log_debug_errno(r, "Failed to parse systemd.condition-needs-update= kernel command line argument, ignoring: %m");
+                log_debug_errno(r, "Failed to parse systemd.condition_needs_update= kernel command line argument, ignoring: %m");
         if (r > 0)
                 return b;
 
index a495f82b875e34d8ab9323446f1f1b58c453ef4b..2d5846a06ffe662d1fb1a6e88d76463c4c6bd3cd 100644 (file)
@@ -1489,7 +1489,7 @@ int decrypt_credential_and_warn(
 
                 if (validate_name && !streq(embedded_name, validate_name)) {
 
-                        r = getenv_bool_secure("SYSTEMD_CREDENTIAL_VALIDATE_NAME");
+                        r = secure_getenv_bool("SYSTEMD_CREDENTIAL_VALIDATE_NAME");
                         if (r < 0 && r != -ENXIO)
                                 log_debug_errno(r, "Failed to parse $SYSTEMD_CREDENTIAL_VALIDATE_NAME: %m");
                         if (r != 0)
@@ -1505,7 +1505,7 @@ int decrypt_credential_and_warn(
 
                 if (le64toh(m->not_after) != USEC_INFINITY && le64toh(m->not_after) < validate_timestamp) {
 
-                        r = getenv_bool_secure("SYSTEMD_CREDENTIAL_VALIDATE_NOT_AFTER");
+                        r = secure_getenv_bool("SYSTEMD_CREDENTIAL_VALIDATE_NOT_AFTER");
                         if (r < 0 && r != -ENXIO)
                                 log_debug_errno(r, "Failed to parse $SYSTEMD_CREDENTIAL_VALIDATE_NOT_AFTER: %m");
                         if (r != 0)
index af42cd4dcc4f57875f61aab5dd9bb154c666d2f1..de13fa3bc30c7378fadefc1cdfd91593452d193e 100644 (file)
@@ -2657,7 +2657,7 @@ static int do_crypt_activate_verity(
         assert(verity);
 
         if (verity->root_hash_sig) {
-                r = getenv_bool_secure("SYSTEMD_DISSECT_VERITY_SIGNATURE");
+                r = secure_getenv_bool("SYSTEMD_DISSECT_VERITY_SIGNATURE");
                 if (r < 0 && r != -ENXIO)
                         log_debug_errno(r, "Failed to parse $SYSTEMD_DISSECT_VERITY_SIGNATURE");
 
@@ -3129,7 +3129,7 @@ int verity_settings_load(
         if (is_device_path(image))
                 return 0;
 
-        r = getenv_bool_secure("SYSTEMD_DISSECT_VERITY_SIDECAR");
+        r = secure_getenv_bool("SYSTEMD_DISSECT_VERITY_SIDECAR");
         if (r < 0 && r != -ENXIO)
                 log_debug_errno(r, "Failed to parse $SYSTEMD_DISSECT_VERITY_SIDECAR, ignoring: %m");
         if (r == 0)
@@ -3314,7 +3314,7 @@ int dissected_image_load_verity_sig_partition(
         if (verity->root_hash && verity->root_hash_sig) /* Already loaded? */
                 return 0;
 
-        r = getenv_bool_secure("SYSTEMD_DISSECT_VERITY_EMBEDDED");
+        r = secure_getenv_bool("SYSTEMD_DISSECT_VERITY_EMBEDDED");
         if (r < 0 && r != -ENXIO)
                 log_debug_errno(r, "Failed to parse $SYSTEMD_DISSECT_VERITY_EMBEDDED, ignoring: %m");
         if (r == 0)
index 7d6bda924a9a0479b46849dc7121cb12a1c7525a..ab377aaa8b7dff2217482e7f05dd95b5a8192442 100644 (file)
@@ -262,7 +262,7 @@ int efi_measured_uki(int log_level) {
          * being used, but it measured things into a different PCR than we are configured for in
          * userspace. (i.e. we expect PCR 11 being used for this by both sd-stub and us) */
 
-        r = getenv_bool_secure("SYSTEMD_FORCE_MEASURE"); /* Give user a chance to override the variable test,
+        r = secure_getenv_bool("SYSTEMD_FORCE_MEASURE"); /* Give user a chance to override the variable test,
                                                           * for debugging purposes */
         if (r >= 0)
                 return (cached = r);
index 38c24760f0a9e60f1807f10fd27376a473a2470b..2955b6e8d57757db2fad01ee1a4d5c659bdaa2b2 100644 (file)
@@ -53,7 +53,7 @@ const NamingScheme* naming_scheme(void) {
                 return cache;
 
         /* Acquire setting from the kernel command line */
-        (void) proc_cmdline_get_key("net.naming-scheme", 0, &buffer);
+        (void) proc_cmdline_get_key("net.naming_scheme", 0, &buffer);
 
         /* Also acquire it from an env var */
         e = getenv("NET_NAMING_SCHEME");
index 19deefab565716a3cffe24a86cdd492a5b1fce26..9b8ae76700537859bc9a97620d2325753aae2a92 100644 (file)
@@ -175,7 +175,7 @@ void pager_open(PagerFlags flags) {
                  * pager. If they didn't, use secure mode when under euid is changed. If $SYSTEMD_PAGERSECURE
                  * wasn't explicitly set, and we autodetect the need for secure mode, only use the pager we
                  * know to be good. */
-                int use_secure_mode = getenv_bool_secure("SYSTEMD_PAGERSECURE");
+                int use_secure_mode = secure_getenv_bool("SYSTEMD_PAGERSECURE");
                 bool trust_pager = use_secure_mode >= 0;
                 if (use_secure_mode == -ENXIO) {
                         uid_t uid;
index f910f3aaf91b7659e2a76ff69054c3192d416cfd..17c1549132ead45b7dea0f23f89230a6f28ac34e 100644 (file)
@@ -270,7 +270,9 @@ static int insert_newline_color_erase(PTYForward *f, size_t offset) {
         _cleanup_free_ char *s = NULL;
 
         assert(f);
-        assert(f->background_color);
+
+        if (!f->background_color)
+                return 0;
 
         /* When we see a newline (ASCII 10) then this sets the background color to the desired one, and erase the rest
          * of the line with it */
@@ -289,7 +291,9 @@ static int insert_carriage_return_color(PTYForward *f, size_t offset) {
         _cleanup_free_ char *s = NULL;
 
         assert(f);
-        assert(f->background_color);
+
+        if (!f->background_color)
+                return 0;
 
         /* When we see a carriage return (ASCII 13) this this sets only the background */
 
@@ -503,9 +507,15 @@ static int pty_forward_ansi_process(PTYForward *f, size_t offset) {
                                 } else if (!strextend(&f->osc_sequence, CHAR_TO_STR(c)))
                                         return -ENOMEM;
                         } else {
-                                /* Otherwise, the OSC sequence is over */
-
-                                if (c == '\x07') {
+                                /* Otherwise, the OSC sequence is over
+                                 *
+                                 * There are two allowed ways to end an OSC sequence:
+                                 * BEL '\x07'
+                                 * String Terminator (ST): <Esc>\ - "\x1b\x5c"
+                                 * since we cannot lookahead to see if the Esc is followed by a \
+                                 * we cut a corner here and assume it will be \. */
+
+                                if (c == '\x07' || c == '\x1b') {
                                         r = insert_window_title_fix(f, i+1);
                                         if (r < 0)
                                                 return r;
index 00a8cedcb8e6d9a2f03ca9cb2b7fc01442b0076b..2469e242534ab7836a9ab4150939610f1d727b13 100644 (file)
@@ -298,7 +298,7 @@ bool is_seccomp_available(void) {
         if (cached_enabled < 0) {
                 int b;
 
-                b = getenv_bool_secure("SYSTEMD_SECCOMP");
+                b = secure_getenv_bool("SYSTEMD_SECCOMP");
                 if (b != 0) {
                         if (b < 0 && b != -ENXIO) /* ENXIO: env var unset */
                                 log_debug_errno(b, "Failed to parse $SYSTEMD_SECCOMP value, ignoring.");
index cc1c0a02056f8de68dc69b339cf671611a72b026..89e957822a620bf8c8919750afb85138d79f07d5 100644 (file)
@@ -569,7 +569,7 @@ static int write_temporary_passwd(
 static usec_t epoch_or_now(void) {
         uint64_t epoch;
 
-        if (getenv_uint64_secure("SOURCE_DATE_EPOCH", &epoch) >= 0) {
+        if (secure_getenv_uint64("SOURCE_DATE_EPOCH", &epoch) >= 0) {
                 if (epoch > UINT64_MAX/USEC_PER_SEC) /* Overflow check */
                         return USEC_INFINITY;
                 return (usec_t) epoch * USEC_PER_SEC;
index 72a9c6454c600212ac5e9fb279e6eeb6e7fcf7f6..2f1810d93be9b5fbad93ef368d5e2f272bb7a62f 100644 (file)
@@ -140,7 +140,7 @@ static void test_gethostbyname4_r(void *handle, const char *module, const char *
                         assert_se(status == NSS_STATUS_SUCCESS);
                         assert_se(n == socket_ipv6_is_enabled() + 1);
 
-                } else if (streq(module, "resolve") && getenv_bool_secure("SYSTEMD_NSS_RESOLVE_SYNTHESIZE") != 0) {
+                } else if (streq(module, "resolve") && secure_getenv_bool("SYSTEMD_NSS_RESOLVE_SYNTHESIZE") != 0) {
                         assert_se(status == NSS_STATUS_SUCCESS);
                         if (socket_ipv6_is_enabled())
                                 assert_se(n == 2);
index 723b31898a923e066e6089527ab5ffc5434b999e..f1d903ee81ad4b0b7ef36d574a833784d95fee15 100644 (file)
@@ -20,10 +20,10 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
 
         assert(key);
 
-        if (proc_cmdline_key_streq(key, "systemd.tpm2-wait")) {
+        if (proc_cmdline_key_streq(key, "systemd.tpm2_wait")) {
                 r = value ? parse_boolean(value) : 1;
                 if (r < 0)
-                        log_warning_errno(r, "Failed to parse 'systemd.tpm2-wait' kernel command line argument, ignoring: %s", value);
+                        log_warning_errno(r, "Failed to parse 'systemd.tpm2_wait=' kernel command line argument, ignoring: %s", value);
                 else
                         arg_tpm2_wait = r;
         }
index a5f532da707dce1da8271b1e95d27d4861a10e93..0f826041078a8735550dc8c98382c1e6f34b65e4 100644 (file)
@@ -12,7 +12,7 @@ Description=Check battery level during early boot
 Documentation=man:systemd-battery-check.service(8)
 ConditionVirtualization=no
 ConditionDirectoryNotEmpty=/sys/class/power_supply/
-ConditionKernelCommandLine=!systemd.battery-check=0
+ConditionKernelCommandLine=!systemd.battery_check=0
 AssertPathExists=/etc/initrd-release
 DefaultDependencies=no
 After=plymouth-start.service