On Tue, Oct 25, 2022 at 8:00 PM <crash-utility-request(a)redhat.com> wrote:
Date: Tue, 25 Oct 2022 05:48:25 +0000
From: HAGIO KAZUHITO(?????) <k-hagio-ab(a)nec.com>
To: "Discussion list for crash utility usage, maintenance and
development" <crash-utility(a)redhat.com>, Matias Ezequiel Vara Larsen
<matiasevara(a)gmail.com>
Subject: Re: [Crash-utility] [PATCH] Fix segmentation fault when
read_string() fails
Message-ID: <a1a0ccda-4971-e7f6-a50f-492279ff4cbd(a)nec.com>
Content-Type: text/plain; charset="utf-8"
On 2022/10/24 18:35, Matias Ezequiel Vara Larsen wrote:
> When read_string() fails, error() dereferences the name variable to print the
> nullchar that the variable points to. However, name points to a nullchar that
> is not in crash's memory-space thus triggering a segmentation fault. This
> commit replaces %s in the error message with %p so the address is printed
> instead.
Thanks for the report and patch.
I think that 'nullchar' means null-terminated string and it's a bit
confusing, so I will replace it with 'string'.
>
> Signed-off-by: Matias Ezequiel Vara Larsen <matias.vara(a)vates.fr>
> ---
> memory.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/memory.c b/memory.c
> index c80ef61..8a1c055 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -6599,7 +6599,7 @@ page_flags_init_from_pageflag_names(void)
> }
>
> if (!read_string((ulong)name, namebuf, BUFSIZE-1)) {
> - error(INFO, "failed to read pageflag_names entry (i: %d
name: \"%s\" mask: %ld)\n",
> + error(INFO, "failed to read pageflag_names entry (i: %d
name: \"%p\" mask: %ld)\n",
I will replace \"%p\" with %lx according to crash's convention.
With the changes above,
Acked-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
I can fix them when merging in this case, you don't need to resend.
Please wait for another ack.
This change looks good. So: Ack.
Thanks.
Lianbo