Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1356345lqd; Thu, 25 Apr 2024 13:01:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUEMCBe+r1dbd1T2bRx6lj2KJu96c1bi9tGBhos+OWAKLnOEhgPXLPZBZoHg21ef0iF9e0CDjGgEJzSScwNXW0wd3SVBpiALwUv14JZRA== X-Google-Smtp-Source: AGHT+IHmnXYEFv/yqsZXmiOgzyau68cuJiypx8nWydSy1gu4aim1d5lBL11Ye1M52n967m+Q0R4D X-Received: by 2002:a17:906:2c06:b0:a55:9195:362c with SMTP id e6-20020a1709062c0600b00a559195362cmr485728ejh.49.1714075273539; Thu, 25 Apr 2024 13:01:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714075273; cv=pass; d=google.com; s=arc-20160816; b=NXAkQAxyC6Cxi3+Q4hRyJusfFV39SmHqQik6WqAVkr0JIFG6LZOGRsQ3LAzkWMcUCw HJdKuXgNXOQ2U2yufg4pAfmYBdTyDoJ1QxO2ekTVB6gEVMir+HfiZ2aKAw/nh0sTmTUk xLYqQsoklTiq8GHBF2+7PD7dKW2UYsOeZdYo44DBz4GMDt/He1mtMSidytEd0ms+2Vvh ht7Sxqux54qSCKJABHCx/dwu+a+oBMvOtCZi0744NUEvjyTUSu1d2PfBZaCowAwz9CX7 lXwQGSy0u8zO38c1sXP+LG32DEwQtDZPxmuhqlEXPoFqx6dCGVsukEFjEJcMgcrUY3Xv Ftyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MPiDO/NuWlBDCPQueU9revoy2ZKV+QsKTFlIIgwR/BM=; fh=OX0J5yHe+Gx8/jYduKXkemD5+S7NEOBYQ9DpGZs75+U=; b=kR3/Djs2674+s48e0N79zr5BClHLNK7GXPlTl1UigT7nZd2UzID0EmZSZGnRbA6JeQ ZBKkbOqUd2+ZEu9zYIBLERveg/ViAMCRQPrT1StrdAl5p+yVjDwyV8+6aoZlAqueN1V1 bFFU/4bSRqhD1mQ5Er8VsqNWdYaGlhPRFe5mZW93oloGjJHmEk2Rj2kuopsNsJYBZ1pI EJglU0woMFhyORM0DJYZhmVYtGK9n43yxiE6JkDloibQ/DgWgxxL6MmWU7h02ibcxd9P ++8ED2rsdtOFYcAdpFeajWmi3m8BcqdeIoN7UrqHskjiE2hI7gNPRh2SDzxWQNcYwqi1 joFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=H8BEzjvY; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-159095-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159095-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qq27-20020a17090720db00b00a525c39ac09si10340069ejb.962.2024.04.25.13.01.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 13:01:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159095-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=H8BEzjvY; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-159095-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159095-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1E9051F22154 for ; Thu, 25 Apr 2024 20:01:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD28D1534E9; Thu, 25 Apr 2024 20:00:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="H8BEzjvY" Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1C8915253B for ; Thu, 25 Apr 2024 20:00:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714075257; cv=none; b=pYaP4pnVPGmK0H5flnsa6V2i9ZtPtqZ6EVrxpqnBKJEYcAGlRX2RVVb2YMCB6UwORhIOO0VjWywLfG4gM76F5ntF/6xH3UgLcx6a+6xjRT+0HFbXN1whV2iu2oUyAISl4mKxOlBnGOEKUuLgolzLFqpaA1xtTxhZf71+OU2N+98= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714075257; c=relaxed/simple; bh=RsL33zhcB30tglM6Diadti+mLV67sxPKk763/larZbA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jEWI2YAlJ+lunKBZHMnwKxxT44hrR/5QKbxdkhXuHCuAQXcEWkNhkq7dBWEomTh1EF3GjBFqs5pkT+NPFWkSzlg1bRSk2SHWK5pRUheo64oYlETBJ8pA6vL85OshWusyEghtw1GcrlCfT6eWfI5k2/F+5F4uBXiBMoTybvRebOA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=H8BEzjvY; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1e8fce77bb2so11072675ad.0 for ; Thu, 25 Apr 2024 13:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714075256; x=1714680056; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=MPiDO/NuWlBDCPQueU9revoy2ZKV+QsKTFlIIgwR/BM=; b=H8BEzjvYMqd9ukWk6BvhUgQeVYcytWXhHIUNyPbExaAqZYsGAzPqnETc9g/TjD3XVE Bc4cleGI/I5P0Vcg7omNm97w37kns1WF4/Xok9aUm1I4fKHJLZRc1rUPpZ+6ZVF+kGoJ 0EtfuNI17tu7FfsLTOP2omZwBxwNGabLaQiLw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714075256; x=1714680056; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MPiDO/NuWlBDCPQueU9revoy2ZKV+QsKTFlIIgwR/BM=; b=cBrWf35BEMdCRHmpqEWLAZ+fpbWSq5rrRbUAFWGuUwDw/aZUg74Y5An3o0qMtC9pxI /UR6EhF7tpQXypqn9ZmdbVdcUOJVqsckrxBe3URosir9GLApNfGnH3NAf+vcKZEid5/e buZuIeA4vMgO+fYvzbMFvXRvlYwSbhikCfNgzFHeODgKyi1vSq+gX/mXSA9jl6XCIbWL 1fk6LUTR1V2v+57embsRXv9qdv+5FllQHD1Y+uECq7xk6RBJFa4Cp+DaBpfQiuVe47WZ SsDea0AmcFHKBpU8C6uHgkJGbyaHp1/Rg3v1K1cPwafc0QiOWiGc/yVOXvFhalDCez8t ePVQ== X-Forwarded-Encrypted: i=1; AJvYcCWKThDfnpTzbDb+ShSc6+PMaXg3zEldRdC0np7qVA7I+jXDVdtPa9evyLaRsGzX0Hj3E6o56CkfY90CvWYjoQ0cGILJsQlSUF8p7RRh X-Gm-Message-State: AOJu0YxhGEraZ+QS8dSGupzxfsV7rk9ywfZfLPw1hrsI4xuHX3xXOKmn YDMcUt6gRbUNdStTolw05XSbRKiYziq2PhtkD0GTlai0CLwiaPZu2VPbugYILA== X-Received: by 2002:a17:902:e5c9:b0:1e3:f27c:457d with SMTP id u9-20020a170902e5c900b001e3f27c457dmr603222plf.65.1714075255870; Thu, 25 Apr 2024 13:00:55 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id q5-20020a17090311c500b001d8f81ecea1sm14246157plh.172.2024.04.25.13.00.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 13:00:55 -0700 (PDT) Date: Thu, 25 Apr 2024 13:00:54 -0700 From: Kees Cook To: Suren Baghdasaryan Cc: Kent Overstreet , akpm@linux-foundation.org, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, penguin-kernel@i-love.sakura.ne.jp, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, jhubbard@nvidia.com, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, ndesaulniers@google.com, vvvvvv@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, songmuchun@bytedance.com, jbaron@akamai.com, aliceryhl@google.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Subject: Re: [PATCH v6 00/37] Memory allocation profiling Message-ID: <202404251254.FE91E2FD8@keescook> References: <20240321163705.3067592-1-surenb@google.com> <202404241852.DC4067B7@keescook> <3eyvxqihylh4st6baagn6o6scw3qhcb6lapgli4wsic2fvbyzu@h66mqxcikmcp> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Apr 25, 2024 at 08:39:37AM -0700, Suren Baghdasaryan wrote: > On Wed, Apr 24, 2024 at 8:26 PM Kent Overstreet > wrote: > > > > On Wed, Apr 24, 2024 at 06:59:01PM -0700, Kees Cook wrote: > > > On Thu, Mar 21, 2024 at 09:36:22AM -0700, Suren Baghdasaryan wrote: > > > > Low overhead [1] per-callsite memory allocation profiling. Not just for > > > > debug kernels, overhead low enough to be deployed in production. > > > > > > Okay, I think I'm holding it wrong. With next-20240424 if I set: > > > > > > CONFIG_CODE_TAGGING=y > > > CONFIG_MEM_ALLOC_PROFILING=y > > > CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT=y > > > > > > My test system totally freaks out: > > > > > > ... > > > SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 > > > Oops: general protection fault, probably for non-canonical address 0xc388d881e4808550: 0000 [#1] PREEMPT SMP NOPTI > > > CPU: 0 PID: 0 Comm: swapper Not tainted 6.9.0-rc5-next-20240424 #1 > > > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015 > > > RIP: 0010:__kmalloc_node_noprof+0xcd/0x560 > > > > > > Which is: > > > > > > __kmalloc_node_noprof+0xcd/0x560: > > > __slab_alloc_node at mm/slub.c:3780 (discriminator 2) > > > (inlined by) slab_alloc_node at mm/slub.c:3982 (discriminator 2) > > > (inlined by) __do_kmalloc_node at mm/slub.c:4114 (discriminator 2) > > > (inlined by) __kmalloc_node_noprof at mm/slub.c:4122 (discriminator 2) > > > > > > Which is: > > > > > > tid = READ_ONCE(c->tid); > > > > > > I haven't gotten any further than that; I'm EOD. Anyone seen anything > > > like this with this series? > > > > I certainly haven't. That looks like some real corruption, we're in slub > > internal data structures and derefing a garbage address. Check kasan and > > all that? > > Hi Kees, > I tested next-20240424 yesterday with defconfig and > CONFIG_MEM_ALLOC_PROFILING enabled but didn't see any issue like that. > Could you share your config file please? Well *that* took a while to .config bisect. I probably should have found it sooner, but CONFIG_DEBUG_KMEMLEAK=y is what broke me. Without that, everything is lovely! :) I can reproduce it now with: $ make defconfig kvm_guest.config $ ./scripts/config -e CONFIG_MEM_ALLOC_PROFILING -e CONFIG_DEBUG_KMEMLEAK -Kees -- Kees Cook