akwei / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

slab_rebalance_finish memset with invalid size #337

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The `slab_rebalance_finish` function memset rebalance slab with size 
`settings.item_size_max`. But if `slab_reassign` is not enable from the 
beginning, `do_slabs_newslab` will try to allocate a block of memory with size 
`p->size * p->perslab`. In this case the memset operation would overwrite data 
still in used. I think it's better to calculate the size with 
`slab_rebal.slab_start` and `slab_rebal.slab_end`.

Original issue reported on code.google.com by codeb...@gmail.com on 19 Aug 2013 at 5:07

GoogleCodeExporter commented 9 years ago
slab_reassign isn't a runtime option, it's start only. There're a few runtime 
assumptions made based on the size of a slab class if reassign is enabled, 
which is why it's not a dynamic option.

Your suggestion is possibly better but suffers from a few problems:

1) It's not a patch with a pull request and I'm lazy.
2) It's not a bug due to slab_reassign being a start option anyway.

Original comment by dorma...@rydia.net on 7 Dec 2013 at 8:24