Merge pull request #34053 from YHNdnzj/follow-ups

Two follow-ups for recent PRs
This commit is contained in:
Yu Watanabe
2024-08-22 04:34:11 +09:00
committed by GitHub
10 changed files with 46 additions and 127 deletions
+1 -9
View File
@@ -172,15 +172,6 @@
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>--no-ask-password</option></term>
<listitem><para>Do not query the user for authentication for
privileged operations.</para>
<xi:include href="version-info.xml" xpointer="v195"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--static</option></term>
<term><option>--transient</option></term>
@@ -198,6 +189,7 @@
<xi:include href="user-system-options.xml" xpointer="host" />
<xi:include href="user-system-options.xml" xpointer="machine" />
<xi:include href="standard-options.xml" xpointer="no-ask-password" />
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="json" />
+1 -9
View File
@@ -177,15 +177,6 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>--no-ask-password</option></term>
<listitem><para>Do not query the user for authentication for
privileged operations.</para>
<xi:include href="version-info.xml" xpointer="v195"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--no-convert</option></term>
@@ -201,6 +192,7 @@
<xi:include href="user-system-options.xml" xpointer="host" />
<xi:include href="user-system-options.xml" xpointer="machine" />
<xi:include href="standard-options.xml" xpointer="no-ask-password" />
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
+1 -7
View File
@@ -306,13 +306,6 @@
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>--no-ask-password</option></term>
<listitem><para>Do not query the user for authentication for
privileged operations.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-p</option></term>
<term><option>--property=</option></term>
@@ -410,6 +403,7 @@
<xi:include href="user-system-options.xml" xpointer="host" />
<xi:include href="user-system-options.xml" xpointer="machine" />
<xi:include href="standard-options.xml" xpointer="no-ask-password" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
<xi:include href="standard-options.xml" xpointer="no-legend" />
<xi:include href="standard-options.xml" xpointer="json" />
+1 -11
View File
@@ -628,22 +628,12 @@ s - Service VLAN, m - Two-port MAC Relay (TPMR)
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="no-ask-password" />
<xi:include href="standard-options.xml" xpointer="json" />
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="no-legend" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
<varlistentry>
<term><option>--no-ask-password</option></term>
<listitem>
<para>Do not query the user for authentication for privileged operations.</para>
<xi:include href="version-info.xml" xpointer="v257"/>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
+1 -10
View File
@@ -495,16 +495,7 @@
<xi:include href="version-info.xml" xpointer="v256"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--no-ask-password</option></term>
<listitem>
<para>Do not query the user for authentication for privileged operations.</para>
<xi:include href="version-info.xml" xpointer="v257"/>
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="no-ask-password" />
<xi:include href="standard-options.xml" xpointer="json" />
<xi:include href="standard-options.xml" xpointer="j" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
+1 -8
View File
@@ -70,14 +70,6 @@
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>--no-ask-password</option></term>
<listitem><para>Do not query the user for authentication for privileged operations.</para>
<xi:include href="version-info.xml" xpointer="v256"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--unit=</option></term>
@@ -210,6 +202,7 @@
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="no-ask-password" />
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
</variablelist>
+1 -20
View File
@@ -2449,26 +2449,6 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
</listitem>
</varlistentry>
<varlistentry>
<term><option>--no-ask-password</option></term>
<listitem>
<para>When used with <command>start</command> and related
commands, disables asking for passwords. Background services
may require input of a password or passphrase string, for
example to unlock system hard disks or cryptographic
certificates. Unless this option is specified and the
command is invoked from a terminal,
<command>systemctl</command> will query the user on the
terminal for the necessary secrets. Use this option to
switch this behavior off. In this case, the password must be
supplied by some other means (for example graphical password
agents) or the service might fail. This also disables
querying the user for authentication for privileged
operations.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--kill-whom=</option></term>
@@ -2896,6 +2876,7 @@ EOF
<xi:include href="user-system-options.xml" xpointer="machine" />
<xi:include href="user-system-options.xml" xpointer="capsule" />
<xi:include href="standard-options.xml" xpointer="no-ask-password" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
<xi:include href="standard-options.xml" xpointer="legend" />
<xi:include href="standard-options.xml" xpointer="help" />
+1 -9
View File
@@ -105,15 +105,6 @@
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>--no-ask-password</option></term>
<listitem><para>Do not query the user for authentication for
privileged operations.</para>
<xi:include href="version-info.xml" xpointer="v226"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--scope</option></term>
@@ -528,6 +519,7 @@
<xi:include href="user-system-options.xml" xpointer="machine" />
<xi:include href="user-system-options.xml" xpointer="capsule" />
<xi:include href="standard-options.xml" xpointer="no-ask-password" />
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="json" />
+1 -9
View File
@@ -206,15 +206,6 @@
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>--no-ask-password</option></term>
<listitem><para>Do not query the user for authentication for
privileged operations.</para>
<xi:include href="version-info.xml" xpointer="v195"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--adjust-system-clock</option></term>
@@ -285,6 +276,7 @@
<xi:include href="user-system-options.xml" xpointer="host" />
<xi:include href="user-system-options.xml" xpointer="machine" />
<xi:include href="standard-options.xml" xpointer="no-ask-password" />
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
+37 -35
View File
@@ -2059,10 +2059,14 @@ int posix_spawn_wrapper(
_unused_ _cleanup_(posix_spawnattr_destroyp) posix_spawnattr_t *attr_destructor = &attr;
#if HAVE_PIDFD_SPAWN
static bool setcgroup_supported = true;
static enum {
CLONE_ONLY_PID,
CLONE_CAN_PIDFD, /* 5.2 */
CLONE_CAN_CGROUP, /* 5.7 */
} clone_support = CLONE_CAN_CGROUP;
_cleanup_close_ int cgroup_fd = -EBADF;
if (cgroup && setcgroup_supported) {
if (cgroup && clone_support >= CLONE_CAN_CGROUP) {
_cleanup_free_ char *resolved_cgroup = NULL;
r = cg_get_path_and_check(
@@ -2093,45 +2097,43 @@ int posix_spawn_wrapper(
return -r;
#if HAVE_PIDFD_SPAWN
_cleanup_close_ int pidfd = -EBADF;
if (clone_support >= CLONE_CAN_PIDFD) {
_cleanup_close_ int pidfd = -EBADF;
r = pidfd_spawn(&pidfd, path, NULL, &attr, argv, envp);
if (r == E2BIG && FLAGS_SET(flags, POSIX_SPAWN_SETCGROUP)) {
/* Some kernels (e.g., 5.4) support clone3 but they do not support CLONE_INTO_CGROUP.
* Retry pidfd_spawn() after removing the flag. */
flags &= ~POSIX_SPAWN_SETCGROUP;
r = posix_spawnattr_setflags(&attr, flags);
if (r != 0)
return -r;
r = pidfd_spawn(&pidfd, path, NULL, &attr, argv, envp);
/* if pidfd_spawn was successful after removing SPAWN_CGROUP,
* mark setcgroup_supported as false so that we do not retry every time */
if (r == 0)
setcgroup_supported = false;
}
if (r == 0) {
r = pidref_set_pidfd_consume(ret_pidref, TAKE_FD(pidfd));
if (r < 0)
return r;
return FLAGS_SET(flags, POSIX_SPAWN_SETCGROUP);
}
if (ERRNO_IS_NOT_SUPPORTED(r)) {
/* clone3() could also return EOPNOTSUPP if the target cgroup is in threaded mode. */
if (cgroup && cg_is_threaded(cgroup) > 0)
if (ERRNO_IS_NOT_SUPPORTED(r) && FLAGS_SET(flags, POSIX_SPAWN_SETCGROUP) &&
cg_is_threaded(cgroup) > 0) /* clone3() could also return EOPNOTSUPP if the target cgroup is in threaded mode. */
return -EUCLEAN;
if ((ERRNO_IS_NOT_SUPPORTED(r) || ERRNO_IS_PRIVILEGE(r) || r == E2BIG) &&
FLAGS_SET(flags, POSIX_SPAWN_SETCGROUP)) {
/* Compiled on a newer host, or seccomp&friends blocking clone3()? Fallback, but
* need to disable POSIX_SPAWN_SETCGROUP, which is what redirects to clone3().
* Note that we might get E2BIG here since some kernels (e.g. 5.4) support clone3()
* but not CLONE_INTO_CGROUP. */
/* clone3() not available? */
} else if (!ERRNO_IS_PRIVILEGE(r))
return -r;
/* CLONE_INTO_CGROUP definitely won't work, hence remember the fact so that we don't
* retry every time. */
assert(clone_support >= CLONE_CAN_CGROUP);
clone_support = CLONE_CAN_PIDFD;
/* Compiled on a newer host, or seccomp&friends blocking clone3()? Fallback, but need to change the
* flags to remove the cgroup one, which is what redirects to clone3() */
if (FLAGS_SET(flags, POSIX_SPAWN_SETCGROUP)) {
flags &= ~POSIX_SPAWN_SETCGROUP;
r = posix_spawnattr_setflags(&attr, flags);
if (r != 0)
flags &= ~POSIX_SPAWN_SETCGROUP;
r = posix_spawnattr_setflags(&attr, flags);
if (r != 0)
return -r;
r = pidfd_spawn(&pidfd, path, NULL, &attr, argv, envp);
}
if (r == 0) {
r = pidref_set_pidfd_consume(ret_pidref, TAKE_FD(pidfd));
if (r < 0)
return r;
return FLAGS_SET(flags, POSIX_SPAWN_SETCGROUP);
}
if (!ERRNO_IS_NOT_SUPPORTED(r) && !ERRNO_IS_PRIVILEGE(r))
return -r;
clone_support = CLONE_ONLY_PID; /* No CLONE_PIDFD either? */
}
#endif