diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch | 222 |
1 files changed, 125 insertions, 97 deletions
diff --git a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch index 4df35d81d19..d389e1d9f9c 100644 --- a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch +++ b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch @@ -38,11 +38,18 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com> src/vconsole/vconsole-setup.c | 2 +- 16 files changed, 34 insertions(+), 34 deletions(-) -diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c -index c9efd862a2..b3708ea925 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c -@@ -766,7 +766,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { +@@ -390,7 +390,7 @@ int cg_kill_kernel_sigkill(const char *c + if (r < 0) + return r; + +- r = write_string_file(killfile, "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(killfile, "1", 0); + if (r < 0) + return r; + +@@ -803,7 +803,7 @@ int cg_install_release_agent(const char sc = strstrip(contents); if (isempty(sc)) { @@ -51,7 +58,7 @@ index c9efd862a2..b3708ea925 100644 if (r < 0) return r; } else if (!path_equal(sc, agent)) -@@ -784,7 +784,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { +@@ -821,7 +821,7 @@ int cg_install_release_agent(const char sc = strstrip(contents); if (streq(sc, "0")) { @@ -60,7 +67,7 @@ index c9efd862a2..b3708ea925 100644 if (r < 0) return r; -@@ -811,7 +811,7 @@ int cg_uninstall_release_agent(const char *controller) { +@@ -848,7 +848,7 @@ int cg_uninstall_release_agent(const cha if (r < 0) return r; @@ -69,7 +76,7 @@ index c9efd862a2..b3708ea925 100644 if (r < 0) return r; -@@ -821,7 +821,7 @@ int cg_uninstall_release_agent(const char *controller) { +@@ -858,7 +858,7 @@ int cg_uninstall_release_agent(const cha if (r < 0) return r; @@ -78,7 +85,7 @@ index c9efd862a2..b3708ea925 100644 if (r < 0) return r; -@@ -1651,7 +1651,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri +@@ -1704,7 +1704,7 @@ int cg_set_attribute(const char *control if (r < 0) return r; @@ -87,11 +94,9 @@ index c9efd862a2..b3708ea925 100644 } int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { -diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c -index 8c57094225..0cf6ec752b 100644 --- a/src/basic/procfs-util.c +++ b/src/basic/procfs-util.c -@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) { +@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limi * decrease it, as threads-max is the much more relevant sysctl. */ if (limit > pid_max-1) { sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ @@ -107,24 +112,20 @@ index 8c57094225..0cf6ec752b 100644 if (r < 0) { uint64_t threads_max; -diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c -index 8913e6ff85..29e6ec0755 100644 --- a/src/basic/sysctl-util.c +++ b/src/basic/sysctl-util.c -@@ -93,7 +93,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c +@@ -58,7 +58,7 @@ int sysctl_write(const char *property, c log_debug("Setting '%s' to '%s'", p, value); -- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); -+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); +- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); ++ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); } - int sysctl_read(const char *property, char **ret) { -diff --git a/src/basic/util.c b/src/basic/util.c -index 955b18bd2a..6d89c90176 100644 + int sysctl_writef(const char *property, const char *format, ...) { --- a/src/basic/util.c +++ b/src/basic/util.c -@@ -234,7 +234,7 @@ void disable_coredumps(void) { +@@ -168,7 +168,7 @@ void disable_coredumps(void) { if (detect_container() > 0) return; @@ -133,67 +134,61 @@ index 955b18bd2a..6d89c90176 100644 if (r < 0) log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); } -diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c -index 981218f52f..436aaaddb4 100644 --- a/src/binfmt/binfmt.c +++ b/src/binfmt/binfmt.c -@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) { - if (!fn) - return log_oom(); +@@ -29,7 +29,7 @@ static bool arg_unregister = false; + static int delete_rule(const char *rulename) { + const char *fn = strjoina("/proc/sys/fs/binfmt_misc/", rulename); - return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); + return write_string_file(fn, "-1", 0); } - static int apply_rule(const char *rule) { -@@ -56,7 +56,7 @@ static int apply_rule(const char *rule) { - - (void) delete_rule(rule); + static int apply_rule(const char *filename, unsigned line, const char *rule) { +@@ -59,7 +59,7 @@ static int apply_rule(const char *filena + if (r >= 0) + log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename); - r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); + r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); if (r < 0) - return log_error_errno(r, "Failed to add binary format: %m"); - -@@ -223,7 +223,7 @@ static int run(int argc, char *argv[]) { + return log_error_errno(r, "%s:%u: Failed to add binary format '%s': %m", + filename, line, rulename); +@@ -226,7 +226,7 @@ static int run(int argc, char *argv[]) { } /* Flush out all rules */ -- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); -+ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); - - STRV_FOREACH(f, files) { - k = apply_file(*f, true); -diff --git a/src/core/main.c b/src/core/main.c -index c64c73883e..1ac185e946 100644 +- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); + if (r < 0) + log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m"); + else --- a/src/core/main.c +++ b/src/core/main.c -@@ -1402,7 +1402,7 @@ static int bump_unix_max_dgram_qlen(void) { +@@ -1466,7 +1466,7 @@ static int bump_unix_max_dgram_qlen(void if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN) return 0; -- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); -+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); +- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, ++ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, + "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); if (r < 0) return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r, - "Failed to bump AF_UNIX datagram queue length, ignoring: %m"); -@@ -1679,7 +1679,7 @@ static void initialize_core_pattern(bool skip_setup) { +@@ -1737,7 +1737,7 @@ static void initialize_core_pattern(bool if (getpid_cached() != 1) return; - r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); + r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); if (r < 0) - log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern); - } -diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c -index 79c4808473..b111ce0a11 100644 + log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", + arg_early_core_pattern); --- a/src/core/smack-setup.c +++ b/src/core/smack-setup.c -@@ -323,17 +323,17 @@ int mac_smack_setup(bool *loaded_policy) { +@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy) } - #ifdef SMACK_RUN_LABEL + #if HAVE_SMACK_RUN_LABEL - r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); + r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); if (r < 0) @@ -212,8 +207,6 @@ index 79c4808473..b111ce0a11 100644 if (r < 0) log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); #endif -diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c -index 58e35e403e..1d0beb4008 100644 --- a/src/hibernate-resume/hibernate-resume.c +++ b/src/hibernate-resume/hibernate-resume.c @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { @@ -225,11 +218,9 @@ index 58e35e403e..1d0beb4008 100644 if (r < 0) { log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor); return EXIT_FAILURE; -diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c -index 388128bf33..695f535ff4 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c -@@ -2096,7 +2096,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, +@@ -2108,7 +2108,7 @@ _public_ int sd_device_set_sysattr_value if (!value) return -ENOMEM; @@ -238,11 +229,9 @@ index 388128bf33..695f535ff4 100644 if (r < 0) { /* On failure, clear cache entry, as we do not know how it fails. */ device_remove_cached_sysattr_value(device, sysattr); -diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c -index cb01b25bc6..e92051268b 100644 --- a/src/nspawn/nspawn-cgroup.c +++ b/src/nspawn/nspawn-cgroup.c -@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { +@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified fn = strjoina(tree, cgroup, "/cgroup.procs"); sprintf(pid_string, PID_FMT, pid); @@ -251,11 +240,9 @@ index cb01b25bc6..e92051268b 100644 if (r < 0) { log_error_errno(r, "Failed to move process: %m"); goto finish; -diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c -index ff08ed23cc..e7c4a874a9 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c -@@ -2751,7 +2751,7 @@ static int reset_audit_loginuid(void) { +@@ -2757,7 +2757,7 @@ static int reset_audit_loginuid(void) { if (streq(p, "4294967295")) return 0; @@ -264,7 +251,7 @@ index ff08ed23cc..e7c4a874a9 100644 if (r < 0) { log_error_errno(r, "Failed to reset audit login UID. This probably means that your kernel is too\n" -@@ -4148,7 +4148,7 @@ static int setup_uid_map( +@@ -4163,7 +4163,7 @@ static int setup_uid_map( return log_oom(); xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); @@ -273,7 +260,7 @@ index ff08ed23cc..e7c4a874a9 100644 if (r < 0) return log_error_errno(r, "Failed to write UID map: %m"); -@@ -4158,7 +4158,7 @@ static int setup_uid_map( +@@ -4173,7 +4173,7 @@ static int setup_uid_map( return log_oom(); xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); @@ -282,11 +269,9 @@ index ff08ed23cc..e7c4a874a9 100644 if (r < 0) return log_error_errno(r, "Failed to write GID map: %m"); -diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c -index f197f715c7..077f893177 100644 --- a/src/shared/cgroup-setup.c +++ b/src/shared/cgroup-setup.c -@@ -267,7 +267,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { +@@ -345,7 +345,7 @@ int cg_attach(const char *controller, co xsprintf(c, PID_FMT "\n", pid); @@ -295,7 +280,7 @@ index f197f715c7..077f893177 100644 if (r < 0) return r; -@@ -799,7 +799,7 @@ int cg_enable_everywhere( +@@ -877,7 +877,7 @@ int cg_enable_everywhere( return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); } @@ -304,31 +289,9 @@ index f197f715c7..077f893177 100644 if (r < 0) { log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); -diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c -index 594efea989..d243b45bc4 100644 ---- a/src/shared/mount-util.c -+++ b/src/shared/mount-util.c -@@ -1019,13 +1019,13 @@ static int make_userns(uid_t uid_shift, uid_t uid_range) { - xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, uid_shift, uid_range); - - xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); -- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(uid_map, line, 0); - if (r < 0) - return log_error_errno(r, "Failed to write UID map: %m"); - - /* We always assign the same UID and GID ranges */ - xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); -- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(uid_map, line, 0); - if (r < 0) - return log_error_errno(r, "Failed to write GID map: %m"); - -diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c -index 3362ee3924..80c0f2a52e 100644 --- a/src/shared/smack-util.c +++ b/src/shared/smack-util.c -@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { +@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const return 0; p = procfs_file_alloca(pid, "attr/current"); @@ -337,11 +300,9 @@ index 3362ee3924..80c0f2a52e 100644 if (r < 0) return r; -diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c -index a3aeb24633..d3e68e1b94 100644 --- a/src/sleep/sleep.c +++ b/src/sleep/sleep.c -@@ -46,7 +46,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca +@@ -46,7 +46,7 @@ static int write_hibernate_location_info assert(hibernate_location->swap); xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno)); @@ -350,7 +311,7 @@ index a3aeb24633..d3e68e1b94 100644 if (r < 0) return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m", hibernate_location->swap->device, resume_str); -@@ -73,7 +73,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca +@@ -73,7 +73,7 @@ static int write_hibernate_location_info } xsprintf(offset_str, "%" PRIu64, hibernate_location->offset); @@ -368,7 +329,7 @@ index a3aeb24633..d3e68e1b94 100644 if (k >= 0) return 0; -@@ -112,7 +112,7 @@ static int write_state(FILE **f, char **states) { +@@ -112,7 +112,7 @@ static int write_state(FILE **f, char ** STRV_FOREACH(state, states) { int k; @@ -377,11 +338,9 @@ index a3aeb24633..d3e68e1b94 100644 if (k >= 0) return 0; log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state); -diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c -index d1c3febdd5..1cc68694d1 100644 --- a/src/vconsole/vconsole-setup.c +++ b/src/vconsole/vconsole-setup.c -@@ -116,7 +116,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) { +@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *na static int toggle_utf8_sysfs(bool utf8) { int r; @@ -390,3 +349,72 @@ index d1c3febdd5..1cc68694d1 100644 if (r < 0) return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); +--- a/src/basic/namespace-util.c ++++ b/src/basic/namespace-util.c +@@ -202,12 +202,12 @@ int userns_acquire(const char *uid_map, + freeze(); + + xsprintf(path, "/proc/" PID_FMT "/uid_map", pid); +- r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, uid_map, 0); + if (r < 0) + return log_error_errno(r, "Failed to write UID map: %m"); + + xsprintf(path, "/proc/" PID_FMT "/gid_map", pid); +- r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, gid_map, 0); + if (r < 0) + return log_error_errno(r, "Failed to write GID map: %m"); + +--- a/src/core/cgroup.c ++++ b/src/core/cgroup.c +@@ -4140,7 +4140,7 @@ int unit_cgroup_freezer_action(Unit *u, + else + u->freezer_state = FREEZER_THAWING; + +- r = write_string_file(path, one_zero(action == FREEZER_FREEZE), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, one_zero(action == FREEZER_FREEZE), 0); + if (r < 0) + return r; + +--- a/src/home/homework.c ++++ b/src/home/homework.c +@@ -284,7 +284,7 @@ static void drop_caches_now(void) { + * details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but not + * more. */ + +- r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0); + if (r < 0) + log_warning_errno(r, "Failed to drop caches, ignoring: %m"); + else +--- a/src/shared/binfmt-util.c ++++ b/src/shared/binfmt-util.c +@@ -26,7 +26,7 @@ int disable_binfmt(void) { + if (r < 0) + return log_warning_errno(r, "Failed to determine whether binfmt_misc is mounted: %m"); + +- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); + if (r < 0) + return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m"); + +--- a/src/shared/coredump-util.c ++++ b/src/shared/coredump-util.c +@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value) + sprintf(t, "0x%"PRIx64, value); + + return write_string_file("/proc/self/coredump_filter", t, +- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); ++ WRITE_STRING_FILE_VERIFY_ON_FAILURE); + } +--- a/src/udev/udev-rules.c ++++ b/src/udev/udev-rules.c +@@ -2181,7 +2181,6 @@ static int udev_rule_apply_token_to_even + log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value); + r = write_string_file(buf, value, + WRITE_STRING_FILE_VERIFY_ON_FAILURE | +- WRITE_STRING_FILE_DISABLE_BUFFER | + WRITE_STRING_FILE_AVOID_NEWLINE | + WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); + if (r < 0) |