From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3337EEB57B for ; Sat, 9 Sep 2023 01:51:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F0E86B00EF; Fri, 8 Sep 2023 21:51:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A0836B00F3; Fri, 8 Sep 2023 21:51:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EAA8D6B00F6; Fri, 8 Sep 2023 21:51:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id DC0DA6B00EF for ; Fri, 8 Sep 2023 21:51:30 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A87B51CAFE4 for ; Sat, 9 Sep 2023 01:51:30 +0000 (UTC) X-FDA: 81215381940.19.1C5E698 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf30.hostedemail.com (Postfix) with ESMTP id 96DB580008 for ; Sat, 9 Sep 2023 01:51:28 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WgdksnmN; spf=pass (imf30.hostedemail.com: domain of aquini@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=aquini@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694224288; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SanvGomkSje1s3xXLYmIy8A6OYMvM6JQdu3zGT78Ysw=; b=uKd/nnlfscsCDyfJ/+VSeSPATSiWJTXGdle3cf2mnzC+iucY0/hE71T4PlPBXAZl/S9Yma XaKtc3h4henCeKO2AwHi7h57Hj+ZYtm5b1+PX1YDkdOZP6x7WaqiKQNE/l9dQEX/WVwi4f AnEEQT+1x5XBA1UdRrGq/S1LpSK3bm8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694224288; a=rsa-sha256; cv=none; b=EDByyykou9tRcQBcZposjoLtRPZSx9gAF6/Yn6iWMdArwQx/t6B6jA9yrp1EVX8kSQhteY Min7EH1+VbKxp8OjwPkcFjpPKQphbCDx6NIW3w4wXIWyzA8xQHsN+6AEmRWbN9zngvemZy ilgi9dFZwZqZEPKnPmQMsytQNJhHeWo= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WgdksnmN; spf=pass (imf30.hostedemail.com: domain of aquini@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=aquini@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694224287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SanvGomkSje1s3xXLYmIy8A6OYMvM6JQdu3zGT78Ysw=; b=WgdksnmNPF+xSeKD9uBRHRDLbPWH2EhVrb5uuoegoSBvCI22CvL9fmfVcA7MTcveTsYBLH 2aE2f12v4zrnlPB/0OhUYpp3q0Os99jjP0EPH2NkHRKhPFhqZ8ngp+5VjoW7CO2Ma/qlV7 HvxGqvt1OuZCBZhq/Prf/wvl0EvvVuE= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-189-B3DuE5laO_iFP1wLLqawhg-1; Fri, 08 Sep 2023 21:51:26 -0400 X-MC-Unique: B3DuE5laO_iFP1wLLqawhg-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-64b7c2a0d5dso28134136d6.3 for ; Fri, 08 Sep 2023 18:51:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694224286; x=1694829086; h=in-reply-to: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=SanvGomkSje1s3xXLYmIy8A6OYMvM6JQdu3zGT78Ysw=; b=S/2ioU1tjv2C2mPUO+EIW8Balf1h4NOwZ3amkxtobooiX3naP3+cqjMqb2EvTfLcUO 0MddsolQJZCbcWrrpMR3lKvx8OS4ml6gnfr7/5rAyfjddOOg93OP5JxTzj8aqPe8o/Ra WSI3Y37Z7b++Puv6GvE4xumyuK+b6Man3JrA0qWfjBKHdOAUtzx1+jEh0hL3ccTyEUpD P9Y76Pn0kLASq3Ol6qroRVvl4MBG2/LbxRHD7WUYGia2jfBSHsH98DtWiwqbDtLg8A5b W6Dnl9Zl/GPslUOzYbsuU/Y6WgNaL1/GlJgpAE3md5mrLtUu+GAjVe7/WFjZBi6dRuhW clxw== X-Gm-Message-State: AOJu0YxUd6pV/gdQnuDXERBPSomUiBMiB6cbvsIP3SvydGwgDEqziq8o PDVfFty4yuP6t4KU5gk0vfu5xMmzgqFl60N0DruSRfsOe+FS1UJNr+n0SqpLQGgI3ZJTx4I59JK N9PS6dwoHsQo= X-Received: by 2002:a0c:f189:0:b0:64f:4ba6:3b2d with SMTP id m9-20020a0cf189000000b0064f4ba63b2dmr3995136qvl.44.1694224286023; Fri, 08 Sep 2023 18:51:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVh4ux+7IqqyRIt488t13shoGm2kJKCOWhsRwEuleU7OnKpj/Zy1OLf+heVW5s49yNQ892NA== X-Received: by 2002:a0c:f189:0:b0:64f:4ba6:3b2d with SMTP id m9-20020a0cf189000000b0064f4ba63b2dmr3995122qvl.44.1694224285794; Fri, 08 Sep 2023 18:51:25 -0700 (PDT) Received: from x1-fbsd.aquini.net (c-73-249-122-233.hsd1.nh.comcast.net. [73.249.122.233]) by smtp.gmail.com with ESMTPSA id x13-20020a0ce24d000000b0064c1b27bf2dsm1145804qvl.140.2023.09.08.18.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Sep 2023 18:51:25 -0700 (PDT) Date: Fri, 8 Sep 2023 21:51:21 -0400 From: Rafael Aquini To: Matthew Wilcox Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Vlastimil Babka , Waiman Long , Rafael Aquini , stable@vger.kernel.org Subject: Re: [PATCH] mm/slab_common: fix slab_caches list corruption after kmem_cache_destroy() Message-ID: References: <20230908230649.802560-1-aquini@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Stat-Signature: syqmtad8be38nz1wxnbrmwgdbgj4ssno X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 96DB580008 X-Rspam-User: X-HE-Tag: 1694224288-772284 X-HE-Meta: U2FsdGVkX1+Xb9hCPIFZOOaIPRoum76nmNbDxlrS4mphJR3UcMIt3xGHAA5hdUyvt8ZoTByg/H9s/3FrEb6r+MEBJvRxptAry6jugmxiqeUdjuSL6gDJIen5lE4Z8zTX348D+GmfXoR47q2DhACtD+yqJSSazndAhd5+hJZa9M10HA7wpJ3TjT1P9RWkq36jcwzsrrgBT1vgk1yr8UuzGSdj2zvX0xzmuIgfJiNiz9DLHMQUzvNM0BTInrWZXZdFLV8hctUguQxdknsoGD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D40l7WyVvjY+nJ2VEu/s+/WA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Sep 09, 2023 at 02:16:00AM +0100, Matthew Wilcox wrote: > On Fri, Sep 08, 2023 at 07:06:49PM -0400, Rafael Aquini wrote: > > This patch fixes this issue by properly checking shutdown_cache()'s > > return value before taking the kmem_cache_release() branch. > > Is this the right way to fix this problem? If the module destroys the > slab cache, it's not going to be possible to free any of the objects > still allocated from the cache. I feel that we should treat this as > implicitly freeing all the objects that were allocated from the cache > rather than saying the cache is still busy. > Leaving the cache with the unfreeable slabs "alone" is how it was historically done, and we have to fix this corner case opened by 0495e337b703 this way to address the corruption on stable releases without changing their established and expected behavior. I think your proposal for a different behavior upon cache destruction is something we should discuss for future releases, but it is orthogonal to this required follow-up fix.