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

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