Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp187549rdb; Tue, 19 Dec 2023 13:20:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZ1naEzwX+E7t3flufTg6ra72N//ebNOy/Nt8asvQ9wDAL1Rmt1alcFDwOO3oDvLHtnJiO X-Received: by 2002:a05:6358:60c6:b0:172:e499:f7f6 with SMTP id i6-20020a05635860c600b00172e499f7f6mr3308617rwi.38.1703020841404; Tue, 19 Dec 2023 13:20:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703020841; cv=none; d=google.com; s=arc-20160816; b=LS/bsdld6IAYAz80m6T9UreEq2nxEg4BTXF5xnfOEXU+QpBH6wRaBfYKpKrKw1YWk4 m7w1rlStXhxK+Z7LgTyKf2OHpQcZeOxF3MIAAgABkWZqb+IRvmGDaDqPBKhC8cb26v/h 0vD/vbeNxofbfYv90Jmr3J6MrUgNxwDOGLbW5HyT8jMYtoYw0bj2VW2qT5Cgm9+fZec+ +tST5DXGNOBPqTjEi4eGyFMeD9NEPaoQs86hsozSoDS3LqSO9BLCQp9cutqPHBXtRu9X jmCMaDjsRJmmDxfDkj8OUxGDWYuAJEF5WsB0qO1QgA/yo6efWO4eDG0QbRqKOzx0E2Ya CzSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=fOHzqh8IZvvUQEcAVUngjlYsg+ArhHiPZJoDS72WUGY=; fh=R37Itr4vM4DSdM7nCVEJRaUzpyR01xRhpmD5Puf7xME=; b=R/Vwf07e52bXd/1A3I4Brk8RIml0VD5p0WrLmu5BOZvaT/TEBAqEUUjyHWRIfxhIj0 Su8fJRozcMdVvEtzHnEIkNLUjf4xE1/lPzjoHFeAvwBcUXifOfRoigDifrGy+ceuC/FP JDHemMLFFR4PP5XS+ng30pPII19tgFh1enk63VC9QsGVTGmmEWE6Y+CvJlOI9cbIJQq8 Fwg1n37F12N+gmdaV/p7IjK/whViU/VdsUEHUGGQBdX8dUDi+mBCzanDd4AJXCKXtQof GlmwSNQp2JUg8Q6CrnU5sBKfu/cMzgV92izOKJNCgkX/Ps+TGlocYOwHrPRoABMHz905 598Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=qSi6bCK8; spf=pass (google.com: domain of linux-kernel+bounces-5961-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5961-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b10-20020a056a00114a00b006ce9cb273c6si20378236pfm.136.2023.12.19.13.20.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 13:20:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5961-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=qSi6bCK8; spf=pass (google.com: domain of linux-kernel+bounces-5961-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5961-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1005A287821 for ; Tue, 19 Dec 2023 21:20:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F07543FB19; Tue, 19 Dec 2023 21:20:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="qSi6bCK8" X-Original-To: linux-kernel@vger.kernel.org Received: from out-175.mta1.migadu.com (out-175.mta1.migadu.com [95.215.58.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 770AD3D0CE for ; Tue, 19 Dec 2023 21:20:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=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=1703020798; 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=qSi6bCK82bZzb5eDpiDbrLAgv900bdtXCroZwQk+HMxNuCcAH6RDEUBSEuZXglh3sQ52dp y4hliOr/Z2u8q2lAKSTk3GSjbIMKCqYtE46R+/r0JsXgn8CkNa8Ohm/TliCh9Gv/qOmJ9H dqjaS5WqDKLwR54ujuGm3mhTRxi7Yx0= 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 v3 mm 3/4] kasan: memset free track in qlink_free Date: Tue, 19 Dec 2023 22:19:52 +0100 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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)); } /* -- 2.25.1