mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-12 22:23:49 +01:00
Merge commit 'public/warn1125'
This commit is contained in:
commit
bf8d66364f
5
changes/warn1125
Normal file
5
changes/warn1125
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
o Minor bugfixes:
|
||||||
|
- Instead of giving an assertion failure on an internal mismatch
|
||||||
|
on estimated freelist size, just log a BUG warning and try later.
|
||||||
|
Mitigates but does not fix bug 1125.
|
||||||
|
|
@ -270,14 +270,25 @@ buf_shrink_freelists(int free_all)
|
|||||||
(freelists[i].lowest_length - slack);
|
(freelists[i].lowest_length - slack);
|
||||||
int n_to_skip = freelists[i].cur_length - n_to_free;
|
int n_to_skip = freelists[i].cur_length - n_to_free;
|
||||||
int orig_n_to_free = n_to_free, n_freed=0;
|
int orig_n_to_free = n_to_free, n_freed=0;
|
||||||
|
int orig_n_to_skip = n_to_skip;
|
||||||
int new_length = n_to_skip;
|
int new_length = n_to_skip;
|
||||||
chunk_t **chp = &freelists[i].head;
|
chunk_t **chp = &freelists[i].head;
|
||||||
chunk_t *chunk;
|
chunk_t *chunk;
|
||||||
log_info(LD_MM, "Cleaning freelist for %d-byte chunks: keeping %d, "
|
log_info(LD_MM, "Cleaning freelist for %d-byte chunks: length %d, "
|
||||||
"dropping %d.",
|
"keeping %d, dropping %d.",
|
||||||
(int)freelists[i].alloc_size, n_to_skip, n_to_free);
|
(int)freelists[i].alloc_size, freelists[i].cur_length,
|
||||||
|
n_to_skip, n_to_free);
|
||||||
|
tor_assert(n_to_skip + n_to_free == freelists[i].cur_length);
|
||||||
while (n_to_skip) {
|
while (n_to_skip) {
|
||||||
tor_assert((*chp)->next);
|
if (! (*chp)->next) {
|
||||||
|
log_warn(LD_BUG, "I wanted to skip %d chunks in the freelist for "
|
||||||
|
"%d-byte chunks, but only found %d. (Length %d)",
|
||||||
|
orig_n_to_skip, (int)freelists[i].alloc_size,
|
||||||
|
orig_n_to_skip-n_to_skip, freelists[i].cur_length);
|
||||||
|
assert_freelist_ok(&freelists[i]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// tor_assert((*chp)->next);
|
||||||
chp = &(*chp)->next;
|
chp = &(*chp)->next;
|
||||||
--n_to_skip;
|
--n_to_skip;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user