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 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B577C47404 for ; Fri, 4 Oct 2019 12:57:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24D26207FF for ; Fri, 4 Oct 2019 12:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570193825; bh=gdv/gdi2vnLybo1eNsYHcB/aLrf/i/GWdoh6hslFqOQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=vgjLioXjx8szFChkPpq50CdrPEMUL15U8QuLQP0Fe7ACNkaJisUML+rOpeFA3nROm 2U7o6hhoQX5uoAQGyzeL8W6HgbD4DD8vgUHepk/Qg2NNDDYO0xwEMMYCBjlwwCa9Va lhPaat2OxvQcsIZV4wxYZRRN+2VZh8+AyiVwyYHg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387945AbfJDM5E (ORCPT ); Fri, 4 Oct 2019 08:57:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:44500 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387440AbfJDM5E (ORCPT ); Fri, 4 Oct 2019 08:57:04 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6794DB123; Fri, 4 Oct 2019 12:57:02 +0000 (UTC) Date: Fri, 4 Oct 2019 14:57:01 +0200 From: Michal Hocko To: Qian Cai Cc: akpm@linux-foundation.org, tj@kernel.org, vdavydov.dev@gmail.com, hannes@cmpxchg.org, guro@fb.com, cl@linux.com, penberg@kernel.org, rientjes@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] mm/slub: fix a deadlock in show_slab_objects() Message-ID: <20191004125701.GJ9578@dhcp22.suse.cz> References: <1570192309-10132-1-git-send-email-cai@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1570192309-10132-1-git-send-email-cai@lca.pw> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 04-10-19 08:31:49, Qian Cai wrote: > Long time ago, there fixed a similar deadlock in show_slab_objects() > [1]. However, it is apparently due to the commits like 01fb58bcba63 > ("slab: remove synchronous synchronize_sched() from memcg cache > deactivation path") and 03afc0e25f7f ("slab: get_online_mems for > kmem_cache_{create,destroy,shrink}"), this kind of deadlock is back by > just reading files in /sys/kernel/slab which will generate a lockdep > splat below. > > Since the "mem_hotplug_lock" here is only to obtain a stable online node > mask while racing with NUMA node hotplug, in the worst case, the results > may me miscalculated while doing NUMA node hotplug, but they shall be > corrected by later reads of the same files. I think it is important to mention that this doesn't expose the show_slab_objects to use-after-free. There is only a single path that might really race here and that is the slab hotplug notifier callback __kmem_cache_shrink (via slab_mem_going_offline_callback) but that path doesn't really destroy kmem_cache_node data structures. Thanks! -- Michal Hocko SUSE Labs