mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
Merge pull request #23504 from keszybz/bls-reordering
Refactor the BLS and add a description of version sorts
This commit is contained in:
35
NEWS
35
NEWS
@@ -29,19 +29,19 @@ CHANGES WITH 251:
|
||||
and backward compatibility broken instead on the assumption that
|
||||
nobody can be affected given the current state of this interface.
|
||||
|
||||
* All kernels supported by systemd mix RDRAND (or similar) into the
|
||||
entropy pool at early boot. This means that on those systems, even if
|
||||
/dev/urandom is not yet initialized, it still returns bytes that
|
||||
are at least as high quality as RDRAND. For that reason, we no longer
|
||||
have reason to invoke RDRAND from systemd itself, which has
|
||||
historically been a source of bugs. Furthermore, kernels ≥5.6 provide
|
||||
the getrandom(GRND_INSECURE) interface for returning random bytes
|
||||
before the entropy pool is initialized without warning into kmsg,
|
||||
which is what we attempt to use if available. systemd's direct usage
|
||||
of RDRAND has been removed. x86 systems ≥Broadwell that are running
|
||||
an older kernel may experience kmsg warnings that were not seen with
|
||||
250. For newer kernels, non-x86 systems, or older x86 systems, there
|
||||
should be no visible changes.
|
||||
* All kernels supported by systemd mix bytes returned by RDRAND (or
|
||||
similar) into the entropy pool at early boot. This means that on
|
||||
those systems, even if /dev/urandom is not yet initialized, it still
|
||||
returns bytes that are of at least RDRAND quality. For that reason,
|
||||
we no longer have reason to invoke RDRAND from systemd itself, which
|
||||
has historically been a source of bugs. Furthermore, kernels ≥5.6
|
||||
provide the getrandom(GRND_INSECURE) interface for returning random
|
||||
bytes before the entropy pool is initialized without warning into
|
||||
kmsg, which is what we attempt to use if available. systemd's direct
|
||||
usage of RDRAND has been removed. x86 systems ≥Broadwell that are
|
||||
running an older kernel may experience kmsg warnings that were not
|
||||
seen with 250. For newer kernels, non-x86 systems, or older x86
|
||||
systems, there should be no visible changes.
|
||||
|
||||
* sd-boot will now measure the kernel command line into TPM PCR 12
|
||||
rather than PCR 8. This improves usefulness of the measurements on
|
||||
@@ -59,11 +59,10 @@ CHANGES WITH 251:
|
||||
* busctl capture now writes output in the newer pcapng format instead
|
||||
of pcap.
|
||||
|
||||
* A udev rule that imported hwdb matches for USB devices with
|
||||
lowercase hexadecimal vendor/product ID digits was added in systemd
|
||||
250. This has been reverted, since uppercase hexadecimal digits are
|
||||
supposed to be used, and we already had a rule for that with the
|
||||
appropriate match.
|
||||
* A udev rule that imported hwdb matches for USB devices with lowercase
|
||||
hexadecimal vendor/product ID digits was added in systemd 250. This
|
||||
has been reverted, since uppercase hexadecimal digits are supposed to
|
||||
be used, and we already had a rule with the appropriate match.
|
||||
|
||||
Users might need to adjust their local hwdb entries.
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -124,8 +124,8 @@ sd_int strverscmp_improved(const sd_char *a, const sd_char *b) {
|
||||
* (newer) 124-1
|
||||
*/
|
||||
|
||||
if (isempty(a) || isempty(b))
|
||||
return CMP(strcmp_ptr(a, b), 0);
|
||||
a = strempty(a);
|
||||
b = strempty(b);
|
||||
|
||||
for (;;) {
|
||||
const sd_char *aa, *bb;
|
||||
@@ -150,7 +150,7 @@ sd_int strverscmp_improved(const sd_char *a, const sd_char *b) {
|
||||
}
|
||||
|
||||
/* If at least one string reaches the end, then longer is newer.
|
||||
* Note that except for '~' prefixed segments, a string has more segments is newer.
|
||||
* Note that except for '~' prefixed segments, a string which has more segments is newer.
|
||||
* So, this check must be after the '~' check. */
|
||||
if (*a == '\0' || *b == '\0')
|
||||
return CMP(*a, *b);
|
||||
@@ -187,12 +187,6 @@ sd_int strverscmp_improved(const sd_char *a, const sd_char *b) {
|
||||
}
|
||||
|
||||
if (is_digit(*a) || is_digit(*b)) {
|
||||
/* Skip leading '0', to make 00123 equivalent to 123. */
|
||||
while (*a == '0')
|
||||
a++;
|
||||
while (*b == '0')
|
||||
b++;
|
||||
|
||||
/* Find the leading numeric segments. One may be an empty string. So,
|
||||
* numeric segments are always newer than alpha segments. */
|
||||
for (aa = a; is_digit(*aa); aa++)
|
||||
@@ -200,6 +194,17 @@ sd_int strverscmp_improved(const sd_char *a, const sd_char *b) {
|
||||
for (bb = b; is_digit(*bb); bb++)
|
||||
;
|
||||
|
||||
/* Check if one of the strings was empty, but the other not. */
|
||||
r = CMP(a != aa, b != bb);
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
/* Skip leading '0', to make 00123 equivalent to 123. */
|
||||
while (*a == '0')
|
||||
a++;
|
||||
while (*b == '0')
|
||||
b++;
|
||||
|
||||
/* To compare numeric segments without parsing their values, first compare the
|
||||
* lengths of the segments. Eg. 12345 vs 123, longer is newer. */
|
||||
r = CMP(aa - a, bb - b);
|
||||
@@ -228,7 +233,7 @@ sd_int strverscmp_improved(const sd_char *a, const sd_char *b) {
|
||||
return r;
|
||||
}
|
||||
|
||||
/* The current segments are equivalent. Let's compare the next one. */
|
||||
/* The current segments are equivalent. Let's move to the next one. */
|
||||
a = aa;
|
||||
b = bb;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ static int session_device_open(SessionDevice *sd, bool active) {
|
||||
assert(sd->type != DEVICE_TYPE_UNKNOWN);
|
||||
assert(sd->node);
|
||||
|
||||
/* open device and try to get an udev_device from it */
|
||||
/* open device and try to get a udev_device from it */
|
||||
fd = open(sd->node, O_RDWR|O_CLOEXEC|O_NOCTTY|O_NONBLOCK);
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
@@ -852,8 +852,8 @@ static void test_strverscmp_improved_newer(const char *older, const char *newer)
|
||||
|
||||
TEST(strverscmp_improved) {
|
||||
static const char * const versions[] = {
|
||||
"",
|
||||
"~1",
|
||||
"",
|
||||
"ab",
|
||||
"abb",
|
||||
"abc",
|
||||
@@ -917,6 +917,29 @@ TEST(strverscmp_improved) {
|
||||
/* invalid characters */
|
||||
assert_se(strverscmp_improved("123_aa2-67.89", "123aa+2-67.89") == 0);
|
||||
|
||||
/* some corner cases */
|
||||
assert_se(strverscmp_improved("123.", "123") > 0); /* One more version segment */
|
||||
assert_se(strverscmp_improved("12_3", "123") < 0); /* 12 < 123 */
|
||||
assert_se(strverscmp_improved("12_3", "12") > 0); /* 3 > '' */
|
||||
assert_se(strverscmp_improved("12_3", "12.3") > 0); /* 3 > '' */
|
||||
assert_se(strverscmp_improved("123.0", "123") > 0); /* 0 > '' */
|
||||
assert_se(strverscmp_improved("123_0", "123") > 0); /* 0 > '' */
|
||||
assert_se(strverscmp_improved("123..0", "123.0") < 0); /* '' < 0 */
|
||||
|
||||
/* empty strings or strings with ignored characters only */
|
||||
assert_se(strverscmp_improved("", NULL) == 0);
|
||||
assert_se(strverscmp_improved(NULL, "") == 0);
|
||||
assert_se(strverscmp_improved("0_", "0") == 0);
|
||||
assert_se(strverscmp_improved("_0_", "0") == 0);
|
||||
assert_se(strverscmp_improved("_0", "0") == 0);
|
||||
assert_se(strverscmp_improved("0", "0___") == 0);
|
||||
assert_se(strverscmp_improved("", "_") == 0);
|
||||
assert_se(strverscmp_improved("_", "") == 0);
|
||||
assert_se(strverscmp_improved("_", "_") == 0);
|
||||
assert_se(strverscmp_improved("", "~") > 0);
|
||||
assert_se(strverscmp_improved("~", "") < 0);
|
||||
assert_se(strverscmp_improved("~", "~") == 0);
|
||||
|
||||
/* non-ASCII digits */
|
||||
(void) setlocale(LC_NUMERIC, "ar_YE.utf8");
|
||||
assert_se(strverscmp_improved("1٠١٢٣٤٥٦٧٨٩", "1") == 0);
|
||||
|
||||
Reference in New Issue
Block a user