systemd-252-16

Resolves: #2169959,#2170883,#2172509,#2176899,#2182632,#2193456,#2208240,#2210145,#2210237,#2212612,#2215412,#2218184,#2218886
This commit is contained in:
Jan Macku 2023-07-17 09:24:27 +02:00
parent c8e795b373
commit 5f20544e0d
36 changed files with 3078 additions and 1 deletions

View File

@ -0,0 +1,30 @@
From d5de6c135caa4cb5871ccfa7d739e0ab46bf02e5 Mon Sep 17 00:00:00 2001
From: Jan Macku <jamacku@redhat.com>
Date: Fri, 19 May 2023 16:37:37 +0200
Subject: [PATCH] ci: update permissions for source-git automation workflows
new version of `redhat-plumbers-in-action/advanced-commit-linter` requires new permission:
`checks: write`.
https://github.com/redhat-plumbers-in-action/advanced-commit-linter/commit/f1bb35fcdeff83d40eb67b5e7c58baad6be689b2
rhel-only
Related: #2170883
---
.github/workflows/source-git-automation.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/source-git-automation.yml b/.github/workflows/source-git-automation.yml
index 140f21b116..e653e28a7f 100644
--- a/.github/workflows/source-git-automation.yml
+++ b/.github/workflows/source-git-automation.yml
@@ -33,7 +33,7 @@ jobs:
validated-pr-metadata: ${{ steps.commit-linter.outputs.validated-pr-metadata }}
permissions:
- statuses: write
+ checks: write
pull-requests: write
steps:

View File

@ -0,0 +1,492 @@
From a6d9977a0cafaaf1dcf5c7658d958aea8e5284f0 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.
(cherry picked from commit 5fbaa757077bde2db8d33b1c358518c41b990339)
Related: #2170883
---
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 d820ceb9f6..cfce994bec 100644
--- a/src/pstore/pstore.c
+++ b/src/pstore/pstore.c
@@ -115,7 +115,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;
@@ -129,7 +129,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();
@@ -172,153 +172,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) {
@@ -394,11 +356,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;
}

View File

@ -0,0 +1,37 @@
From f781f42f512b77b4283f0b96cc87907306075b52 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Fri, 28 Apr 2023 11:09:22 +0200
Subject: [PATCH] pstore: explicitly set the base when converting record ID
(cherry picked from commit a95d96a2430db171b40fc2e50589807236f8f746)
Related: #2170883
---
src/pstore/pstore.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/pstore/pstore.c b/src/pstore/pstore.c
index cfce994bec..066d8ebb81 100644
--- a/src/pstore/pstore.c
+++ b/src/pstore/pstore.c
@@ -202,7 +202,7 @@ static int append_dmesg(PStoreEntry *pe, const char *subdir1, const char *subdir
static int process_dmesg_files(PStoreList *list) {
/* Move files, reconstruct dmesg.txt */
_cleanup_free_ char *erst_subdir = NULL;
- uint64_t last_record_id = 0;
+ unsigned long long 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
@@ -258,9 +258,9 @@ static int process_dmesg_files(PStoreList *list) {
} 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;
+ unsigned long long record_id;
- if (safe_atou64(p, &record_id) < 0)
+ if (safe_atollu_full(p, 10, &record_id) < 0)
continue;
if (last_record_id - 1 != record_id)
/* A discontinuity in the number has been detected, this current record id

View File

@ -0,0 +1,68 @@
From 4c6c7127a96f086b919b4c082b9da6b29f791bb8 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Fri, 28 Apr 2023 11:50:33 +0200
Subject: [PATCH] pstore: avoid opening the dmesg.txt file if not requested
Even with Storage=journal we would still attempt to open the final
dmesg.txt file which causes a lot of noise in the journal:
```
[ 5.764111] H testsuite-82.sh[658]: + systemctl start systemd-pstore
[ 5.806385] H systemd[1]: Starting modprobe@efi_pstore.service...
[ 5.808656] H systemd[1]: modprobe@efi_pstore.service: Deactivated successfully.
[ 5.808971] H systemd[1]: Finished modprobe@efi_pstore.service.
[ 5.818845] H kernel: audit: type=1130 audit(1682630623.637:114): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=modprobe@efi_pstore comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? termin>
[ 5.818865] H kernel: audit: type=1131 audit(1682630623.637:115): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=modprobe@efi_pstore comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? termin>
[ 5.816052] H systemd[1]: Starting systemd-pstore.service...
[ 5.840703] H systemd-pstore[806]: PStore dmesg-efi-168263062313014.
[ 5.841239] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.841428] H systemd-pstore[806]: PStore dmesg-efi-168263062312014.
[ 5.841575] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.841712] H systemd-pstore[806]: PStore dmesg-efi-168263062311014.
[ 5.841839] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.841989] H systemd-pstore[806]: PStore dmesg-efi-168263062310014.
[ 5.842141] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.842274] H systemd-pstore[806]: PStore dmesg-efi-168263062309014.
[ 5.842423] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.842589] H systemd-pstore[806]: PStore dmesg-efi-168263062308014.
[ 5.842722] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.842865] H systemd-pstore[806]: PStore dmesg-efi-168263062307014.
[ 5.843003] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.843153] H systemd-pstore[806]: PStore dmesg-efi-168263062306014.
[ 5.843280] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.843434] H systemd-pstore[806]: PStore dmesg-efi-168263062305014.
[ 5.843570] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.843702] H systemd-pstore[806]: PStore dmesg-efi-168263062304014.
[ 5.843831] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.843958] H systemd-pstore[806]: PStore dmesg-efi-168263062303014.
[ 5.844093] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.844250] H systemd-pstore[806]: PStore dmesg-efi-168263062302014.
[ 5.844412] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.844619] H systemd-pstore[806]: PStore dmesg-efi-168263062301014.
[ 5.844781] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.844956] H systemd-pstore[806]: PStore dmesg-efi-168263062300014.
[ 5.845168] H systemd-pstore[806]: Failed to open file /var/lib/systemd/pstore/1682630623/014/dmesg.txt: Operation not permitted
[ 5.851101] H systemd[1]: Finished systemd-pstore.service.
```
(cherry picked from commit ad5980803adac8dc1cf980447a07cb18962c238b)
Related: #2170883
---
src/pstore/pstore.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/pstore/pstore.c b/src/pstore/pstore.c
index 066d8ebb81..7fff6cee62 100644
--- a/src/pstore/pstore.c
+++ b/src/pstore/pstore.c
@@ -180,6 +180,9 @@ static int append_dmesg(PStoreEntry *pe, const char *subdir1, const char *subdir
assert(pe);
+ if (arg_storage != PSTORE_STORAGE_EXTERNAL)
+ return 0;
+
if (pe->content_size == 0)
return 0;

View File

@ -0,0 +1,240 @@
From 356247b0fb704e62bf378a7940a8190677358daa Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Thu, 27 Apr 2023 23:17:52 +0200
Subject: [PATCH] test: add a couple of tests for systemd-pstore
(cherry picked from commit 6858e32d730fd5574eaa3d7fbf4cb12aacaea336)
Related: #2170883
---
test/units/testsuite-74.pstore.sh | 221 ++++++++++++++++++++++++++++++
1 file changed, 221 insertions(+)
create mode 100755 test/units/testsuite-74.pstore.sh
diff --git a/test/units/testsuite-74.pstore.sh b/test/units/testsuite-74.pstore.sh
new file mode 100755
index 0000000000..b4e442c1be
--- /dev/null
+++ b/test/units/testsuite-74.pstore.sh
@@ -0,0 +1,221 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -eux
+set -o pipefail
+
+systemctl log-level info
+
+if systemd-detect-virt -cq; then
+ echo "Running in a container, skipping the systemd-pstore test..."
+ exit 0
+fi
+
+DUMMY_DMESG_1="$(mktemp)"
+cat >"$DUMMY_DMESG_1" <<\EOF
+6,17159,5340096332127,-;usb 1-4: USB disconnect, device number 124
+6,17160,5340109662397,-;input: WH-1000XM3 (AVRCP) as /devices/virtual/input/input293
+6,17161,5343126458360,-;loop0: detected capacity change from 0 to 3145728
+6,17162,5343126766065,-; loop0: p1 p2
+6,17163,5343126815038,-;EXT4-fs (loop0p1): mounted filesystem with ordered data mode. Quota mode: none.
+6,17164,5343158037334,-;EXT4-fs (loop0p1): unmounting filesystem.
+6,17165,5343158072598,-;loop0: detected capacity change from 0 to 3145728
+6,17166,5343158073563,-; loop0: p1 p2
+6,17167,5343158074325,-; loop0: p1 p2
+6,17168,5343158140859,-;EXT4-fs (loop0p1): mounted filesystem with ordered data mode. Quota mode: none.
+6,17169,5343158182977,-;EXT4-fs (loop0p1): unmounting filesystem.
+6,17170,5343158700241,-;loop0: detected capacity change from 0 to 3145728
+6,17171,5343158700439,-; loop0: p1 p2
+6,17172,5343158701120,-; loop0: p1 p2
+EOF
+
+DUMMY_DMESG_2="$(mktemp)"
+cat >"$DUMMY_DMESG_2" <<\EOF
+Nechť již hříšné saxofony ďáblů rozezvučí síň úděsnými tóny waltzu, tanga a quickstepu.
+Příliš žluťoučký kůň úpěl ďábelské ódy.
+Zvlášť zákeřný učeň s ďolíčky běží podél zóny úlů.
+Vyciď křišťálový nůž, ó učiň úděsné líbivým!
+Loď čeří kýlem tůň obzvlášť v Grónské úžině
+Ó, náhlý déšť již zvířil prach a čilá laň teď běží s houfcem gazel k úkrytům.
+Vypätá dcéra grófa Maxwella s IQ nižším ako kôň núti čeľaď hrýzť hŕbu jabĺk.
+Kŕdeľ šťastných ďatľov učí pri ústí Váhu mĺkveho koňa obhrýzať kôru a žrať čerstvé mäso.
+Stróż pchnął kość w quiz gędźb vel fax myjń.
+Portez ce vieux whisky au juge blond qui fume!
+EOF
+
+file_count() { find "${1:?}" -type f | wc -l; }
+file_size() { wc -l <"${1:?}"; }
+random_efi_timestamp() { printf "%0.10d" "$((1000000000 + RANDOM))"; }
+
+# 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.
+
+prepare_efi_logs() {
+ local file="${1:?}"
+ local timestamp="${2:?}"
+ local chunk count filename
+
+ # 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().
+ count="$(file_size "$file")"
+ chunk=0
+ # The sed in the process substitution below just reverses the file
+ while read -r line; do
+ filename="$(printf "dmesg-efi-%0.10d%0.2d%0.3d" "$timestamp" "$chunk" "$count")"
+ echo "$line" >"/sys/fs/pstore/$filename"
+ chunk=$((chunk + 1))
+ done < <(sed '1!G;h;$!d' "$file")
+
+ if [[ "$chunk" -eq 0 ]]; then
+ echo >&2 "No dmesg-efi files were created"
+ exit 1
+ fi
+}
+
+prepare_erst_logs() {
+ local file="${1:?}"
+ local start_id="${2:?}"
+ local id filename
+
+ # 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().
+ id="$start_id"
+ # The sed in the process substitution below just reverses the file
+ while read -r line; do
+ filename="$(printf "dmesg-erst-%0.16d" "$id")"
+ echo "$line" >"/sys/fs/pstore/$filename"
+ id=$((id + 1))
+ done < <(sed '1!G;h;$!d' "$file")
+
+ if [[ "$id" -eq "$start_id" ]]; then
+ echo >&2 "No dmesg-erst files were created"
+ exit 1
+ fi
+
+ # ID of the last dmesg file will be the ID of the erst subfolder
+ echo "$((id - 1))"
+}
+
+prepare_pstore_config() {
+ local storage="${1:?}"
+ local unlink="${2:?}"
+
+ systemctl stop systemd-pstore
+
+ rm -fr /sys/fs/pstore/* /var/lib/systemd/pstore/*
+
+ mkdir -p /run/systemd/pstore.conf.d
+ cat >"/run/systemd/pstore.conf.d/99-test.conf" <<EOF
+[PStore]
+Storage=$storage
+Unlink=$unlink
+EOF
+
+ systemd-analyze cat-config systemd/pstore.conf | grep "$storage"
+ systemd-analyze cat-config systemd/pstore.conf | grep "$unlink"
+}
+
+start_pstore() {
+ rm -f /tmp/journal.cursor
+ journalctl -q -n 0 --cursor-file=/tmp/journal.cursor
+ systemctl start systemd-pstore
+ journalctl --sync
+}
+
+# To avoid having to depend on the VM providing the pstore, let's simulate
+# it using a simple bind mount
+PSTORE_DIR="$(mktemp -d)"
+mount --bind "${PSTORE_DIR:?}" "/sys/fs/pstore"
+
+# systemd-pstore is a no-op with Storage=none
+for unlink in yes no; do
+ : "Backend: N/A; Storage: none; Unlink: $unlink"
+ timestamp="$(random_efi_timestamp)"
+ prepare_pstore_config "none" "$unlink"
+ prepare_efi_logs "$DUMMY_DMESG_1" "$timestamp"
+ old_count="$(file_count /sys/fs/pstore/)"
+ start_pstore
+ [[ "$(file_count /sys/fs/pstore)" -ge "$old_count" ]]
+ [[ "$(file_count /var/lib/systemd/pstore/)" -eq 0 ]]
+
+ : "Backend: EFI; Storage: external; Unlink: $unlink"
+ timestamp="$(random_efi_timestamp)"
+ prepare_pstore_config "external" "$unlink"
+ prepare_efi_logs "$DUMMY_DMESG_1" "$timestamp"
+ [[ "$unlink" == yes ]] && exp_count=0 || exp_count="$(file_count /sys/fs/pstore/)"
+ start_pstore
+ [[ "$(file_count /sys/fs/pstore)" -ge "$exp_count" ]]
+ [[ "$(file_count /var/lib/systemd/pstore/)" -ne 0 ]]
+ # We always log to journal
+ diff "$DUMMY_DMESG_1" <(journalctl -o cat -u systemd-pstore --output-fields=FILE --cursor-file=/tmp/journal.cursor | sed "/^$/d")
+ filename="$(printf "/var/lib/systemd/pstore/%s/%0.3d/dmesg.txt" "$timestamp" "$(file_size "$DUMMY_DMESG_1")")"
+ diff "$DUMMY_DMESG_1" "$filename"
+
+ : "Backend: EFI; Storage: external; Unlink: $unlink; multiple dmesg files"
+ timestamp_1="$(random_efi_timestamp)"
+ timestamp_2="$((timestamp_1 + 1))"
+ prepare_pstore_config "external" "$unlink"
+ prepare_efi_logs "$DUMMY_DMESG_1" "$timestamp_1"
+ prepare_efi_logs "$DUMMY_DMESG_2" "$timestamp_2"
+ # Add one "random" (non-dmesg) file as well
+ echo "hello world" >/sys/fs/pstore/foo.bar
+ [[ "$unlink" == yes ]] && exp_count=0 || exp_count="$(file_count /sys/fs/pstore/)"
+ start_pstore
+ [[ "$(file_count /sys/fs/pstore)" -ge "$exp_count" ]]
+ [[ "$(file_count /var/lib/systemd/pstore/)" -ne 0 ]]
+ filename_1="$(printf "/var/lib/systemd/pstore/%s/%0.3d/dmesg.txt" "$timestamp_1" "$(file_size "$DUMMY_DMESG_1")")"
+ diff "$DUMMY_DMESG_1" "$filename_1"
+ filename_2="$(printf "/var/lib/systemd/pstore/%s/%0.3d/dmesg.txt" "$timestamp_2" "$(file_size "$DUMMY_DMESG_2")")"
+ diff "$DUMMY_DMESG_2" "$filename_2"
+ grep "hello world" "/var/lib/systemd/pstore/foo.bar"
+
+ : "Backend: EFI; Storage: journal; Unlink: $unlink"
+ timestamp="$(random_efi_timestamp)"
+ prepare_pstore_config "journal" "$unlink"
+ prepare_efi_logs "$DUMMY_DMESG_1" "$timestamp"
+ [[ "$unlink" == yes ]] && exp_count=0 || exp_count="$(file_count /sys/fs/pstore/)"
+ start_pstore
+ [[ "$(file_count /sys/fs/pstore)" -ge "$exp_count" ]]
+ [[ "$(file_count /var/lib/systemd/pstore/)" -eq 0 ]]
+ diff "$DUMMY_DMESG_1" <(journalctl -o cat -u systemd-pstore --output-fields=FILE --cursor-file=/tmp/journal.cursor | sed "/^$/d")
+
+ : "Backend: ERST; Storage: external; Unlink: $unlink"
+ prepare_pstore_config "external" "$unlink"
+ last_id="$(prepare_erst_logs "$DUMMY_DMESG_1" 0)"
+ [[ "$unlink" == yes ]] && exp_count=0 || exp_count="$(file_count /sys/fs/pstore/)"
+ start_pstore
+ [[ "$(file_count /sys/fs/pstore)" -ge "$exp_count" ]]
+ [[ "$(file_count /var/lib/systemd/pstore/)" -ne 0 ]]
+ # We always log to journal
+ diff "$DUMMY_DMESG_1" <(journalctl -o cat -u systemd-pstore --output-fields=FILE --cursor-file=/tmp/journal.cursor | sed "/^$/d")
+ filename="$(printf "/var/lib/systemd/pstore/%0.16d/dmesg.txt" "$last_id")"
+ diff "$DUMMY_DMESG_1" "$filename"
+
+ : "Backend: ERST; Storage: external; Unlink: $unlink; multiple dmesg files"
+ prepare_pstore_config "external" "$unlink"
+ last_id_1="$(prepare_erst_logs "$DUMMY_DMESG_1" 0)"
+ last_id_2="$(prepare_erst_logs "$DUMMY_DMESG_2" "$((last_id_1 + 10))")"
+ # Add one "random" (non-dmesg) file as well
+ echo "hello world" >/sys/fs/pstore/foo.bar
+ [[ "$unlink" == yes ]] && exp_count=0 || exp_count="$(file_count /sys/fs/pstore/)"
+ start_pstore
+ [[ "$(file_count /sys/fs/pstore)" -ge "$exp_count" ]]
+ [[ "$(file_count /var/lib/systemd/pstore/)" -ne 0 ]]
+ filename_1="$(printf "/var/lib/systemd/pstore/%0.16d/dmesg.txt" "$last_id_1")"
+ diff "$DUMMY_DMESG_1" "$filename_1"
+ filename_2="$(printf "/var/lib/systemd/pstore/%0.16d/dmesg.txt" "$last_id_2")"
+ diff "$DUMMY_DMESG_2" "$filename_2"
+ grep "hello world" "/var/lib/systemd/pstore/foo.bar"
+
+ : "Backend: ERST; Storage: journal; Unlink: $unlink"
+ prepare_pstore_config "journal" "$unlink"
+ last_id="$(prepare_erst_logs "$DUMMY_DMESG_1" 0)"
+ [[ "$unlink" == yes ]] && exp_count=0 || exp_count="$(file_count /sys/fs/pstore/)"
+ start_pstore
+ [[ "$(file_count /sys/fs/pstore)" -ge "$exp_count" ]]
+ [[ "$(file_count /var/lib/systemd/pstore/)" -eq 0 ]]
+ diff "$DUMMY_DMESG_1" <(journalctl -o cat -u systemd-pstore --output-fields=FILE --cursor-file=/tmp/journal.cursor | sed "/^$/d")
+done

View File

@ -0,0 +1,57 @@
From ea861dba363ac970a838a183c71e333f9f201f02 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Sat, 29 Apr 2023 09:33:18 +0200
Subject: [PATCH] test: match all messages with the FILE field
As the systemd-pstore process is quite short lived, it might sometimes
lack the necessary metadata to make matching against a unit or a syslog
tag work. Since we already use a cursor file to make the matching window
small as possible, let's just drop the unit match completely and hope
for the best.
Resolves: #27453
(cherry picked from commit edea0d6ac57610b7af603b833b19a846327e3638)
Related: #2170883
---
test/units/testsuite-74.pstore.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/units/testsuite-74.pstore.sh b/test/units/testsuite-74.pstore.sh
index b4e442c1be..b8bf5534a1 100755
--- a/test/units/testsuite-74.pstore.sh
+++ b/test/units/testsuite-74.pstore.sh
@@ -150,7 +150,7 @@ for unlink in yes no; do
[[ "$(file_count /sys/fs/pstore)" -ge "$exp_count" ]]
[[ "$(file_count /var/lib/systemd/pstore/)" -ne 0 ]]
# We always log to journal
- diff "$DUMMY_DMESG_1" <(journalctl -o cat -u systemd-pstore --output-fields=FILE --cursor-file=/tmp/journal.cursor | sed "/^$/d")
+ diff "$DUMMY_DMESG_1" <(journalctl -o cat --output-fields=FILE --cursor-file=/tmp/journal.cursor | sed "/^$/d")
filename="$(printf "/var/lib/systemd/pstore/%s/%0.3d/dmesg.txt" "$timestamp" "$(file_size "$DUMMY_DMESG_1")")"
diff "$DUMMY_DMESG_1" "$filename"
@@ -180,7 +180,7 @@ for unlink in yes no; do
start_pstore
[[ "$(file_count /sys/fs/pstore)" -ge "$exp_count" ]]
[[ "$(file_count /var/lib/systemd/pstore/)" -eq 0 ]]
- diff "$DUMMY_DMESG_1" <(journalctl -o cat -u systemd-pstore --output-fields=FILE --cursor-file=/tmp/journal.cursor | sed "/^$/d")
+ diff "$DUMMY_DMESG_1" <(journalctl -o cat --output-fields=FILE --cursor-file=/tmp/journal.cursor | sed "/^$/d")
: "Backend: ERST; Storage: external; Unlink: $unlink"
prepare_pstore_config "external" "$unlink"
@@ -190,7 +190,7 @@ for unlink in yes no; do
[[ "$(file_count /sys/fs/pstore)" -ge "$exp_count" ]]
[[ "$(file_count /var/lib/systemd/pstore/)" -ne 0 ]]
# We always log to journal
- diff "$DUMMY_DMESG_1" <(journalctl -o cat -u systemd-pstore --output-fields=FILE --cursor-file=/tmp/journal.cursor | sed "/^$/d")
+ diff "$DUMMY_DMESG_1" <(journalctl -o cat --output-fields=FILE --cursor-file=/tmp/journal.cursor | sed "/^$/d")
filename="$(printf "/var/lib/systemd/pstore/%0.16d/dmesg.txt" "$last_id")"
diff "$DUMMY_DMESG_1" "$filename"
@@ -217,5 +217,5 @@ for unlink in yes no; do
start_pstore
[[ "$(file_count /sys/fs/pstore)" -ge "$exp_count" ]]
[[ "$(file_count /var/lib/systemd/pstore/)" -eq 0 ]]
- diff "$DUMMY_DMESG_1" <(journalctl -o cat -u systemd-pstore --output-fields=FILE --cursor-file=/tmp/journal.cursor | sed "/^$/d")
+ diff "$DUMMY_DMESG_1" <(journalctl -o cat --output-fields=FILE --cursor-file=/tmp/journal.cursor | sed "/^$/d")
done

View File

@ -0,0 +1,116 @@
From 0baa19a28f07328fa4357efc97a522bc0e29f74e Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Fri, 19 May 2023 11:45:11 +0200
Subject: [PATCH] test: build the SELinux test module on the host
Let's save some time and build the SELinux test module on the host
instead of a possibly unaccelerated VM. This brings the runtime of
TEST-06-SELINUX from ~12 minutes down to a ~1 minute.
(cherry picked from commit 038efe6df154b04a4c2a1d9da7263e5f49d2a1b0)
Related: #2170883
---
test/TEST-06-SELINUX/test.sh | 68 ++++++++++---------
.../load-systemd-test-module.service | 2 +-
2 files changed, 36 insertions(+), 34 deletions(-)
diff --git a/test/TEST-06-SELINUX/test.sh b/test/TEST-06-SELINUX/test.sh
index a867dea4b7..5d72638ec6 100755
--- a/test/TEST-06-SELINUX/test.sh
+++ b/test/TEST-06-SELINUX/test.sh
@@ -7,7 +7,6 @@ IMAGE_NAME="selinux"
TEST_NO_NSPAWN=1
# Requirements:
-# Fedora 23
# selinux-policy-targeted
# selinux-policy-devel
@@ -21,38 +20,41 @@ SETUP_SELINUX=yes
KERNEL_APPEND="${KERNEL_APPEND:=} selinux=1 security=selinux"
test_append_files() {
- (
- local workspace="${1:?}"
- local policy_headers_dir=/usr/share/selinux/devel
- local modules_dir=/var/lib/selinux
-
- setup_selinux
- # Make sure we never expand this to "/..."
- rm -rf "${workspace:?}/$modules_dir"
-
- if ! cp -ar "$modules_dir" "$workspace/$modules_dir"; then
- dfatal "Failed to copy $modules_dir"
- exit 1
- fi
-
- rm -rf "${workspace:?}/$policy_headers_dir"
- inst_dir /usr/share/selinux
-
- if ! cp -ar "$policy_headers_dir" "$workspace/$policy_headers_dir"; then
- dfatal "Failed to copy $policy_headers_dir"
- exit 1
- fi
-
- mkdir "$workspace/systemd-test-module"
- cp systemd_test.te "$workspace/systemd-test-module"
- cp systemd_test.if "$workspace/systemd-test-module"
- cp systemd_test.fc "$workspace/systemd-test-module"
- image_install -o sesearch
- image_install runcon
- image_install checkmodule semodule semodule_package m4 make load_policy sefcontext_compile
- image_install -o /usr/libexec/selinux/hll/pp # Fedora/RHEL/...
- image_install -o /usr/lib/selinux/hll/pp # Debian/Ubuntu/...
- )
+ local workspace="${1:?}"
+ local policy_headers_dir=/usr/share/selinux/devel
+ local modules_dir=/var/lib/selinux
+
+ setup_selinux
+ # Make sure we never expand this to "/..."
+ rm -rf "${workspace:?}/$modules_dir"
+
+ if ! cp -ar "$modules_dir" "$workspace/$modules_dir"; then
+ dfatal "Failed to copy $modules_dir"
+ exit 1
+ fi
+
+ rm -rf "${workspace:?}/$policy_headers_dir"
+ inst_dir /usr/share/selinux
+
+ if ! cp -ar "$policy_headers_dir" "$workspace/$policy_headers_dir"; then
+ dfatal "Failed to copy $policy_headers_dir"
+ exit 1
+ fi
+
+ mkdir "$workspace/systemd-test-module"
+ cp systemd_test.te "$workspace/systemd-test-module"
+ cp systemd_test.if "$workspace/systemd-test-module"
+ cp systemd_test.fc "$workspace/systemd-test-module"
+ image_install -o sesearch
+ image_install runcon
+ image_install checkmodule semodule semodule_package m4 make load_policy sefcontext_compile
+ image_install -o /usr/libexec/selinux/hll/pp # Fedora/RHEL/...
+ image_install -o /usr/lib/selinux/hll/pp # Debian/Ubuntu/...
+
+ if ! chroot "$workspace" make -C /systemd-test-module -f /usr/share/selinux/devel/Makefile clean systemd_test.pp; then
+ dfatal "Failed to build the systemd test module"
+ exit 1
+ fi
}
do_test "$@"
diff --git a/test/testsuite-06.units/load-systemd-test-module.service b/test/testsuite-06.units/load-systemd-test-module.service
index 3a22c15b25..2d15a62715 100644
--- a/test/testsuite-06.units/load-systemd-test-module.service
+++ b/test/testsuite-06.units/load-systemd-test-module.service
@@ -9,7 +9,7 @@ Before=sysinit.target shutdown.target autorelabel.service
ConditionSecurity=selinux
[Service]
-ExecStart=sh -x -c 'echo 0 >/sys/fs/selinux/enforce && cd /systemd-test-module && make -f /usr/share/selinux/devel/Makefile clean load'
+ExecStart=sh -x -c 'echo 0 >/sys/fs/selinux/enforce && make -C /systemd-test-module -f /usr/share/selinux/devel/Makefile load'
Type=oneshot
TimeoutSec=0
RemainAfterExit=yes

View File

@ -0,0 +1,32 @@
From 36426e030fc9f2afc5926b2c484b9943f9970529 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Fri, 19 May 2023 10:48:15 +0200
Subject: [PATCH] test: make the stress test slightly less stressful on slower
machines
Without acceleration this part of the test takes over 10 minutes (!),
which feels quite unnecessary. Let's cut down the number of stuff we
dump to the journal in such case, but keep the original value if we run
with acceleration (since in that case it takes less than 10 seconds).
(cherry picked from commit ff40235b9bd2a944131c36b1c7ccfd88f49a194e)
Related: #2170883
---
test/units/testsuite-04.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/units/testsuite-04.sh b/test/units/testsuite-04.sh
index bb41045809..b5ff2ff704 100755
--- a/test/units/testsuite-04.sh
+++ b/test/units/testsuite-04.sh
@@ -8,7 +8,8 @@ trap "journalctl --rotate --vacuum-size=16M" EXIT
# Rotation/flush test, see https://github.com/systemd/systemd/issues/19895
journalctl --relinquish-var
-for _ in {0..50}; do
+[[ "$(systemd-detect-virt -v)" == "qemu" ]] && ITERATIONS=10 || ITERATIONS=50
+for ((i = 0; i < ITERATIONS; i++)); do
dd if=/dev/urandom bs=1M count=1 | base64 | systemd-cat
done
journalctl --rotate

View File

@ -0,0 +1,202 @@
From 58aba81d1e530d53e462ec4ae542570cd537264a Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Wed, 22 Mar 2023 08:49:49 +0900
Subject: [PATCH] coredump: use unaligned_read_ne{32,64}() to parse auxv
Fixes a bug introduced by 3e4d0f6cf99f8677edd6a237382a65bfe758de03.
The auxv metadata is unaligned, as the length of the prefix
"COREDUMP_PROC_AUXV=" is 19. Hence, parse_auxv{32,64}() may triger
an undefined behavior (or at least cause slow down), which can be
detected when running on an undefined behavior sanitizer.
This also introduces a macro to define `parse_auxv{32,64}()`.
Fixes #26912.
(cherry picked from commit 9b032f932c4172fac379234d9d42cf2b266ccaea)
Related: #2170883
---
src/coredump/coredump.c | 149 ++++++++++++++++------------------------
1 file changed, 60 insertions(+), 89 deletions(-)
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index ea3d8c415a..b9c5f3ad04 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -48,6 +48,7 @@
#include "sync-util.h"
#include "tmpfile-util.h"
#include "uid-alloc-range.h"
+#include "unaligned.h"
#include "user-util.h"
/* The maximum size up to which we process coredumps. We use 1G on 32bit systems, and 32G on 64bit systems */
@@ -339,95 +340,65 @@ static int make_filename(const Context *context, char **ret) {
return 0;
}
-static int parse_auxv64(
- const uint64_t *auxv,
- size_t size_bytes,
- int *at_secure,
- uid_t *uid,
- uid_t *euid,
- gid_t *gid,
- gid_t *egid) {
-
- assert(auxv || size_bytes == 0);
-
- if (size_bytes % (2 * sizeof(uint64_t)) != 0)
- return log_warning_errno(SYNTHETIC_ERRNO(EIO), "Incomplete auxv structure (%zu bytes).", size_bytes);
-
- size_t words = size_bytes / sizeof(uint64_t);
-
- /* Note that we set output variables even on error. */
-
- for (size_t i = 0; i + 1 < words; i += 2)
- switch (auxv[i]) {
- case AT_SECURE:
- *at_secure = auxv[i + 1] != 0;
- break;
- case AT_UID:
- *uid = auxv[i + 1];
- break;
- case AT_EUID:
- *euid = auxv[i + 1];
- break;
- case AT_GID:
- *gid = auxv[i + 1];
- break;
- case AT_EGID:
- *egid = auxv[i + 1];
- break;
- case AT_NULL:
- if (auxv[i + 1] != 0)
- goto error;
- return 0;
- }
- error:
- return log_warning_errno(SYNTHETIC_ERRNO(ENODATA),
- "AT_NULL terminator not found, cannot parse auxv structure.");
-}
-
-static int parse_auxv32(
- const uint32_t *auxv,
- size_t size_bytes,
- int *at_secure,
- uid_t *uid,
- uid_t *euid,
- gid_t *gid,
- gid_t *egid) {
-
- assert(auxv || size_bytes == 0);
-
- size_t words = size_bytes / sizeof(uint32_t);
-
- if (size_bytes % (2 * sizeof(uint32_t)) != 0)
- return log_warning_errno(SYNTHETIC_ERRNO(EIO), "Incomplete auxv structure (%zu bytes).", size_bytes);
+#define _DEFINE_PARSE_AUXV(size, type, unaligned_read) \
+ static int parse_auxv##size( \
+ const void *auxv, \
+ size_t size_bytes, \
+ int *at_secure, \
+ uid_t *uid, \
+ uid_t *euid, \
+ gid_t *gid, \
+ gid_t *egid) { \
+ \
+ assert(auxv || size_bytes == 0); \
+ \
+ if (size_bytes % (2 * sizeof(type)) != 0) \
+ return log_warning_errno(SYNTHETIC_ERRNO(EIO), \
+ "Incomplete auxv structure (%zu bytes).", \
+ size_bytes); \
+ \
+ size_t words = size_bytes / sizeof(type); \
+ \
+ /* Note that we set output variables even on error. */ \
+ \
+ for (size_t i = 0; i + 1 < words; i += 2) { \
+ type key, val; \
+ \
+ key = unaligned_read((uint8_t*) auxv + i * sizeof(type)); \
+ val = unaligned_read((uint8_t*) auxv + (i + 1) * sizeof(type)); \
+ \
+ switch (key) { \
+ case AT_SECURE: \
+ *at_secure = val != 0; \
+ break; \
+ case AT_UID: \
+ *uid = val; \
+ break; \
+ case AT_EUID: \
+ *euid = val; \
+ break; \
+ case AT_GID: \
+ *gid = val; \
+ break; \
+ case AT_EGID: \
+ *egid = val; \
+ break; \
+ case AT_NULL: \
+ if (val != 0) \
+ goto error; \
+ return 0; \
+ } \
+ } \
+ error: \
+ return log_warning_errno(SYNTHETIC_ERRNO(ENODATA), \
+ "AT_NULL terminator not found, cannot parse auxv structure."); \
+ }
- /* Note that we set output variables even on error. */
+#define DEFINE_PARSE_AUXV(size)\
+ _DEFINE_PARSE_AUXV(size, uint##size##_t, unaligned_read_ne##size)
- for (size_t i = 0; i + 1 < words; i += 2)
- switch (auxv[i]) {
- case AT_SECURE:
- *at_secure = auxv[i + 1] != 0;
- break;
- case AT_UID:
- *uid = auxv[i + 1];
- break;
- case AT_EUID:
- *euid = auxv[i + 1];
- break;
- case AT_GID:
- *gid = auxv[i + 1];
- break;
- case AT_EGID:
- *egid = auxv[i + 1];
- break;
- case AT_NULL:
- if (auxv[i + 1] != 0)
- goto error;
- return 0;
- }
- error:
- return log_warning_errno(SYNTHETIC_ERRNO(ENODATA),
- "AT_NULL terminator not found, cannot parse auxv structure.");
-}
+DEFINE_PARSE_AUXV(32);
+DEFINE_PARSE_AUXV(64);
static int grant_user_access(int core_fd, const Context *context) {
int at_secure = -1;
@@ -464,11 +435,11 @@ static int grant_user_access(int core_fd, const Context *context) {
"Core file has non-native endianness, not adjusting permissions.");
if (elf[EI_CLASS] == ELFCLASS64)
- r = parse_auxv64((const uint64_t*) context->meta[META_PROC_AUXV],
+ r = parse_auxv64(context->meta[META_PROC_AUXV],
context->meta_size[META_PROC_AUXV],
&at_secure, &uid, &euid, &gid, &egid);
else
- r = parse_auxv32((const uint32_t*) context->meta[META_PROC_AUXV],
+ r = parse_auxv32(context->meta[META_PROC_AUXV],
context->meta_size[META_PROC_AUXV],
&at_secure, &uid, &euid, &gid, &egid);
if (r < 0)

View File

@ -0,0 +1,57 @@
From 1c7d14785d8975df5f6400d22fa5eae4693f7288 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sat, 18 Mar 2023 12:12:01 +0900
Subject: [PATCH] core/transaction: make merge_unit_ids() always return
NUL-terminated string
Follow-up for 924775e8ce49817f96df19c2b06356c12ecfc754.
The loop run with `STRV_FOREACH_PAIR()`, hence `if (*(unit_id+1))` is
not a good way to detect if there exist a next entry.
Fixes #26872.
(cherry picked from commit 366eced4c81a15a25b9225347fa203aa67798b02)
Related: #2170883
---
src/core/transaction.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 8ec853d58d..043998078c 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -323,22 +323,25 @@ _pure_ static bool unit_matters_to_anchor(Unit *u, Job *job) {
return false;
}
-static char* merge_unit_ids(const char* unit_log_field, char **pairs) {
- char *ans = NULL;
- size_t size = 0, next;
+static char* merge_unit_ids(const char* unit_log_field, char * const* pairs) {
+ _cleanup_free_ char *ans = NULL;
+ size_t size = 0;
STRV_FOREACH_PAIR(unit_id, job_type, pairs) {
+ size_t next;
+
+ if (size > 0)
+ ans[size - 1] = '\n';
+
next = strlen(unit_log_field) + strlen(*unit_id);
if (!GREEDY_REALLOC(ans, size + next + 1))
- return mfree(ans);
+ return NULL;
sprintf(ans + size, "%s%s", unit_log_field, *unit_id);
- if (*(unit_id+1))
- ans[size + next] = '\n';
size += next + 1;
}
- return ans;
+ return TAKE_PTR(ans);
}
static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsigned generation, sd_bus_error *e) {

View File

@ -0,0 +1,27 @@
From dbdeb09d8893a680c8241b4af3fd096c7aabe03f Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sat, 18 Mar 2023 12:17:54 +0900
Subject: [PATCH] core/transaction: make merge_unit_ids() return non-NULL on
success
(cherry picked from commit 999f16514367224cbc50cb3ccc1e4392e43f6811)
Related: #2170883
---
src/core/transaction.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 043998078c..7c862f35be 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -341,6 +341,9 @@ static char* merge_unit_ids(const char* unit_log_field, char * const* pairs) {
size += next + 1;
}
+ if (!ans)
+ return strdup("");
+
return TAKE_PTR(ans);
}

View File

@ -0,0 +1,45 @@
From 8e0b41ea9bf9afedcda713934f424b17195f9add Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sat, 18 Mar 2023 12:15:10 +0900
Subject: [PATCH] core/transaction: do not log "(null)"
As we ignores the failure in merge_unit_ids(), so unit_ids may be NULL.
(cherry picked from commit 5803c24da5cf543a55c4fce9009a9c5f2b18519a)
Related: #2170883
---
src/core/transaction.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 7c862f35be..bb51f51318 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -400,7 +400,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
"Found %s on %s/%s",
unit_id == array ? "ordering cycle" : "dependency",
*unit_id, *job_type),
- "%s", unit_ids);
+ "%s", strna(unit_ids));
if (delete) {
const char *status;
@@ -410,7 +410,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
"Job %s/%s deleted to break ordering cycle starting with %s/%s",
delete->unit->id, job_type_to_string(delete->type),
j->unit->id, job_type_to_string(j->type)),
- "%s", unit_ids);
+ "%s", strna(unit_ids));
if (log_get_show_color())
status = ANSI_HIGHLIGHT_RED " SKIP " ANSI_NORMAL;
@@ -429,7 +429,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
log_struct(LOG_ERR,
LOG_UNIT_MESSAGE(j->unit, "Unable to break cycle starting with %s/%s",
j->unit->id, job_type_to_string(j->type)),
- "%s", unit_ids);
+ "%s", strna(unit_ids));
return sd_bus_error_setf(e, BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC,
"Transaction order is cyclic. See system logs for details.");

View File

@ -0,0 +1,24 @@
From ea5817de22075c8770775e8ee113a90417517fee Mon Sep 17 00:00:00 2001
From: Jan Macku <jamacku@redhat.com>
Date: Mon, 10 Jul 2023 12:31:05 +0200
Subject: [PATCH] ci: allow `RHEL-only` labels to mark downstream-only commits
RHEL-only
Related: #2170883
---
.github/advanced-commit-linter.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/advanced-commit-linter.yml b/.github/advanced-commit-linter.yml
index 491836abbb..327af0467a 100644
--- a/.github/advanced-commit-linter.yml
+++ b/.github/advanced-commit-linter.yml
@@ -6,6 +6,7 @@ policy:
exception:
note:
- rhel-only
+ - RHEL-only
tracker:
- keyword:
- 'Resolves: #?'

View File

@ -0,0 +1,69 @@
From 7924438d595c7c77ead2e9ed475212fab7792fe4 Mon Sep 17 00:00:00 2001
From: Romain Geissler <romain.geissler@amadeus.com>
Date: Tue, 20 Jun 2023 16:06:31 +0000
Subject: [PATCH] elf-util: discard PT_LOAD segment early based on the start
address.
Indeed when iterating over all the PT_LOAD segment of the core dump
while trying to look for the elf headers of a given module, we iterate
over them all and try to use the first one for which we can parse a
package metadata, but the start address is never taken into account,
so absolutely nothing guarantees we actually parse the right ELF header
of the right module we are currently iterating on.
This was tested like this:
- Create a core dump using sleep on a fedora 37 container, with an
explicit LD_PRELOAD of a library having a valid package metadata:
podman run -t -i --rm -v $(pwd):$(pwd) -w $(pwd) fedora:37 bash -x -c \
'LD_PRELOAD=libreadline.so.8 sleep 1000 & SLEEP_PID="$!" && sleep 1 && kill -11 "${SLEEP_PID}" && mv "core.${SLEEP_PID}" the-core'
- Then from a fedora 38 container with systemd installed, the resulting
core dump has been passed to systemd-coredump with and without this
patch. Without this patch, we get:
Module /usr/bin/sleep from rpm bash-5.2.15-3.fc38.x86_64
Module /usr/lib64/libtinfo.so.6.3 from rpm coreutils-9.1-8.fc37.x86_64
Module /usr/lib64/libc.so.6 from rpm coreutils-9.1-8.fc37.x86_64
Module /usr/lib64/libreadline.so.8.2 from rpm coreutils-9.1-8.fc37.x86_64
Module /usr/lib64/ld-linux-x86-64.so.2 from rpm coreutils-9.1-8.fc37.x86_64
While with this patch we get:
Module /usr/bin/sleep from rpm bash-5.2.15-3.fc38.x86_64
Module /usr/lib64/libtinfo.so.6.3 from rpm ncurses-6.3-5.20220501.fc37.x86_64
Module /usr/lib64/libreadline.so.8.2 from rpm readline-8.2-2.fc37.x86_64
So the parsed package metadata reported by systemd-coredump when the module
files are not found on the host (ie the case of crash inside a container) are
now correct. The inconsistency of the first module in the above example
(sleep is indeed not provided by the bash package) can be ignored as it
is a consequence of how this was tested.
In addition to this, this also fixes the performance issue of
systemd-coredump in case of the crashing process uses a large number of
shared libraries and having no package metadata, as reported in
https://sourceware.org/pipermail/elfutils-devel/2023q2/006225.html.
(cherry picked from commit 21a2c735e2bfdc3bfdc42f894d6e3d00f4a38dcd)
Resolves: #2215412
---
src/shared/elf-util.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/shared/elf-util.c b/src/shared/elf-util.c
index 181735409d..d746f3ab3f 100644
--- a/src/shared/elf-util.c
+++ b/src/shared/elf-util.c
@@ -538,6 +538,10 @@ static int module_callback(Dwfl_Module *mod, void **userdata, const char *name,
if (!program_header || program_header->p_type != PT_LOAD)
continue;
+ /* This PT_LOAD segment doesn't contain the start address, so it can't be the module we are looking for. */
+ if (start < program_header->p_vaddr || start >= program_header->p_vaddr + program_header->p_memsz)
+ continue;
+
/* Now get a usable Elf reference, and parse the notes from it. */
data = sym_elf_getdata_rawchunk(elf,
program_header->p_offset,

View File

@ -0,0 +1,40 @@
From 57d92dd0f1fd55f2bb2ff7f4228ca01b29dbd054 Mon Sep 17 00:00:00 2001
From: Romain Geissler <romain.geissler@amadeus.com>
Date: Thu, 22 Jun 2023 16:05:18 +0000
Subject: [PATCH] elf-util: check for overflow when computing end of core's
PT_LOAD segments
(cherry picked from commit 3965f173eae4701a014113cfaf4a28a6bb63bed7)
Related: #2215412
---
src/shared/elf-util.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/shared/elf-util.c b/src/shared/elf-util.c
index d746f3ab3f..bde5013b92 100644
--- a/src/shared/elf-util.c
+++ b/src/shared/elf-util.c
@@ -532,14 +532,21 @@ static int module_callback(Dwfl_Module *mod, void **userdata, const char *name,
for (size_t i = 0; i < n_program_headers; ++i) {
GElf_Phdr mem, *program_header;
Elf_Data *data;
+ GElf_Addr end_of_segment;
/* The core file stores the ELF files in the PT_LOAD segment. */
program_header = sym_gelf_getphdr(elf, i, &mem);
if (!program_header || program_header->p_type != PT_LOAD)
continue;
+ /* Check that the end of segment is a valid address. */
+ if (__builtin_add_overflow(program_header->p_vaddr, program_header->p_memsz, &end_of_segment)) {
+ log_error("Abort due to corrupted core dump, end of segment address %#zx + %#zx overflows", (size_t)program_header->p_vaddr, (size_t)program_header->p_memsz);
+ return DWARF_CB_ABORT;
+ }
+
/* This PT_LOAD segment doesn't contain the start address, so it can't be the module we are looking for. */
- if (start < program_header->p_vaddr || start >= program_header->p_vaddr + program_header->p_memsz)
+ if (start < program_header->p_vaddr || start >= end_of_segment)
continue;
/* Now get a usable Elf reference, and parse the notes from it. */

View File

@ -0,0 +1,46 @@
From b3053fa0f83a55bb9fb8148eab51089171da21cb Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
Date: Tue, 14 Feb 2023 22:10:13 -0500
Subject: [PATCH] sulogin: use DEFINE_MAIN_FUNCTION()
Let's use DEFINE_MAIN_FUNCTION() as the other commands for consistency.
This commit should be no functional change.
(cherry picked from commit 2ffbf44344983d64949e032e74edb19c48b16cc0)
Related: #2169959
---
src/sulogin-shell/sulogin-shell.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/sulogin-shell/sulogin-shell.c b/src/sulogin-shell/sulogin-shell.c
index 5648dfd83b..e3601de8d4 100644
--- a/src/sulogin-shell/sulogin-shell.c
+++ b/src/sulogin-shell/sulogin-shell.c
@@ -14,6 +14,7 @@
#include "def.h"
#include "env-util.h"
#include "log.h"
+#include "main-func.h"
#include "process-util.h"
#include "signal-util.h"
#include "special.h"
@@ -86,7 +87,7 @@ static void print_mode(const char* mode) {
fflush(stdout);
}
-int main(int argc, char *argv[]) {
+static int run(int argc, char *argv[]) {
const char* sulogin_cmdline[] = {
SULOGIN,
NULL, /* --force */
@@ -115,5 +116,7 @@ int main(int argc, char *argv[]) {
r = start_default_target(bus);
}
- return r >= 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+ return r;
}
+
+DEFINE_MAIN_FUNCTION(run);

View File

@ -0,0 +1,131 @@
From 348854f8023fa6233ce7549b32eb8319b91c24e6 Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
Date: Sun, 12 Feb 2023 12:15:08 +0000
Subject: [PATCH] sulogin: fix control lost of the current terminal when
default.target is rescue.target
When default.target is rescue.target, exiting from the single-user shell
results in lost of the control of the current terminal. This is because the
operation performed to continue to boot is systemctl default but default.target
is now rescue.target and it is already active. Hence, no new process that
controls the current terminal is created. Users need to make hardware reset to
recover the situation.
This sounds like a bit corner case issue and some might feel configuring
default.target as rescue.target is odd because there are several other ways to
transition to rescue.mode without configuring default.target to rescue.target
such as systemctl rescue or systemd.unit=rescue.target something like
that. However, users unfamiliar with systemd operations tend to come up with
systemctl set-default rescue.target.
To fix this issue, let's transition to default.target only when default.target
is inactive. Otherwise, invoke the single-user shell again to keep control of
the current terminal for users.
This new logic depends on whether D-Bus working well. Exiting without any check
of result of systemctl default could lead to again the control lost of the
current terminal. Hence, add checking results of each D-Bus operations
including systemctl default and invoke the single-user shell if they fail.
(cherry picked from commit 937ca8330d11e406b8ef343bead6f4f6244e39c7)
Resolves: #2169959
---
src/sulogin-shell/sulogin-shell.c | 59 +++++++++++++++++++++++++------
1 file changed, 49 insertions(+), 10 deletions(-)
diff --git a/src/sulogin-shell/sulogin-shell.c b/src/sulogin-shell/sulogin-shell.c
index e3601de8d4..f1660c69e0 100644
--- a/src/sulogin-shell/sulogin-shell.c
+++ b/src/sulogin-shell/sulogin-shell.c
@@ -18,6 +18,7 @@
#include "process-util.h"
#include "signal-util.h"
#include "special.h"
+#include "unit-def.h"
static int reload_manager(sd_bus *bus) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
@@ -42,6 +43,28 @@ static int reload_manager(sd_bus *bus) {
return 0;
}
+static int default_target_is_inactive(sd_bus *bus) {
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_free_ char *path = NULL, *state = NULL;
+ int r;
+
+ path = unit_dbus_path_from_name(SPECIAL_DEFAULT_TARGET);
+ if (!path)
+ return log_oom();
+
+ r = sd_bus_get_property_string(bus,
+ "org.freedesktop.systemd1",
+ path,
+ "org.freedesktop.systemd1.Unit",
+ "ActiveState",
+ &error,
+ &state);
+ if (r < 0)
+ return log_error_errno(r, "Failed to retrieve unit state: %s", bus_error_message(&error, r));
+
+ return streq_ptr(state, "inactive");
+}
+
static int start_default_target(sd_bus *bus) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
int r;
@@ -93,7 +116,6 @@ static int run(int argc, char *argv[]) {
NULL, /* --force */
NULL
};
- _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r;
log_setup();
@@ -104,19 +126,36 @@ static int run(int argc, char *argv[]) {
/* allows passwordless logins if root account is locked. */
sulogin_cmdline[1] = "--force";
- (void) fork_wait(sulogin_cmdline);
+ for (;;) {
+ _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
+
+ (void) fork_wait(sulogin_cmdline);
+
+ r = bus_connect_system_systemd(&bus);
+ if (r < 0) {
+ log_warning_errno(r, "Failed to get D-Bus connection: %m");
+ goto fallback;
+ }
- r = bus_connect_system_systemd(&bus);
- if (r < 0) {
- log_warning_errno(r, "Failed to get D-Bus connection: %m");
- r = 0;
- } else {
- (void) reload_manager(bus);
+ if (reload_manager(bus) < 0)
+ goto fallback;
- r = start_default_target(bus);
+ r = default_target_is_inactive(bus);
+ if (r < 0)
+ goto fallback;
+ if (!r) {
+ log_warning(SPECIAL_DEFAULT_TARGET" is not inactive. Please review the "SPECIAL_DEFAULT_TARGET" setting.\n");
+ goto fallback;
+ }
+
+ if (start_default_target(bus) >= 0)
+ break;
+
+ fallback:
+ log_warning("Fallback to the single-user shell.\n");
}
- return r;
+ return 0;
}
DEFINE_MAIN_FUNCTION(run);

View File

@ -0,0 +1,90 @@
From 407e6bbb46a67200ea27a04c10c931dba9727cdd Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Wed, 22 Mar 2023 12:36:54 +0100
Subject: [PATCH] journal-vacuum: count size of all journal files
Currently, active journal files are excluded, which means that vacuuming
may not remove anything even if *MaxUse= has been exceeded.
(cherry picked from commit 9ea46af4f2368b41d57705bac09774778126507f)
Resolves: #2182632
---
src/libsystemd/sd-journal/journal-vacuum.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/libsystemd/sd-journal/journal-vacuum.c b/src/libsystemd/sd-journal/journal-vacuum.c
index eac3500202..23497af28e 100644
--- a/src/libsystemd/sd-journal/journal-vacuum.c
+++ b/src/libsystemd/sd-journal/journal-vacuum.c
@@ -158,6 +158,8 @@ int journal_directory_vacuum(
if (!S_ISREG(st.st_mode))
continue;
+ size = 512UL * (uint64_t) st.st_blocks;
+
q = strlen(de->d_name);
if (endswith(de->d_name, ".journal")) {
@@ -167,6 +169,7 @@ int journal_directory_vacuum(
if (q < 1 + 32 + 1 + 16 + 1 + 16 + 8) {
n_active_files++;
+ sum += size;
continue;
}
@@ -174,6 +177,7 @@ int journal_directory_vacuum(
de->d_name[q-8-16-1-16-1] != '-' ||
de->d_name[q-8-16-1-16-1-32-1] != '@') {
n_active_files++;
+ sum += size;
continue;
}
@@ -186,11 +190,13 @@ int journal_directory_vacuum(
de->d_name[q-8-16-1-16-1] = 0;
if (sd_id128_from_string(de->d_name + q-8-16-1-16-1-32, &seqnum_id) < 0) {
n_active_files++;
+ sum += size;
continue;
}
if (sscanf(de->d_name + q-8-16-1-16, "%16llx-%16llx.journal", &seqnum, &realtime) != 2) {
n_active_files++;
+ sum += size;
continue;
}
@@ -206,12 +212,14 @@ int journal_directory_vacuum(
if (q < 1 + 16 + 1 + 16 + 8 + 1) {
n_active_files++;
+ sum += size;
continue;
}
if (de->d_name[q-1-8-16-1] != '-' ||
de->d_name[q-1-8-16-1-16-1] != '@') {
n_active_files++;
+ sum += size;
continue;
}
@@ -223,6 +231,7 @@ int journal_directory_vacuum(
if (sscanf(de->d_name + q-1-8-16-1-16, "%16llx-%16llx.journal~", &realtime, &tmp) != 2) {
n_active_files++;
+ sum += size;
continue;
}
@@ -233,8 +242,6 @@ int journal_directory_vacuum(
continue;
}
- size = 512UL * (uint64_t) st.st_blocks;
-
r = journal_file_empty(dirfd(d), p);
if (r < 0) {
log_debug_errno(r, "Failed check if %s is empty, ignoring: %m", p);

View File

@ -0,0 +1,133 @@
From f49fbc3ebbb026f87b974c11c40808cc777bd277 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 22 Feb 2023 23:10:25 +0100
Subject: [PATCH] memory-util: add a concept for gcc cleanup attribute based
array destruction
(cherry picked from commit ff3f1464ec2dd40c9d8eb92e1474cb4d1c8c676b)
Related: #2182632
---
src/basic/alloc-util.h | 1 +
src/basic/memory-util.h | 34 +++++++++++++++++++++++++++++
src/test/meson.build | 2 ++
src/test/test-memory-util.c | 43 +++++++++++++++++++++++++++++++++++++
4 files changed, 80 insertions(+)
create mode 100644 src/test/test-memory-util.c
diff --git a/src/basic/alloc-util.h b/src/basic/alloc-util.h
index b38db7d473..e4c8b71a2b 100644
--- a/src/basic/alloc-util.h
+++ b/src/basic/alloc-util.h
@@ -14,6 +14,7 @@
typedef void (*free_func_t)(void *p);
typedef void* (*mfree_func_t)(void *p);
+typedef void (*free_array_func_t)(void *p, size_t n);
/* If for some reason more than 4M are allocated on the stack, let's abort immediately. It's better than
* proceeding and smashing the stack limits. Note that by default RLIMIT_STACK is 8M on Linux. */
diff --git a/src/basic/memory-util.h b/src/basic/memory-util.h
index 6e3280b9df..8d75befed5 100644
--- a/src/basic/memory-util.h
+++ b/src/basic/memory-util.h
@@ -121,3 +121,37 @@ static inline void erase_and_freep(void *p) {
static inline void erase_char(char *p) {
explicit_bzero_safe(p, sizeof(char));
}
+
+/* An automatic _cleanup_-like logic for destroy arrays (i.e. pointers + size) when leaving scope */
+struct ArrayCleanup {
+ void **parray;
+ size_t *pn;
+ free_array_func_t pfunc;
+};
+
+static inline void array_cleanup(struct ArrayCleanup *c) {
+ assert(c);
+
+ assert(!c->parray == !c->pn);
+
+ if (!c->parray)
+ return;
+
+ if (*c->parray) {
+ assert(c->pfunc);
+ c->pfunc(*c->parray, *c->pn);
+ *c->parray = NULL;
+ }
+
+ *c->pn = 0;
+}
+
+#define CLEANUP_ARRAY(array, n, func) \
+ _cleanup_(array_cleanup) _unused_ struct ArrayCleanup CONCATENATE(_cleanup_array_, UNIQ) = { \
+ .parray = (void**) &(array), \
+ .pn = &(n), \
+ .pfunc = (free_array_func_t) ({ \
+ void (*_f)(typeof(array[0]) *a, size_t b) = func; \
+ _f; \
+ }), \
+ }
diff --git a/src/test/meson.build b/src/test/meson.build
index 2a4dfe26db..536ab08652 100644
--- a/src/test/meson.build
+++ b/src/test/meson.build
@@ -213,6 +213,8 @@ tests += [
[],
[libm]],
+ [files('test-memory-util.c')],
+
[files('test-mkdir.c')],
[files('test-json.c'),
diff --git a/src/test/test-memory-util.c b/src/test/test-memory-util.c
new file mode 100644
index 0000000000..a81b0e0120
--- /dev/null
+++ b/src/test/test-memory-util.c
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "memory-util.h"
+#include "tests.h"
+
+static void my_destructor(struct iovec *iov, size_t n) {
+ /* not really a destructor, just something we can use to check if the destruction worked */
+ memset(iov, 'y', sizeof(struct iovec) * n);
+}
+
+TEST(cleanup_array) {
+ struct iovec *iov, *saved_iov;
+ size_t n, saved_n;
+
+ n = 7;
+ iov = new(struct iovec, n);
+ assert_se(iov);
+
+ memset(iov, 'x', sizeof(struct iovec) * n);
+
+ saved_iov = iov;
+ saved_n = n;
+
+ {
+ assert_se(memeqbyte('x', saved_iov, sizeof(struct iovec) * saved_n));
+ assert_se(iov);
+ assert_se(n > 0);
+
+ CLEANUP_ARRAY(iov, n, my_destructor);
+
+ assert_se(memeqbyte('x', saved_iov, sizeof(struct iovec) * saved_n));
+ assert_se(iov);
+ assert_se(n > 0);
+ }
+
+ assert_se(memeqbyte('y', saved_iov, sizeof(struct iovec) * saved_n));
+ assert_se(!iov);
+ assert_se(n == 0);
+
+ free(saved_iov);
+}
+
+DEFINE_TEST_MAIN(LOG_INFO);

View File

@ -0,0 +1,94 @@
From b9f50b820804113811bcf291f586793de434fcdc Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sun, 5 Mar 2023 14:56:15 +0900
Subject: [PATCH] macro: introduce FOREACH_ARRAY() macro
The pattern that runs all array element is quite common.
But, sometimes, the number of element may be in a signed integer, or the
array may be NULL.
(cherry picked from commit 5716c27e1f52d2aba9dd02916c01d6271d9d0b16)
Related: #2182632
---
src/basic/macro.h | 7 ++++++
src/test/test-macro.c | 50 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+)
diff --git a/src/basic/macro.h b/src/basic/macro.h
index 237117db12..b977730e54 100644
--- a/src/basic/macro.h
+++ b/src/basic/macro.h
@@ -329,6 +329,13 @@ static inline int __coverity_check_and_return__(int condition) {
#endif
#endif
+#define _FOREACH_ARRAY(i, array, num, m, s) \
+ for (typeof(num) m = (num); m > 0; m = 0) \
+ for (typeof(array[0]) *s = (array), *i = s; s && i < s + m; i++)
+
+#define FOREACH_ARRAY(i, array, num) \
+ _FOREACH_ARRAY(i, array, num, UNIQ_T(m, UNIQ), UNIQ_T(s, UNIQ))
+
#define DEFINE_TRIVIAL_DESTRUCTOR(name, type, func) \
static inline void name(type *p) { \
func(p); \
diff --git a/src/test/test-macro.c b/src/test/test-macro.c
index 049ea2c14e..6a5f4bbeb7 100644
--- a/src/test/test-macro.c
+++ b/src/test/test-macro.c
@@ -521,4 +521,54 @@ TEST(ISPOWEROF2) {
assert_se(!ISPOWEROF2(u));
}
+TEST(FOREACH_ARRAY) {
+ int a[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ int b[10] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
+ int x, n;
+
+ x = n = 0;
+ FOREACH_ARRAY(i, a, 10) {
+ x += *i;
+ n++;
+ }
+ assert_se(x == 45);
+ assert_se(n == 10);
+
+ x = n = 0;
+ FOREACH_ARRAY(i, a, 10)
+ FOREACH_ARRAY(j, b, 10) {
+ x += (*i) * (*j);
+ n++;
+ }
+ assert_se(x == 45 * 45);
+ assert_se(n == 10 * 10);
+
+ x = n = 0;
+ FOREACH_ARRAY(i, a, 5)
+ FOREACH_ARRAY(j, b, 5) {
+ x += (*i) * (*j);
+ n++;
+ }
+ assert_se(x == 10 * 35);
+ assert_se(n == 5 * 5);
+
+ x = n = 0;
+ FOREACH_ARRAY(i, a, 0)
+ FOREACH_ARRAY(j, b, 0) {
+ x += (*i) * (*j);
+ n++;
+ }
+ assert_se(x == 0);
+ assert_se(n == 0);
+
+ x = n = 0;
+ FOREACH_ARRAY(i, a, -1)
+ FOREACH_ARRAY(j, b, -1) {
+ x += (*i) * (*j);
+ n++;
+ }
+ assert_se(x == 0);
+ assert_se(n == 0);
+}
+
DEFINE_TEST_MAIN(LOG_INFO);

View File

@ -0,0 +1,64 @@
From 2f59a7790dc32bd9ba9e76331dbef6c80d07b705 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Wed, 22 Mar 2023 12:43:25 +0100
Subject: [PATCH] journal-vacuum: rename function to match struct name
(cherry picked from commit 646d5df49e1806b8c6322854ddb21903d906f471)
Related: #2182632
---
src/libsystemd/sd-journal/journal-vacuum.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/libsystemd/sd-journal/journal-vacuum.c b/src/libsystemd/sd-journal/journal-vacuum.c
index 23497af28e..e3d691a1e9 100644
--- a/src/libsystemd/sd-journal/journal-vacuum.c
+++ b/src/libsystemd/sd-journal/journal-vacuum.c
@@ -19,7 +19,7 @@
#include "time-util.h"
#include "xattr-util.h"
-struct vacuum_info {
+typedef struct vacuum_info {
uint64_t usage;
char *filename;
@@ -28,9 +28,9 @@ struct vacuum_info {
sd_id128_t seqnum_id;
uint64_t seqnum;
bool have_seqnum;
-};
+} vacuum_info;
-static int vacuum_compare(const struct vacuum_info *a, const struct vacuum_info *b) {
+static int vacuum_info_compare(const vacuum_info *a, const vacuum_info *b) {
int r;
if (a->have_seqnum && b->have_seqnum &&
@@ -125,7 +125,7 @@ int journal_directory_vacuum(
uint64_t sum = 0, freed = 0, n_active_files = 0;
size_t n_list = 0, i;
_cleanup_closedir_ DIR *d = NULL;
- struct vacuum_info *list = NULL;
+ vacuum_info *list = NULL;
usec_t retention_limit = 0;
int r;
@@ -270,7 +270,7 @@ int journal_directory_vacuum(
goto finish;
}
- list[n_list++] = (struct vacuum_info) {
+ list[n_list++] = (vacuum_info) {
.filename = TAKE_PTR(p),
.usage = size,
.seqnum = seqnum,
@@ -282,7 +282,7 @@ int journal_directory_vacuum(
sum += size;
}
- typesafe_qsort(list, n_list, vacuum_compare);
+ typesafe_qsort(list, n_list, vacuum_info_compare);
for (i = 0; i < n_list; i++) {
uint64_t left;

View File

@ -0,0 +1,107 @@
From e548d975a79204ab88ab6638aa5b24c173402723 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Wed, 22 Mar 2023 12:53:20 +0100
Subject: [PATCH] journal-vacuum: use CLEANUP_ARRAY
(cherry picked from commit 567cb18cc9185900ac6f701f0783a7d378e213cf)
Related: #2182632
---
src/libsystemd/sd-journal/journal-vacuum.c | 41 +++++++++++-----------
1 file changed, 20 insertions(+), 21 deletions(-)
diff --git a/src/libsystemd/sd-journal/journal-vacuum.c b/src/libsystemd/sd-journal/journal-vacuum.c
index e3d691a1e9..6f8aaaee4c 100644
--- a/src/libsystemd/sd-journal/journal-vacuum.c
+++ b/src/libsystemd/sd-journal/journal-vacuum.c
@@ -47,6 +47,16 @@ static int vacuum_info_compare(const vacuum_info *a, const vacuum_info *b) {
return strcmp(a->filename, b->filename);
}
+static void vacuum_info_array_free(vacuum_info *list, size_t n) {
+ if (!list)
+ return;
+
+ FOREACH_ARRAY(i, list, n)
+ free(i->filename);
+
+ free(list);
+}
+
static void patch_realtime(
int fd,
const char *fn,
@@ -129,6 +139,8 @@ int journal_directory_vacuum(
usec_t retention_limit = 0;
int r;
+ CLEANUP_ARRAY(list, n_list, vacuum_info_array_free);
+
assert(directory);
if (max_use <= 0 && max_retention_usec <= 0 && n_max_files <= 0)
@@ -141,7 +153,7 @@ int journal_directory_vacuum(
if (!d)
return -errno;
- FOREACH_DIRENT_ALL(de, d, r = -errno; goto finish) {
+ FOREACH_DIRENT_ALL(de, d, return -errno) {
unsigned long long seqnum = 0, realtime;
_cleanup_free_ char *p = NULL;
sd_id128_t seqnum_id;
@@ -182,10 +194,8 @@ int journal_directory_vacuum(
}
p = strdup(de->d_name);
- if (!p) {
- r = -ENOMEM;
- goto finish;
- }
+ if (!p)
+ return -ENOMEM;
de->d_name[q-8-16-1-16-1] = 0;
if (sd_id128_from_string(de->d_name + q-8-16-1-16-1-32, &seqnum_id) < 0) {
@@ -224,10 +234,8 @@ int journal_directory_vacuum(
}
p = strdup(de->d_name);
- if (!p) {
- r = -ENOMEM;
- goto finish;
- }
+ if (!p)
+ return -ENOMEM;
if (sscanf(de->d_name + q-1-8-16-1-16, "%16llx-%16llx.journal~", &realtime, &tmp) != 2) {
n_active_files++;
@@ -265,10 +273,8 @@ int journal_directory_vacuum(
patch_realtime(dirfd(d), p, &st, &realtime);
- if (!GREEDY_REALLOC(list, n_list + 1)) {
- r = -ENOMEM;
- goto finish;
- }
+ if (!GREEDY_REALLOC(list, n_list + 1))
+ return -ENOMEM;
list[n_list++] = (vacuum_info) {
.filename = TAKE_PTR(p),
@@ -312,15 +318,8 @@ int journal_directory_vacuum(
if (oldest_usec && i < n_list && (*oldest_usec == 0 || list[i].realtime < *oldest_usec))
*oldest_usec = list[i].realtime;
- r = 0;
-
-finish:
- for (i = 0; i < n_list; i++)
- free(list[i].filename);
- free(list);
-
log_full(verbose ? LOG_INFO : LOG_DEBUG, "Vacuuming done, freed %s of archived journals from %s.",
FORMAT_BYTES(freed), directory);
- return r;
+ return 0;
}

View File

@ -0,0 +1,28 @@
From 12894fae724cee1e5b94e6b36708e0b6752c9cec Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Wed, 31 May 2023 18:50:12 +0200
Subject: [PATCH] pam: add call to pam_umask
Setting umask for user sessions via UMASK setting in /etc/login.defs is
a well-known feature. Let's make sure that user manager also runs with
this umask value.
Follow-up for 5e37d1930b41b24c077ce37c6db0e36c745106c7.
(cherry picked from commit 159f1b78576ce91c3932f4867f07361a530875d3)
Resolves: #2210145
---
src/login/systemd-user.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/login/systemd-user.in b/src/login/systemd-user.in
index 39bcbd71fe..5906a7481b 100644
--- a/src/login/systemd-user.in
+++ b/src/login/systemd-user.in
@@ -18,4 +18,5 @@ session optional pam_keyinit.so force revoke
{% if ENABLE_HOMED %}
-session optional pam_systemd_home.so
{% endif %}
+session optional pam_umask.so silent
session optional pam_systemd.so

View File

@ -0,0 +1,196 @@
From ac7fc3fd00a6f468b14ba05b80d7e2d41b46d485 Mon Sep 17 00:00:00 2001
From: Ivan Vecera <ivecera@redhat.com>
Date: Thu, 22 Jun 2023 10:06:27 +0200
Subject: [PATCH] udev-builtin-net_id: align VF representor names with VF names
Certain cards support to set their eswitch to switchdev mode. In this
mode for each created VF there is also created so called VF representor.
This representor is helper network interface used for configuration of
mentioned eswitch and belongs to an appropriate PF.
VF representors are identified by the specific value of phys_port_name
attribute and the value has format "pfMvfN" where M is PF function
number and N is VF number inside this PF.
As the VF representor interfaces belong to PF PCI device the naming
scheme used for them is the same like for other PCI devices. In this
case name of PF interface is used and phys_port_name suffix is appended.
E.g.
PF=enp65s0f0np0 # phys_port_name for PF interface is 'p0'
VF=enp65s0f0np0v0 # v0 is appended for VF0 in case of NAMING_SR_IOV_V
REP=enp65s0f0np0pf0vf0 # phys_port_name for VF0 representor is 'pf0vf0'
First as the phys_port_name for representors is long (6+ chars) then the
generated name does not fit into IFNAMSIZ so this name is used only as
alternate interface name and for the primary one is used generic one
like eth<N>. Second 'f0' and 'pf0' in REP name is redundant.
This patch fixes this issue by introducing another naming scheme for VF
representors and appending 'rN' suffix to PF interface name for them.
N is VF number so the name used for representor interface is similar to
VF interface and differs only by the suffix.
For the example above we get:
PF=enp65s0f0np0
VF=enp65s0f0np0v0
REP=enp65s0f0np0r0
This eases for userspace to determine which representor interface
represents particular VF.
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
(cherry picked from commit 88d2bda8120dcc375a90e28b64de06b9646ab3b6)
Resolves: #2218886
---
man/systemd.net-naming-scheme.xml | 22 ++++++++++++++++++++++
src/shared/netif-naming-scheme.h | 2 ++
src/udev/udev-builtin-net_id.c | 25 ++++++++++++++++++++-----
3 files changed, 44 insertions(+), 5 deletions(-)
diff --git a/man/systemd.net-naming-scheme.xml b/man/systemd.net-naming-scheme.xml
index 0886369c9b..ade4e27e31 100644
--- a/man/systemd.net-naming-scheme.xml
+++ b/man/systemd.net-naming-scheme.xml
@@ -158,6 +158,7 @@
<term><varname>ID_NET_NAME_SLOT=<replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]<constant>b</constant><replaceable>number</replaceable></varname></term>
<term><varname>ID_NET_NAME_SLOT=<replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]<constant>u</constant><replaceable>port</replaceable>…[<constant>c</constant><replaceable>config</replaceable>][<constant>i</constant><replaceable>interface</replaceable>]</varname></term>
<term><varname>ID_NET_NAME_SLOT=<replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]<constant>v</constant><replaceable>slot</replaceable></varname></term>
+ <term><varname>ID_NET_NAME_SLOT=<replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]<constant>r</constant><replaceable>slot</replaceable></varname></term>
<listitem><para>This property describes the slot position. Different schemes are used depending on
the bus type, as described in the table below. In case of USB, BCMA, and SR-VIO devices, the full
@@ -205,6 +206,11 @@
<entry>… <constant>v</constant><replaceable>slot</replaceable></entry>
<entry>SR-VIO slot number</entry>
</row>
+
+ <row>
+ <entry>… <constant>r</constant><replaceable>slot</replaceable></entry>
+ <entry>SR-IOV slot number</entry>
+ </row>
</tbody>
</tgroup>
</table>
@@ -225,6 +231,11 @@
<constant>v</constant> and the virtual device number, with any leading zeros removed. The bus
number is ignored.</para>
+ <para>SR-IOV virtual device representors are named based on the name of the physical device
+ interface, with a suffix of <constant>r</constant> and the number of the virtual device that
+ is linked to the particular representor, with any leading zeros removed. The physical port
+ name and the bus number are ignored.</para>
+
<para>In some configurations a parent PCI bridge of a given network controller may be associated
with a slot. In such case we don't generate this device property to avoid possible naming conflicts.</para>
</listitem>
@@ -472,6 +483,17 @@
<listitem><para>Same as naming scheme <constant>rhel-9.0</constant>.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><constant>rhel-9.3</constant></term>
+
+ <listitem><para>Naming was changed for SR-IOV virtual device representors.</para>
+
+ <para>The <literal>r<replaceable>slot</replaceable></literal> suffix was added to differentiate SR-IOV
+ virtual device representors attached to a single physical device interface.
+ </para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
<para>Note that <constant>latest</constant> may be used to denote the latest scheme known (to this
diff --git a/src/shared/netif-naming-scheme.h b/src/shared/netif-naming-scheme.h
index 3e35c5e2fa..fb3c8eb9b3 100644
--- a/src/shared/netif-naming-scheme.h
+++ b/src/shared/netif-naming-scheme.h
@@ -38,6 +38,7 @@ typedef enum NamingSchemeFlags {
NAMING_XEN_VIF = 1 << 13, /* Generate names for Xen netfront devices */
NAMING_BRIDGE_MULTIFUNCTION_SLOT = 1 << 14, /* Use PCI hotplug slot information associated with bridge, but only if PCI device is multifunction */
NAMING_DEVICETREE_ALIASES = 1 << 15, /* Generate names from devicetree aliases */
+ NAMING_SR_IOV_R = 1 << 17, /* Use "r" suffix for SR-IOV VF representors */
/* And now the masks that combine the features above */
NAMING_V238 = 0,
@@ -54,6 +55,7 @@ typedef enum NamingSchemeFlags {
NAMING_RHEL_9_0 = NAMING_V250 | NAMING_BRIDGE_MULTIFUNCTION_SLOT,
NAMING_RHEL_9_1 = NAMING_RHEL_9_0,
NAMING_RHEL_9_2 = NAMING_RHEL_9_0,
+ NAMING_RHEL_9_3 = NAMING_RHEL_9_0 | NAMING_SR_IOV_R,
EXTRA_NET_NAMING_SCHEMES
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index d4e9dcb60d..c57568f8cb 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -80,6 +80,7 @@ typedef struct LinkInfo {
int ifindex;
int iflink;
int iftype;
+ int vf_representor_id;
const char *devtype;
const char *phys_port_name;
struct hw_addr_data hw_addr;
@@ -208,7 +209,10 @@ static int dev_pci_onboard(sd_device *dev, const LinkInfo *info, NetNames *names
s = names->pci_onboard;
l = sizeof(names->pci_onboard);
l = strpcpyf(&s, l, "o%lu", idx);
- if (!isempty(info->phys_port_name))
+ if (naming_scheme_has(NAMING_SR_IOV_R) && info->vf_representor_id >= 0)
+ /* For VF representor append 'r<VF_NUM>' and not phys_port_name */
+ l = strpcpyf(&s, l, "r%d", info->vf_representor_id);
+ else if (!isempty(info->phys_port_name))
/* kernel provided front panel port name for multiple port PCI device */
l = strpcpyf(&s, l, "n%s", info->phys_port_name);
else if (dev_port > 0)
@@ -391,7 +395,10 @@ static int dev_pci_slot(sd_device *dev, const LinkInfo *info, NetNames *names) {
l = strpcpyf(&s, l, "p%us%u", bus, slot);
if (func > 0 || is_pci_multifunction(names->pcidev) > 0)
l = strpcpyf(&s, l, "f%u", func);
- if (!isempty(info->phys_port_name))
+ if (naming_scheme_has(NAMING_SR_IOV_R) && info->vf_representor_id >= 0)
+ /* For VF representor append 'r<VF_NUM>' and not phys_port_name */
+ l = strpcpyf(&s, l, "r%d", info->vf_representor_id);
+ else if (!isempty(info->phys_port_name))
/* kernel provided front panel port name for multi-port PCI device */
l = strpcpyf(&s, l, "n%s", info->phys_port_name);
else if (dev_port > 0)
@@ -485,7 +492,10 @@ static int dev_pci_slot(sd_device *dev, const LinkInfo *info, NetNames *names) {
l = strpcpyf(&s, l, "s%"PRIu32, hotplug_slot);
if (func > 0 || is_pci_multifunction(names->pcidev) > 0)
l = strpcpyf(&s, l, "f%u", func);
- if (!isempty(info->phys_port_name))
+ if (naming_scheme_has(NAMING_SR_IOV_R) && info->vf_representor_id >= 0)
+ /* For VF representor append 'r<VF_NUM>' and not phys_port_name */
+ l = strpcpyf(&s, l, "r%d", info->vf_representor_id);
+ else if (!isempty(info->phys_port_name))
l = strpcpyf(&s, l, "n%s", info->phys_port_name);
else if (dev_port > 0)
l = strpcpyf(&s, l, "d%lu", dev_port);
@@ -1082,7 +1092,10 @@ static int get_link_info(sd_device *dev, LinkInfo *info) {
if (r < 0 && r != -ENOENT)
return r;
- (void) sd_device_get_sysattr_value(dev, "phys_port_name", &info->phys_port_name);
+ r = sd_device_get_sysattr_value(dev, "phys_port_name", &info->phys_port_name);
+ if (r >= 0)
+ /* Check if phys_port_name indicates virtual device representor */
+ (void) sscanf(info->phys_port_name, "pf%*uvf%d", &info->vf_representor_id);
r = sd_device_get_sysattr_value(dev, "address", &s);
if (r < 0 && r != -ENOENT)
@@ -1099,7 +1112,9 @@ static int get_link_info(sd_device *dev, LinkInfo *info) {
static int builtin_net_id(sd_device *dev, sd_netlink **rtnl, int argc, char *argv[], bool test) {
const char *prefix;
NetNames names = {};
- LinkInfo info = {};
+ LinkInfo info = {
+ .vf_representor_id = -1,
+ };
int r;
r = get_link_info(dev, &info);

View File

@ -0,0 +1,42 @@
From 7c717362136027e8efa82edba061158f4bb1fd07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 23 Nov 2022 16:09:56 +0100
Subject: [PATCH] pam: add a call to pam_namespace
A call to pam_namespace is required so that children of user@.service end up in
a namespace as expected. pam_namespace gets called as part of the stack that
creates a session (login, sshd, gdm, etc.) and those processes end up in a
namespace, but it also needs to be called from our stack which is parallel and
descends from pid1 itself.
The call to pam_namespace is similar to the call to pam_keyinit that was added
in ab79099d1684457d040ee7c28b2012e8c1ea9a4f. The pam stack for user@.service
creates a new session which is disconnected from the parent environment. Both
calls are not suitable for inclusion in the shared part of the stack (e.g.
@system-auth on Fedora/RHEL systems), because for example su/sudo/runuser
should not include them.
Fixes #17043 (Allow to execute user service into dedicated namespace
if pam_namespace enabled)
Related to https://bugzilla.redhat.com/show_bug.cgi?id=1861836
(Polyinstantiation is ignored/bypassed in GNOME sessions)
(cherry picked from commit 0ef48896d9f23b9fd547a532a4e6e6b8f8b12901)
Resolves: #2218184
---
src/login/systemd-user.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/login/systemd-user.in b/src/login/systemd-user.in
index 5906a7481b..8805306908 100644
--- a/src/login/systemd-user.in
+++ b/src/login/systemd-user.in
@@ -15,6 +15,7 @@ session required pam_selinux.so nottys open
{% endif %}
session required pam_loginuid.so
session optional pam_keyinit.so force revoke
+session required pam_namespace.so
{% if ENABLE_HOMED %}
-session optional pam_systemd_home.so
{% endif %}

View File

@ -0,0 +1,39 @@
From 65d993c2efe52d683396dc3181cc79f29698bf39 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
Date: Wed, 21 Jun 2023 17:10:46 +0200
Subject: [PATCH] rules: online CPU automatically on IBM s390x platforms when
configured
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RHEL-only
Fix CPU hotplug regression on s390x introduced by commit 94c7e260b499 ("rules:
do not online CPU automatically on IBM platforms"). After discussion with IBM,
CPUs should be auto-enabled when in the configured state after a hotplug.
However, if the CPU is deconfigured, it should not.
This is because on zVM and KVM hotplugged CPUs are configured and on LPAR/DPM
they are deconfigured.
Resolves: #2212612
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
rules.d/40-redhat.rules | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/rules.d/40-redhat.rules b/rules.d/40-redhat.rules
index efb866966e..00c02a59bd 100644
--- a/rules.d/40-redhat.rules
+++ b/rules.d/40-redhat.rules
@@ -3,7 +3,8 @@
# CPU hotadd request
SUBSYSTEM!="cpu", GOTO="cpu_online_end"
ACTION!="add", GOTO="cpu_online_end"
-CONST{arch}=="s390*|ppc64*", GOTO="cpu_online_end"
+CONST{arch}=="ppc64*", GOTO="cpu_online_end"
+CONST{arch}=="s390*", ATTR{configure}=="0", GOTO="cpu_online_end"
TEST=="online", ATTR{online}=="0", ATTR{online}="1"

View File

@ -0,0 +1,106 @@
From fcdec60764cd1d6f2d859558303390fffcec3633 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Thu, 11 May 2023 19:21:57 +0900
Subject: [PATCH] core/mount: escape invalid UTF8 char in dbus reply
When What= or Options= may contain invalid UTF8 chars.
Replaces aaf7b0e41105d7b7cf30912cdac32820f011a219 (#27541).
(cherry picked from commit 4804da58536ab7ad46178a03f4d2da49fd8e4ba2)
Resolves: #2208240
---
src/core/dbus-mount.c | 67 +++++++++++++++++++++++++++++++++++--------
1 file changed, 55 insertions(+), 12 deletions(-)
diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c
index 73702b1a16..55ad4f2c98 100644
--- a/src/core/dbus-mount.c
+++ b/src/core/dbus-mount.c
@@ -9,21 +9,66 @@
#include "mount.h"
#include "string-util.h"
#include "unit.h"
+#include "utf8.h"
+
+static int property_get_what(
+ sd_bus *bus,
+ const char *path,
+ const char *interface,
+ const char *property,
+ sd_bus_message *reply,
+ void *userdata,
+ sd_bus_error *error) {
+
+ _cleanup_free_ char *escaped = NULL;
+ Mount *m = ASSERT_PTR(userdata);
+ const char *s = NULL;
+
+ assert(bus);
+ assert(reply);
-static const char *mount_get_what(const Mount *m) {
if (m->from_proc_self_mountinfo && m->parameters_proc_self_mountinfo.what)
- return m->parameters_proc_self_mountinfo.what;
- if (m->from_fragment && m->parameters_fragment.what)
- return m->parameters_fragment.what;
- return NULL;
+ s = m->parameters_proc_self_mountinfo.what;
+ else if (m->from_fragment && m->parameters_fragment.what)
+ s = m->parameters_fragment.what;
+
+ if (s) {
+ escaped = utf8_escape_invalid(s);
+ if (!escaped)
+ return -ENOMEM;
+ }
+
+ return sd_bus_message_append_basic(reply, 's', escaped);
}
-static const char *mount_get_options(const Mount *m) {
+static int property_get_options(
+ sd_bus *bus,
+ const char *path,
+ const char *interface,
+ const char *property,
+ sd_bus_message *reply,
+ void *userdata,
+ sd_bus_error *error) {
+
+ _cleanup_free_ char *escaped = NULL;
+ Mount *m = ASSERT_PTR(userdata);
+ const char *s = NULL;
+
+ assert(bus);
+ assert(reply);
+
if (m->from_proc_self_mountinfo && m->parameters_proc_self_mountinfo.options)
- return m->parameters_proc_self_mountinfo.options;
- if (m->from_fragment && m->parameters_fragment.options)
- return m->parameters_fragment.options;
- return NULL;
+ s = m->parameters_proc_self_mountinfo.options;
+ else if (m->from_fragment && m->parameters_fragment.options)
+ s = m->parameters_fragment.options;
+
+ if (s) {
+ escaped = utf8_escape_invalid(s);
+ if (!escaped)
+ return -ENOMEM;
+ }
+
+ return sd_bus_message_append_basic(reply, 's', escaped);
}
static const char *mount_get_fstype(const Mount *m) {
@@ -34,8 +79,6 @@ static const char *mount_get_fstype(const Mount *m) {
return NULL;
}
-static BUS_DEFINE_PROPERTY_GET(property_get_what, "s", Mount, mount_get_what);
-static BUS_DEFINE_PROPERTY_GET(property_get_options, "s", Mount, mount_get_options);
static BUS_DEFINE_PROPERTY_GET(property_get_type, "s", Mount, mount_get_fstype);
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, mount_result, MountResult);

View File

@ -0,0 +1,76 @@
From 1d38915c7ac741cd1772521b3921b4e1655af9f8 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Fri, 3 Mar 2023 10:58:37 +0100
Subject: [PATCH] Revert "user: delegate cpu controller, assign weights to user
slices"
This reverts commit b8df7f8629cb310beac982a4779b27eabe5362c6.
Resolves: #2176899
---
TODO | 2 --
units/user/app.slice | 3 ---
units/user/background.slice | 3 ---
units/user/session.slice | 3 ---
units/user@.service.in | 2 +-
5 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/TODO b/TODO
index 560ec4bca4..66c008bff3 100644
--- a/TODO
+++ b/TODO
@@ -1662,8 +1662,6 @@ Features:
- when reloading configuration, apply new cgroup configuration
- when recursively showing the cgroup hierarchy, optionally also show
the hierarchies of child processes
-- add settings for cgroup.max.descendants and cgroup.max.depth,
- maybe use them for user@.service
* transient units:
- add field to transient units that indicate whether systemd or somebody else saves/restores its settings, for integration with libvirt
diff --git a/units/user/app.slice b/units/user/app.slice
index eac50645a4..0c73135e17 100644
--- a/units/user/app.slice
+++ b/units/user/app.slice
@@ -10,6 +10,3 @@
[Unit]
Description=User Application Slice
Documentation=man:systemd.special(7)
-
-[Slice]
-CPUWeight=100
diff --git a/units/user/background.slice b/units/user/background.slice
index a9767753b3..8f2a0949bd 100644
--- a/units/user/background.slice
+++ b/units/user/background.slice
@@ -10,6 +10,3 @@
[Unit]
Description=User Background Tasks Slice
Documentation=man:systemd.special(7)
-
-[Slice]
-CPUWeight=30
diff --git a/units/user/session.slice b/units/user/session.slice
index aa12b7d03c..3d99d51bc5 100644
--- a/units/user/session.slice
+++ b/units/user/session.slice
@@ -10,6 +10,3 @@
[Unit]
Description=User Core Session Slice
Documentation=man:systemd.special(7)
-
-[Slice]
-CPUWeight=100
diff --git a/units/user@.service.in b/units/user@.service.in
index 1660de0326..efbd5dfbc8 100644
--- a/units/user@.service.in
+++ b/units/user@.service.in
@@ -21,7 +21,7 @@ Type=notify
ExecStart={{ROOTLIBEXECDIR}}/systemd --user
Slice=user-%i.slice
KillMode=mixed
-Delegate=pids memory cpu
+Delegate=pids memory
TasksMax=infinity
TimeoutStopSec=120s
KeyringMode=inherit

View File

@ -0,0 +1,61 @@
From b4bf6261b5025dabf92997bf124f57e2e314935e Mon Sep 17 00:00:00 2001
From: Thomas Blume <Thomas.Blume@suse.com>
Date: Thu, 2 Mar 2023 12:06:13 +0100
Subject: [PATCH] udev-rules: fix nvme symlink creation on namespace changes
The nvme by-id symlink changes to the latest namespace when a new namespace gets
added, for example by connecting multiple NVMe/TCP host controllers via nvme
connect-all.
That is incorrect for persistent device links.
The persistent symbolic device link should continue to point to the same NVMe
namespace throughout the lifetime of the current boot.
Therefore the namespace id needs to be added to the link name.
(cherry picked from commit c5ba7a2a4dd19a2d31b8a9d52d3c4bdde78387f0)
Resolves: #2172509
---
rules.d/60-persistent-storage.rules | 8 ++++++++
test/units/testsuite-64.sh | 2 ++
2 files changed, 10 insertions(+)
diff --git a/rules.d/60-persistent-storage.rules b/rules.d/60-persistent-storage.rules
index 18588e4c45..d6612daf7d 100644
--- a/rules.d/60-persistent-storage.rules
+++ b/rules.d/60-persistent-storage.rules
@@ -37,14 +37,22 @@ KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{serial}=="?*", ENV{ID_S
KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{wwid}=="?*", ENV{ID_WWN}="$attr{wwid}"
KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{model}=="?*", ENV{ID_MODEL}="$attr{model}"
KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{firmware_rev}=="?*", ENV{ID_REVISION}="$attr{firmware_rev}"
+KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{nsid}=="?*", ENV{ID_NSID}="$attr{nsid}"
+# obsolete symlink that might get overridden on adding a new nvme controller, kept for backward compatibility
KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}"
+KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_NSID}=="?*",\
+ OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}_$env{ID_NSID}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}"
KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{serial}=="?*", ENV{ID_SERIAL_SHORT}="$attr{serial}"
KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{model}=="?*", ENV{ID_MODEL}="$attr{model}"
KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{firmware_rev}=="?*", ENV{ID_REVISION}="$attr{firmware_rev}"
+KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{nsid}=="?*", ENV{ID_NSID}="$attr{nsid}"
+# obsolete symlink that might get overridden on adding a new nvme controller, kept for backward compatibility
KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n"
+KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_NSID}=="?*",\
+ OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}_$env{ID_NSID}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n"
# virtio-blk
KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}"
diff --git a/test/units/testsuite-64.sh b/test/units/testsuite-64.sh
index 201a673d06..f7298ed0d6 100755
--- a/test/units/testsuite-64.sh
+++ b/test/units/testsuite-64.sh
@@ -182,6 +182,8 @@ testcase_nvme_subsystem() {
local expected_symlinks=(
# Controller(s)
/dev/disk/by-id/nvme-QEMU_NVMe_Ctrl_deadbeef
+ /dev/disk/by-id/nvme-QEMU_NVMe_Ctrl_deadbeef_16
+ /dev/disk/by-id/nvme-QEMU_NVMe_Ctrl_deadbeef_17
# Shared namespaces
/dev/disk/by-path/pci-*-nvme-16
/dev/disk/by-path/pci-*-nvme-17

View File

@ -0,0 +1,35 @@
From b3a19cc848f1f7046fb19c6a27b56fa3bf341728 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
Date: Sat, 25 Mar 2023 08:00:00 +0000
Subject: [PATCH] rules: add whitespace after comma before the line
continuation
(cherry picked from commit 519044f565cf32f4ebd0ecca5eb162555aa006b2)
Related: #2172509
---
rules.d/60-persistent-storage.rules | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rules.d/60-persistent-storage.rules b/rules.d/60-persistent-storage.rules
index d6612daf7d..f5178ed6bd 100644
--- a/rules.d/60-persistent-storage.rules
+++ b/rules.d/60-persistent-storage.rules
@@ -41,7 +41,7 @@ KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{nsid}=="?*", ENV{ID_NSI
# obsolete symlink that might get overridden on adding a new nvme controller, kept for backward compatibility
KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}"
-KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_NSID}=="?*",\
+KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_NSID}=="?*", \
OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}_$env{ID_NSID}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}"
KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{serial}=="?*", ENV{ID_SERIAL_SHORT}="$attr{serial}"
@@ -51,7 +51,7 @@ KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{nsid}=="?*"
# obsolete symlink that might get overridden on adding a new nvme controller, kept for backward compatibility
KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n"
-KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_NSID}=="?*",\
+KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_NSID}=="?*", \
OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}_$env{ID_NSID}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n"
# virtio-blk

View File

@ -0,0 +1,61 @@
From b4c71f09f1933324593aef453f70e986d0175b70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 6 Apr 2023 12:28:14 +0200
Subject: [PATCH] udev: restore compat symlink for nvme devices
In 5118e8e71dda211d20e34ec8d3012186ba27d3d3, the rules were changed to add
OPTIONS="string_escape=replace" to creation of
ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", so that "/" would be
escaped. But this also changes how the symlink looks for devices that do not
have "/". This adds back the old symlink for compat, except when a slash
is present.
In the meantime, we changed the symlink format to include ${ND_NSID}. Since
the symlink with unescaped characters are older than that, for compat we
only need to cover the older type. (Symlinks without escaping and with ${ND_NSID}
were never created.) This makes it slightly easier on users: the non-deprecated
symlinks are with "_${ND_NSID}", so they are easier to distinguish.
Fixes #27155.
Mostly untested :( I only have a boring nvme device with no special characters
in the id, and the symlinks are unchanged for it by this patch.
(cherry picked from commit d05e1be86e6b14bd22d57af17efcc3b8fb7ecd82)
Related: #2172509
[msekleta: it is not strictly necessary to include this commit in RHEL-9
because the we never had the previous version of non-escaped symlinks in
RHEL-9. However, by including it we are making a life a bit easier for
folks that are doing in-place upgrade from RHEL-8.]
---
rules.d/60-persistent-storage.rules | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/rules.d/60-persistent-storage.rules b/rules.d/60-persistent-storage.rules
index f5178ed6bd..8269c3cfd9 100644
--- a/rules.d/60-persistent-storage.rules
+++ b/rules.d/60-persistent-storage.rules
@@ -38,6 +38,10 @@ KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{wwid}=="?*", ENV{ID_WWN
KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{model}=="?*", ENV{ID_MODEL}="$attr{model}"
KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{firmware_rev}=="?*", ENV{ID_REVISION}="$attr{firmware_rev}"
KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{nsid}=="?*", ENV{ID_NSID}="$attr{nsid}"
+# obsolete symlink with non-escaped characters, kept for backward compatiblity
+KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
+ ENV{ID_MODEL}!="*/*", ENV{ID_SERIAL_SHORT}!="*/*", \
+ ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}"
# obsolete symlink that might get overridden on adding a new nvme controller, kept for backward compatibility
KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}"
@@ -48,6 +52,10 @@ KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{serial}=="?
KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{model}=="?*", ENV{ID_MODEL}="$attr{model}"
KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{firmware_rev}=="?*", ENV{ID_REVISION}="$attr{firmware_rev}"
KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{nsid}=="?*", ENV{ID_NSID}="$attr{nsid}"
+# obsolete symlink with non-escaped characters, kept for backward compatiblity
+KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
+ ENV{ID_MODEL}!="*/*", ENV{ID_SERIAL_SHORT}!="*/*", \
+ ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n"
# obsolete symlink that might get overridden on adding a new nvme controller, kept for backward compatibility
KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n"

View File

@ -0,0 +1,25 @@
From 5e92f162bc25197b67d9ffd7669d803a9168b4e6 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sat, 8 Apr 2023 03:36:44 +0900
Subject: [PATCH] rules: drop doubled space
(cherry picked from commit 49e3e219b01132ef269297574a9bc7b7b34d9398)
Related: #2172509
---
rules.d/60-persistent-storage.rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rules.d/60-persistent-storage.rules b/rules.d/60-persistent-storage.rules
index 8269c3cfd9..10b347e191 100644
--- a/rules.d/60-persistent-storage.rules
+++ b/rules.d/60-persistent-storage.rules
@@ -59,7 +59,7 @@ KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?
# obsolete symlink that might get overridden on adding a new nvme controller, kept for backward compatibility
KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n"
-KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_NSID}=="?*", \
+KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_NSID}=="?*", \
OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}_$env{ID_NSID}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n"
# virtio-blk

View File

@ -0,0 +1,64 @@
From b7b6493dd0a58931afbb7c7d818c1ebb6460b2bc Mon Sep 17 00:00:00 2001
From: Jan Macku <jamacku@redhat.com>
Date: Tue, 9 May 2023 13:15:06 +0200
Subject: [PATCH] manager: don't taint the host if cgroups v1 is used
In upstream of systemd, cgroups v1 are not considered as supported.
This is not true for RHEL, don't taint the host when cgroups v1 are enabled.
rhel-only
Resolves: #2193456
---
man/org.freedesktop.systemd1.xml | 6 ------
src/core/manager.c | 3 ---
src/test/test-manager.c | 5 -----
3 files changed, 14 deletions(-)
diff --git a/man/org.freedesktop.systemd1.xml b/man/org.freedesktop.systemd1.xml
index 40510c43eb..13a84af747 100644
--- a/man/org.freedesktop.systemd1.xml
+++ b/man/org.freedesktop.systemd1.xml
@@ -1589,12 +1589,6 @@ node /org/freedesktop/systemd1 {
<listitem><para>Support for cgroups is unavailable.</para></listitem>
</varlistentry>
- <varlistentry>
- <term><literal>cgroupsv1</literal></term>
-
- <listitem><para>The system is using the old cgroup hierarchy.</para></listitem>
- </varlistentry>
-
<varlistentry>
<term><literal>local-hwclock</literal></term>
diff --git a/src/core/manager.c b/src/core/manager.c
index a59afafb58..657263eb73 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -4491,9 +4491,6 @@ char* manager_taint_string(const Manager *m) {
if (access("/proc/cgroups", F_OK) < 0)
stage[n++] = "cgroups-missing";
- if (cg_all_unified() == 0)
- stage[n++] = "cgroupsv1";
-
if (clock_is_localtime(NULL) > 0)
stage[n++] = "local-hwclock";
diff --git a/src/test/test-manager.c b/src/test/test-manager.c
index 89f9277b28..2faf715d76 100644
--- a/src/test/test-manager.c
+++ b/src/test/test-manager.c
@@ -14,11 +14,6 @@ TEST(manager_taint_string) {
* to test for them. Let's do just one. */
assert_se(!strstr(a, "split-usr"));
- if (cg_all_unified() == 0)
- assert_se(strstr(a, "cgroupsv1"));
- else
- assert_se(!strstr(a, "cgroupsv1"));
-
m.taint_usr = true;
_cleanup_free_ char *b = manager_taint_string(&m);
assert_se(b);

View File

@ -0,0 +1,43 @@
From 14d3ca976102d1c013b4b634586a365aadcd94c4 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Mon, 22 May 2023 17:44:30 +0200
Subject: [PATCH] core/service: when resetting PID also reset known flag
Re-watching pids on cgroup v1 (needed because of unreliability of cgroup
empty notifications in containers) is handled bellow at the end of
service_sigchld_event() and depends on value main_pid_known flag.
In CentOS Stream 8 container on cgroup v1 the stop action would get stuck
indefinitely on unit like this,
$ cat /run/systemd/system/foo.service
[Service]
ExecStart=/bin/bash -c 'trap "nohup sleep 1 & exit 0" TERM; sleep infinity'
ExecStop=/bin/bash -c 'kill -s TERM $MAINPID'
TimeoutSec=0
However, upstream works "fine" because in upstream version of systemd we
actually never wait on processes killed in containers and proceed
immediately to sending SIGKILL hence re-watching of pids in the cgroup
is not necessary. But for the sake of correctness we should merge the
patch also upstream.
(cherry picked from commit ff32060f2ed37b68dc26256b05e2e69013b0ecfe)
Resolves: #2210237
---
src/core/service.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/core/service.c b/src/core/service.c
index 1e14cdc6ca..e5127a4ccf 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -3507,6 +3507,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
return;
s->main_pid = 0;
+ s->main_pid_known = false;
exec_status_exit(&s->main_exec_status, &s->exec_context, pid, code, status);
if (s->main_command) {

View File

@ -0,0 +1,28 @@
From 7885b4384b422db6b2d6ad1771dc89c4a3c3461b Mon Sep 17 00:00:00 2001
From: Jan Macku <jamacku@redhat.com>
Date: Thu, 13 Jul 2023 14:21:20 +0200
Subject: [PATCH] ci: drop systemd-stable from advanced-commit-linter config
It's sufficient enough to check only the `systemd/systemd` repo.
Related to https://github.com/redhat-plumbers-in-action/advanced-commit-linter/issues/62
rhel-only
Related: #2170883
---
.github/advanced-commit-linter.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.github/advanced-commit-linter.yml b/.github/advanced-commit-linter.yml
index 327af0467a..0fb74a9dc8 100644
--- a/.github/advanced-commit-linter.yml
+++ b/.github/advanced-commit-linter.yml
@@ -2,7 +2,6 @@ policy:
cherry-pick:
upstream:
- github: systemd/systemd
- - github: systemd/systemd-stable
exception:
note:
- rhel-only

View File

@ -21,7 +21,7 @@
Name: systemd
Url: https://systemd.io
Version: 252
Release: 15%{?dist}
Release: 16%{?dist}
# For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+
Summary: System and Service Manager
@ -327,6 +327,41 @@ Patch0246: 0246-sd-journal-always-use-the-compression-algorithm-spec.patch
Patch0247: 0247-sd-journal-allow-to-specify-compression-algorithm-th.patch
Patch0248: 0248-test-add-test-case-that-journal-file-is-created-with.patch
Patch0249: 0249-rules-do-not-online-CPU-automatically-on-IBM-platfor.patch
Patch0250: 0250-ci-update-permissions-for-source-git-automation-work.patch
Patch0251: 0251-pstore-fixes-for-dmesg.txt-reconstruction.patch
Patch0252: 0252-pstore-explicitly-set-the-base-when-converting-recor.patch
Patch0253: 0253-pstore-avoid-opening-the-dmesg.txt-file-if-not-reque.patch
Patch0254: 0254-test-add-a-couple-of-tests-for-systemd-pstore.patch
Patch0255: 0255-test-match-all-messages-with-the-FILE-field.patch
Patch0256: 0256-test-build-the-SELinux-test-module-on-the-host.patch
Patch0257: 0257-test-make-the-stress-test-slightly-less-stressful-on.patch
Patch0258: 0258-coredump-use-unaligned_read_ne-32-64-to-parse-auxv.patch
Patch0259: 0259-core-transaction-make-merge_unit_ids-always-return-N.patch
Patch0260: 0260-core-transaction-make-merge_unit_ids-return-non-NULL.patch
Patch0261: 0261-core-transaction-do-not-log-null.patch
Patch0262: 0262-ci-allow-RHEL-only-labels-to-mark-downstream-only-co.patch
Patch0263: 0263-elf-util-discard-PT_LOAD-segment-early-based-on-the-.patch
Patch0264: 0264-elf-util-check-for-overflow-when-computing-end-of-co.patch
Patch0265: 0265-sulogin-use-DEFINE_MAIN_FUNCTION.patch
Patch0266: 0266-sulogin-fix-control-lost-of-the-current-terminal-whe.patch
Patch0267: 0267-journal-vacuum-count-size-of-all-journal-files.patch
Patch0268: 0268-memory-util-add-a-concept-for-gcc-cleanup-attribute-.patch
Patch0269: 0269-macro-introduce-FOREACH_ARRAY-macro.patch
Patch0270: 0270-journal-vacuum-rename-function-to-match-struct-name.patch
Patch0271: 0271-journal-vacuum-use-CLEANUP_ARRAY.patch
Patch0272: 0272-pam-add-call-to-pam_umask.patch
Patch0273: 0273-udev-builtin-net_id-align-VF-representor-names-with-.patch
Patch0274: 0274-pam-add-a-call-to-pam_namespace.patch
Patch0275: 0275-rules-online-CPU-automatically-on-IBM-s390x-platform.patch
Patch0276: 0276-core-mount-escape-invalid-UTF8-char-in-dbus-reply.patch
Patch0277: 0277-Revert-user-delegate-cpu-controller-assign-weights-t.patch
Patch0278: 0278-udev-rules-fix-nvme-symlink-creation-on-namespace-ch.patch
Patch0279: 0279-rules-add-whitespace-after-comma-before-the-line-con.patch
Patch0280: 0280-udev-restore-compat-symlink-for-nvme-devices.patch
Patch0281: 0281-rules-drop-doubled-space.patch
Patch0282: 0282-manager-don-t-taint-the-host-if-cgroups-v1-is-used.patch
Patch0283: 0283-core-service-when-resetting-PID-also-reset-known-fla.patch
Patch0284: 0284-ci-drop-systemd-stable-from-advanced-commit-linter-c.patch
# Downstream-only patches (90009999)
@ -1148,6 +1183,43 @@ getent passwd systemd-oom &>/dev/null || useradd -r -l -g systemd-oom -d / -s /s
%files standalone-sysusers -f .file-list-standalone-sysusers
%changelog
* Mon Jul 17 2023 systemd maintenance team <systemd-maint@redhat.com> - 252-16
- ci: update permissions for source-git automation workflows (#2170883)
- pstore: fixes for dmesg.txt reconstruction (#2170883)
- pstore: explicitly set the base when converting record ID (#2170883)
- pstore: avoid opening the dmesg.txt file if not requested (#2170883)
- test: add a couple of tests for systemd-pstore (#2170883)
- test: match all messages with the FILE field (#2170883)
- test: build the SELinux test module on the host (#2170883)
- test: make the stress test slightly less stressful on slower machines (#2170883)
- coredump: use unaligned_read_ne{32,64}() to parse auxv (#2170883)
- core/transaction: make merge_unit_ids() always return NUL-terminated string (#2170883)
- core/transaction: make merge_unit_ids() return non-NULL on success (#2170883)
- core/transaction: do not log "(null)" (#2170883)
- ci: allow `RHEL-only` labels to mark downstream-only commits (#2170883)
- elf-util: discard PT_LOAD segment early based on the start address. (#2215412)
- elf-util: check for overflow when computing end of core's PT_LOAD segments (#2215412)
- sulogin: use DEFINE_MAIN_FUNCTION() (#2169959)
- sulogin: fix control lost of the current terminal when default.target is rescue.target (#2169959)
- journal-vacuum: count size of all journal files (#2182632)
- memory-util: add a concept for gcc cleanup attribute based array destruction (#2182632)
- macro: introduce FOREACH_ARRAY() macro (#2182632)
- journal-vacuum: rename function to match struct name (#2182632)
- journal-vacuum: use CLEANUP_ARRAY (#2182632)
- pam: add call to pam_umask (#2210145)
- udev-builtin-net_id: align VF representor names with VF names (#2218886)
- pam: add a call to pam_namespace (#2218184)
- rules: online CPU automatically on IBM s390x platforms when configured (#2212612)
- core/mount: escape invalid UTF8 char in dbus reply (#2208240)
- Revert "user: delegate cpu controller, assign weights to user slices" (#2176899)
- udev-rules: fix nvme symlink creation on namespace changes (#2172509)
- rules: add whitespace after comma before the line continuation (#2172509)
- udev: restore compat symlink for nvme devices (#2172509)
- rules: drop doubled space (#2172509)
- manager: don't taint the host if cgroups v1 is used (#2193456)
- core/service: when resetting PID also reset known flag (#2210237)
- ci: drop systemd-stable from advanced-commit-linter config (#2170883)
* Thu May 18 2023 systemd maintenance team <systemd-maint@redhat.com> - 252-15
- ci: trigger `differential-shellcheck` workflow on push (#2100440)
- ci: workflow for gathering metadata for source-git automation (#2100440)