Re: [PATCH] Fix segmentation fault when read_string() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 25, 2022 at 8:00 PM <crash-utility-request@xxxxxxxxxx> wrote:
> Date: Tue, 25 Oct 2022 05:48:25 +0000
> From: HAGIO KAZUHITO(?????)  <k-hagio-ab@xxxxxxx>
> To: "Discussion list for crash utility usage, maintenance and
>         development" <crash-utility@xxxxxxxxxx>, Matias Ezequiel Vara Larsen
>         <matiasevara@xxxxxxxxx>
> Subject: Re:  [PATCH] Fix segmentation fault when
>         read_string() fails
> Message-ID: <a1a0ccda-4971-e7f6-a50f-492279ff4cbd@xxxxxxx>
> 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@xxxxxxxx>
> > ---
> >   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@xxxxxxx>
>
> 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

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux