From patchwork Tue Dec 12 00:14:02 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: 13488209 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 BCBCAC4332F for ; Tue, 12 Dec 2023 00:14:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 618D96B025C; Mon, 11 Dec 2023 19:14:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A31D6B025F; Mon, 11 Dec 2023 19:14:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CF706B0260; Mon, 11 Dec 2023 19:14:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 258C26B025C for ; Mon, 11 Dec 2023 19:14:14 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DC1F0A1CA9 for ; Tue, 12 Dec 2023 00:14:13 +0000 (UTC) X-FDA: 81556243986.30.7A4BFDD Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) by imf29.hostedemail.com (Postfix) with ESMTP id 2B4FF120019 for ; Tue, 12 Dec 2023 00:14:11 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=AhuNEvWc; spf=pass (imf29.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.183 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=1702340052; 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=OwbAGppKL3WPs8Dt+2mYc7aec7Z15bPqx/lY8lY4n/4=; b=JpOJy0rENMpofmsQw8EBsLqx501CLQG+E8O4/SYN0XH26qG+5fwPu20f5ki2K+hvceFq90 iy8Y3hv/zagzwBGrh2DP7SGzu8b6g5Zj+7L8irRIWeOylfJE4+Ba4WwJpMa1T2EaorSRg8 wLTgnQ0kyF35bdbK7Boei7a5/Rolu9c= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702340052; a=rsa-sha256; cv=none; b=Chr81hA/S58NDpvnh6JWkELagvdwEEfhsayJ1KaAvwz79gWcnt94jOpfoYRSgq7Ts1kaPg 84bq6T/oTKxz1JNVM1qxRpDWUxLH90Pd7JG0XDyobxtpy4ECYVhEHrpvaznEdIj3K/Xwma BaEqF9uw0a1MXQEDp0yuvkS7vy3sA0w= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=AhuNEvWc; spf=pass (imf29.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.183 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=1702340050; 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=OwbAGppKL3WPs8Dt+2mYc7aec7Z15bPqx/lY8lY4n/4=; b=AhuNEvWc+xId+ebmaR6PLfGdXFqw+Wg1SNRrPQ1ZlK1Sc1etaByaW4J7PAGKThBVnj447n j8TePKCfHAMCJ1KwilljkT2LUfiq2L5u0pH0HA7XJfeRd1JbF++UGx/w+zfsttHD227a+f IZQYQmT7JGekNhMS5pIy488rlfoaazI= 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 mm 3/4] kasan: memset free track in qlink_free Date: Tue, 12 Dec 2023 01:14:02 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 2B4FF120019 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: iity8qeg3ob98c8z68mrppakkjyajc76 X-HE-Tag: 1702340051-855339 X-HE-Meta: U2FsdGVkX1/j6/yOm119qlEvToIkebPCawC08H16I6etIm98KNVmeXPK2edHRM8xnevRxLriCTpySfK6R40tmpFqI1uYSHWfNVzX26wqUkr20RpsJid7iTyGHns/X7ZC4cI87tBMesVb4mGPegv0yR1nSr9muPBWJh8YBGDsX2gsIA/C5lQyymM9uWSrWYzXs0gAhclTB8J3LRHLLijTjykQuugzfXEcpkAYp4lw44VVR3KLYVrd9pueFwt9zn3rdys8ABDMeEteJosht7kIOoVJLLJxejQu6P4ChPiphxRJFg0mf0T8VvteCJGVEz/UhwaHPT+fMjWFPoDmWsRBJTZnWOFJ+JUTiDBfbca7H35V0hvU61CEXuVSPBMqJh4tcMjw4DVudqZ9G4emh91CVxrQz1EfeI6c32oePTxuaJoAsaXtw2HZS7f2zwxduNoGutl41ajUaSdgmYUpJfP3pkF52CDFF73zoLjC4t20URbFTVq4zi+NGvvslQfxRL3DSdbZwITSkb63d6mr7cRkxV/x42jRZUwy/HCEBIJ1Q9jv5vQVRyS3BzlBHypSVDLZfqUKyWw72xrl8I3/RvBwW12t3qoNI5MKPOyYcpHMT7skABYm1MZD1t9cAMIDdutZ53TMOlctFv/3W2wGRKOrgJBRH9eewYXwGqvdJv46Q/Oeex4bFSPuSwTllbImIz4qCsxzp5CIAvCZPkkSEZ8zJOFshowA6mRsmeaHRR2Exud0yhunir1xx29GTFOmv5ohx+qBmhs+GFaxXJPpBgNW94cDBhdusOweKRx8nOWLN0F5TU7tLrX6+cTB4XOXb3jHZ8G/QM8pP6Mr5ftC0khL1WPUfmPPY4UaCrp+1kQ4QXOsFJ7ziPXF6TNJVTCyQzMT1HP4DoduhSBR0l7tsS0S9PvukICYQGb9UnqImkZLhoa7L9z1p2TRQnBEHn8ERRFvYefOZ+/usuoDTmIpSHt Zco92dTm I2v9HtmAxm0MdxkIcmWfgywGObdcA6GHilPH8b4S8eUm5biNSAkcFjanXSSIeLSfiS7X6jxvVi7Oz+GCRlVIrbVXQYGhF8ihPojg/vsla4YDeMrA= 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. Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver --- This can be squashed into "kasan: use stack_depot_put for Generic mode" or left standalone. --- 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)); } /*