Re: malloc.c: better double free check

2017-09-27 Thread Theo de Raadt
> On Sun, Sep 24, 2017 at 09:02:58PM -0400, Daniel Micay wrote: > > > > In the end all double frees still will be caught by the actual free > > > code, just with a delay. The delayed free buffer double free check is > > > just a way of catching it as soon as possible to make debugging > > >

Re: malloc.c: better double free check

2017-09-25 Thread Otto Moerbeek
On Sun, Sep 24, 2017 at 09:02:58PM -0400, Daniel Micay wrote: > > In the end all double frees still will be caught by the actual free > > code, just with a delay. The delayed free buffer double free check is > > just a way of catching it as soon as possible to make debugging > > easier. That's

Re: malloc.c: better double free check

2017-09-24 Thread Daniel Micay
> In the end all double frees still will be caught by the actual free > code, just with a delay. The delayed free buffer double free check is > just a way of catching it as soon as possible to make debugging > easier. That's the reason the originla code could just do the check > on the slot being

Re: malloc.c: better double free check

2017-09-24 Thread Otto Moerbeek
On Sat, Sep 23, 2017 at 05:19:58PM -0400, Daniel Micay wrote: > On Sat, 2017-09-23 at 09:32 +0200, Otto Moerbeek wrote: > > On Fri, Sep 22, 2017 at 04:35:39PM -0400, Daniel Micay wrote: > > > > > A linear search works well for the current small quarantine (16) but > > > won't work > > > well if

Re: malloc.c: better double free check

2017-09-23 Thread Daniel Micay
On Sat, 2017-09-23 at 09:32 +0200, Otto Moerbeek wrote: > On Fri, Sep 22, 2017 at 04:35:39PM -0400, Daniel Micay wrote: > > > A linear search works well for the current small quarantine (16) but > > won't work > > well if you ever want to have a larger / configurable quarantine > > size. It would

Re: malloc.c: better double free check

2017-09-23 Thread Theo Buehler
On Sat, Sep 23, 2017 at 02:05:34PM +, Otto Moerbeek wrote: > On Sat, Sep 23, 2017 at 05:28:57AM -0400, Ted Unangst wrote: > > > Otto Moerbeek wrote: > > > Hi, > > > > > > Malloc maintains a list if 16 slots of chunks to be freed. On free a > > > chunk is put in a random slot and the existing

Re: malloc.c: better double free check

2017-09-23 Thread Otto Moerbeek
On Sat, Sep 23, 2017 at 05:28:57AM -0400, Ted Unangst wrote: > Otto Moerbeek wrote: > > Hi, > > > > Malloc maintains a list if 16 slots of chunks to be freed. On free a > > chunk is put in a random slot and the existing chunk in that slot is > > actually freed. Currently, the code only checks

Re: malloc.c: better double free check

2017-09-23 Thread Ted Unangst
Otto Moerbeek wrote: > Hi, > > Malloc maintains a list if 16 slots of chunks to be freed. On free a > chunk is put in a random slot and the existing chunk in that slot is > actually freed. Currently, the code only checks the slot selected for > a double free. > > This diff adds code to check all

Re: malloc.c: better double free check

2017-09-23 Thread Otto Moerbeek
On Fri, Sep 22, 2017 at 04:35:39PM -0400, Daniel Micay wrote: > A linear search works well for the current small quarantine (16) but won't > work > well if you ever want to have a larger / configurable quarantine size. It > would > also be nice to make this fast enough to enable by default. >

Re: malloc.c: better double free check

2017-09-22 Thread Daniel Micay
A linear search works well for the current small quarantine (16) but won't work well if you ever want to have a larger / configurable quarantine size. It would also be nice to make this fast enough to enable by default. We (CopperheadOS) use an open addressed hash table for this based on the

malloc.c: better double free check

2017-09-22 Thread Otto Moerbeek
Hi, Malloc maintains a list if 16 slots of chunks to be freed. On free a chunk is put in a random slot and the existing chunk in that slot is actually freed. Currently, the code only checks the slot selected for a double free. This diff adds code to check all slots. It also removes the option to