linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Maciej Wieczor-Retman <m.wieczorretman@pm.me>
To: "Maciej Żenczykowski" <maze@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	Kees Cook <kees@kernel.org>,
	joonki.min@samsung-slsi.corp-partner.google.com,
	Andrew Morton <akpm@google.com>,
	Alexander Potapenko <glider@google.com>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Marco Elver <elver@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Uladzislau Rezki <urezki@gmail.com>,
	Danilo Krummrich <dakr@kernel.org>,
	jiayuan.chen@linux.dev,
	syzbot+997752115a851cb0cf36@syzkaller.appspotmail.com,
	Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>,
	kasan-dev@googlegroups.com,
	Kernel hackers <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org
Subject: Re: KASAN vs realloc
Date: Fri, 06 Feb 2026 20:14:25 +0000	[thread overview]
Message-ID: <aYZJ2Ohug6b9Vth0@wieczorr-mobl1.localdomain> (raw)
In-Reply-To: <CANP3RGeHnhufYyc0P2OiKJbXdZjPW41TP=JS6nYk9xGRU8UuKQ@mail.gmail.com>

From what I see kasan_poison_last_granule() is called through:

__kasan_vrealloc()
--> __kasan_unpoison_vmalloc()
----> kasan_unpoison()
------> kasan_poison_last_granule()

and the arguments are "addr + old_size" and "new_size - old_size" so it looks
okay I think.

On 2026-02-06 at 11:07:12 -0800, Maciej Żenczykowski wrote:
>While looking at:
>  https://android-review.git.corp.google.com/c/kernel/common/+/3939998
>  UPSTREAM: mm/kasan: fix KASAN poisoning in vrealloc()
>
>I noticed a lack of symmetry - I'm not sure if it's a problem or not...
>but I'd have expected kasan_poison_last_granule() to be called
>regardless of whether the size shrunk or increased.
>
>It is of course possible this is handled automatically by
>__kasan_unpoison_vmalloc() - I haven't traced that deep,
>in general these functions seem to have a terrible api surface full of
>razors... with hidden assumptions about what is and is not granule
>aligned.

-- 
Kind regards
Maciej Wieczór-Retman



  reply	other threads:[~2026-02-06 20:14 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-06 12:42 Maciej Żenczykowski
2026-01-07 20:28 ` Kees Cook
2026-01-07 20:47   ` Maciej Wieczor-Retman
2026-01-07 21:47     ` Maciej Żenczykowski
2026-01-07 21:50       ` Maciej Żenczykowski
2026-01-07 21:55         ` Maciej Żenczykowski
2026-01-09 18:55           ` Maciej Wieczor-Retman
2026-01-09 20:05             ` Maciej Żenczykowski
2026-02-06 19:07               ` Maciej Żenczykowski
2026-02-06 20:14                 ` Maciej Wieczor-Retman [this message]
2026-02-06 21:26                   ` Maciej Żenczykowski
2026-01-13 19:15 ` [PATCH 1/2] mm/kasan: Fix KASAN poisoning in vrealloc() Andrey Ryabinin
2026-01-13 19:15   ` [PATCH 2/2] mm/kasan/kunit: extend vmalloc OOB tests to cover vrealloc() Andrey Ryabinin
2026-01-15  3:56     ` Andrey Konovalov
2026-01-16 13:28       ` [PATCH] mm-kasan-kunit-extend-vmalloc-oob-tests-to-cover-vrealloc-fix Andrey Ryabinin
2026-01-16 18:53         ` Maciej Wieczor-Retman
2026-01-17  1:16         ` Andrey Konovalov
2026-01-14 12:17   ` [PATCH 1/2] mm/kasan: Fix KASAN poisoning in vrealloc() Maciej Wieczor-Retman
2026-01-15  3:56   ` Andrey Konovalov
2026-01-16 13:26     ` Andrey Ryabinin
2026-01-17  1:16       ` Andrey Konovalov
2026-01-17 17:08         ` Andrey Konovalov
2026-01-19  0:48           ` Andrew Morton
2026-01-19 14:43             ` Andrey Ryabinin
2026-01-19 14:45           ` [PATCH] mm-kasan-fix-kasan-poisoning-in-vrealloc-fix Andrey Ryabinin
2026-01-20 17:46             ` Andrey Konovalov
2026-01-21 16:01               ` Andrey Ryabinin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aYZJ2Ohug6b9Vth0@wieczorr-mobl1.localdomain \
    --to=m.wieczorretman@pm.me \
    --cc=akpm@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=dakr@kernel.org \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=jiayuan.chen@linux.dev \
    --cc=joonki.min@samsung-slsi.corp-partner.google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=maze@google.com \
    --cc=ryabinin.a.a@gmail.com \
    --cc=syzbot+997752115a851cb0cf36@syzkaller.appspotmail.com \
    --cc=urezki@gmail.com \
    --cc=vincenzo.frascino@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox