Message ID | d0943bd69fdfe27fbda20fde9b143e57c825546f.1702339432.git.andreyknvl@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7419802vqy; Mon, 11 Dec 2023 16:16:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIITPW4AHC759zhmgR7qISqglRUq8pazB8gRamskGTjHnazDZMvKs/xiO1nQmsAOcoy1YL X-Received: by 2002:a05:6a00:139f:b0:6ce:725f:7d9d with SMTP id t31-20020a056a00139f00b006ce725f7d9dmr6642772pfg.14.1702340175945; Mon, 11 Dec 2023 16:16:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702340175; cv=none; d=google.com; s=arc-20160816; b=tXBFFAlfwdeo6ZfQxq9vpUay51GN5+I0kFnaw95f+pZm4XU9ITj6BfDDiTi/ksKb7a +FTSanKjnrCpiq+ne2UGYQGefe9WdE4G8W7y6le/0IPAeV+Yr3laPOkCnd+eePBMp3Bw jxX+v6oMWTMBpU7v/5F0v1iSSnLPIdZPXIT57hsGpBGHQ5YvBt53TeEtbVDDIrx2lvEf Z92gLzxw7UhGVK7Zzh7OSdPHfm+aWhEjsWPXXSOD9X6UBR8qFueCcZoWkRRompVIT83u +DUXZGpOu4AeSTCKkBanlEUJv5zNgLqhb1Ow8H7oFwQPABoqFcJT0xNArAjsHTHCwPZB Ji4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OwbAGppKL3WPs8Dt+2mYc7aec7Z15bPqx/lY8lY4n/4=; fh=R37Itr4vM4DSdM7nCVEJRaUzpyR01xRhpmD5Puf7xME=; b=w6kVh1k61o3v2aDUaQ27QyAFVAMjaVkf0s86OxQidtgZd0BvrbC0qfJBzIVR5bfOgt l0vaIeZV8+btVanBQa8Fhjq4HOUs1VNk5ysOiHCBy4++MQ9pPEV/LMJRsPww4Gz9l4R1 YlC1aRbSyMwA5B4ItT1m6LBWtWEEX9/6vMabcIZJsVT39WjiPikMMDOq9zc2wel41M0C pjv9glvlC0/BT1m7fOQDWkwdIzi7N0pAB4hdeEfw23hmD69on17n39USP9vuhR9fI6aa 9qMb1oonwjQd3oKljLaZP0/H6e1sJqPwI+ydbVsdFig32gao2fTgqOWOm6Cu8GRfR6qi WSvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=AhuNEvWc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id du23-20020a056a002b5700b006cdf3e98118si6575162pfb.118.2023.12.11.16.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 16:16:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=AhuNEvWc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id BEF0D807C5FD; Mon, 11 Dec 2023 16:15:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345460AbjLLAOJ (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Mon, 11 Dec 2023 19:14:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345418AbjLLAOF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 11 Dec 2023 19:14:05 -0500 Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [IPv6:2001:41d0:203:375::b0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 170FBB5 for <linux-kernel@vger.kernel.org>; Mon, 11 Dec 2023 16:14:12 -0800 (PST) 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 <akpm@linux-foundation.org> Cc: Andrey Konovalov <andreyknvl@gmail.com>, Marco Elver <elver@google.com>, Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, Vlastimil Babka <vbabka@suse.cz>, kasan-dev@googlegroups.com, Evgenii Stepanov <eugenis@google.com>, Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov <andreyknvl@google.com> Subject: [PATCH mm 3/4] kasan: memset free track in qlink_free Date: Tue, 12 Dec 2023 01:14:02 +0100 Message-Id: <d0943bd69fdfe27fbda20fde9b143e57c825546f.1702339432.git.andreyknvl@google.com> In-Reply-To: <cover.1702339432.git.andreyknvl@google.com> References: <cover.1702339432.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 11 Dec 2023 16:15:14 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785033052439716582 X-GMAIL-MSGID: 1785033052439716582 |
Series |
lib/stackdepot, kasan: fixes for stack eviction series
|
|
Commit Message
andrey.konovalov@linux.dev
Dec. 12, 2023, 12:14 a.m. UTC
From: Andrey Konovalov <andreyknvl@google.com> 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 <andreyknvl@google.com> --- 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(-)
Comments
On Tue, 12 Dec 2023 at 01:14, <andrey.konovalov@linux.dev> wrote: > > From: Andrey Konovalov <andreyknvl@google.com> > > 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 <andreyknvl@google.com> Reviewed-by: Marco Elver <elver@google.com> > --- > > 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)); > } > > /* > -- > 2.25.1 >
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)); } /*