Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3630953rdb; Wed, 27 Dec 2023 14:10:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/OzioXnTYedKcVkqzO3NW47/pG2vRTd1Tu+VIS06XLzBKvJTqmJMzpSKFWRnqHWbb1NEI X-Received: by 2002:a17:902:8694:b0:1d0:6ffd:e2ea with SMTP id g20-20020a170902869400b001d06ffde2eamr9239729plo.132.1703715012763; Wed, 27 Dec 2023 14:10:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703715012; cv=none; d=google.com; s=arc-20160816; b=nlv/KZSf8Fw4GcvTJ2jXlc0HngA4/eKaVeprmB0s1gaA8bqz0+bqizZ950P0dLja5z gdNt08uP5eWzuSfku+yYgs+uhbLYCeFuyKxnb2tWI2ecIn+juwO99Vp+TUgmhJKfRhca qlSOj1P4H7HWyNQTf6nccJtX9ztqXwb1ohHmwBtpSssDvlRmF2qdfzYj4DjS03v5cF11 Th8QZfssBYkhFNAfjohOX4oFM9y7i8brvr5qfYDNh3oBUeCg1pskLl0+r6d+/gVSttGG /An5c7RV82mrk6n1YzQlL40eBtPPDsNihRZHqVYDhi8D8SVzzJsagdND/fUqmcP5oXmT 7qfg== 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 :subject:cc:to:from:date:dkim-signature; bh=mvbWQPtLRjTEXBG8qxYD9GJ79sXogi23Rjf5NvvIXn8=; fh=alWGelObRkKDSeGH5FNgPzT45v0l97HgM4toqaSmMb4=; b=b5wvR6DVPtT+yOLTEZY8gllmrEA7YdHCFIrhFcR/4BBJE6VRmD8kRTk2kdhw8ddV83 HHbBvzGKo4V8UhH+G0BO3lB941Ga1XGXm1df5PQNaeimv45CdnxrNvnPb7stoQwX4iVd hXy7tjW5lHl4lNRwiED7e8IYKhmAiDwJgHkkXE8aWYmcK++94gseIdbx5R7M0VyR4HZk t7cWI5vfD6nrQMUWOVGKZtk7Po4GCuU4Apo3/enNhDhpbQJkIRKUUse5kuryg2G0mkjv SDknCFqZjmAWyFaHaPaIHzVDgyQSRAKdcL+6tls2CMtLjV7s8CroDDiY5s8gJwCPIHKb G14w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=djtb3RQw; spf=pass (google.com: domain of linux-kernel+bounces-12281-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12281-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l18-20020a170902d35200b001d3c3495ea4si11563042plk.192.2023.12.27.14.10.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 14:10:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12281-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=djtb3RQw; spf=pass (google.com: domain of linux-kernel+bounces-12281-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12281-linux.lists.archive=gmail.com@vger.kernel.org" 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 B4A67283D8C for ; Wed, 27 Dec 2023 22:10:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB4A4481CC; Wed, 27 Dec 2023 22:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="djtb3RQw" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D55A2481A3; Wed, 27 Dec 2023 22:10:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F36D5C433C7; Wed, 27 Dec 2023 22:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1703715006; bh=IsNop+8agQGKkYo5eY0cj9pIaFJSRadegBPPU7K7vBs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=djtb3RQwHbPOU168xGDiQ8WhknSl4qCpB3Dv5B2/0wTgBHtMmISEw4rF3MGjEPt0R QA0He0895rEtX5IBfbdy2LI/LlFvrnjJryGTDKw6dWQ5LkbRh/deDbJR+wQ3+ZArd0 7Qb8LvIurV67ebK/j5NSgPR+5c+BqVHFk0pbNnEo= Date: Wed, 27 Dec 2023 14:10:05 -0800 From: Andrew Morton To: Andrey Konovalov Cc: kernel test robot , andrey.konovalov@linux.dev, Marco Elver , oe-kbuild-all@lists.linux.dev, Linux Memory Management List , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH mm] kasan: stop leaking stack trace handles Message-Id: <20231227141005.14e278c3f08dd0d64004dbf7@linux-foundation.org> In-Reply-To: References: <20231226225121.235865-1-andrey.konovalov@linux.dev> <202312280213.6j147JJb-lkp@intel.com> <20231227132311.557c302e92bdc9ffb88b42d5@linux-foundation.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Wed, 27 Dec 2023 22:42:40 +0100 Andrey Konovalov wrote: > On Wed, Dec 27, 2023 at 10:23 PM Andrew Morton > wrote: > > > > Thanks, I added this fix: > > > > --- a/mm/kasan/generic.c~kasan-stop-leaking-stack-trace-handles-fix > > +++ a/mm/kasan/generic.c > > @@ -503,7 +503,7 @@ void kasan_init_object_meta(struct kmem_ > > */ > > } > > > > -void release_alloc_meta(struct kasan_alloc_meta *meta) > > +static void release_alloc_meta(struct kasan_alloc_meta *meta) > > { > > /* Evict the stack traces from stack depot. */ > > stack_depot_put(meta->alloc_track.stack); > > @@ -514,7 +514,7 @@ void release_alloc_meta(struct kasan_all > > __memset(meta, 0, sizeof(*meta)); > > } > > > > -void release_free_meta(const void *object, struct kasan_free_meta *meta) > > +static void release_free_meta(const void *object, struct kasan_free_meta *meta) > > { > > /* Check if free meta is valid. */ > > if (*(u8 *)kasan_mem_to_shadow(object) != KASAN_SLAB_FREE_META) > > _ > > > > Could you mark them as "static inline" even? That's rather old-fashioned. Nowadays gcc is supposed to work out whether or not to inline things, and we override that with noinline and __always_inline.