Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp32415lqf; Thu, 25 Apr 2024 20:46:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU27YqJaMnPgUNN1bLjoeVHLtHDuwXBy+k2eFzfZ2wpgPwLX9p54Cx2TyyzSPisO4itw+pULTLGyk8mVczcMy9ThMWgkCYdT2IA262u8Q== X-Google-Smtp-Source: AGHT+IGbfa9Rt5YBSLDUOzynpT64LMwOr7SHL7KsY0D6LsezkCU6XIiijPTi3Jp1yuZQsH2vT/39 X-Received: by 2002:a50:875e:0:b0:570:5b70:d76d with SMTP id 30-20020a50875e000000b005705b70d76dmr858855edv.28.1714103200541; Thu, 25 Apr 2024 20:46:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714103200; cv=pass; d=google.com; s=arc-20160816; b=c06plopnHG4Vm/PpUcKZTBXr1eMUsqqwsXXZ+qYCKcSy/zgx8k2SwBcSOR7DrcN/PY RLZGlSkYUbBwPgaP6WDJ5m7bg8GI1zrkeUUqCvYER/yt9M33P8y6EkdR2/r/WlAQjJsz 9Hr9aU5nrbojwJO4HEjUJrxccbsC/7cQ7ycGs/XL92mTlm7wSnJkFjDghbyWClVPj3pO Nf38QCqURAI/iDECZYeWEnlnsh3BtZ2iauTfps38ucayBR4F3OGDGW6SRTuFhSc+hRNX r6yTF7GzyeXJP0zsJ0xY70nluJT8tGII8LAKCvB5s9PR8lbHi79OEkbW3rpZr4yxLNCN GtuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=e1BiNqNhU+y+tI1tYv0T3j8xw4UhvzM3meLf5Vht+lc=; fh=fXWu6suT7hCacAt98uQvxzUhPBXmbT2j/6wmqdO17H8=; b=tHqYKtqoDS1VSaD9AWko3esxBJx9zqLejjqgsTVoBAUZ9UMhBEyK8/7OUkUSV4zQ1c AfbaHhxjPN/nsCUPLUnvQuRy9ofNeDSrptXkXd85frPaViNJIVOLaeae+k0+GYE6/e06 QpKDGxH1ZDRJJTDwf90LG7bdz9mcRT4L5kb9SD2Jp9bNFSlPDOJRKpBdLgKiV0lDqCVR GzkxF5RVdWpEHpD1rFCtENtYadLa33rgH83jo6cNgO2xVpftXxMUQhC6365xA37R8hQd V18Ood/3FUw8tIPpfHIlzg8dc0gzCpq8A4Jls4uGYdXZ7FdNoz8mHXP7+H9nZmTa71g7 CKxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XtrIsZ6y; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-159486-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159486-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p13-20020aa7c88d000000b005721c06cfc9si4760353eds.151.2024.04.25.20.46.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 20:46:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159486-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=@google.com header.s=20230601 header.b=XtrIsZ6y; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-159486-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159486-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 46F581F226D4 for ; Fri, 26 Apr 2024 03:46:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E28C78C83; Fri, 26 Apr 2024 03:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XtrIsZ6y" Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (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 0DB387604D for ; Fri, 26 Apr 2024 03:46:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714103193; cv=none; b=Nsc1gBPKmzHOUVdkP6j5rhqNlkANJBdj8xKbIpbsrgcP8LEZ8rD121DSWghZqdNseb36XgLkErn4s3KJXoOwTuNDuRLyKknHWYaclrxLaS3aLXwtRXGAqnnaOKqm9sjCGw31FtDWKSOXVfAKa05NxM/hhrqjaUL7Jb+AR2x33ZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714103193; c=relaxed/simple; bh=pRC//LvuGtpP82d38hhF3gkqaFj594fJoemwwmcaR2M=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ERErLVo6qdpEZBRWhf8tS/WxkT6BYYM7RMSVqIFcq0vQlL9q/74/z9DOABuOUy0Hhj1j4k461TGoYg9wfG01PZbhO93FuqUmvvPAsYfaB8Zg4tre7UzzbAXS2W9mhvnlvoZWE0XaWmbcja/3OqhdRnqBeUe75rOIJlVy935OT80= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XtrIsZ6y; arc=none smtp.client-ip=209.85.219.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-de59daab3f3so1006844276.3 for ; Thu, 25 Apr 2024 20:46:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714103187; x=1714707987; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=e1BiNqNhU+y+tI1tYv0T3j8xw4UhvzM3meLf5Vht+lc=; b=XtrIsZ6ydXuEygtQweV5xllWNrH//9pXHTwcHdQl5oejAm8fWjW9BH584LulDQpAzS e00Wz6Zyio5y7arGDipi3GefkYDzjQaWnEMT2lh1gUODlvuhNF3mLIRpYUNrxkYMBEwI pnry9ILjtaw+0tTV+Gau71NTN4pCxXSfC78SjBy11QsXj5QAndvVB/FGjy/NHRsp53Fm 4qf17mi2lIzF150OLQHGYcAQBUFMHA3yOhP+Ema+gJA9Q930D2s2vYySop7myDkKH+ai azpR9dW10Rqh7mX9NDWvdAHDJDG0mBf+jpYsI+mghE5hE2DY/9jI0wYDpKVsfQ69sRpZ 0xjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714103187; x=1714707987; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e1BiNqNhU+y+tI1tYv0T3j8xw4UhvzM3meLf5Vht+lc=; b=RWgWxV1704ZDpW2P6xgts5DZPJDLYwRMaBjyerlF6Whyp+jPszHaP02QXLmYbPPUY4 NuviYGGx5b3QXN3Jxi9kZ/D75x/6RrQ6TLG0anBd0LN5fAO9UdJ4RDfWvw9qS9P22kcN n8o0Op3kxQBuXTw2mgFVU7fHVMupDrl5/uw7+cq4RhS3UYRXe5MhsyO+Pe6PcVy/ff+7 RsfREG7PnNSlwjEpdnzhrQiTmhH3dQtGKGwvlPAEd9zi28ASqySRsMSyqKTsgTq9GCFn iaUSQbgdKVfgOMW0WGsvDZavGVKFqX5+iB/jOJfbMGOxHBZ4LTpXTqnaRSBxCsX+LZIC wcAQ== X-Forwarded-Encrypted: i=1; AJvYcCXUIRin1rSgDdfK5bBLYQPZ+wsaiyNDumZZRX4orNONljbHp8FJGR5Nj271U44f1KptRWvLCam3ZxoPU91skizJ/4ujo5iLK4ndB5JW X-Gm-Message-State: AOJu0YxVJXmawRCqPUnbtREvJATYYtqnlckQLVKxeNCDa6nsfmFBw4cd ozFIwymUd4mSQnXOPxilRHd49lPd2BW1/A626w+4Rcm473zYIO+U7aL8zXZb1C9EG4i2P7Y4lhq P1Nd0BFo9sEcnzCH5QDIS2XTtctkTJhSiwRNx X-Received: by 2002:a25:df48:0:b0:de5:49a4:8a9d with SMTP id w69-20020a25df48000000b00de549a48a9dmr1666176ybg.39.1714103186722; Thu, 25 Apr 2024 20:46:26 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240425205516.work.220-kees@kernel.org> <20240425164917.8c9603387b4cce11121024a8@linux-foundation.org> In-Reply-To: From: Suren Baghdasaryan Date: Thu, 25 Apr 2024 20:46:13 -0700 Message-ID: Subject: Re: [PATCH] mm/slub: Avoid recursive loop with kmemleak To: Kent Overstreet Cc: Andrew Morton , Kees Cook , Catalin Marinas , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 25, 2024 at 5:19=E2=80=AFPM Kent Overstreet wrote: > > On Thu, Apr 25, 2024 at 04:49:17PM -0700, Andrew Morton wrote: > > On Thu, 25 Apr 2024 14:30:55 -0700 Suren Baghdasaryan wrote: > > > > > > > --- a/mm/kmemleak.c > > > > > +++ b/mm/kmemleak.c > > > > > @@ -463,7 +463,7 @@ static struct kmemleak_object *mem_pool_alloc= (gfp_t gfp) > > > > > > > > > > /* try the slab allocator first */ > > > > > if (object_cache) { > > > > > - object =3D kmem_cache_alloc(object_cache, gfp_kmeml= eak_mask(gfp)); > > > > > + object =3D kmem_cache_alloc_noprof(object_cache, gf= p_kmemleak_mask(gfp)); > > > > > > > > What do these get accounted to, or does this now pop a warning with > > > > CONFIG_MEM_ALLOC_PROFILING_DEBUG? > > > > > > Thanks for the fix, Kees! > > > I'll look into this recursion more closely to see if there is a bette= r > > > way to break it. As a stopgap measure seems ok to me. I also think > > > it's unlikely that one would use both tracking mechanisms on the same > > > system. > > > > I'd really like to start building mm-stable without having to route > > around memprofiling. How about I include Kees's patch in that for now? > > Agreed Yes, please. When I figure out a better way, I'll post a separate patch. Th= anks!