Re: [Crash-utility] [PATCH] Fix list '-B' option incorrect loop 0 with single embedded list_head
by Dave Anderson
----- Original Message -----
>
> Commit 6596f1121b added a '-B' option to the list command to allow
> more efficient enumeration of longer lists. Unfortunately there
> is a small bug with this option where it may incorrectly flag a
> loop length of '0' on list of length 1. It is impossible to have
> a loop of length 0 and we can easily avoid the bug by looking at
> 'count'.
Hi Dave,
Queued for crash-7.2.7:
https://github.com/crash-utility/crash/commit/69cd19866a1b852ece40d0800f0...
Thanks,
Dave
> Example:
> crash> mutex.wait_list 0xffff8801070d6958
> wait_list = 0xffff88010802bd08
> crash> struct -o mutex.wait_list
> struct mutex {
> [8] struct list_head *wait_list;
> }
> crash> list -B -H 0xffff8801070d6960 -o mutex_waiter.list -s mutex_waiter.task
> ffff88010802bd08
> task = 0xffff88013e7d7520
> list: loop detected, loop length: 0
> crash> list -H 0xffff8801070d6960 -o mutex_waiter.list -s mutex_waiter.task
> ffff88010802bd08
> task = 0xffff88013e7d7520
> crash>
>
> Fixes: 6596f1121b
> Signed-off-by: Dave Wysochanski <dwysocha(a)redhat.com>
> ---
> tools.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools.c b/tools.c
> index f32e62f..85c8166 100644
> --- a/tools.c
> +++ b/tools.c
> @@ -4146,7 +4146,7 @@ do_list_no_hash(struct list_data *ld)
> return -1;
>
> if (!brent_loop_detect) {
> - if (brent_x == brent_y) {
> + if (count > 1 && brent_x == brent_y) {
> brent_loop_detect = 1;
> error(INFO, "loop detected, loop length: %ld\n", brent_lambda);
> /* reset x and y to start; advance y loop length */
> --
> 1.8.3.1
5 years, 4 months
[PATCH] Fix list '-B' option incorrect loop 0 with single embedded list_head
by Dave Wysochanski
Commit 6596f1121b added a '-B' option to the list command to allow
more efficient enumeration of longer lists. Unfortunately there
is a small bug with this option where it may incorrectly flag a
loop length of '0' on list of length 1. It is impossible to have
a loop of length 0 and we can easily avoid the bug by looking at
'count'.
Example:
crash> mutex.wait_list 0xffff8801070d6958
wait_list = 0xffff88010802bd08
crash> struct -o mutex.wait_list
struct mutex {
[8] struct list_head *wait_list;
}
crash> list -B -H 0xffff8801070d6960 -o mutex_waiter.list -s mutex_waiter.task
ffff88010802bd08
task = 0xffff88013e7d7520
list: loop detected, loop length: 0
crash> list -H 0xffff8801070d6960 -o mutex_waiter.list -s mutex_waiter.task
ffff88010802bd08
task = 0xffff88013e7d7520
crash>
Fixes: 6596f1121b
Signed-off-by: Dave Wysochanski <dwysocha(a)redhat.com>
---
tools.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools.c b/tools.c
index f32e62f..85c8166 100644
--- a/tools.c
+++ b/tools.c
@@ -4146,7 +4146,7 @@ do_list_no_hash(struct list_data *ld)
return -1;
if (!brent_loop_detect) {
- if (brent_x == brent_y) {
+ if (count > 1 && brent_x == brent_y) {
brent_loop_detect = 1;
error(INFO, "loop detected, loop length: %ld\n", brent_lambda);
/* reset x and y to start; advance y loop length */
--
1.8.3.1
5 years, 4 months