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

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