Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1614146

[PATCH] mm: Add additional consistency check

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject [PATCH] mm: Add additional consistency check
Date 2017-03-31 18:50 +0200
Message-ID <tr7Um-76y-13@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


As found in PaX, this adds a cheap check on heap consistency, just to
notice if things have gotten corrupted in the page lookup.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 mm/slab.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/slab.h b/mm/slab.h
index 65e7c3fcac72..64447640b70c 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -384,6 +384,7 @@ static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x)
 		return s;
 
 	page = virt_to_head_page(x);
+	BUG_ON(!PageSlab(page));
 	cachep = page->slab_cache;
 	if (slab_equal_or_root(cachep, s))
 		return cachep;
-- 
2.7.4


-- 
Kees Cook
Pixel Security

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] mm: Add additional consistency check Kees Cook <keescook@chromium.org> - 2017-03-31 18:50 +0200
  Re: [PATCH] mm: Add additional consistency check Andrew Morton <akpm@linux-foundation.org> - 2017-03-31 23:40 +0200
    Re: [PATCH] mm: Add additional consistency check Kees Cook <keescook@chromium.org> - 2017-04-01 02:10 +0200
      Re: [PATCH] mm: Add additional consistency check Michael Ellerman <mpe@ellerman.id.au> - 2017-04-03 05:50 +0200
        Re: [PATCH] mm: Add additional consistency check Christoph Lameter <cl@linux.com> - 2017-04-03 16:20 +0200
          Re: [PATCH] mm: Add additional consistency check Matthew Wilcox <willy@infradead.org> - 2017-04-03 17:00 +0200
  Re: [PATCH] mm: Add additional consistency check Michal Hocko <mhocko@kernel.org> - 2017-04-04 13:40 +0200
    Re: [PATCH] mm: Add additional consistency check Christoph Lameter <cl@linux.com> - 2017-04-04 17:10 +0200
      Re: [PATCH] mm: Add additional consistency check Michal Hocko <mhocko@kernel.org> - 2017-04-04 17:20 +0200
        Re: [PATCH] mm: Add additional consistency check Kees Cook <keescook@chromium.org> - 2017-04-04 17:50 +0200
          Re: [PATCH] mm: Add additional consistency check Michal Hocko <mhocko@kernel.org> - 2017-04-04 18:00 +0200
            Re: [PATCH] mm: Add additional consistency check Kees Cook <keescook@chromium.org> - 2017-04-04 18:10 +0200
        Re: [PATCH] mm: Add additional consistency check Christoph Lameter <cl@linux.com> - 2017-04-04 21:20 +0200
          Re: [PATCH] mm: Add additional consistency check Michal Hocko <mhocko@kernel.org> - 2017-04-04 21:50 +0200
            Re: [PATCH] mm: Add additional consistency check Christoph Lameter <cl@linux.com> - 2017-04-04 22:00 +0200
              Re: [PATCH] mm: Add additional consistency check Michal Hocko <mhocko@kernel.org> - 2017-04-04 22:20 +0200

csiph-web