import OL systemd-252-14.0.1.el9_2.1
This commit is contained in:
parent
0541658fd4
commit
5df445d7c6
@ -0,0 +1,26 @@
|
||||
From 6b6f61668c539329bc95fb7f3c3b644b793dfb52 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Wed, 25 Jan 2023 18:47:05 +0100
|
||||
Subject: [PATCH] journal-def: fix type of signature to match the actual field
|
||||
in the Header structure
|
||||
|
||||
(cherry picked from commit 6fe167d0a77f72086b457125fad6931ca02a4baf)
|
||||
|
||||
Related: #2184929
|
||||
---
|
||||
src/libsystemd/sd-journal/journal-def.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-journal/journal-def.h b/src/libsystemd/sd-journal/journal-def.h
|
||||
index 8f994b0178..ab4880761b 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-def.h
|
||||
+++ b/src/libsystemd/sd-journal/journal-def.h
|
||||
@@ -195,7 +195,7 @@ enum {
|
||||
#endif
|
||||
|
||||
#define HEADER_SIGNATURE \
|
||||
- ((const char[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
|
||||
+ ((const uint8_t[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
|
||||
|
||||
#define struct_Header__contents { \
|
||||
uint8_t signature[8]; /* "LPKSHHRH" */ \
|
@ -0,0 +1,63 @@
|
||||
From de2a4abb178021ab6700f0bc4038daf88f92cb03 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Wed, 25 Jan 2023 18:48:31 +0100
|
||||
Subject: [PATCH] journal: use compound initialization for journal file Header
|
||||
structure
|
||||
|
||||
(cherry picked from commit c3dd0dcb888fd8da7ce4e5299caf45e90ddcd41b)
|
||||
|
||||
Related: #2184929
|
||||
---
|
||||
src/libsystemd/sd-journal/journal-file.c | 23 +++++++++++------------
|
||||
1 file changed, 11 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
|
||||
index c489436a1e..cf86bab2dc 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-file.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-file.c
|
||||
@@ -320,9 +320,8 @@ static bool compact_mode_requested(void) {
|
||||
}
|
||||
|
||||
static int journal_file_init_header(JournalFile *f, JournalFileFlags file_flags, JournalFile *template) {
|
||||
- Header h = {};
|
||||
- ssize_t k;
|
||||
bool seal = false;
|
||||
+ ssize_t k;
|
||||
int r;
|
||||
|
||||
assert(f);
|
||||
@@ -332,16 +331,17 @@ static int journal_file_init_header(JournalFile *f, JournalFileFlags file_flags,
|
||||
seal = FLAGS_SET(file_flags, JOURNAL_SEAL) && journal_file_fss_load(f) >= 0;
|
||||
#endif
|
||||
|
||||
- memcpy(h.signature, HEADER_SIGNATURE, 8);
|
||||
- h.header_size = htole64(ALIGN64(sizeof(h)));
|
||||
-
|
||||
- h.incompatible_flags |= htole32(
|
||||
- FLAGS_SET(file_flags, JOURNAL_COMPRESS) *
|
||||
- COMPRESSION_TO_HEADER_INCOMPATIBLE_FLAG(DEFAULT_COMPRESSION) |
|
||||
- keyed_hash_requested() * HEADER_INCOMPATIBLE_KEYED_HASH |
|
||||
- compact_mode_requested() * HEADER_INCOMPATIBLE_COMPACT);
|
||||
+ Header h = {
|
||||
+ .header_size = htole64(ALIGN64(sizeof(h))),
|
||||
+ .incompatible_flags = htole32(
|
||||
+ FLAGS_SET(file_flags, JOURNAL_COMPRESS) * COMPRESSION_TO_HEADER_INCOMPATIBLE_FLAG(DEFAULT_COMPRESSION) |
|
||||
+ keyed_hash_requested() * HEADER_INCOMPATIBLE_KEYED_HASH |
|
||||
+ compact_mode_requested() * HEADER_INCOMPATIBLE_COMPACT),
|
||||
+ .compatible_flags = htole32(seal * HEADER_COMPATIBLE_SEALED),
|
||||
+ };
|
||||
|
||||
- h.compatible_flags = htole32(seal * HEADER_COMPATIBLE_SEALED);
|
||||
+ assert_cc(sizeof(h.signature) == sizeof(HEADER_SIGNATURE));
|
||||
+ memcpy(h.signature, HEADER_SIGNATURE, sizeof(HEADER_SIGNATURE));
|
||||
|
||||
r = sd_id128_randomize(&h.file_id);
|
||||
if (r < 0)
|
||||
@@ -356,7 +356,6 @@ static int journal_file_init_header(JournalFile *f, JournalFileFlags file_flags,
|
||||
k = pwrite(f->fd, &h, sizeof(h), 0);
|
||||
if (k < 0)
|
||||
return -errno;
|
||||
-
|
||||
if (k != sizeof(h))
|
||||
return -EIO;
|
||||
|
25
SOURCES/0238-journald-fix-log-message.patch
Normal file
25
SOURCES/0238-journald-fix-log-message.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From de88fa23f060ab5f554f4c0d41b0f93430f1db8a Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 17:11:28 +0900
|
||||
Subject: [PATCH] journald: fix log message
|
||||
|
||||
(cherry picked from commit 01aa59979bc61125f599a5b8a6c911fff5daaee7)
|
||||
|
||||
Resolves: #2184929
|
||||
---
|
||||
src/journal/journald-server.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
|
||||
index 71d7a59bda..cbcf1e9d9e 100644
|
||||
--- a/src/journal/journald-server.c
|
||||
+++ b/src/journal/journald-server.c
|
||||
@@ -2011,7 +2011,7 @@ static int vl_method_synchronize(Varlink *link, JsonVariant *parameters, Varlink
|
||||
if (json_variant_elements(parameters) > 0)
|
||||
return varlink_error_invalid_parameter(link, parameters);
|
||||
|
||||
- log_info("Received client request to rotate journal.");
|
||||
+ log_info("Received client request to sync journal.");
|
||||
|
||||
/* We don't do the main work now, but instead enqueue a deferred event loop job which will do
|
||||
* it. That job is scheduled at low priority, so that we return from this method call only after all
|
@ -0,0 +1,66 @@
|
||||
From c7919b02b504e2c0ccacf02c6f21f65c3f18ea4c Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 16:43:44 +0900
|
||||
Subject: [PATCH] sd-journal: cache results of parsing environment variables
|
||||
|
||||
(cherry picked from commit 9dfbae203e3afa500163bc46e0070c4cb2180aac)
|
||||
|
||||
Resolves: #2184929
|
||||
---
|
||||
src/libsystemd/sd-journal/journal-file.c | 34 +++++++++++++++---------
|
||||
1 file changed, 22 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
|
||||
index cf86bab2dc..00de564499 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-file.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-file.c
|
||||
@@ -296,27 +296,37 @@ JournalFile* journal_file_close(JournalFile *f) {
|
||||
}
|
||||
|
||||
static bool keyed_hash_requested(void) {
|
||||
+ static thread_local int cached = -1;
|
||||
int r;
|
||||
|
||||
- r = getenv_bool("SYSTEMD_JOURNAL_KEYED_HASH");
|
||||
- if (r >= 0)
|
||||
- return r;
|
||||
- if (r != -ENXIO)
|
||||
- log_debug_errno(r, "Failed to parse $SYSTEMD_JOURNAL_KEYED_HASH environment variable, ignoring: %m");
|
||||
+ if (cached < 0) {
|
||||
+ r = getenv_bool("SYSTEMD_JOURNAL_KEYED_HASH");
|
||||
+ if (r < 0) {
|
||||
+ if (r != -ENXIO)
|
||||
+ log_debug_errno(r, "Failed to parse $SYSTEMD_JOURNAL_KEYED_HASH environment variable, ignoring: %m");
|
||||
+ cached = true;
|
||||
+ } else
|
||||
+ cached = r;
|
||||
+ }
|
||||
|
||||
- return true;
|
||||
+ return cached;
|
||||
}
|
||||
|
||||
static bool compact_mode_requested(void) {
|
||||
+ static thread_local int cached = -1;
|
||||
int r;
|
||||
|
||||
- r = getenv_bool("SYSTEMD_JOURNAL_COMPACT");
|
||||
- if (r >= 0)
|
||||
- return r;
|
||||
- if (r != -ENXIO)
|
||||
- log_debug_errno(r, "Failed to parse $SYSTEMD_JOURNAL_COMPACT environment variable, ignoring: %m");
|
||||
+ if (cached < 0) {
|
||||
+ r = getenv_bool("SYSTEMD_JOURNAL_COMPACT");
|
||||
+ if (r < 0) {
|
||||
+ if (r != -ENXIO)
|
||||
+ log_debug_errno(r, "Failed to parse $SYSTEMD_JOURNAL_COMPACT environment variable, ignoring: %m");
|
||||
+ cached = true;
|
||||
+ } else
|
||||
+ cached = r;
|
||||
+ }
|
||||
|
||||
- return true;
|
||||
+ return cached;
|
||||
}
|
||||
|
||||
static int journal_file_init_header(JournalFile *f, JournalFileFlags file_flags, JournalFile *template) {
|
@ -0,0 +1,55 @@
|
||||
From c926e4ff48022a71665e7e7833fd59a1bf2ad5fb Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 14:34:32 +0900
|
||||
Subject: [PATCH] compress: introduce compression_supported() helper function
|
||||
|
||||
(cherry picked from commit 83f3d73da8d132773dd91aae0fa7babb74920774)
|
||||
|
||||
Resolves: #2184929
|
||||
---
|
||||
src/basic/compress.c | 10 ++++++++++
|
||||
src/basic/compress.h | 3 +++
|
||||
2 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/src/basic/compress.c b/src/basic/compress.c
|
||||
index 1e94635397..dce0ebf222 100644
|
||||
--- a/src/basic/compress.c
|
||||
+++ b/src/basic/compress.c
|
||||
@@ -66,6 +66,16 @@ static const char* const compression_table[_COMPRESSION_MAX] = {
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(compression, Compression);
|
||||
|
||||
+bool compression_supported(Compression c) {
|
||||
+ static const unsigned supported =
|
||||
+ (1U << COMPRESSION_NONE) |
|
||||
+ (1U << COMPRESSION_XZ) * HAVE_XZ |
|
||||
+ (1U << COMPRESSION_LZ4) * HAVE_LZ4 |
|
||||
+ (1U << COMPRESSION_ZSTD) * HAVE_ZSTD;
|
||||
+
|
||||
+ return c >= 0 && c < _COMPRESSION_MAX && FLAGS_SET(supported, 1U << c);
|
||||
+}
|
||||
+
|
||||
int compress_blob_xz(const void *src, uint64_t src_size,
|
||||
void *dst, size_t dst_alloc_size, size_t *dst_size) {
|
||||
#if HAVE_XZ
|
||||
diff --git a/src/basic/compress.h b/src/basic/compress.h
|
||||
index 583b105c66..2201bca74c 100644
|
||||
--- a/src/basic/compress.h
|
||||
+++ b/src/basic/compress.h
|
||||
@@ -2,6 +2,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <errno.h>
|
||||
+#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -17,6 +18,8 @@ typedef enum Compression {
|
||||
const char* compression_to_string(Compression compression);
|
||||
Compression compression_from_string(const char *compression);
|
||||
|
||||
+bool compression_supported(Compression c);
|
||||
+
|
||||
int compress_blob_xz(const void *src, uint64_t src_size,
|
||||
void *dst, size_t dst_alloc_size, size_t *dst_size);
|
||||
int compress_blob_lz4(const void *src, uint64_t src_size,
|
@ -0,0 +1,115 @@
|
||||
From 3baac68b2bcad46062b12aa11e15adf8e6d80a40 Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 18:22:50 +0900
|
||||
Subject: [PATCH] sd-journal: always use the compression algorithm specified in
|
||||
the header
|
||||
|
||||
Previously, data object may be compressed with an algorithm that is not
|
||||
mentioned in the header.
|
||||
|
||||
(cherry picked from commit 2360352ef02548723ac0c8eaf5ff6905eb9eeca5)
|
||||
|
||||
Resolves: #2184929
|
||||
---
|
||||
src/libsystemd/sd-journal/journal-file.c | 40 ++++++++++++++----------
|
||||
src/libsystemd/sd-journal/journal-file.h | 12 +++++--
|
||||
2 files changed, 33 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
|
||||
index 00de564499..1b8f0abf97 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-file.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-file.c
|
||||
@@ -1593,24 +1593,31 @@ static int journal_file_append_field(
|
||||
}
|
||||
|
||||
static Compression maybe_compress_payload(JournalFile *f, uint8_t *dst, const uint8_t *src, uint64_t size, size_t *rsize) {
|
||||
- Compression compression = COMPRESSION_NONE;
|
||||
-
|
||||
assert(f);
|
||||
assert(f->header);
|
||||
|
||||
#if HAVE_COMPRESSION
|
||||
- if (JOURNAL_FILE_COMPRESS(f) && size >= f->compress_threshold_bytes) {
|
||||
- compression = compress_blob(src, size, dst, size - 1, rsize);
|
||||
- if (compression > 0)
|
||||
- log_debug("Compressed data object %"PRIu64" -> %zu using %s",
|
||||
- size, *rsize, compression_to_string(compression));
|
||||
- else
|
||||
- /* Compression didn't work, we don't really care why, let's continue without compression */
|
||||
- compression = COMPRESSION_NONE;
|
||||
+ Compression c;
|
||||
+ int r;
|
||||
+
|
||||
+ c = JOURNAL_FILE_COMPRESSION(f);
|
||||
+ if (c == COMPRESSION_NONE || size < f->compress_threshold_bytes)
|
||||
+ return COMPRESSION_NONE;
|
||||
+
|
||||
+ r = compress_blob_explicit(c, src, size, dst, size - 1, rsize);
|
||||
+ if (r < 0) {
|
||||
+ log_debug_errno(r, "Failed to compress data object using %s, ignoring: %m", compression_to_string(c));
|
||||
+ /* Compression didn't work, we don't really care why, let's continue without compression */
|
||||
+ return COMPRESSION_NONE;
|
||||
}
|
||||
-#endif
|
||||
|
||||
- return compression;
|
||||
+ assert(r == c);
|
||||
+ log_debug("Compressed data object %"PRIu64" -> %zu using %s", size, *rsize, compression_to_string(c));
|
||||
+
|
||||
+ return c;
|
||||
+#else
|
||||
+ return COMPRESSION_NONE;
|
||||
+#endif
|
||||
}
|
||||
|
||||
static int journal_file_append_data(
|
||||
@@ -3887,20 +3894,21 @@ int journal_file_open(
|
||||
f->close_fd = true;
|
||||
|
||||
if (DEBUG_LOGGING) {
|
||||
- static int last_seal = -1, last_compress = -1, last_keyed_hash = -1;
|
||||
+ static int last_seal = -1, last_keyed_hash = -1;
|
||||
+ static Compression last_compression = _COMPRESSION_INVALID;
|
||||
static uint64_t last_bytes = UINT64_MAX;
|
||||
|
||||
if (last_seal != JOURNAL_HEADER_SEALED(f->header) ||
|
||||
last_keyed_hash != JOURNAL_HEADER_KEYED_HASH(f->header) ||
|
||||
- last_compress != JOURNAL_FILE_COMPRESS(f) ||
|
||||
+ last_compression != JOURNAL_FILE_COMPRESSION(f) ||
|
||||
last_bytes != f->compress_threshold_bytes) {
|
||||
|
||||
log_debug("Journal effective settings seal=%s keyed_hash=%s compress=%s compress_threshold_bytes=%s",
|
||||
yes_no(JOURNAL_HEADER_SEALED(f->header)), yes_no(JOURNAL_HEADER_KEYED_HASH(f->header)),
|
||||
- yes_no(JOURNAL_FILE_COMPRESS(f)), FORMAT_BYTES(f->compress_threshold_bytes));
|
||||
+ compression_to_string(JOURNAL_FILE_COMPRESSION(f)), FORMAT_BYTES(f->compress_threshold_bytes));
|
||||
last_seal = JOURNAL_HEADER_SEALED(f->header);
|
||||
last_keyed_hash = JOURNAL_HEADER_KEYED_HASH(f->header);
|
||||
- last_compress = JOURNAL_FILE_COMPRESS(f);
|
||||
+ last_compression = JOURNAL_FILE_COMPRESSION(f);
|
||||
last_bytes = f->compress_threshold_bytes;
|
||||
}
|
||||
}
|
||||
diff --git a/src/libsystemd/sd-journal/journal-file.h b/src/libsystemd/sd-journal/journal-file.h
|
||||
index 1f3c80c912..0321da4a16 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-file.h
|
||||
+++ b/src/libsystemd/sd-journal/journal-file.h
|
||||
@@ -305,10 +305,16 @@ bool journal_file_rotate_suggested(JournalFile *f, usec_t max_file_usec, int log
|
||||
int journal_file_map_data_hash_table(JournalFile *f);
|
||||
int journal_file_map_field_hash_table(JournalFile *f);
|
||||
|
||||
-static inline bool JOURNAL_FILE_COMPRESS(JournalFile *f) {
|
||||
+static inline Compression JOURNAL_FILE_COMPRESSION(JournalFile *f) {
|
||||
assert(f);
|
||||
- return JOURNAL_HEADER_COMPRESSED_XZ(f->header) || JOURNAL_HEADER_COMPRESSED_LZ4(f->header) ||
|
||||
- JOURNAL_HEADER_COMPRESSED_ZSTD(f->header);
|
||||
+
|
||||
+ if (JOURNAL_HEADER_COMPRESSED_XZ(f->header))
|
||||
+ return COMPRESSION_XZ;
|
||||
+ if (JOURNAL_HEADER_COMPRESSED_LZ4(f->header))
|
||||
+ return COMPRESSION_LZ4;
|
||||
+ if (JOURNAL_HEADER_COMPRESSED_ZSTD(f->header))
|
||||
+ return COMPRESSION_ZSTD;
|
||||
+ return COMPRESSION_NONE;
|
||||
}
|
||||
|
||||
uint64_t journal_file_hash_data(JournalFile *f, const void *data, size_t sz);
|
@ -0,0 +1,100 @@
|
||||
From 6d0fb28f2d7b64146361673be99bc2586e3763ce Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 14:19:51 +0900
|
||||
Subject: [PATCH] sd-journal: allow to specify compression algorithm through
|
||||
env
|
||||
|
||||
Fixes RHBZ#2183546 (https://bugzilla.redhat.com/show_bug.cgi?id=2183546).
|
||||
|
||||
Previously, journal file is always compressed with the default algorithm
|
||||
set at compile time. So, if a newer algorithm is used, journal files
|
||||
cannot be read by older version of journalctl that does not support the
|
||||
algorithm.
|
||||
|
||||
Co-authored-by: Colin Walters <walters@verbum.org>
|
||||
(cherry picked from commit 1f06ea747b5939a1083c436dd7dae97b37bedee7)
|
||||
|
||||
Resolves: #2184929
|
||||
---
|
||||
docs/ENVIRONMENT.md | 8 +++++
|
||||
src/libsystemd/sd-journal/journal-file.c | 44 +++++++++++++++++++++++-
|
||||
2 files changed, 51 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md
|
||||
index ab3add6031..70fac2e361 100644
|
||||
--- a/docs/ENVIRONMENT.md
|
||||
+++ b/docs/ENVIRONMENT.md
|
||||
@@ -471,3 +471,11 @@ SYSTEMD_HOME_DEBUG_SUFFIX=foo \
|
||||
in a more compact format that reduces the amount of disk space required by the
|
||||
journal. Note that journal files in compact mode are limited to 4G to allow use of
|
||||
32-bit offsets. Enabled by default.
|
||||
+
|
||||
+* `$SYSTEMD_JOURNAL_COMPRESS` – Takes a boolean, or one of the compression
|
||||
+ algorithms "XZ", "LZ4", and "ZSTD". If enabled, the default compression
|
||||
+ algorithm set at compile time will be used when opening a new journal file.
|
||||
+ If disabled, the journal file compression will be disabled. Note that the
|
||||
+ compression mode of existing journal files are not changed. To make the
|
||||
+ specified algorithm takes an effect immediately, you need to explicitly run
|
||||
+ `journalctl --rotate`.
|
||||
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
|
||||
index 1b8f0abf97..3c1385ddb0 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-file.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-file.c
|
||||
@@ -329,6 +329,48 @@ static bool compact_mode_requested(void) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
+#if HAVE_COMPRESSION
|
||||
+static Compression getenv_compression(void) {
|
||||
+ Compression c;
|
||||
+ const char *e;
|
||||
+ int r;
|
||||
+
|
||||
+ e = getenv("SYSTEMD_JOURNAL_COMPRESS");
|
||||
+ if (!e)
|
||||
+ return DEFAULT_COMPRESSION;
|
||||
+
|
||||
+ r = parse_boolean(e);
|
||||
+ if (r >= 0)
|
||||
+ return r ? DEFAULT_COMPRESSION : COMPRESSION_NONE;
|
||||
+
|
||||
+ c = compression_from_string(e);
|
||||
+ if (c < 0) {
|
||||
+ log_debug_errno(c, "Failed to parse SYSTEMD_JOURNAL_COMPRESS value, ignoring: %s", e);
|
||||
+ return DEFAULT_COMPRESSION;
|
||||
+ }
|
||||
+
|
||||
+ if (!compression_supported(c)) {
|
||||
+ log_debug("Unsupported compression algorithm specified, ignoring: %s", e);
|
||||
+ return DEFAULT_COMPRESSION;
|
||||
+ }
|
||||
+
|
||||
+ return c;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+static Compression compression_requested(void) {
|
||||
+#if HAVE_COMPRESSION
|
||||
+ static thread_local Compression cached = _COMPRESSION_INVALID;
|
||||
+
|
||||
+ if (cached < 0)
|
||||
+ cached = getenv_compression();
|
||||
+
|
||||
+ return cached;
|
||||
+#else
|
||||
+ return COMPRESSION_NONE;
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
static int journal_file_init_header(JournalFile *f, JournalFileFlags file_flags, JournalFile *template) {
|
||||
bool seal = false;
|
||||
ssize_t k;
|
||||
@@ -344,7 +386,7 @@ static int journal_file_init_header(JournalFile *f, JournalFileFlags file_flags,
|
||||
Header h = {
|
||||
.header_size = htole64(ALIGN64(sizeof(h))),
|
||||
.incompatible_flags = htole32(
|
||||
- FLAGS_SET(file_flags, JOURNAL_COMPRESS) * COMPRESSION_TO_HEADER_INCOMPATIBLE_FLAG(DEFAULT_COMPRESSION) |
|
||||
+ FLAGS_SET(file_flags, JOURNAL_COMPRESS) * COMPRESSION_TO_HEADER_INCOMPATIBLE_FLAG(compression_requested()) |
|
||||
keyed_hash_requested() * HEADER_INCOMPATIBLE_KEYED_HASH |
|
||||
compact_mode_requested() * HEADER_INCOMPATIBLE_COMPACT),
|
||||
.compatible_flags = htole32(seal * HEADER_COMPATIBLE_SEALED),
|
@ -0,0 +1,54 @@
|
||||
From 7c20d0bfec62de66e81f6b6e1c7ce9f3a3b3d5cf Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 15:03:35 +0900
|
||||
Subject: [PATCH] test: add test case that journal file is created with the
|
||||
requested compression algorithm
|
||||
|
||||
(cherry picked from commit d23a1c52a93206b0dbabcb4336752ccb796c11c3)
|
||||
|
||||
Resolves: #2184929
|
||||
---
|
||||
test/units/testsuite-04.sh | 32 ++++++++++++++++++++++++++++++++
|
||||
1 file changed, 32 insertions(+)
|
||||
|
||||
diff --git a/test/units/testsuite-04.sh b/test/units/testsuite-04.sh
|
||||
index fdc3273fea..bb41045809 100755
|
||||
--- a/test/units/testsuite-04.sh
|
||||
+++ b/test/units/testsuite-04.sh
|
||||
@@ -179,4 +179,36 @@ sleep 3
|
||||
# https://github.com/systemd/systemd/issues/15528
|
||||
journalctl --follow --file=/var/log/journal/*/* | head -n1 || [[ $? -eq 1 ]]
|
||||
|
||||
+# https://bugzilla.redhat.com/show_bug.cgi?id=2183546
|
||||
+mkdir /run/systemd/system/systemd-journald.service.d
|
||||
+MID=$(cat /etc/machine-id)
|
||||
+for c in "NONE" "XZ" "LZ4" "ZSTD"; do
|
||||
+ cat >/run/systemd/system/systemd-journald.service.d/compress.conf <<EOF
|
||||
+[Service]
|
||||
+Environment=SYSTEMD_JOURNAL_COMPRESS=${c}
|
||||
+EOF
|
||||
+ systemctl daemon-reload
|
||||
+ systemctl restart systemd-journald.service
|
||||
+ journalctl --rotate
|
||||
+
|
||||
+ ID=$(systemd-id128 new)
|
||||
+ systemd-cat -t "$ID" /bin/bash -c "for ((i=0;i<100;i++)); do echo -n hoge with ${c}; done; echo"
|
||||
+ journalctl --sync
|
||||
+ timeout 10 bash -c "while ! SYSTEMD_LOG_LEVEL=debug journalctl --verify --quiet --file /var/log/journal/$MID/system.journal 2>&1 | grep -q -F 'compress=${c}'; do sleep .5; done"
|
||||
+
|
||||
+ # $SYSTEMD_JOURNAL_COMPRESS= also works for journal-remote
|
||||
+ if [[ -x /usr/lib/systemd/systemd-journal-remote ]]; then
|
||||
+ for cc in "NONE" "XZ" "LZ4" "ZSTD"; do
|
||||
+ rm -f /tmp/foo.journal
|
||||
+ SYSTEMD_JOURNAL_COMPRESS="${cc}" /usr/lib/systemd/systemd-journal-remote --split-mode=none -o /tmp/foo.journal --getter="journalctl -b -o export -t $ID"
|
||||
+ SYSTEMD_LOG_LEVEL=debug journalctl --verify --quiet --file /tmp/foo.journal 2>&1 | grep -q -F "compress=${cc}"
|
||||
+ journalctl -t "$ID" -o cat --file /tmp/foo.journal | grep -q -F "hoge with ${c}"
|
||||
+ done
|
||||
+ fi
|
||||
+done
|
||||
+rm /run/systemd/system/systemd-journald.service.d/compress.conf
|
||||
+systemctl daemon-reload
|
||||
+systemctl restart systemd-journald.service
|
||||
+journalctl --rotate
|
||||
+
|
||||
touch /testok
|
@ -0,0 +1,51 @@
|
||||
From 15d494b7ee019ab3e3a2a8e61c73ea8693ddb8ba Mon Sep 17 00:00:00 2001
|
||||
From: Jan Macku <jamacku@redhat.com>
|
||||
Date: Mon, 17 Apr 2023 14:51:19 +0200
|
||||
Subject: [PATCH] ci: workflow for gathering metadata for source-git automation
|
||||
|
||||
Workflow gathers metadata like pull request numbers and information about commits.
|
||||
This metadata is used for commit validation and other actions.
|
||||
This workflow also triggers for rest of the source-git automation workflows.
|
||||
|
||||
rhel-only
|
||||
|
||||
Related: #2184929
|
||||
---
|
||||
.github/workflows/gather-metadata.yml | 28 +++++++++++++++++++++++++++
|
||||
1 file changed, 28 insertions(+)
|
||||
create mode 100644 .github/workflows/gather-metadata.yml
|
||||
|
||||
diff --git a/.github/workflows/gather-metadata.yml b/.github/workflows/gather-metadata.yml
|
||||
new file mode 100644
|
||||
index 0000000000..635708a71f
|
||||
--- /dev/null
|
||||
+++ b/.github/workflows/gather-metadata.yml
|
||||
@@ -0,0 +1,28 @@
|
||||
+name: Gather Pull Request Metadata
|
||||
+on:
|
||||
+ pull_request:
|
||||
+ types: [ opened, reopened, synchronize ]
|
||||
+ branches:
|
||||
+ - main
|
||||
+ - rhel-9.*.0
|
||||
+
|
||||
+permissions:
|
||||
+ contents: read
|
||||
+
|
||||
+jobs:
|
||||
+ gather-metadata:
|
||||
+ runs-on: ubuntu-latest
|
||||
+
|
||||
+ steps:
|
||||
+ - name: Repository checkout
|
||||
+ uses: actions/checkout@v3
|
||||
+
|
||||
+ - id: Metadata
|
||||
+ name: Gather Pull Request Metadata
|
||||
+ uses: redhat-plumbers-in-action/gather-pull-request-metadata@v1
|
||||
+
|
||||
+ - name: Upload artifact with gathered metadata
|
||||
+ uses: actions/upload-artifact@v3
|
||||
+ with:
|
||||
+ name: pr-metadata
|
||||
+ path: ${{ steps.Metadata.outputs.metadata-file }}
|
@ -0,0 +1,103 @@
|
||||
From 47c1a02ba0e669484e93dd78dd475592ecaa4cbd Mon Sep 17 00:00:00 2001
|
||||
From: Jan Macku <jamacku@redhat.com>
|
||||
Date: Mon, 17 Apr 2023 14:59:55 +0200
|
||||
Subject: [PATCH] ci: first part of the source-git automation - commit linter
|
||||
|
||||
Add a GitHub Workflow that is triggered on `workflow_run` events.
|
||||
It uses metadata provided by `redhat-plumbers-in-action/gather-pull-request-metadata`
|
||||
GitHub Action to get the PR number and the commit metadata.
|
||||
The commit metadata is then used to check if the commit message contains
|
||||
all required information (tracker and upstream reference). GitHub Action
|
||||
responsible for commit verification `redhat-plumbers-in-action/advanced-commit-linter`
|
||||
is configured via the `advanced-commit-linter.yml` file.
|
||||
|
||||
rhel-only
|
||||
|
||||
Related: #2184929
|
||||
---
|
||||
.github/advanced-commit-linter.yml | 23 +++++++++++
|
||||
.github/workflows/source-git-automation.yml | 45 +++++++++++++++++++++
|
||||
2 files changed, 68 insertions(+)
|
||||
create mode 100644 .github/advanced-commit-linter.yml
|
||||
create mode 100644 .github/workflows/source-git-automation.yml
|
||||
|
||||
diff --git a/.github/advanced-commit-linter.yml b/.github/advanced-commit-linter.yml
|
||||
new file mode 100644
|
||||
index 0000000000..491836abbb
|
||||
--- /dev/null
|
||||
+++ b/.github/advanced-commit-linter.yml
|
||||
@@ -0,0 +1,23 @@
|
||||
+policy:
|
||||
+ cherry-pick:
|
||||
+ upstream:
|
||||
+ - github: systemd/systemd
|
||||
+ - github: systemd/systemd-stable
|
||||
+ exception:
|
||||
+ note:
|
||||
+ - rhel-only
|
||||
+ tracker:
|
||||
+ - keyword:
|
||||
+ - 'Resolves: #?'
|
||||
+ - 'Related: #?'
|
||||
+ - 'Reverts: #?'
|
||||
+ issue-format:
|
||||
+ - '\d+$'
|
||||
+ url: 'https://bugzilla.redhat.com/show_bug.cgi?id='
|
||||
+ - keyword:
|
||||
+ - 'Resolves: '
|
||||
+ - 'Related: '
|
||||
+ - 'Reverts: '
|
||||
+ issue-format:
|
||||
+ - 'RHEL-\d+$'
|
||||
+ url: 'https://issues.redhat.com/browse/'
|
||||
diff --git a/.github/workflows/source-git-automation.yml b/.github/workflows/source-git-automation.yml
|
||||
new file mode 100644
|
||||
index 0000000000..140f21b116
|
||||
--- /dev/null
|
||||
+++ b/.github/workflows/source-git-automation.yml
|
||||
@@ -0,0 +1,45 @@
|
||||
+name: Source git Automation
|
||||
+on:
|
||||
+ workflow_run:
|
||||
+ workflows: [ Gather Pull Request Metadata ]
|
||||
+ types:
|
||||
+ - completed
|
||||
+
|
||||
+permissions:
|
||||
+ contents: read
|
||||
+
|
||||
+jobs:
|
||||
+ download-metadata:
|
||||
+ if: >
|
||||
+ github.event.workflow_run.event == 'pull_request' &&
|
||||
+ github.event.workflow_run.conclusion == 'success'
|
||||
+ runs-on: ubuntu-latest
|
||||
+
|
||||
+ outputs:
|
||||
+ pr-metadata: ${{ steps.Artifact.outputs.pr-metadata-json }}
|
||||
+
|
||||
+ steps:
|
||||
+ - id: Artifact
|
||||
+ name: Download Artifact
|
||||
+ uses: redhat-plumbers-in-action/download-artifact@v1
|
||||
+ with:
|
||||
+ name: pr-metadata
|
||||
+
|
||||
+ commit-linter:
|
||||
+ needs: [ download-metadata ]
|
||||
+ runs-on: ubuntu-latest
|
||||
+
|
||||
+ outputs:
|
||||
+ validated-pr-metadata: ${{ steps.commit-linter.outputs.validated-pr-metadata }}
|
||||
+
|
||||
+ permissions:
|
||||
+ statuses: write
|
||||
+ pull-requests: write
|
||||
+
|
||||
+ steps:
|
||||
+ - id: commit-linter
|
||||
+ name: Lint Commits
|
||||
+ uses: redhat-plumbers-in-action/advanced-commit-linter@v1
|
||||
+ with:
|
||||
+ pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
|
||||
+ token: ${{ secrets.GITHUB_TOKEN }}
|
@ -0,0 +1,33 @@
|
||||
From 0536963a3e4bef554b29b0d93f7d9bf93d75cbdf Mon Sep 17 00:00:00 2001
|
||||
From: rpm-build <rpm-build>
|
||||
Date: Fri, 24 Feb 2023 07:49:12 -0800
|
||||
Subject: [PATCH] Hardcode dm ioctl to use "0" as version minor part to
|
||||
allow co-operate with UEK3 whose dm version is lower than RHCK.
|
||||
|
||||
Orabug: 18467469
|
||||
Signed-off-by: Vaughan Cao <vaughan.cao@oracle.com>
|
||||
Signed-off-by: John Sobecki <john.sobecki@oracle.com>
|
||||
Signed-off-by: Darren Archibald <darren.archibald@oracle.com>
|
||||
Signed-off-by: Tony Rodriguez <tony.rodriguez@oracle.com>
|
||||
Reviewed-by: Laurence Rochfort <laurence.rochfort@oracle.com>
|
||||
Reviewed-by: Aleksandr Burmashev <alexander.burmashev@oracle.com>
|
||||
---
|
||||
src/shutdown/umount.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c
|
||||
index e650b82..522ebb3 100644
|
||||
--- a/src/shutdown/umount.c
|
||||
+++ b/src/shutdown/umount.c
|
||||
@@ -495,7 +495,7 @@ static int delete_dm(MountPoint *m) {
|
||||
return RET_NERRNO(ioctl(fd, DM_DEV_REMOVE, &(struct dm_ioctl) {
|
||||
.version = {
|
||||
DM_VERSION_MAJOR,
|
||||
- DM_VERSION_MINOR,
|
||||
+ 0,
|
||||
DM_VERSION_PATCHLEVEL
|
||||
},
|
||||
.data_size = sizeof(struct dm_ioctl),
|
||||
--
|
||||
2.27.0
|
||||
|
@ -0,0 +1,92 @@
|
||||
From efe3164e83da693f87e832c087797be8d466c306 Mon Sep 17 00:00:00 2001
|
||||
From: Tony Rodriguez <tony.rodriguez@oracle.com>
|
||||
Date: Mon, 27 Feb 2023 19:30:00 +0100
|
||||
Subject: Fix missing netdev for iscsi entry in fstab
|
||||
|
||||
Orabug: 25897792
|
||||
|
||||
|
||||
To check every entry of fstab whether it is iscsi and then set it
|
||||
to remote-fs.target on the corresponding ".mount' file. We use
|
||||
find_device() to find the corresponding device using the udev
|
||||
function.
|
||||
|
||||
Signed-off-by: Tony Lam <tony.l.lam@oracle.com>
|
||||
Signed-off-by: Alex Burmashev <alexander.burmashev@oracle.com>
|
||||
Signed-off-by: Darren Archibald <darren.archibald@oracle.com>
|
||||
Signed-off-by: Tony Rodriguez <tony.rodriguez@oracle.com>
|
||||
Reviewed-by: Laurence Rochfort <laurence.rochfort@oracle.com>
|
||||
Reviewed-by: Aleksandr Burmashev <alexander.burmashev@oracle.com>
|
||||
---
|
||||
|
||||
diff -Nur systemd-252.orig/meson.build systemd-252/meson.build
|
||||
--- systemd-252.orig/meson.build 2023-02-27 12:30:47.814831419 -0800
|
||||
+++ systemd-252/meson.build 2023-02-27 12:30:41.084646203 -0800
|
||||
@@ -2351,7 +2351,9 @@
|
||||
exe = executable(
|
||||
'systemd-fstab-generator',
|
||||
'src/fstab-generator/fstab-generator.c',
|
||||
- include_directories : includes,
|
||||
+ 'src/udev/udevadm-util.c',
|
||||
+ 'src/libsystemd/sd-device/device-util.c',
|
||||
+ include_directories : [includes, udev_includes],
|
||||
link_with : [libshared],
|
||||
install_rpath : rootpkglibdir,
|
||||
install : true,
|
||||
|
||||
diff -Nur systemd-252.orig/src/fstab-generator/fstab-generator.c systemd-252/src/fstab-generator/fstab-generator.c
|
||||
--- systemd-252.orig/src/fstab-generator/fstab-generator.c 2023-02-27 15:36:14.629052661 -0800
|
||||
+++ systemd-252/src/fstab-generator/fstab-generator.c 2023-02-27 18:21:13.382354633 -0800
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "util.h"
|
||||
#include "virt.h"
|
||||
#include "volatile-util.h"
|
||||
+#include "device-util.h"
|
||||
+#include "udevadm-util.h"
|
||||
|
||||
typedef enum MountPointFlags {
|
||||
MOUNT_NOAUTO = 1 << 0,
|
||||
@@ -735,6 +737,9 @@
|
||||
k = add_swap(fstab, what, me, flags);
|
||||
else {
|
||||
bool rw_only, automount;
|
||||
+ const char *name;
|
||||
+ _cleanup_(sd_device_unrefp) sd_device *device = NULL;
|
||||
+ int st;
|
||||
|
||||
rw_only = fstab_test_option(me->mnt_opts, "x-systemd.rw-only\0");
|
||||
automount = fstab_test_option(me->mnt_opts,
|
||||
@@ -749,6 +754,33 @@
|
||||
mount_is_network(me) ? SPECIAL_REMOTE_FS_TARGET :
|
||||
SPECIAL_LOCAL_FS_TARGET;
|
||||
|
||||
+ if (target_unit && strcmp(target_unit, SPECIAL_LOCAL_FS_TARGET) == 0){
|
||||
+ st = find_device(what, NULL, &device);
|
||||
+ if (st < 0 || !device) {
|
||||
+ /* For local device, find_device() will always be successful. For iscsi,
|
||||
+ during bootup time, find_device() may fail, so we set to REMOTE-FS
|
||||
+ if find_device() failed */
|
||||
+
|
||||
+ target_unit = SPECIAL_REMOTE_FS_TARGET;
|
||||
+ log_debug("set %s SPECIAL_REMOTE_FS_TARGET since device is NULL or find_device() return code is %d", what, st);
|
||||
+ }
|
||||
+ else {
|
||||
+ log_debug("device found %s: %p", where, device);
|
||||
+
|
||||
+ FOREACH_DEVICE_DEVLINK(device, name) {
|
||||
+ if (name && strstr(name, "iscsi")) {
|
||||
+ target_unit = SPECIAL_REMOTE_FS_TARGET;
|
||||
+ log_debug("set %s SPECIAL_REMOTE_FS_TARGET ", what);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (strcmp(target_unit, SPECIAL_LOCAL_FS_TARGET) == 0)
|
||||
+ log_debug("set %s SPECIAL_LOCAL_FS_TARGET ", what);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
k = add_mount(fstab,
|
||||
arg_dest,
|
||||
what,
|
@ -0,0 +1,38 @@
|
||||
From 4dd615f7727cfc52f9b6b3c7f88425631326477f Mon Sep 17 00:00:00 2001
|
||||
From: Aleksandr Burmashev <alexander.burmashev@oracle.com>
|
||||
Date: Fri, 4 Feb 2022 13:12:14 +0100
|
||||
Subject: udev rules: fix for memory hot add and remove
|
||||
|
||||
This patch allows hot added memory for kvm guests to be
|
||||
onlined as 'online_movable', thus facilitating removal
|
||||
of the same hot added memory at a later point in time.
|
||||
|
||||
The use of 'online_movable' prevents kernel allocations
|
||||
from occuring within the memory. Kernel allocations
|
||||
tend to be persistent, and thus prevent removal of
|
||||
memory.
|
||||
|
||||
|
||||
Orabug: 31310273
|
||||
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||
Reviewed-by: Tony Rodriguez <tony.rodriguez@oracle.com>
|
||||
Reviewed-by: Laurence Rochfort <laurence.rochfort@oracle.com>
|
||||
---
|
||||
rules.d/40-redhat.rules | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/rules.d/40-redhat.rules b/rules.d/40-redhat.rules
|
||||
index 3c95cd2..43c8ab4 100644
|
||||
--- a/rules.d/40-redhat.rules
|
||||
+++ b/rules.d/40-redhat.rules
|
||||
@@ -11,6 +11,7 @@ CONST{arch}=="ppc64*", GOTO="memory_hotplug_end"
|
||||
|
||||
ENV{.state}="online"
|
||||
CONST{virt}=="none", ENV{.state}="online_movable"
|
||||
+CONST{virt}=="kvm", ENV{.state}="online_movable"
|
||||
ATTR{state}=="offline", ATTR{state}="$env{.state}"
|
||||
|
||||
LABEL="memory_hotplug_end"
|
||||
--
|
||||
2.27.0
|
||||
|
@ -0,0 +1,58 @@
|
||||
From 949d205261192998ed612da48e6d06429c8de629 Mon Sep 17 00:00:00 2001
|
||||
From: Aleksandr Burmashev <alexander.burmashev@oracle.com>
|
||||
Date: Fri, 4 Feb 2022 13:24:09 +0100
|
||||
Subject: Disable unprivileged BPF by default
|
||||
|
||||
There are several CVEs whose mitigation is to disable unprivileged BPF
|
||||
by default. While all these can, and should, be fixed the issues keep
|
||||
arising and to be defensive we need to disable unprivileged BPF.
|
||||
Note that the upstream kernel _does_ permit unprivileged BPF and so
|
||||
this patch is not suggesting making a change there; this is a non-invasive,
|
||||
safe, reversible change.
|
||||
|
||||
This patch simply adds this /usr/lib/sysctl.d/01-unprivileged-bpf.conf
|
||||
to systemd with this content:
|
||||
|
||||
~~
|
||||
kernel.unprivileged_bpf_disabled=1
|
||||
~~
|
||||
|
||||
Orabug: 32870980
|
||||
|
||||
Suggested-by: John Haxby <john.haxby@oracle.com>
|
||||
Signed-off-by: Isaac Chen <isaac.chen@oracle.com>
|
||||
Reviewed-by: Tony Rodriguez <tony.rodriguez@oracle.com>
|
||||
Reviewed-by: Laurence Rochfort <laurence.rochfort@oracle.com>
|
||||
---
|
||||
sysctl.d/01-unprivileged-bpf.conf | 6 ++++++
|
||||
sysctl.d/meson.build | 1 +
|
||||
2 files changed, 7 insertions(+)
|
||||
create mode 100644 sysctl.d/01-unprivileged-bpf.conf
|
||||
|
||||
diff --git a/sysctl.d/01-unprivileged-bpf.conf b/sysctl.d/01-unprivileged-bpf.conf
|
||||
new file mode 100644
|
||||
index 0000000..1f230ea
|
||||
--- /dev/null
|
||||
+++ b/sysctl.d/01-unprivileged-bpf.conf
|
||||
@@ -0,0 +1,6 @@
|
||||
+# When running UEK, this file ensures that unprivileged BPF is disabled by
|
||||
+# default. To enable it, copy this file to /etc/sysctl.d, comment out the
|
||||
+# last line and reboot.
|
||||
+#
|
||||
+# You may also need to rebuild your initramfs with "dracut -f".
|
||||
+kernel.unprivileged_bpf_disabled=1
|
||||
diff --git a/sysctl.d/meson.build b/sysctl.d/meson.build
|
||||
index 6f3db59..07f395d 100644
|
||||
--- a/sysctl.d/meson.build
|
||||
+++ b/sysctl.d/meson.build
|
||||
@@ -3,6 +3,7 @@
|
||||
install_data(
|
||||
'README',
|
||||
'50-default.conf',
|
||||
+ '01-unprivileged-bpf.conf',
|
||||
install_dir : sysctldir)
|
||||
|
||||
# Kernel determines PID_MAX_LIMIT by
|
||||
--
|
||||
2.27.0
|
||||
|
@ -0,0 +1,69 @@
|
||||
From 3a3b022d2cc112803ea7b9beea98bbcad110368a Mon Sep 17 00:00:00 2001
|
||||
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||
Date: Tue, 29 Mar 2022 12:49:54 +0200
|
||||
Subject: [PATCH] shutdown: get only active md arrays.
|
||||
|
||||
Current md_list_get() implementation filters all block devices, started from
|
||||
"md*". This is ambiguous because list could contain:
|
||||
- partitions created upon md device (mdXpY)
|
||||
- external metadata container- specific type of md array.
|
||||
|
||||
For partitions there is no issue, because they aren't handle STOP_ARRAY
|
||||
ioctl sent later. It generates misleading errors only.
|
||||
|
||||
Second case is more problematic because containers are not locked in kernel.
|
||||
They are stopped even if container member array is active. For that reason
|
||||
reboot or shutdown flow could be blocked because metadata manager cannot be
|
||||
restarted after switch root on shutdown.
|
||||
|
||||
Add filters to remove partitions and containers from md_list. Partitions
|
||||
can be excluded by DEVTYPE. Containers are determined by MD_LEVEL
|
||||
property, we are excluding all with "container" value.
|
||||
|
||||
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||
|
||||
Orabug: 34467234
|
||||
Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com>
|
||||
Reviewed-by: Laurence Rochfort <laurence.rochfort@oracle.com>
|
||||
---
|
||||
src/shutdown/umount.c | 18 +++++++++++++++++-
|
||||
1 file changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c
|
||||
index 3e9e241499a5..820aa8e28685 100644
|
||||
--- a/src/shutdown/umount.c
|
||||
+++ b/src/shutdown/umount.c
|
||||
@@ -352,9 +352,14 @@ static int md_list_get(MountPoint **head) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
+ /* Filter out partitions. */
|
||||
+ r = sd_device_enumerator_add_match_property(e, "DEVTYPE", "disk");
|
||||
+ if (r < 0)
|
||||
+ return r;
|
||||
+
|
||||
FOREACH_DEVICE(e, d) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
- const char *dn;
|
||||
+ const char *dn, *md_level;
|
||||
MountPoint *m;
|
||||
dev_t devnum;
|
||||
|
||||
@@ -362,6 +367,17 @@ static int md_list_get(MountPoint **head) {
|
||||
sd_device_get_devname(d, &dn) < 0)
|
||||
continue;
|
||||
|
||||
+ r = sd_device_get_property_value(d, "MD_LEVEL", &md_level);
|
||||
+ if (r < 0) {
|
||||
+ log_warning_errno(r, "Failed to get MD_LEVEL property for %s, ignoring: %m", dn);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* MD "containers" are a special type of MD devices, used for external metadata.
|
||||
+ * Since it doesn't provide RAID functionality in itself we don't need to stop it. */
|
||||
+ if (streq(md_level, "container"))
|
||||
+ continue;
|
||||
+
|
||||
p = strdup(dn);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
@ -0,0 +1,491 @@
|
||||
From 5fbaa757077bde2db8d33b1c358518c41b990339 Mon Sep 17 00:00:00 2001
|
||||
From: Eric DeVolder <eric.devolder@oracle.com>
|
||||
Date: Mon, 21 Nov 2022 11:27:27 -0500
|
||||
Subject: [PATCH] pstore: fixes for dmesg.txt reconstruction
|
||||
|
||||
This patch fixes problems with the re-assembly of the dmesg
|
||||
from the records stored in pstore.
|
||||
|
||||
The current code simply ignores the last 6 characters of the
|
||||
file name to form a base record id, which then groups any
|
||||
pstore files with this base id into the reconstructed dmesg.txt.
|
||||
This approach fails when the following oops generated the
|
||||
following in pstore:
|
||||
|
||||
-rw-------. 1 root root 1808 Oct 27 22:07 dmesg-efi-166692286101001
|
||||
-rw-------. 1 root root 1341 Oct 27 22:07 dmesg-efi-166692286101002
|
||||
-rw-------. 1 root root 1812 Oct 27 22:07 dmesg-efi-166692286102001
|
||||
-rw-------. 1 root root 1820 Oct 27 22:07 dmesg-efi-166692286102002
|
||||
-rw-------. 1 root root 1807 Oct 27 22:07 dmesg-efi-166692286103001
|
||||
-rw-------. 1 root root 1791 Oct 27 22:07 dmesg-efi-166692286103002
|
||||
-rw-------. 1 root root 1773 Oct 27 22:07 dmesg-efi-166692286104001
|
||||
-rw-------. 1 root root 1801 Oct 27 22:07 dmesg-efi-166692286104002
|
||||
-rw-------. 1 root root 1821 Oct 27 22:07 dmesg-efi-166692286105001
|
||||
-rw-------. 1 root root 1809 Oct 27 22:07 dmesg-efi-166692286105002
|
||||
-rw-------. 1 root root 1804 Oct 27 22:07 dmesg-efi-166692286106001
|
||||
-rw-------. 1 root root 1817 Oct 27 22:07 dmesg-efi-166692286106002
|
||||
-rw-------. 1 root root 1792 Oct 27 22:07 dmesg-efi-166692286107001
|
||||
-rw-------. 1 root root 1810 Oct 27 22:07 dmesg-efi-166692286107002
|
||||
-rw-------. 1 root root 1717 Oct 27 22:07 dmesg-efi-166692286108001
|
||||
-rw-------. 1 root root 1808 Oct 27 22:07 dmesg-efi-166692286108002
|
||||
-rw-------. 1 root root 1764 Oct 27 22:07 dmesg-efi-166692286109001
|
||||
-rw-------. 1 root root 1765 Oct 27 22:07 dmesg-efi-166692286109002
|
||||
-rw-------. 1 root root 1796 Oct 27 22:07 dmesg-efi-166692286110001
|
||||
-rw-------. 1 root root 1816 Oct 27 22:07 dmesg-efi-166692286110002
|
||||
-rw-------. 1 root root 1793 Oct 27 22:07 dmesg-efi-166692286111001
|
||||
-rw-------. 1 root root 1751 Oct 27 22:07 dmesg-efi-166692286111002
|
||||
-rw-------. 1 root root 1813 Oct 27 22:07 dmesg-efi-166692286112001
|
||||
-rw-------. 1 root root 1786 Oct 27 22:07 dmesg-efi-166692286112002
|
||||
-rw-------. 1 root root 1754 Oct 27 22:07 dmesg-efi-166692286113001
|
||||
-rw-------. 1 root root 1752 Oct 27 22:07 dmesg-efi-166692286113002
|
||||
-rw-------. 1 root root 1803 Oct 27 22:07 dmesg-efi-166692286114001
|
||||
-rw-------. 1 root root 1759 Oct 27 22:07 dmesg-efi-166692286114002
|
||||
-rw-------. 1 root root 1805 Oct 27 22:07 dmesg-efi-166692286115001
|
||||
-rw-------. 1 root root 1787 Oct 27 22:07 dmesg-efi-166692286115002
|
||||
-rw-------. 1 root root 1815 Oct 27 22:07 dmesg-efi-166692286116001
|
||||
-rw-------. 1 root root 1771 Oct 27 22:07 dmesg-efi-166692286116002
|
||||
-rw-------. 1 root root 1816 Oct 27 22:07 dmesg-efi-166692286117002
|
||||
-rw-------. 1 root root 1388 Oct 27 22:07 dmesg-efi-166692286701003
|
||||
-rw-------. 1 root root 1824 Oct 27 22:07 dmesg-efi-166692286702003
|
||||
-rw-------. 1 root root 1795 Oct 27 22:07 dmesg-efi-166692286703003
|
||||
-rw-------. 1 root root 1805 Oct 27 22:07 dmesg-efi-166692286704003
|
||||
-rw-------. 1 root root 1813 Oct 27 22:07 dmesg-efi-166692286705003
|
||||
-rw-------. 1 root root 1821 Oct 27 22:07 dmesg-efi-166692286706003
|
||||
-rw-------. 1 root root 1814 Oct 27 22:07 dmesg-efi-166692286707003
|
||||
-rw-------. 1 root root 1812 Oct 27 22:07 dmesg-efi-166692286708003
|
||||
-rw-------. 1 root root 1769 Oct 27 22:07 dmesg-efi-166692286709003
|
||||
-rw-------. 1 root root 1820 Oct 27 22:07 dmesg-efi-166692286710003
|
||||
-rw-------. 1 root root 1755 Oct 27 22:07 dmesg-efi-166692286711003
|
||||
-rw-------. 1 root root 1790 Oct 27 22:07 dmesg-efi-166692286712003
|
||||
-rw-------. 1 root root 1756 Oct 27 22:07 dmesg-efi-166692286713003
|
||||
-rw-------. 1 root root 1763 Oct 27 22:07 dmesg-efi-166692286714003
|
||||
-rw-------. 1 root root 1791 Oct 27 22:07 dmesg-efi-166692286715003
|
||||
-rw-------. 1 root root 1775 Oct 27 22:07 dmesg-efi-166692286716003
|
||||
-rw-------. 1 root root 1820 Oct 27 22:07 dmesg-efi-166692286717003
|
||||
|
||||
The "reconstructed" dmesg.txt that resulted from the above contained
|
||||
the following (ignoring actual contents, just providing the Part info):
|
||||
|
||||
Emergency#3 Part17
|
||||
Emergency#3 Part16
|
||||
Emergency#3 Part15
|
||||
Emergency#3 Part14
|
||||
Emergency#3 Part13
|
||||
Emergency#3 Part12
|
||||
Emergency#3 Part11
|
||||
Emergency#3 Part10
|
||||
Emergency#3 Part9
|
||||
Emergency#3 Part8
|
||||
Emergency#3 Part7
|
||||
Emergency#3 Part6
|
||||
Emergency#3 Part5
|
||||
Emergency#3 Part4
|
||||
Emergency#3 Part3
|
||||
Emergency#3 Part2
|
||||
Emergency#3 Part1
|
||||
Panic#2 Part17
|
||||
Panic#2 Part16
|
||||
Oops#1 Part16
|
||||
Panic#2 Part15
|
||||
Oops#1 Part15
|
||||
Panic#2 Part14
|
||||
Oops#1 Part14
|
||||
Panic#2 Part13
|
||||
Oops#1 Part13
|
||||
Panic#2 Part12
|
||||
Oops#1 Part12
|
||||
Panic#2 Part11
|
||||
Oops#1 Part11
|
||||
Panic#2 Part10
|
||||
Oops#1 Part10
|
||||
Panic#2 Part9
|
||||
Oops#1 Part9
|
||||
Panic#2 Part8
|
||||
Oops#1 Part8
|
||||
Panic#2 Part7
|
||||
Oops#1 Part7
|
||||
Panic#2 Part6
|
||||
Oops#1 Part6
|
||||
Panic#2 Part5
|
||||
Oops#1 Part5
|
||||
Panic#2 Part4
|
||||
Oops#1 Part4
|
||||
Panic#2 Part3
|
||||
Oops#1 Part3
|
||||
Panic#2 Part2
|
||||
Oops#1 Part2
|
||||
Panic#2 Part1
|
||||
Oops#1 Part1
|
||||
|
||||
The above is a interleaved mess of three dmesg dumps.
|
||||
|
||||
This patch fixes the above problems, and simplifies the dmesg
|
||||
reconstruction process. The code now distinguishes between
|
||||
records on EFI vs ERST, which have differently formatted
|
||||
record identifiers. Using knowledge of the format of the
|
||||
record ids allows vastly improved reconstruction process.
|
||||
|
||||
With this change in place, the above pstore records now
|
||||
result in the following:
|
||||
|
||||
# ls -alR /var/lib/systemd/pstore
|
||||
1666922861:
|
||||
total 8
|
||||
drwxr-xr-x. 4 root root 28 Nov 18 14:58 .
|
||||
drwxr-xr-x. 7 root root 144 Nov 18 14:58 ..
|
||||
drwxr-xr-x. 2 root root 4096 Nov 18 14:58 001
|
||||
drwxr-xr-x. 2 root root 4096 Nov 18 14:58 002
|
||||
|
||||
1666922861/001:
|
||||
total 100
|
||||
drwxr-xr-x. 2 root root 4096 Nov 18 14:58 .
|
||||
drwxr-xr-x. 4 root root 28 Nov 18 14:58 ..
|
||||
-rw-------. 1 root root 1808 Oct 27 22:07 dmesg-efi-166692286101001
|
||||
-rw-------. 1 root root 1812 Oct 27 22:07 dmesg-efi-166692286102001
|
||||
-rw-------. 1 root root 1807 Oct 27 22:07 dmesg-efi-166692286103001
|
||||
-rw-------. 1 root root 1773 Oct 27 22:07 dmesg-efi-166692286104001
|
||||
-rw-------. 1 root root 1821 Oct 27 22:07 dmesg-efi-166692286105001
|
||||
-rw-------. 1 root root 1804 Oct 27 22:07 dmesg-efi-166692286106001
|
||||
-rw-------. 1 root root 1792 Oct 27 22:07 dmesg-efi-166692286107001
|
||||
-rw-------. 1 root root 1717 Oct 27 22:07 dmesg-efi-166692286108001
|
||||
-rw-------. 1 root root 1764 Oct 27 22:07 dmesg-efi-166692286109001
|
||||
-rw-------. 1 root root 1796 Oct 27 22:07 dmesg-efi-166692286110001
|
||||
-rw-------. 1 root root 1793 Oct 27 22:07 dmesg-efi-166692286111001
|
||||
-rw-------. 1 root root 1813 Oct 27 22:07 dmesg-efi-166692286112001
|
||||
-rw-------. 1 root root 1754 Oct 27 22:07 dmesg-efi-166692286113001
|
||||
-rw-------. 1 root root 1803 Oct 27 22:07 dmesg-efi-166692286114001
|
||||
-rw-------. 1 root root 1805 Oct 27 22:07 dmesg-efi-166692286115001
|
||||
-rw-------. 1 root root 1815 Oct 27 22:07 dmesg-efi-166692286116001
|
||||
-rw-r-----. 1 root root 28677 Nov 18 14:58 dmesg.txt
|
||||
|
||||
1666922861/002:
|
||||
total 104
|
||||
drwxr-xr-x. 2 root root 4096 Nov 18 14:58 .
|
||||
drwxr-xr-x. 4 root root 28 Nov 18 14:58 ..
|
||||
-rw-------. 1 root root 1341 Oct 27 22:07 dmesg-efi-166692286101002
|
||||
-rw-------. 1 root root 1820 Oct 27 22:07 dmesg-efi-166692286102002
|
||||
-rw-------. 1 root root 1791 Oct 27 22:07 dmesg-efi-166692286103002
|
||||
-rw-------. 1 root root 1801 Oct 27 22:07 dmesg-efi-166692286104002
|
||||
-rw-------. 1 root root 1809 Oct 27 22:07 dmesg-efi-166692286105002
|
||||
-rw-------. 1 root root 1817 Oct 27 22:07 dmesg-efi-166692286106002
|
||||
-rw-------. 1 root root 1810 Oct 27 22:07 dmesg-efi-166692286107002
|
||||
-rw-------. 1 root root 1808 Oct 27 22:07 dmesg-efi-166692286108002
|
||||
-rw-------. 1 root root 1765 Oct 27 22:07 dmesg-efi-166692286109002
|
||||
-rw-------. 1 root root 1816 Oct 27 22:07 dmesg-efi-166692286110002
|
||||
-rw-------. 1 root root 1751 Oct 27 22:07 dmesg-efi-166692286111002
|
||||
-rw-------. 1 root root 1786 Oct 27 22:07 dmesg-efi-166692286112002
|
||||
-rw-------. 1 root root 1752 Oct 27 22:07 dmesg-efi-166692286113002
|
||||
-rw-------. 1 root root 1759 Oct 27 22:07 dmesg-efi-166692286114002
|
||||
-rw-------. 1 root root 1787 Oct 27 22:07 dmesg-efi-166692286115002
|
||||
-rw-------. 1 root root 1771 Oct 27 22:07 dmesg-efi-166692286116002
|
||||
-rw-------. 1 root root 1816 Oct 27 22:07 dmesg-efi-166692286117002
|
||||
-rw-r-----. 1 root root 30000 Nov 18 14:58 dmesg.txt
|
||||
|
||||
1666922867:
|
||||
total 4
|
||||
drwxr-xr-x. 3 root root 17 Nov 18 14:58 .
|
||||
drwxr-xr-x. 7 root root 144 Nov 18 14:58 ..
|
||||
drwxr-xr-x. 2 root root 4096 Nov 18 14:58 003
|
||||
|
||||
1666922867/003:
|
||||
total 104
|
||||
drwxr-xr-x. 2 root root 4096 Nov 18 14:58 .
|
||||
drwxr-xr-x. 3 root root 17 Nov 18 14:58 ..
|
||||
-rw-------. 1 root root 1388 Oct 27 22:07 dmesg-efi-166692286701003
|
||||
-rw-------. 1 root root 1824 Oct 27 22:07 dmesg-efi-166692286702003
|
||||
-rw-------. 1 root root 1795 Oct 27 22:07 dmesg-efi-166692286703003
|
||||
-rw-------. 1 root root 1805 Oct 27 22:07 dmesg-efi-166692286704003
|
||||
-rw-------. 1 root root 1813 Oct 27 22:07 dmesg-efi-166692286705003
|
||||
-rw-------. 1 root root 1821 Oct 27 22:07 dmesg-efi-166692286706003
|
||||
-rw-------. 1 root root 1814 Oct 27 22:07 dmesg-efi-166692286707003
|
||||
-rw-------. 1 root root 1812 Oct 27 22:07 dmesg-efi-166692286708003
|
||||
-rw-------. 1 root root 1769 Oct 27 22:07 dmesg-efi-166692286709003
|
||||
-rw-------. 1 root root 1820 Oct 27 22:07 dmesg-efi-166692286710003
|
||||
-rw-------. 1 root root 1755 Oct 27 22:07 dmesg-efi-166692286711003
|
||||
-rw-------. 1 root root 1790 Oct 27 22:07 dmesg-efi-166692286712003
|
||||
-rw-------. 1 root root 1756 Oct 27 22:07 dmesg-efi-166692286713003
|
||||
-rw-------. 1 root root 1763 Oct 27 22:07 dmesg-efi-166692286714003
|
||||
-rw-------. 1 root root 1791 Oct 27 22:07 dmesg-efi-166692286715003
|
||||
-rw-------. 1 root root 1775 Oct 27 22:07 dmesg-efi-166692286716003
|
||||
-rw-------. 1 root root 1820 Oct 27 22:07 dmesg-efi-166692286717003
|
||||
-rw-r-----. 1 root root 30111 Nov 18 14:58 dmesg.txt
|
||||
|
||||
Furthemore, pstore records on ERST are now able to accurately
|
||||
identify the change in timestamp sequence in order to start a
|
||||
new dmesg.txt, as needed.
|
||||
---
|
||||
src/pstore/pstore.c | 204 ++++++++++++++++++--------------------------
|
||||
1 file changed, 83 insertions(+), 121 deletions(-)
|
||||
|
||||
diff --git a/src/pstore/pstore.c b/src/pstore/pstore.c
|
||||
index f8e6582d5b..6c3d577507 100644
|
||||
--- a/src/pstore/pstore.c
|
||||
+++ b/src/pstore/pstore.c
|
||||
@@ -114,7 +114,7 @@ static int compare_pstore_entries(const PStoreEntry *a, const PStoreEntry *b) {
|
||||
return strcmp(a->dirent.d_name, b->dirent.d_name);
|
||||
}
|
||||
|
||||
-static int move_file(PStoreEntry *pe, const char *subdir) {
|
||||
+static int move_file(PStoreEntry *pe, const char *subdir1, const char *subdir2) {
|
||||
_cleanup_free_ char *ifd_path = NULL, *ofd_path = NULL;
|
||||
_cleanup_free_ void *field = NULL;
|
||||
const char *suffix, *message;
|
||||
@@ -128,7 +128,7 @@ static int move_file(PStoreEntry *pe, const char *subdir) {
|
||||
if (!ifd_path)
|
||||
return log_oom();
|
||||
|
||||
- ofd_path = path_join(arg_archivedir, subdir, pe->dirent.d_name);
|
||||
+ ofd_path = path_join(arg_archivedir, subdir1, subdir2, pe->dirent.d_name);
|
||||
if (!ofd_path)
|
||||
return log_oom();
|
||||
|
||||
@@ -171,153 +171,115 @@ static int move_file(PStoreEntry *pe, const char *subdir) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int write_dmesg(const char *dmesg, size_t size, const char *id) {
|
||||
- _cleanup_(unlink_and_freep) char *tmp_path = NULL;
|
||||
+static int append_dmesg(PStoreEntry *pe, const char *subdir1, const char *subdir2) {
|
||||
+ /* Append dmesg chunk to end, create if needed */
|
||||
_cleanup_free_ char *ofd_path = NULL;
|
||||
_cleanup_close_ int ofd = -1;
|
||||
ssize_t wr;
|
||||
- int r;
|
||||
|
||||
- if (size == 0)
|
||||
- return 0;
|
||||
+ assert(pe);
|
||||
|
||||
- assert(dmesg);
|
||||
+ if (pe->content_size == 0)
|
||||
+ return 0;
|
||||
|
||||
- ofd_path = path_join(arg_archivedir, id, "dmesg.txt");
|
||||
+ ofd_path = path_join(arg_archivedir, subdir1, subdir2, "dmesg.txt");
|
||||
if (!ofd_path)
|
||||
return log_oom();
|
||||
|
||||
- ofd = open_tmpfile_linkable(ofd_path, O_CLOEXEC|O_CREAT|O_TRUNC|O_WRONLY, &tmp_path);
|
||||
+ ofd = open(ofd_path, O_CREAT|O_NOFOLLOW|O_NOCTTY|O_CLOEXEC|O_APPEND|O_WRONLY, 0640);
|
||||
if (ofd < 0)
|
||||
- return log_error_errno(ofd, "Failed to open temporary file %s: %m", ofd_path);
|
||||
- wr = write(ofd, dmesg, size);
|
||||
+ return log_error_errno(ofd, "Failed to open file %s: %m", ofd_path);
|
||||
+ wr = write(ofd, pe->content, pe->content_size);
|
||||
if (wr < 0)
|
||||
return log_error_errno(errno, "Failed to store dmesg to %s: %m", ofd_path);
|
||||
- if (wr != (ssize_t)size)
|
||||
- return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to store dmesg to %s. %zu bytes are lost.", ofd_path, size - wr);
|
||||
- r = link_tmpfile(ofd, tmp_path, ofd_path);
|
||||
- if (r < 0)
|
||||
- return log_error_errno(r, "Failed to write temporary file %s: %m", ofd_path);
|
||||
- tmp_path = mfree(tmp_path);
|
||||
+ if ((size_t)wr != pe->content_size)
|
||||
+ return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to store dmesg to %s. %zu bytes are lost.", ofd_path, pe->content_size - wr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void process_dmesg_files(PStoreList *list) {
|
||||
+static int process_dmesg_files(PStoreList *list) {
|
||||
/* Move files, reconstruct dmesg.txt */
|
||||
- _cleanup_free_ char *dmesg = NULL, *dmesg_id = NULL;
|
||||
- size_t dmesg_size = 0;
|
||||
- bool dmesg_bad = false;
|
||||
- PStoreEntry *pe;
|
||||
+ _cleanup_free_ char *erst_subdir = NULL;
|
||||
+ uint64_t last_record_id = 0;
|
||||
+
|
||||
+ /* When dmesg is written into pstore, it is done so in small chunks, whatever the exchange buffer
|
||||
+ * size is with the underlying pstore backend (ie. EFI may be ~2KiB), which means an example
|
||||
+ * pstore with approximately 64KB of storage may have up to roughly 32 dmesg files, some likely
|
||||
+ * related.
|
||||
+ *
|
||||
+ * Here we look at the dmesg filename and try to discern if files are part of a related group,
|
||||
+ * meaning the same original dmesg.
|
||||
+ *
|
||||
+ * The dmesg- filename contains the backend-type and the Common Platform Error Record, CPER,
|
||||
+ * record id, a 64-bit number.
|
||||
+ *
|
||||
+ * Files are processed in reverse lexigraphical order so as to properly reconstruct original dmesg.*/
|
||||
|
||||
- /* Handle each dmesg file: files processed in reverse
|
||||
- * order so as to properly reconstruct original dmesg */
|
||||
for (size_t n = list->n_entries; n > 0; n--) {
|
||||
- bool move_file_and_continue = false;
|
||||
- _cleanup_free_ char *pe_id = NULL;
|
||||
+ PStoreEntry *pe;
|
||||
char *p;
|
||||
- size_t plen;
|
||||
|
||||
pe = &list->entries[n-1];
|
||||
|
||||
if (pe->handled)
|
||||
continue;
|
||||
- if (!startswith(pe->dirent.d_name, "dmesg-"))
|
||||
- continue;
|
||||
-
|
||||
if (endswith(pe->dirent.d_name, ".enc.z")) /* indicates a problem */
|
||||
- move_file_and_continue = true;
|
||||
- p = strrchr(pe->dirent.d_name, '-');
|
||||
- if (!p)
|
||||
- move_file_and_continue = true;
|
||||
-
|
||||
- if (move_file_and_continue) {
|
||||
- /* A dmesg file on which we do NO additional processing */
|
||||
- (void) move_file(pe, NULL);
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- /* See if this file is one of a related group of files
|
||||
- * in order to reconstruct dmesg */
|
||||
-
|
||||
- /* When dmesg is written into pstore, it is done so in
|
||||
- * small chunks, whatever the exchange buffer size is
|
||||
- * with the underlying pstore backend (ie. EFI may be
|
||||
- * ~2KiB), which means an example pstore with approximately
|
||||
- * 64KB of storage may have up to roughly 32 dmesg files
|
||||
- * that could be related, depending upon the size of the
|
||||
- * original dmesg.
|
||||
- *
|
||||
- * Here we look at the dmesg filename and try to discern
|
||||
- * if files are part of a related group, meaning the same
|
||||
- * original dmesg.
|
||||
- *
|
||||
- * The two known pstore backends are EFI and ERST. These
|
||||
- * backends store data in the Common Platform Error
|
||||
- * Record, CPER, format. The dmesg- filename contains the
|
||||
- * CPER record id, a 64bit number (in decimal notation).
|
||||
- * In Linux, the record id is encoded with two digits for
|
||||
- * the dmesg part (chunk) number and 3 digits for the
|
||||
- * count number. So allowing an additional digit to
|
||||
- * compensate for advancing time, this code ignores the
|
||||
- * last six digits of the filename in determining the
|
||||
- * record id.
|
||||
- *
|
||||
- * For the EFI backend, the record id encodes an id in the
|
||||
- * upper 32 bits, and a timestamp in the lower 32-bits.
|
||||
- * So ignoring the least significant 6 digits has proven
|
||||
- * to generally identify related dmesg entries. */
|
||||
-#define PSTORE_FILENAME_IGNORE 6
|
||||
-
|
||||
- /* determine common portion of record id */
|
||||
- ++p; /* move beyond dmesg- */
|
||||
- plen = strlen(p);
|
||||
- if (plen > PSTORE_FILENAME_IGNORE) {
|
||||
- pe_id = memdup_suffix0(p, plen - PSTORE_FILENAME_IGNORE);
|
||||
- if (!pe_id) {
|
||||
- log_oom();
|
||||
- return;
|
||||
- }
|
||||
- } else
|
||||
- pe_id = mfree(pe_id);
|
||||
-
|
||||
- /* Now move file from pstore to archive storage */
|
||||
- move_file(pe, pe_id);
|
||||
-
|
||||
- if (dmesg_bad)
|
||||
continue;
|
||||
-
|
||||
- /* If the current record id is NOT the same as the
|
||||
- * previous record id, then start a new dmesg.txt file */
|
||||
- if (!streq_ptr(pe_id, dmesg_id)) {
|
||||
- /* Encountered a new dmesg group, close out old one, open new one */
|
||||
- (void) write_dmesg(dmesg, dmesg_size, dmesg_id);
|
||||
- dmesg_size = 0;
|
||||
-
|
||||
- /* now point dmesg_id to storage of pe_id */
|
||||
- free_and_replace(dmesg_id, pe_id);
|
||||
- }
|
||||
-
|
||||
- /* Reconstruction of dmesg is done as a useful courtesy: do not fail, but don't write garbled
|
||||
- * output either. */
|
||||
- size_t needed = strlen(pe->dirent.d_name) + strlen(":\n") + pe->content_size + 1;
|
||||
- if (!GREEDY_REALLOC(dmesg, dmesg_size + needed)) {
|
||||
- log_oom();
|
||||
- dmesg_bad = true;
|
||||
+ if (!startswith(pe->dirent.d_name, "dmesg-"))
|
||||
continue;
|
||||
- }
|
||||
-
|
||||
- dmesg_size += sprintf(dmesg + dmesg_size, "%s:\n", pe->dirent.d_name);
|
||||
- if (pe->content) {
|
||||
- memcpy(dmesg + dmesg_size, pe->content, pe->content_size);
|
||||
- dmesg_size += pe->content_size;
|
||||
- }
|
||||
|
||||
- pe_id = mfree(pe_id);
|
||||
+ if ((p = startswith(pe->dirent.d_name, "dmesg-efi-"))) {
|
||||
+ /* For the EFI backend, the 3 least significant digits of record id encodes a
|
||||
+ * "count" number, the next 2 least significant digits for the dmesg part
|
||||
+ * (chunk) number, and the remaining digits as the timestamp. See
|
||||
+ * linux/drivers/firmware/efi/efi-pstore.c in efi_pstore_write(). */
|
||||
+ _cleanup_free_ char *subdir1 = NULL, *subdir2 = NULL;
|
||||
+ size_t plen = strlen(p);
|
||||
+
|
||||
+ if (plen < 6)
|
||||
+ continue;
|
||||
+
|
||||
+ /* Extract base record id */
|
||||
+ subdir1 = strndup(p, plen - 5);
|
||||
+ if (!subdir1)
|
||||
+ return log_oom();
|
||||
+ /* Extract "count" field */
|
||||
+ subdir2 = strndup(p + plen - 3, 3);
|
||||
+ if (!subdir2)
|
||||
+ return log_oom();
|
||||
+
|
||||
+ /* Now move file from pstore to archive storage */
|
||||
+ (void) move_file(pe, subdir1, subdir2);
|
||||
+
|
||||
+ /* Append to the dmesg */
|
||||
+ (void) append_dmesg(pe, subdir1, subdir2);
|
||||
+ } else if ((p = startswith(pe->dirent.d_name, "dmesg-erst-"))) {
|
||||
+ /* For the ERST backend, the record is a monotonically increasing number, seeded as
|
||||
+ * a timestamp. See linux/drivers/acpi/apei/erst.c in erst_writer(). */
|
||||
+ uint64_t record_id;
|
||||
+
|
||||
+ if (safe_atou64(p, &record_id) < 0)
|
||||
+ continue;
|
||||
+ if (last_record_id - 1 != record_id)
|
||||
+ /* A discontinuity in the number has been detected, this current record id
|
||||
+ * will become the directory name for all pieces of the dmesg in this
|
||||
+ * series. */
|
||||
+ if (free_and_strdup(&erst_subdir, p) < 0)
|
||||
+ return log_oom();
|
||||
+
|
||||
+ /* Now move file from pstore to archive storage */
|
||||
+ (void) move_file(pe, erst_subdir, NULL);
|
||||
+
|
||||
+ /* Append to the dmesg */
|
||||
+ (void) append_dmesg(pe, erst_subdir, NULL);
|
||||
+
|
||||
+ /* Update, but keep erst_subdir for next file */
|
||||
+ last_record_id = record_id;
|
||||
+ } else
|
||||
+ log_debug("Unknown backend, ignoring \"%s\".", pe->dirent.d_name);
|
||||
}
|
||||
-
|
||||
- if (!dmesg_bad)
|
||||
- (void) write_dmesg(dmesg, dmesg_size, dmesg_id);
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static int list_files(PStoreList *list, const char *sourcepath) {
|
||||
@@ -393,11 +355,11 @@ static int run(int argc, char *argv[]) {
|
||||
typesafe_qsort(list.entries, list.n_entries, compare_pstore_entries);
|
||||
|
||||
/* Process known file types */
|
||||
- process_dmesg_files(&list);
|
||||
+ (void) process_dmesg_files(&list);
|
||||
|
||||
/* Move left over files out of pstore */
|
||||
for (size_t n = 0; n < list.n_entries; n++)
|
||||
- move_file(&list.entries[n], NULL);
|
||||
+ (void) move_file(&list.entries[n], NULL, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -21,7 +21,7 @@
|
||||
Name: systemd
|
||||
Url: https://systemd.io
|
||||
Version: 252
|
||||
Release: 13%{?dist}
|
||||
Release: 14.0.1%{?dist}.1
|
||||
# For a breakdown of the licensing, see README
|
||||
License: LGPLv2+ and MIT and GPLv2+
|
||||
Summary: System and Service Manager
|
||||
@ -313,6 +313,24 @@ Patch0232: 0232-meson-Store-fuzz-tests-in-structured-way.patch
|
||||
Patch0233: 0233-meson-Generate-fuzzer-inputs-with-directives.patch
|
||||
Patch0234: 0234-oss-fuzz-include-generated-corpora-in-the-final-zip-.patch
|
||||
Patch0235: 0235-unit-In-cgroupv1-gracefully-terminate-delegated-scop.patch
|
||||
Patch0236: 0236-journal-def-fix-type-of-signature-to-match-the-actua.patch
|
||||
Patch0237: 0237-journal-use-compound-initialization-for-journal-file.patch
|
||||
Patch0238: 0238-journald-fix-log-message.patch
|
||||
Patch0239: 0239-sd-journal-cache-results-of-parsing-environment-vari.patch
|
||||
Patch0240: 0240-compress-introduce-compression_supported-helper-func.patch
|
||||
Patch0241: 0241-sd-journal-always-use-the-compression-algorithm-spec.patch
|
||||
Patch0242: 0242-sd-journal-allow-to-specify-compression-algorithm-th.patch
|
||||
Patch0243: 0243-test-add-test-case-that-journal-file-is-created-with.patch
|
||||
Patch0244: 0244-ci-workflow-for-gathering-metadata-for-source-git-au.patch
|
||||
Patch0245: 0245-ci-first-part-of-the-source-git-automation-commit-li.patch
|
||||
|
||||
# Oracle Patches
|
||||
Patch1000: 1000-orabug18467469-Hardcode-dm-ioctl-to-use-0-as-version-minor-part-to-.patch
|
||||
Patch1001: 1001-Fix-missing-netdev-for-iscsi-entry-in-fstab.patch
|
||||
Patch1002: 1002-udev-rules-fix-for-memory-hot-add-and-remove.patch
|
||||
Patch1003: 1003-orabug32870980-disable-unprivileged-BPF-by-default.patch
|
||||
Patch1006: 1006-orabug34467234-shutdown-get-only-active-md-arrays.patch
|
||||
Patch1007: 1007-orabug34868110-pstore-fixes-for-dmesg.txt-reconstruction.patch
|
||||
|
||||
# Downstream-only patches (9000–9999)
|
||||
|
||||
@ -329,6 +347,7 @@ BuildRequires: libfdisk-devel
|
||||
BuildRequires: pam-devel
|
||||
BuildRequires: libselinux-devel
|
||||
BuildRequires: audit-libs-devel
|
||||
BuildRequires: systemtap-sdt-devel
|
||||
%if %{without bootstrap}
|
||||
BuildRequires: cryptsetup-devel
|
||||
%endif
|
||||
@ -719,8 +738,8 @@ CONFIGURE_OPTS=(
|
||||
-Duserdb=false
|
||||
-Dportabled=false
|
||||
-Dnetworkd=false
|
||||
-Dsupport-url=https://access.redhat.com/support
|
||||
-Ddefault-net-naming-scheme=rhel-9.0
|
||||
-Dsupport-url=https://support.oracle.com
|
||||
)
|
||||
|
||||
%if %{without lto}
|
||||
@ -741,6 +760,10 @@ fi
|
||||
%install
|
||||
%meson_install
|
||||
|
||||
# Set RemoveIPC=no as the default for OL
|
||||
echo "#This is the default for OL" >> %{buildroot}%{_sysconfdir}/systemd/logind.conf
|
||||
echo "RemoveIPC=no" >> %{buildroot}%{_sysconfdir}/systemd/logind.conf
|
||||
|
||||
# udev links
|
||||
mkdir -p %{buildroot}/%{_sbindir}
|
||||
ln -sf ../bin/udevadm %{buildroot}%{_sbindir}/udevadm
|
||||
@ -1134,6 +1157,34 @@ getent passwd systemd-oom &>/dev/null || useradd -r -l -g systemd-oom -d / -s /s
|
||||
%files standalone-sysusers -f .file-list-standalone-sysusers
|
||||
|
||||
%changelog
|
||||
* Wed Jun 21 2023 Pooja Senthil Kumar <pooja.senthil.kumar@oracle.com> - 252-14.0.1.1
|
||||
- Backport upstream pstore dmesg fix [Orabug: 34868110]
|
||||
- Remove upstream references [Orabug: 33995357]
|
||||
- Disable unprivileged BPF by default [Orabug: 32870980]
|
||||
- udev rules: fix memory hot add and remove [Orabug: 31310273]
|
||||
- set "RemoveIPC=no" in logind.conf as default for OL7.2 [Orabug: 22224874]
|
||||
- allow dm remove ioctl to co-operate with UEK3 (Vaughan Cao) [Orabug: 18467469]
|
||||
- fix _netdev is missing for iscsi entry in /etc/fstab (tony.l.lam@oracle.com) [Orabug: 25897792]
|
||||
- shutdown: get only active md arrays. [Orabug: 34467234]
|
||||
- Removed unneeded patches from the systemd.spec file [Orabug: 34272490]
|
||||
- A) 1004-orabug34272490-0001-core-device-ignore-DEVICE_FOUND_UDEV-bit-on-switchin.patch
|
||||
- B) 1005-orabug34272490-0002-core-device-drop-unnecessary-condition.patch
|
||||
|
||||
* Wed May 24 2023 systemd maintenance team <systemd-maint@redhat.com> - 252-14.1
|
||||
- Bump version to 252-14.1 to make sure that NEVRA is higher than systemd-252-14.el9.rhaos4.13 (#2184929)
|
||||
|
||||
* Thu May 18 2023 systemd maintenance team <systemd-maint@redhat.com> - 252-13.1
|
||||
- journal-def: fix type of signature to match the actual field in the Header structure (#2184929)
|
||||
- journal: use compound initialization for journal file Header structure (#2184929)
|
||||
- journald: fix log message (#2184929)
|
||||
- sd-journal: cache results of parsing environment variables (#2184929)
|
||||
- compress: introduce compression_supported() helper function (#2184929)
|
||||
- sd-journal: always use the compression algorithm specified in the header (#2184929)
|
||||
- sd-journal: allow to specify compression algorithm through env (#2184929)
|
||||
- test: add test case that journal file is created with the requested compression algorithm (#2184929)
|
||||
- ci: workflow for gathering metadata for source-git automation (#2184929)
|
||||
- ci: first part of the source-git automation - commit linter (#2184929)
|
||||
|
||||
* Mon Mar 20 2023 systemd maintenance team <systemd-maint@redhat.com> - 252-13
|
||||
- spec: release bump (#2179165)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user