mirror of
https://github.com/systemd/systemd
synced 2026-03-25 08:14:54 +01:00
Compare commits
10 Commits
b5a920cee1
...
f9425092c6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9425092c6 | ||
|
|
568fe0294d | ||
|
|
0927356f8e | ||
|
|
8fba2ed258 | ||
|
|
b6abe84602 | ||
|
|
2e8985113b | ||
|
|
4d136f1462 | ||
|
|
12df39fadf | ||
|
|
8f397d5922 | ||
|
|
29a823b3b6 |
@ -2132,8 +2132,8 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnINET:pnP325J:*
|
|||||||
# Home: LeftCtrl + Esc -> LeftMeta (ignore LeftCtrl, map Esc to LeftMeta)
|
# Home: LeftCtrl + Esc -> LeftMeta (ignore LeftCtrl, map Esc to LeftMeta)
|
||||||
# Back: Backspace -> back (map backspace to back)
|
# Back: Backspace -> back (map backspace to back)
|
||||||
evdev:name:FTSC1000:00 2808:509C Keyboard:dmi:*:svnXiaomiInc:pnMipad2:*
|
evdev:name:FTSC1000:00 2808:509C Keyboard:dmi:*:svnXiaomiInc:pnMipad2:*
|
||||||
KEYBOARD_KEY_700e0=unknown # LeftCtrl -> ignore
|
KEYBOARD_KEY_700e0=reserved # LeftCtrl -> ignore
|
||||||
KEYBOARD_KEY_700e3=unknown # LeftMeta -> ignore
|
KEYBOARD_KEY_700e3=reserved # LeftMeta -> ignore
|
||||||
KEYBOARD_KEY_70016=menu # S -> menu
|
KEYBOARD_KEY_70016=menu # S -> menu
|
||||||
KEYBOARD_KEY_70029=leftmeta # Esc -> LeftMeta (Windows key / Win8 tablets home)
|
KEYBOARD_KEY_70029=leftmeta # Esc -> LeftMeta (Windows key / Win8 tablets home)
|
||||||
KEYBOARD_KEY_7002a=back # Backspace -> back
|
KEYBOARD_KEY_7002a=back # Backspace -> back
|
||||||
|
|||||||
@ -3195,10 +3195,11 @@ SystemCallErrorNumber=EPERM</programlisting>
|
|||||||
ignored; both the backslash and the following character are preserved verbatim. Leading and trailing
|
ignored; both the backslash and the following character are preserved verbatim. Leading and trailing
|
||||||
whitespace outside of the double quotes is discarded.</para>
|
whitespace outside of the double quotes is discarded.</para>
|
||||||
|
|
||||||
<para>The argument passed should be an absolute filename or wildcard expression, optionally prefixed with
|
<para>The argument passed should be an absolute filename or wildcard expression. If the file does not
|
||||||
<literal>-</literal>, which indicates that if the file does not exist, it will not be read and no error or
|
exist, cannot be read, or contains invalid content, the service will fail to start. To make the file
|
||||||
warning message is logged. This option may be specified more than once in which case all specified files are
|
optional, prefix the path with <literal>-</literal>, which causes all errors related to the file to be
|
||||||
read. If the empty string is assigned to this option, the list of file to read is reset, all prior assignments
|
silently ignored. This option may be specified more than once in which case all specified files are read.
|
||||||
|
If the empty string is assigned to this option, the list of files to read is reset, all prior assignments
|
||||||
have no effect.</para>
|
have no effect.</para>
|
||||||
|
|
||||||
<para>The files listed with this directive will be read shortly before the process is executed (more
|
<para>The files listed with this directive will be read shortly before the process is executed (more
|
||||||
|
|||||||
@ -1746,6 +1746,8 @@ if conf.get('BPF_FRAMEWORK') == 1
|
|||||||
bpf_clang_flags = [
|
bpf_clang_flags = [
|
||||||
'-std=gnu17',
|
'-std=gnu17',
|
||||||
'-Wno-compare-distinct-pointer-types',
|
'-Wno-compare-distinct-pointer-types',
|
||||||
|
'-Wno-microsoft-anon-tag',
|
||||||
|
'-fms-extensions',
|
||||||
'-fno-stack-protector',
|
'-fno-stack-protector',
|
||||||
'-O2',
|
'-O2',
|
||||||
'-target',
|
'-target',
|
||||||
@ -1756,6 +1758,7 @@ if conf.get('BPF_FRAMEWORK') == 1
|
|||||||
|
|
||||||
bpf_gcc_flags = [
|
bpf_gcc_flags = [
|
||||||
'-std=gnu17',
|
'-std=gnu17',
|
||||||
|
'-fms-extensions',
|
||||||
'-fno-stack-protector',
|
'-fno-stack-protector',
|
||||||
'-fno-ssa-phiopt',
|
'-fno-ssa-phiopt',
|
||||||
'-O2',
|
'-O2',
|
||||||
|
|||||||
@ -86,6 +86,7 @@ typedef enum CGroupFlags CGroupFlags;
|
|||||||
typedef enum CGroupMask CGroupMask;
|
typedef enum CGroupMask CGroupMask;
|
||||||
typedef enum ChaseFlags ChaseFlags;
|
typedef enum ChaseFlags ChaseFlags;
|
||||||
typedef enum ExtractFlags ExtractFlags;
|
typedef enum ExtractFlags ExtractFlags;
|
||||||
|
typedef enum ForkFlags ForkFlags;
|
||||||
typedef enum Glyph Glyph;
|
typedef enum Glyph Glyph;
|
||||||
typedef enum ImageClass ImageClass;
|
typedef enum ImageClass ImageClass;
|
||||||
typedef enum JobMode JobMode;
|
typedef enum JobMode JobMode;
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "dlfcn-util.h"
|
||||||
#include "errno-util.h"
|
#include "errno-util.h"
|
||||||
#include "fd-util.h"
|
#include "fd-util.h"
|
||||||
#include "fileio.h"
|
#include "fileio.h"
|
||||||
@ -217,6 +218,9 @@ int namespace_open(
|
|||||||
int namespace_enter(int pidns_fd, int mntns_fd, int netns_fd, int userns_fd, int root_fd) {
|
int namespace_enter(int pidns_fd, int mntns_fd, int netns_fd, int userns_fd, int root_fd) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
/* Block dlopen() now, to avoid us inadvertently loading shared library from another namespace */
|
||||||
|
block_dlopen();
|
||||||
|
|
||||||
if (userns_fd >= 0) {
|
if (userns_fd >= 0) {
|
||||||
/* Can't setns to your own userns, since then you could escalate from non-root to root in
|
/* Can't setns to your own userns, since then you could escalate from non-root to root in
|
||||||
* your own namespace, so check if namespaces are equal before attempting to enter. */
|
* your own namespace, so check if namespaces are equal before attempting to enter. */
|
||||||
|
|||||||
@ -1703,6 +1703,7 @@ int pidref_safe_fork_full(
|
|||||||
* foreign environment. Note that this has no effect on NSS! (i.e. it only has effect on uses of our
|
* foreign environment. Note that this has no effect on NSS! (i.e. it only has effect on uses of our
|
||||||
* dlopen_safe(), which we use comprehensively in our codebase, but glibc NSS doesn't bother, of
|
* dlopen_safe(), which we use comprehensively in our codebase, but glibc NSS doesn't bother, of
|
||||||
* course.) */
|
* course.) */
|
||||||
|
if (!FLAGS_SET(flags, FORK_ALLOW_DLOPEN))
|
||||||
block_dlopen();
|
block_dlopen();
|
||||||
|
|
||||||
if (flags & (FORK_DEATHSIG_SIGTERM|FORK_DEATHSIG_SIGINT|FORK_DEATHSIG_SIGKILL))
|
if (flags & (FORK_DEATHSIG_SIGTERM|FORK_DEATHSIG_SIGINT|FORK_DEATHSIG_SIGKILL))
|
||||||
@ -1906,6 +1907,7 @@ int namespace_fork(
|
|||||||
/* This is much like safe_fork(), but forks twice, and joins the specified namespaces in the middle
|
/* This is much like safe_fork(), but forks twice, and joins the specified namespaces in the middle
|
||||||
* process. This ensures that we are fully a member of the destination namespace, with pidns an all, so that
|
* process. This ensures that we are fully a member of the destination namespace, with pidns an all, so that
|
||||||
* /proc/self/fd works correctly. */
|
* /proc/self/fd works correctly. */
|
||||||
|
assert(!FLAGS_SET(flags, FORK_ALLOW_DLOPEN)); /* never allow loading shared library from another ns */
|
||||||
|
|
||||||
r = safe_fork_full(outer_name,
|
r = safe_fork_full(outer_name,
|
||||||
NULL,
|
NULL,
|
||||||
|
|||||||
@ -187,8 +187,9 @@ typedef enum ForkFlags {
|
|||||||
FORK_NEW_NETNS = 1 << 20, /* Run child in its own network namespace 💣 DO NOT USE IN THREADED PROGRAMS! 💣 */
|
FORK_NEW_NETNS = 1 << 20, /* Run child in its own network namespace 💣 DO NOT USE IN THREADED PROGRAMS! 💣 */
|
||||||
FORK_NEW_PIDNS = 1 << 21, /* Run child in its own PID namespace 💣 DO NOT USE IN THREADED PROGRAMS! 💣 */
|
FORK_NEW_PIDNS = 1 << 21, /* Run child in its own PID namespace 💣 DO NOT USE IN THREADED PROGRAMS! 💣 */
|
||||||
FORK_FREEZE = 1 << 22, /* Don't return in child, just call freeze() instead */
|
FORK_FREEZE = 1 << 22, /* Don't return in child, just call freeze() instead */
|
||||||
|
FORK_ALLOW_DLOPEN = 1 << 23, /* Do not block dlopen() in child */
|
||||||
|
|
||||||
_FORK_PID_ONLY = 1 << 23, /* Don't open a pidfd referencing the child process */
|
_FORK_PID_ONLY = 1 << 24, /* Don't open a pidfd referencing the child process */
|
||||||
} ForkFlags;
|
} ForkFlags;
|
||||||
|
|
||||||
int pidref_safe_fork_full(
|
int pidref_safe_fork_full(
|
||||||
|
|||||||
@ -627,16 +627,19 @@ static EFI_STATUS load_addons(
|
|||||||
return log_error_status(err, "Failed to find protocol in %ls: %m", items[i]);
|
return log_error_status(err, "Failed to find protocol in %ls: %m", items[i]);
|
||||||
|
|
||||||
err = pe_memory_locate_sections(loaded_addon->ImageBase, unified_sections, sections);
|
err = pe_memory_locate_sections(loaded_addon->ImageBase, unified_sections, sections);
|
||||||
if (err != EFI_SUCCESS ||
|
if (err != EFI_SUCCESS) {
|
||||||
(!PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_CMDLINE) &&
|
log_error_status(err,
|
||||||
|
"Unable to locate embedded .cmdline/.dtb/.dtbauto/.initrd/.ucode sections in %ls, ignoring: %m",
|
||||||
|
items[i]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_CMDLINE) &&
|
||||||
!PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_DTB) &&
|
!PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_DTB) &&
|
||||||
!PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_DTBAUTO) &&
|
!PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_DTBAUTO) &&
|
||||||
!PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_INITRD) &&
|
!PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_INITRD) &&
|
||||||
!PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_UCODE))) {
|
!PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_UCODE)) {
|
||||||
if (err == EFI_SUCCESS)
|
log_debug("No applicable .cmdline/.dtb/.dtbauto/.initrd/.ucode sections found in %ls, ignoring.",
|
||||||
err = EFI_NOT_FOUND;
|
|
||||||
log_error_status(err,
|
|
||||||
"Unable to locate embedded .cmdline/.dtb/.dtbauto/.initrd/.ucode sections in %ls, ignoring: %m",
|
|
||||||
items[i]);
|
items[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
#include "base-filesystem.h"
|
#include "base-filesystem.h"
|
||||||
#include "bitfield.h"
|
#include "bitfield.h"
|
||||||
#include "chase.h"
|
#include "chase.h"
|
||||||
|
#include "cryptsetup-util.h"
|
||||||
#include "dev-setup.h"
|
#include "dev-setup.h"
|
||||||
#include "devnum-util.h"
|
#include "devnum-util.h"
|
||||||
#include "dissect-image.h"
|
#include "dissect-image.h"
|
||||||
@ -3852,6 +3853,8 @@ int refresh_extensions_in_namespace(
|
|||||||
if (r > 0)
|
if (r > 0)
|
||||||
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Target namespace is not separate, cannot reload extensions");
|
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Target namespace is not separate, cannot reload extensions");
|
||||||
|
|
||||||
|
(void) dlopen_cryptsetup();
|
||||||
|
|
||||||
extension_dir = path_join(p->private_namespace_dir, "unit-extensions");
|
extension_dir = path_join(p->private_namespace_dir, "unit-extensions");
|
||||||
if (!extension_dir)
|
if (!extension_dir)
|
||||||
return log_oom_debug();
|
return log_oom_debug();
|
||||||
|
|||||||
@ -14,7 +14,6 @@
|
|||||||
#include "bus-error.h"
|
#include "bus-error.h"
|
||||||
#include "bus-util.h"
|
#include "bus-util.h"
|
||||||
#include "chase.h"
|
#include "chase.h"
|
||||||
#include "cryptsetup-util.h"
|
|
||||||
#include "dbus-service.h"
|
#include "dbus-service.h"
|
||||||
#include "dbus-unit.h"
|
#include "dbus-unit.h"
|
||||||
#include "devnum-util.h"
|
#include "devnum-util.h"
|
||||||
@ -2882,7 +2881,9 @@ static void service_enter_refresh_extensions(Service *s) {
|
|||||||
|
|
||||||
/* Given we are running from PID1, avoid doing potentially heavy I/O operations like opening images
|
/* Given we are running from PID1, avoid doing potentially heavy I/O operations like opening images
|
||||||
* directly, and instead fork a worker process. */
|
* directly, and instead fork a worker process. */
|
||||||
r = unit_fork_helper_process(UNIT(s), "(sd-refresh-extensions)", /* into_cgroup= */ false, &worker);
|
r = unit_fork_helper_process_full(UNIT(s), "(sd-refresh-extensions)", /* into_cgroup= */ false,
|
||||||
|
FORK_ALLOW_DLOPEN, /* permit dlopen() to avoid load of libcryptsetup in pid1 */
|
||||||
|
&worker);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_unit_error_errno(UNIT(s), r, "Failed to fork process to refresh extensions in unit's namespace: %m");
|
log_unit_error_errno(UNIT(s), r, "Failed to fork process to refresh extensions in unit's namespace: %m");
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -5562,8 +5563,6 @@ static int service_live_mount(
|
|||||||
u->id);
|
u->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) dlopen_cryptsetup();
|
|
||||||
|
|
||||||
service_unwatch_control_pid(s);
|
service_unwatch_control_pid(s);
|
||||||
s->live_mount_result = SERVICE_SUCCESS;
|
s->live_mount_result = SERVICE_SUCCESS;
|
||||||
s->control_command = NULL;
|
s->control_command = NULL;
|
||||||
@ -5584,7 +5583,9 @@ static int service_live_mount(
|
|||||||
* directly, and instead fork a worker process. We record the D-Bus message, so that we can reply
|
* directly, and instead fork a worker process. We record the D-Bus message, so that we can reply
|
||||||
* after the operation has finished. This way callers can wait on the message and know that the new
|
* after the operation has finished. This way callers can wait on the message and know that the new
|
||||||
* resource is available (or the operation failed) once they receive the response. */
|
* resource is available (or the operation failed) once they receive the response. */
|
||||||
r = unit_fork_helper_process(u, "(sd-mount-in-ns)", /* into_cgroup= */ false, &worker);
|
r = unit_fork_helper_process_full(u, "(sd-mount-in-ns)", /* into_cgroup= */ false,
|
||||||
|
FORK_ALLOW_DLOPEN,
|
||||||
|
&worker);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_unit_error_errno(u, r,
|
log_unit_error_errno(u, r,
|
||||||
"Failed to fork process to mount '%s' on '%s' in unit's namespace: %m",
|
"Failed to fork process to mount '%s' on '%s' in unit's namespace: %m",
|
||||||
|
|||||||
@ -5539,12 +5539,13 @@ int unit_set_exec_params(Unit *u, ExecParameters *p) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int unit_fork_helper_process(Unit *u, const char *name, bool into_cgroup, PidRef *ret) {
|
int unit_fork_helper_process_full(Unit *u, const char *name, bool into_cgroup, ForkFlags flags, PidRef *ret) {
|
||||||
CGroupRuntime *crt = NULL;
|
CGroupRuntime *crt = NULL;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(u);
|
assert(u);
|
||||||
|
assert((flags & (FORK_RESET_SIGNALS|FORK_DETACH|FORK_WAIT)) == 0); /* these don't really make sense for manager */
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
/* Forks off a helper process and makes sure it is a member of the unit's cgroup, if configured to
|
/* Forks off a helper process and makes sure it is a member of the unit's cgroup, if configured to
|
||||||
@ -5559,7 +5560,7 @@ int unit_fork_helper_process(Unit *u, const char *name, bool into_cgroup, PidRef
|
|||||||
crt = unit_get_cgroup_runtime(u);
|
crt = unit_get_cgroup_runtime(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
r = safe_fork(name, FORK_REOPEN_LOG|FORK_DEATHSIG_SIGTERM, &pid);
|
r = safe_fork(name, FORK_REOPEN_LOG|FORK_DEATHSIG_SIGTERM|flags, &pid);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
@ -5592,6 +5593,10 @@ int unit_fork_helper_process(Unit *u, const char *name, bool into_cgroup, PidRef
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int unit_fork_helper_process(Unit *u, const char *name, bool into_cgroup, PidRef *ret) {
|
||||||
|
return unit_fork_helper_process_full(u, name, into_cgroup, /* flags = */ 0, ret);
|
||||||
|
}
|
||||||
|
|
||||||
int unit_fork_and_watch_rm_rf(Unit *u, char **paths, PidRef *ret_pid) {
|
int unit_fork_and_watch_rm_rf(Unit *u, char **paths, PidRef *ret_pid) {
|
||||||
_cleanup_(pidref_done) PidRef pid = PIDREF_NULL;
|
_cleanup_(pidref_done) PidRef pid = PIDREF_NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|||||||
@ -1005,6 +1005,7 @@ int unit_acquire_invocation_id(Unit *u);
|
|||||||
|
|
||||||
int unit_set_exec_params(Unit *u, ExecParameters *p);
|
int unit_set_exec_params(Unit *u, ExecParameters *p);
|
||||||
|
|
||||||
|
int unit_fork_helper_process_full(Unit *u, const char *name, bool into_cgroup, ForkFlags flags, PidRef *ret);
|
||||||
int unit_fork_helper_process(Unit *u, const char *name, bool into_cgroup, PidRef *ret);
|
int unit_fork_helper_process(Unit *u, const char *name, bool into_cgroup, PidRef *ret);
|
||||||
int unit_fork_and_watch_rm_rf(Unit *u, char **paths, PidRef *ret);
|
int unit_fork_and_watch_rm_rf(Unit *u, char **paths, PidRef *ret);
|
||||||
|
|
||||||
|
|||||||
@ -12,8 +12,20 @@ sync_in() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wait_for_signal() {
|
wait_for_signal() {
|
||||||
|
local notify="${1:?}"
|
||||||
|
local p
|
||||||
|
|
||||||
sleep infinity &
|
sleep infinity &
|
||||||
wait "$!" || :
|
p=$!
|
||||||
|
|
||||||
|
# Notify readiness after 'sleep' is running to avoid race
|
||||||
|
# condition where the SIGHUP is sent before 'sleep' is ready to
|
||||||
|
# receive it and we get stuck
|
||||||
|
if [ "$notify" -eq 1 ]; then
|
||||||
|
systemd-notify --ready
|
||||||
|
fi
|
||||||
|
|
||||||
|
wait "$p" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
sighup_handler() {
|
sighup_handler() {
|
||||||
@ -24,17 +36,14 @@ trap sighup_handler SIGHUP
|
|||||||
|
|
||||||
export SYSTEMD_LOG_LEVEL=debug
|
export SYSTEMD_LOG_LEVEL=debug
|
||||||
|
|
||||||
systemd-notify --ready
|
wait_for_signal 1
|
||||||
|
|
||||||
wait_for_signal
|
|
||||||
systemd-notify --reloading
|
systemd-notify --reloading
|
||||||
|
|
||||||
wait_for_signal
|
wait_for_signal 0
|
||||||
systemd-notify --reloading
|
systemd-notify --reloading
|
||||||
sync_in ready
|
sync_in ready
|
||||||
systemd-notify --ready
|
|
||||||
|
|
||||||
wait_for_signal
|
wait_for_signal 1
|
||||||
systemd-notify --reloading --ready
|
systemd-notify --reloading --ready
|
||||||
|
|
||||||
exec sleep infinity
|
exec sleep infinity
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user