public inbox for libc-locales@sourceware.org
 help / color / mirror / Atom feed
From: Abhidnya Joshi <abhidnyachirmule@gmail.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-locales@sourceware.org
Subject: Re: Crash in gconv_db.c
Date: Fri, 20 Dec 2019 15:05:00 -0000	[thread overview]
Message-ID: <CALmqtCXvsdTWQindGNsgVVtMdsWW0dNW+FAttrogeH4uenk_iw@mail.gmail.com> (raw)
In-Reply-To: <875ziledsy.fsf@oldenburg2.str.redhat.com>

Hi Florian,

Good News! We are able to reproduce it using continuous readdirs.
(Where reply involved encoding to UTF-16)
The stack is exactly same as shared earlier. It did overflowed counter.

Do you have any suggestion on the fix? We can test the fix using our test.

Thanks and Regards
Abhidnya Joshi

On Thu, Dec 12, 2019 at 9:28 PM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Abhidnya Joshi:
>
> > In increment_counter function, do we have to handle integer overflow like this?
> >
> >
> > if (step->__counter == INT_MAX)
> > {
> > step->__counter = 1
> > }
> > if (step->__counter++ == 0)
> > { ....
> > }
> >
> > I do not understand what will be impact of this on different "steps".
> > If step->__counter gets set to 0 and step->__modname is NULL
> > then we see the segfault as mentioned earlier.
>
> The steps array has reference counts in the array *elements*, which is
> wrong.  We ran into this a couple of months ago when we tried to fix a
> memory leak.  This is the reason why I have limited confidence in the
> correctness of the reference counting.
>
> I looked at what it would take to reproduce the overflow with repeated
> iconv_open calls, and I estimate that 1.2 TiB of RAM are required, so I
> have not reproduced that yet.
>
> But there could be more subtle ways to trigger counter overflow, like
> uselocale followed by pthread_exit.  Without a reproducer, we are in the
> dark here unfortunately.
>
> Thanks,
> Florian
>

  reply	other threads:[~2019-12-20 15:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-11 16:05 Abhidnya Joshi
2019-11-11 16:19 ` Florian Weimer
2019-11-11 16:47   ` Abhidnya Joshi
     [not found]     ` <CALmqtCVBCb2vJ+XNb6WZa1csNZaisLmqoG5nTn-QUU0MO=UbPw@mail.gmail.com>
2019-11-14 17:34       ` Florian Weimer
2019-11-19 14:05         ` Abhidnya Joshi
2019-11-28 18:47           ` Abhidnya Joshi
2019-12-12 15:58             ` Florian Weimer
2019-12-20 15:05               ` Abhidnya Joshi [this message]
2019-12-20 15:16                 ` Florian Weimer
2019-12-20 15:40                   ` Abhidnya Joshi
2019-12-20 15:43                     ` Florian Weimer
2019-12-20 15:53                       ` Abhidnya Joshi
2019-12-20 16:09                         ` Florian Weimer
2019-12-20 16:42                           ` Abhidnya Joshi
2019-12-20 16:47                             ` Florian Weimer
2019-12-20 17:18                               ` Abhidnya Joshi
2019-12-20 18:39                                 ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALmqtCXvsdTWQindGNsgVVtMdsWW0dNW+FAttrogeH4uenk_iw@mail.gmail.com \
    --to=abhidnyachirmule@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=libc-locales@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).