diff options
5 files changed, 13 insertions, 329 deletions
diff --git a/meta/recipes-core/util-linux/util-linux/0001-hwclock-fix-for-glibc-2.31-settimeofday.patch b/meta/recipes-core/util-linux/util-linux/0001-hwclock-fix-for-glibc-2.31-settimeofday.patch deleted file mode 100644 index 0672c3546a..0000000000 --- a/meta/recipes-core/util-linux/util-linux/0001-hwclock-fix-for-glibc-2.31-settimeofday.patch +++ /dev/null | |||
| @@ -1,112 +0,0 @@ | |||
| 1 | From ee85d3967ea09b215fcea5efdd90bbbf5e74a681 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Karel Zak <kzak@redhat.com> | ||
| 3 | Date: Wed, 19 Feb 2020 15:50:47 +0100 | ||
| 4 | Subject: [PATCH] hwclock: fix for glibc 2.31 settimeofday() | ||
| 5 | |||
| 6 | glibc announce: | ||
| 7 | ... settimeofday can no longer be used to set the time and the offset | ||
| 8 | simultaneously. If both of its two arguments are non-null, the call | ||
| 9 | will fail (setting errno to EINVAL). | ||
| 10 | |||
| 11 | It means we need to call settimeofday(NULL, tz) and settimeofday(tv, NULL). | ||
| 12 | |||
| 13 | Unfortunately, settimeofday(NULL, tz) has very special warp-clock | ||
| 14 | semantic if used as the very first settimeofday() call. It means we | ||
| 15 | have to be sure that we do not touch warp-clock if we need only need | ||
| 16 | to modify system TZ. So, let's always call settimeofday(NULL, 0) | ||
| 17 | before settimeofday(NULL, tz) for UTC rtc mode when modify system TZ. | ||
| 18 | |||
| 19 | Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/ee85d3967ea09b215fcea5efdd90bbbf5e74a681] | ||
| 20 | |||
| 21 | CC: J William Piggott <elseifthen@gmx.com> | ||
| 22 | Signed-off-by: Karel Zak <kzak@redhat.com> | ||
| 23 | Addresses: https://github.com/karelzak/util-linux/issues/957 | ||
| 24 | Signed-off-by: Liwei Song <liwei.song@windriver.com> | ||
| 25 | --- | ||
| 26 | sys-utils/hwclock.c | 49 ++++++++++++++++++++++++++------------------- | ||
| 27 | 1 file changed, 28 insertions(+), 21 deletions(-) | ||
| 28 | |||
| 29 | diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c | ||
| 30 | index e736da7179f8..16576bc186ff 100644 | ||
| 31 | --- a/sys-utils/hwclock.c | ||
| 32 | +++ b/sys-utils/hwclock.c | ||
| 33 | @@ -658,6 +658,9 @@ display_time(struct timeval hwctime) | ||
| 34 | * PCIL: persistent_clock_is_local, sets the "11 minute mode" timescale. | ||
| 35 | * firsttime: locks the warp_clock function (initialized to 1 at boot). | ||
| 36 | * | ||
| 37 | + * Note that very first settimeofday(NULL, tz) modifies warp-clock as well as | ||
| 38 | + * system TZ. | ||
| 39 | + * | ||
| 40 | * +---------------------------------------------------------------------------+ | ||
| 41 | * | op | RTC scale | settimeofday calls | | ||
| 42 | * |---------|-----------|-----------------------------------------------------| | ||
| 43 | @@ -675,41 +678,45 @@ set_system_clock(const struct hwclock_control *ctl, | ||
| 44 | struct tm broken; | ||
| 45 | int minuteswest; | ||
| 46 | int rc = 0; | ||
| 47 | - const struct timezone tz_utc = { 0 }; | ||
| 48 | |||
| 49 | localtime_r(&newtime.tv_sec, &broken); | ||
| 50 | minuteswest = -get_gmtoff(&broken) / 60; | ||
| 51 | |||
| 52 | if (ctl->verbose) { | ||
| 53 | - if (ctl->hctosys && !ctl->universal) | ||
| 54 | - printf(_("Calling settimeofday(NULL, %d) to set " | ||
| 55 | - "persistent_clock_is_local.\n"), minuteswest); | ||
| 56 | - if (ctl->systz && ctl->universal) | ||
| 57 | + if (ctl->universal) | ||
| 58 | puts(_("Calling settimeofday(NULL, 0) " | ||
| 59 | - "to lock the warp function.")); | ||
| 60 | + "to lock the warp function.")); | ||
| 61 | + else | ||
| 62 | + printf(_("Calling settimeofday(NULL, %d) to set " | ||
| 63 | + "persistent_clock_is_local and " | ||
| 64 | + "the kernel timezone.\n"), minuteswest); | ||
| 65 | + | ||
| 66 | + if (ctl->universal && minuteswest) | ||
| 67 | + printf(_("Calling settimeofday(NULL, %d) to set " | ||
| 68 | + "the kernel timezone.\n"), minuteswest); | ||
| 69 | + | ||
| 70 | if (ctl->hctosys) | ||
| 71 | - printf(_("Calling settimeofday(%ld.%06ld, %d)\n"), | ||
| 72 | - newtime.tv_sec, newtime.tv_usec, minuteswest); | ||
| 73 | - else { | ||
| 74 | - printf(_("Calling settimeofday(NULL, %d) "), minuteswest); | ||
| 75 | - if (ctl->universal) | ||
| 76 | - puts(_("to set the kernel timezone.")); | ||
| 77 | - else | ||
| 78 | - puts(_("to warp System time.")); | ||
| 79 | - } | ||
| 80 | + printf(_("Calling settimeofday(%ld.%06ld, 0) to set " | ||
| 81 | + "the kernel time.\n"), newtime.tv_sec, newtime.tv_usec); | ||
| 82 | } | ||
| 83 | |||
| 84 | if (!ctl->testing) { | ||
| 85 | + const struct timezone tz_utc = { 0 }; | ||
| 86 | const struct timezone tz = { minuteswest }; | ||
| 87 | |||
| 88 | - if (ctl->hctosys && !ctl->universal) /* set PCIL */ | ||
| 89 | + /* warp-clock */ | ||
| 90 | + if (ctl->universal) | ||
| 91 | + rc = settimeofday(NULL, &tz_utc); /* lock to UTC */ | ||
| 92 | + else | ||
| 93 | + rc = settimeofday(NULL, &tz); /* set PCIL and TZ */ | ||
| 94 | + | ||
| 95 | + /* set timezone */ | ||
| 96 | + if (!rc && ctl->universal && minuteswest) | ||
| 97 | rc = settimeofday(NULL, &tz); | ||
| 98 | - if (ctl->systz && ctl->universal) /* lock warp_clock */ | ||
| 99 | - rc = settimeofday(NULL, &tz_utc); | ||
| 100 | + | ||
| 101 | + /* set time */ | ||
| 102 | if (!rc && ctl->hctosys) | ||
| 103 | - rc = settimeofday(&newtime, &tz); | ||
| 104 | - else if (!rc) | ||
| 105 | - rc = settimeofday(NULL, &tz); | ||
| 106 | + rc = settimeofday(&newtime, NULL); | ||
| 107 | |||
| 108 | if (rc) { | ||
| 109 | warn(_("settimeofday() failed")); | ||
| 110 | -- | ||
| 111 | 2.17.1 | ||
| 112 | |||
diff --git a/meta/recipes-core/util-linux/util-linux/0001-kill-include-sys-types.h-before-checking-SYS_pidfd_s.patch b/meta/recipes-core/util-linux/util-linux/0001-kill-include-sys-types.h-before-checking-SYS_pidfd_s.patch deleted file mode 100644 index e43e12873f..0000000000 --- a/meta/recipes-core/util-linux/util-linux/0001-kill-include-sys-types.h-before-checking-SYS_pidfd_s.patch +++ /dev/null | |||
| @@ -1,64 +0,0 @@ | |||
| 1 | From 3cfde0370d3a8949df0c5bcf447cec6692910ed2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Sami Kerola <kerolasa@iki.fi> | ||
| 3 | Date: Sat, 15 Feb 2020 21:12:50 +0000 | ||
| 4 | Subject: [PATCH] kill: include sys/types.h before checking | ||
| 5 | SYS_pidfd_send_signal | ||
| 6 | |||
| 7 | Including sys/types.h must happen before SYS_pidfd_send_signal is checked, | ||
| 8 | because that header defines variable in normal conditions. When sys/types.h | ||
| 9 | does not have SYS_pidfd_send_signal then fallback is defined in config.h | ||
| 10 | that is included by default, and has therefore worked fine before and after | ||
| 11 | this change. | ||
| 12 | |||
| 13 | Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/3cfde0370d3a8949df0c5bcf447cec6692910ed2] | ||
| 14 | |||
| 15 | Signed-off-by: Sami Kerola <kerolasa@iki.fi> | ||
| 16 | Signed-off-by: Benjamin Fair <benjaminfair@google.com> | ||
| 17 | --- | ||
| 18 | include/pidfd-utils.h | 18 ++++++++++-------- | ||
| 19 | 1 file changed, 10 insertions(+), 8 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/include/pidfd-utils.h b/include/pidfd-utils.h | ||
| 22 | index 593346576..0baedd2c9 100644 | ||
| 23 | --- a/include/pidfd-utils.h | ||
| 24 | +++ b/include/pidfd-utils.h | ||
| 25 | @@ -1,26 +1,28 @@ | ||
| 26 | #ifndef UTIL_LINUX_PIDFD_UTILS | ||
| 27 | #define UTIL_LINUX_PIDFD_UTILS | ||
| 28 | |||
| 29 | -#if defined(__linux__) && defined(SYS_pidfd_send_signal) | ||
| 30 | -# include <sys/types.h> | ||
| 31 | +#if defined(__linux__) | ||
| 32 | # include <sys/syscall.h> | ||
| 33 | +# if defined(SYS_pidfd_send_signal) | ||
| 34 | +# include <sys/types.h> | ||
| 35 | |||
| 36 | -# ifndef HAVE_PIDFD_OPEN | ||
| 37 | +# ifndef HAVE_PIDFD_OPEN | ||
| 38 | static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info, | ||
| 39 | unsigned int flags) | ||
| 40 | { | ||
| 41 | return syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags); | ||
| 42 | } | ||
| 43 | -# endif | ||
| 44 | +# endif | ||
| 45 | |||
| 46 | -# ifndef HAVE_PIDFD_SEND_SIGNAL | ||
| 47 | +# ifndef HAVE_PIDFD_SEND_SIGNAL | ||
| 48 | static inline int pidfd_open(pid_t pid, unsigned int flags) | ||
| 49 | { | ||
| 50 | return syscall(SYS_pidfd_open, pid, flags); | ||
| 51 | } | ||
| 52 | -# endif | ||
| 53 | +# endif | ||
| 54 | |||
| 55 | -# define UL_HAVE_PIDFD 1 | ||
| 56 | +# define UL_HAVE_PIDFD 1 | ||
| 57 | |||
| 58 | -#endif /* __linux__ && SYS_pidfd_send_signal */ | ||
| 59 | +# endif /* SYS_pidfd_send_signal */ | ||
| 60 | +#endif /* __linux__ */ | ||
| 61 | #endif /* UTIL_LINUX_PIDFD_UTILS */ | ||
| 62 | -- | ||
| 63 | 2.26.1.301.g55bc3eb7cb9-goog | ||
| 64 | |||
diff --git a/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch b/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch deleted file mode 100644 index 911f70bc1f..0000000000 --- a/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch +++ /dev/null | |||
| @@ -1,137 +0,0 @@ | |||
| 1 | From 00e53f17c8462cb34ece08cc10db60a7da29a305 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Karel Zak <kzak@redhat.com> | ||
| 3 | Date: Tue, 4 Feb 2020 15:11:19 +0100 | ||
| 4 | Subject: [PATCH] libfdisk: (script) accept sector-size, ignore unknown headers | ||
| 5 | |||
| 6 | - add sector-size between supported headers (already in --dump output) | ||
| 7 | |||
| 8 | - report unknown headers by -ENOTSUP | ||
| 9 | |||
| 10 | - ignore ENOTSUP in sfdisk (but print warning) and in fdisk_script_read_file() | ||
| 11 | |||
| 12 | Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/00e53f17c8462cb34ece08cc10db60a7da29a305] | ||
| 13 | |||
| 14 | Addresses: https://github.com/karelzak/util-linux/issues/949 | ||
| 15 | Signed-off-by: Karel Zak <kzak@redhat.com> | ||
| 16 | Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io> | ||
| 17 | --- | ||
| 18 | disk-utils/sfdisk.c | 6 +++++- | ||
| 19 | libfdisk/src/script.c | 49 ++++++++++++++++++++++++++----------------------- | ||
| 20 | 2 files changed, 31 insertions(+), 24 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c | ||
| 23 | index bb6e1c6..c0bea70 100644 | ||
| 24 | --- a/disk-utils/sfdisk.c | ||
| 25 | +++ b/disk-utils/sfdisk.c | ||
| 26 | @@ -1782,7 +1782,11 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv) | ||
| 27 | } | ||
| 28 | |||
| 29 | rc = fdisk_script_read_line(dp, stdin, buf, sizeof(buf)); | ||
| 30 | - if (rc < 0) { | ||
| 31 | + if (rc == -ENOTSUP) { | ||
| 32 | + buf[sizeof(buf) - 1] = '\0'; | ||
| 33 | + fdisk_warnx(sf->cxt, _("Unknown script header '%s' -- ignore."), buf); | ||
| 34 | + continue; | ||
| 35 | + } else if (rc < 0) { | ||
| 36 | DBG(PARSE, ul_debug("script parsing failed, trying sfdisk specific commands")); | ||
| 37 | buf[sizeof(buf) - 1] = '\0'; | ||
| 38 | rc = loop_control_commands(sf, dp, buf); | ||
| 39 | diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c | ||
| 40 | index a21771b..d3e67fa 100644 | ||
| 41 | --- a/libfdisk/src/script.c | ||
| 42 | +++ b/libfdisk/src/script.c | ||
| 43 | @@ -805,8 +805,12 @@ static inline int is_header_line(const char *s) | ||
| 44 | /* parses "<name>: value", note modifies @s*/ | ||
| 45 | static int parse_line_header(struct fdisk_script *dp, char *s) | ||
| 46 | { | ||
| 47 | - int rc = -EINVAL; | ||
| 48 | + size_t i; | ||
| 49 | char *name, *value; | ||
| 50 | + static const char *supported[] = { | ||
| 51 | + "label", "unit", "label-id", "device", "grain", | ||
| 52 | + "first-lba", "last-lba", "table-length", "sector-size" | ||
| 53 | + }; | ||
| 54 | |||
| 55 | DBG(SCRIPT, ul_debugobj(dp, " parse header '%s'", s)); | ||
| 56 | |||
| 57 | @@ -816,7 +820,7 @@ static int parse_line_header(struct fdisk_script *dp, char *s) | ||
| 58 | name = s; | ||
| 59 | value = strchr(s, ':'); | ||
| 60 | if (!value) | ||
| 61 | - goto done; | ||
| 62 | + return -EINVAL; | ||
| 63 | *value = '\0'; | ||
| 64 | value++; | ||
| 65 | |||
| 66 | @@ -825,32 +829,30 @@ static int parse_line_header(struct fdisk_script *dp, char *s) | ||
| 67 | ltrim_whitespace((unsigned char *) value); | ||
| 68 | rtrim_whitespace((unsigned char *) value); | ||
| 69 | |||
| 70 | + if (!*name || !*value) | ||
| 71 | + return -EINVAL; | ||
| 72 | + | ||
| 73 | + /* check header name */ | ||
| 74 | + for (i = 0; i < ARRAY_SIZE(supported); i++) { | ||
| 75 | + if (strcmp(name, supported[i]) == 0) | ||
| 76 | + break; | ||
| 77 | + } | ||
| 78 | + if (i == ARRAY_SIZE(supported)) | ||
| 79 | + return -ENOTSUP; | ||
| 80 | + | ||
| 81 | + /* header specific actions */ | ||
| 82 | if (strcmp(name, "label") == 0) { | ||
| 83 | if (dp->cxt && !fdisk_get_label(dp->cxt, value)) | ||
| 84 | - goto done; /* unknown label name */ | ||
| 85 | + return -EINVAL; /* unknown label name */ | ||
| 86 | dp->force_label = 1; | ||
| 87 | + | ||
| 88 | } else if (strcmp(name, "unit") == 0) { | ||
| 89 | if (strcmp(value, "sectors") != 0) | ||
| 90 | - goto done; /* only "sectors" supported */ | ||
| 91 | - } else if (strcmp(name, "label-id") == 0 | ||
| 92 | - || strcmp(name, "device") == 0 | ||
| 93 | - || strcmp(name, "grain") == 0 | ||
| 94 | - || strcmp(name, "first-lba") == 0 | ||
| 95 | - || strcmp(name, "last-lba") == 0 | ||
| 96 | - || strcmp(name, "table-length") == 0) { | ||
| 97 | - ; /* whatever is possible */ | ||
| 98 | - } else | ||
| 99 | - goto done; /* unknown header */ | ||
| 100 | + return -EINVAL; /* only "sectors" supported */ | ||
| 101 | |||
| 102 | - if (*name && *value) | ||
| 103 | - rc = fdisk_script_set_header(dp, name, value); | ||
| 104 | -done: | ||
| 105 | - if (rc) | ||
| 106 | - DBG(SCRIPT, ul_debugobj(dp, "header parse error: " | ||
| 107 | - "[rc=%d, name='%s', value='%s']", | ||
| 108 | - rc, name, value)); | ||
| 109 | - return rc; | ||
| 110 | + } | ||
| 111 | |||
| 112 | + return fdisk_script_set_header(dp, name, value); | ||
| 113 | } | ||
| 114 | |||
| 115 | /* returns zero terminated string with next token and @str is updated */ | ||
| 116 | @@ -1363,7 +1365,8 @@ int fdisk_script_set_fgets(struct fdisk_script *dp, | ||
| 117 | * | ||
| 118 | * Reads next line into dump. | ||
| 119 | * | ||
| 120 | - * Returns: 0 on success, <0 on error, 1 when nothing to read. | ||
| 121 | + * Returns: 0 on success, <0 on error, 1 when nothing to read. For unknown headers | ||
| 122 | + * returns -ENOTSUP, it's usually safe to ignore this error. | ||
| 123 | */ | ||
| 124 | int fdisk_script_read_line(struct fdisk_script *dp, FILE *f, char *buf, size_t bufsz) | ||
| 125 | { | ||
| 126 | @@ -1428,7 +1431,7 @@ int fdisk_script_read_file(struct fdisk_script *dp, FILE *f) | ||
| 127 | |||
| 128 | while (!feof(f)) { | ||
| 129 | rc = fdisk_script_read_line(dp, f, buf, sizeof(buf)); | ||
| 130 | - if (rc) | ||
| 131 | + if (rc && rc != -ENOTSUP) | ||
| 132 | break; | ||
| 133 | } | ||
| 134 | |||
| 135 | -- | ||
| 136 | 2.7.4 | ||
| 137 | |||
diff --git a/meta/recipes-core/util-linux/util-linux_2.35.1.bb b/meta/recipes-core/util-linux/util-linux_2.35.1.bb deleted file mode 100644 index 516b783887..0000000000 --- a/meta/recipes-core/util-linux/util-linux_2.35.1.bb +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 1 | require util-linux.inc | ||
| 2 | |||
| 3 | SRC_URI += "file://configure-sbindir.patch \ | ||
| 4 | file://runuser.pamd \ | ||
| 5 | file://runuser-l.pamd \ | ||
| 6 | file://ptest.patch \ | ||
| 7 | file://run-ptest \ | ||
| 8 | file://display_testname_for_subtest.patch \ | ||
| 9 | file://avoid_parallel_tests.patch \ | ||
| 10 | file://0001-hwclock-fix-for-glibc-2.31-settimeofday.patch \ | ||
| 11 | file://0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch \ | ||
| 12 | file://0001-kill-include-sys-types.h-before-checking-SYS_pidfd_s.patch \ | ||
| 13 | file://0001-include-cleanup-pidfd-inckudes.patch \ | ||
| 14 | " | ||
| 15 | SRC_URI[md5sum] = "7f64882f631225f0295ca05080cee1bf" | ||
| 16 | SRC_URI[sha256sum] = "d9de3edd287366cd908e77677514b9387b22bc7b88f45b83e1922c3597f1d7f9" | ||
diff --git a/meta/recipes-core/util-linux/util-linux_2.35.2.bb b/meta/recipes-core/util-linux/util-linux_2.35.2.bb new file mode 100644 index 0000000000..752a6fa214 --- /dev/null +++ b/meta/recipes-core/util-linux/util-linux_2.35.2.bb | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | require util-linux.inc | ||
| 2 | |||
| 3 | SRC_URI += "file://configure-sbindir.patch \ | ||
| 4 | file://runuser.pamd \ | ||
| 5 | file://runuser-l.pamd \ | ||
| 6 | file://ptest.patch \ | ||
| 7 | file://run-ptest \ | ||
| 8 | file://display_testname_for_subtest.patch \ | ||
| 9 | file://avoid_parallel_tests.patch \ | ||
| 10 | file://0001-include-cleanup-pidfd-inckudes.patch \ | ||
| 11 | " | ||
| 12 | SRC_URI[md5sum] = "248a4d0810c9193e0e9a4bb3f26b93d8" | ||
| 13 | SRC_URI[sha256sum] = "21b7431e82f6bcd9441a01beeec3d57ed33ee948f8a5b41da577073c372eb58a" | ||
