From 5ea349b66b627ee31be93826f1357f88a7a26aff Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 6 Apr 2010 00:04:49 -0700 Subject: [PATCH] Fix auxv scanning in core-file grokking. --- libdwfl/ChangeLog | 5 +++++ libdwfl/link_map.c | 13 +++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 86cc69305..5205bdc9a 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2010-03-11 Roland McGrath + + * link_map.c (auxv_format_probe): Fix scanning loop, so we really scan + the second half for 32-bit matches. + 2010-03-10 Roland McGrath * core-file.c (dwfl_core_file_report): Punt EHDR argument. diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c index ecb499058..5991a1128 100644 --- a/libdwfl/link_map.c +++ b/libdwfl/link_map.c @@ -1,5 +1,5 @@ /* Report modules by examining dynamic linker data structures. - Copyright (C) 2008, 2009 Red Hat, Inc. + Copyright (C) 2008-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -123,8 +123,7 @@ auxv_format_probe (const void *auxv, size_t size, return false; } - size_t i; - for (i = 0; i < size / sizeof (Elf64_auxv_t); ++i) + for (size_t i = 0; i < size / sizeof (Elf64_auxv_t); ++i) { if (check64 (i)) { @@ -132,18 +131,12 @@ auxv_format_probe (const void *auxv, size_t size, return true; } - if (check32 (i)) + if (check32 (i * 2) || check32 (i * 2 + 1)) { *elfclass = ELFCLASS32; return true; } } - for (; i < size / sizeof (Elf64_auxv_t); ++i) - if (check32 (i)) - { - *elfclass = ELFCLASS32; - return true; - } return false; } -- 2.47.2