[nginx] Slab: improved double free detection.

Ruslan Ermilov ru at nginx.com
Sat Dec 3 07:06:35 UTC 2016


details:   http://hg.nginx.org/nginx/rev/87d7e640b45d
branches:  
changeset: 6809:87d7e640b45d
user:      Ruslan Ermilov <ru at nginx.com>
date:      Sat Dec 03 10:01:39 2016 +0300
description:
Slab: improved double free detection.

Previously, an attempt to double free the starting page of the
free range was not detected.

diffstat:

 src/core/ngx_slab.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 2af776c22aec -r 87d7e640b45d src/core/ngx_slab.c
--- a/src/core/ngx_slab.c	Sat Dec 03 10:01:03 2016 +0300
+++ b/src/core/ngx_slab.c	Sat Dec 03 10:01:39 2016 +0300
@@ -597,7 +597,7 @@ ngx_slab_free_locked(ngx_slab_pool_t *po
             goto wrong_chunk;
         }
 
-        if (slab == NGX_SLAB_PAGE_FREE) {
+        if (!(slab & NGX_SLAB_PAGE_START)) {
             ngx_slab_error(pool, NGX_LOG_ALERT,
                            "ngx_slab_free(): page is already free");
             goto fail;



More information about the nginx-devel mailing list