All of lore.kernel.org
 help / color / mirror / Atom feed
* + kfence-slab-fix-cache_alloc_debugcheck_after-for-bulk-allocations.patch added to -mm tree
@ 2021-03-05  1:32 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-03-05  1:32 UTC (permalink / raw)
  To: andreyknvl, dvyukov, elver, glider, jannh, mm-commits


The patch titled
     Subject: kfence, slab: fix cache_alloc_debugcheck_after() for bulk allocations
has been added to the -mm tree.  Its filename is
     kfence-slab-fix-cache_alloc_debugcheck_after-for-bulk-allocations.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/kfence-slab-fix-cache_alloc_debugcheck_after-for-bulk-allocations.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/kfence-slab-fix-cache_alloc_debugcheck_after-for-bulk-allocations.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Marco Elver <elver@google.com>
Subject: kfence, slab: fix cache_alloc_debugcheck_after() for bulk allocations

cache_alloc_debugcheck_after() performs checks on an object, including
adjusting the returned pointer.  None of this should apply to KFENCE
objects.  While for non-bulk allocations, the checks are skipped when we
allocate via KFENCE, for bulk allocations cache_alloc_debugcheck_after()
is called via cache_alloc_debugcheck_after_bulk().

Fix it by skipping cache_alloc_debugcheck_after() for KFENCE objects.

Link: https://lkml.kernel.org/r/20210304205256.2162309-1-elver@google.com
Signed-off-by: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Cc: Jann Horn <jannh@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/slab.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/slab.c~kfence-slab-fix-cache_alloc_debugcheck_after-for-bulk-allocations
+++ a/mm/slab.c
@@ -2992,7 +2992,7 @@ static void *cache_alloc_debugcheck_afte
 				gfp_t flags, void *objp, unsigned long caller)
 {
 	WARN_ON_ONCE(cachep->ctor && (flags & __GFP_ZERO));
-	if (!objp)
+	if (!objp || is_kfence_address(objp))
 		return objp;
 	if (cachep->flags & SLAB_POISON) {
 		check_poison_obj(cachep, objp);
_

Patches currently in -mm which might be from elver@google.com are

kfence-fix-printk-format-for-ptrdiff_t.patch
kfence-slab-fix-cache_alloc_debugcheck_after-for-bulk-allocations.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-05  1:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05  1:32 + kfence-slab-fix-cache_alloc_debugcheck_after-for-bulk-allocations.patch added to -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.