Blame SOURCES/0018-sbitmapq-Limit-kernels-without-sbitmap-again.patch

aefe19
From b8f2ae6b494d706b1e4855b439c4930a6a6a2f5c Mon Sep 17 00:00:00 2001
aefe19
From: Kazuhito Hagio <k-hagio-ab@nec.com>
aefe19
Date: Fri, 10 Jun 2022 16:00:14 +0900
aefe19
Subject: [PATCH 18/18] sbitmapq: Limit kernels without sbitmap again
aefe19
aefe19
commit 364b2e413c69 ("sbitmapq: remove struct and member validation
aefe19
in sbitmapq_init()") allowed the use of the "sbitmapq" command
aefe19
unconditionally.  Without the patch, the command fails with the
aefe19
following error on kernels without sbitmap:
aefe19
aefe19
  crash> sbitmapq ffff88015796e550
aefe19
aefe19
  sbitmapq: invalid structure member offset: sbitmap_queue_sb
aefe19
            FILE: sbitmap.c  LINE: 385  FUNCTION: sbitmap_queue_context_load()
aefe19
aefe19
Now the command supports Linux 4.9 and later kernels since it was
aefe19
abstracted out, so it can be limited by the non-existence of the
aefe19
sbitmap structure.
aefe19
aefe19
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
aefe19
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
aefe19
---
aefe19
 sbitmap.c | 4 ++++
aefe19
 1 file changed, 4 insertions(+)
aefe19
aefe19
diff --git a/sbitmap.c b/sbitmap.c
aefe19
index be5d30a8ea88..12d6512a1e4d 100644
aefe19
--- a/sbitmap.c
aefe19
+++ b/sbitmap.c
aefe19
@@ -540,6 +540,10 @@ void sbitmapq_init(void)
aefe19
 	STRUCT_SIZE_INIT(sbitmap_queue, "sbitmap_queue");
aefe19
 	STRUCT_SIZE_INIT(sbq_wait_state, "sbq_wait_state");
aefe19
 
aefe19
+	/* sbitmap was abstracted out by commit 88459642cba4 on Linux 4.9. */
aefe19
+	if (INVALID_SIZE(sbitmap))
aefe19
+		command_not_supported();
aefe19
+
aefe19
 	MEMBER_OFFSET_INIT(sbitmap_word_depth, "sbitmap_word", "depth");
aefe19
 	MEMBER_OFFSET_INIT(sbitmap_word_word, "sbitmap_word", "word");
aefe19
 	MEMBER_OFFSET_INIT(sbitmap_word_cleared, "sbitmap_word", "cleared");
aefe19
-- 
aefe19
2.30.2
aefe19