From patchwork Thu Dec 14 00:47:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 13492156 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85E3DC4167D for ; Thu, 14 Dec 2023 00:48:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D661C6B0397; Wed, 13 Dec 2023 19:48:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D164A8D0083; Wed, 13 Dec 2023 19:48:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B68A26B039B; Wed, 13 Dec 2023 19:48:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9AED26B0397 for ; Wed, 13 Dec 2023 19:48:04 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6D30B140150 for ; Thu, 14 Dec 2023 00:48:04 +0000 (UTC) X-FDA: 81563586888.29.209E8F6 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) by imf20.hostedemail.com (Postfix) with ESMTP id A59451C0022 for ; Thu, 14 Dec 2023 00:48:02 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=mE3jhmI4; spf=pass (imf20.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.188 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702514882; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fOHzqh8IZvvUQEcAVUngjlYsg+ArhHiPZJoDS72WUGY=; b=71Cxn27jPqeCrl9AOP5phFGFe78LKlEmS6zJnbh8Zm6cQnFN2j9HuSyok3/mHuk1g1gGO9 n5TQyZjZBqZk83GkjduSZ6qRfdNoqDSPhsClhuEhTIjMTWx1IwV23mfbkPMB50HkHuins6 Fr9pvucrCicHJNRZ1txdNnMNWgNa5hU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702514882; a=rsa-sha256; cv=none; b=mHnuAfaNgwpV6Qo48o/KxYUUkPV0CzodQ+yaYdOaJKKvu7cdGQw3f9qZ40mm/USDlogGM/ LnAVE3hsH16KKPYAlVop4ax+BMqXLf1huJ9mFfv1eogj540ATx60kxWHvnzxzU9FIE3Sy7 WFwqBc9eXYLWhoS/IwSksNpG9xC8FBE= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=mE3jhmI4; spf=pass (imf20.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.188 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702514881; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fOHzqh8IZvvUQEcAVUngjlYsg+ArhHiPZJoDS72WUGY=; b=mE3jhmI4IuQyy9Oj7FbJ4UWoTg80r8UlyLdLcotJ2d/EbCumZB6ZIk/usRDEldWY+o2Do0 taeItiOWOIa0q4b6vqwJB8QO9mSeuaXO84ASNC46APW3IbCNy6spdT/VnDOv9ZjJh/7OiI jNBCabIu/dOKWGrgx7tbKL2hH4yxYFI= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Tetsuo Handa , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH -v2 mm 3/4] kasan: memset free track in qlink_free Date: Thu, 14 Dec 2023 01:47:53 +0100 Message-Id: <39bbc4d0bc72dfaf02f9dc63ee6f25a8f3a1719c.1702514411.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: A59451C0022 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: swpw94xki6s49dhx6aasastd459inag3 X-HE-Tag: 1702514882-441171 X-HE-Meta: U2FsdGVkX188g0I+rV9M6xRou1ZUp9/VnkEju9EttOO+uEmEVNzAPg+LPyZhSPhwLNsLjVaTWpsBegjHJlHKTqWcbNVW3kOkAy3iOR7Lem1Tm2PkT5msDWjhKyMj1ncZwvh6Q5qF2BLHnuWZ/sCKbf775POANlI5t2G1zfTlYMkrQv9eWojBEJSkNnw0xYVuBDyqJD0X1APkl/I2OdAKIXI7aUkvw8GVbc6JbEW3DRJJ9mck7i9YQbBeE3+M+qX7y/qguBfSkP5ydvHgoJvuBw2pagbS0VJxwDdtvU3jp9fVFUmCr8YSStU+7fM/TgcuedxqUioRbtGf4JaZLjvmQJI00u9G2m/6PU732FQwVOYbAvWWxI0g5l83ho4Y86Q3KKZOfRuchIWcYlvmVf8wUV4Qw911LJzn+yUBf6TRMG08KEi6gA0CglICbgTMFX8Dw9cxggLJO/tkXcgZq3PcE26fSB9ICnBVVydTdv+IwQyrZBfapYCBWwtXhRdC5ewATWnex9jTCAw+zE8FLDAVQ14vUIartQ3uvK+/avzO5owYJc7qm5PemtDra+p546hDRO4cIgo4lqUrAen2arHQhGwirRruu8kYEFXInT49mqFrzbVPhMYxBSX4QFFdThWENS75aIf4mLsgEsimV2Vk9txwQPj+B5zRoD6KoakFySmjxt71iuwksnmBpST+75WtJlOawOlIH54IGdEdeJEd0q3A9/k4llHhgst/WKNCTmAyPxm4tXQYxTkXYWyNRsgZmMo9nzLPfgzbPbX5TyY5W+M9dfT8QDv+JupHW+rOjFtUz2VoHG+xPtvJKTYGj0eOzkdLV917uVSiSAr8Q+ESqw4gOHz7Zs+MJff0JT63LfSM8VI8IERHzfB/jP2EpwUAGXJqjNhyQxKBO9LHz5NZs/l65/i59XRLQnvFeW3CC9HibpEroOd45M8m2vP8mpNumk6Rhsgut5Em49ZsoJ2 lY9f9ysC E4JaEAloFq72f2PkbyPRtoejCp9s7NLpg6xbdCUirbkzi452aNJwJjEYB6m52nUO1+nwrqOdabHw/RthSRt3EJ5is5OY8Gm9nILKg X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Andrey Konovalov Instead of only zeroing out the stack depot handle when evicting the free stack trace in qlink_free, zero out the whole track. Do this just to produce a similar effect for alloc and free meta. The other fields of the free track besides the stack trace handle are considered invalid at this point anyway, so no harm in zeroing them out. Fixes: 773688a6cb24 ("kasan: use stack_depot_put for Generic mode") Reviewed-by: Marco Elver Signed-off-by: Andrey Konovalov --- mm/kasan/quarantine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c index 265ca2bbe2dd..782e045da911 100644 --- a/mm/kasan/quarantine.c +++ b/mm/kasan/quarantine.c @@ -157,7 +157,7 @@ static void qlink_free(struct qlist_node *qlink, struct kmem_cache *cache) if (free_meta && *(u8 *)kasan_mem_to_shadow(object) == KASAN_SLAB_FREETRACK) { stack_depot_put(free_meta->free_track.stack); - free_meta->free_track.stack = 0; + __memset(&free_meta->free_track, 0, sizeof(free_meta->free_track)); } /*