Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4516185imw; Tue, 19 Jul 2022 08:04:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sOwI85MIKtB8VFgpA3zxyeCSiulmkamVHdc5C3TdctNCJBgwdpjSuZ25LbmtnDh31OzmeM X-Received: by 2002:a9d:be9:0:b0:61c:10b3:d787 with SMTP id 96-20020a9d0be9000000b0061c10b3d787mr13790933oth.228.1658243070996; Tue, 19 Jul 2022 08:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658243070; cv=none; d=google.com; s=arc-20160816; b=Zs1+Rc+zAsF/ZseYCg1NYrtixjgHvhYyHSnIhBq9KVxzlb5av76XnSN5Fp6xa0UlAY hSamkio8f6EzjycKcLv8jFSWab+w4Vy1F9txQU+l4DWYwpxtbCc9VrQjHt77dx0AePl/ PeFM58z2IsLZS7/sIsKeg3bjOO0W2UaSd92DzaxkzYXtYqQUMLw3CpCKl2BZeMfrgiVv bKnhZ0jJa8IDxwvzn6aFmlfMLiDeOBjz6bH+isNEYhnATk3aw+xIfDnr0U3GP57S+jxG m1DcdOyhlvmsgYv7IUi5tuD/CWOaw7o5iRioUOwLuTEYvhsdQSoWAIu2Yju+PebtS8o4 vRUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=faZQzQJp2jSV+DEwY6aFeTWmsrjxRq7qoRQPFl/6u1I=; b=0l7F0gazkxl6DBFvqb/vSZdQlBaMysVE3SKo3zfzlqHb7t4Bha7E9JOLRXmZMJ6qAR vvOdX6pCvNG++tCNHWqchl55UCwQOsvbuNa5wXUdIllTeWm5HfXlLy1BzrExo+LTK5d+ G5GlU+gyKEvqqa11OdEv8EvekNGdHuWNEjO7V/vvwVfo9c9eROAt2ash9Zt6PoGZ9cws +ivpTUlfIq9qE68lS97ezrQD08G6mIg9uuz5TDV0Abhre5uZt6ParscSkzeJH/bWQzKj 88+VffLgwg0GI0nVeZgEZ1HvOUJ0uws2wV/2lE0XdZvp6hRdpuoMrAELs1iNyRfHsMwF RQWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="mU/9U99F"; dkim=neutral (no key) header.i=@suse.cz header.b=zQvSlfD9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ba28-20020a056870c59c00b000ee108540ddsi13583435oab.297.2022.07.19.08.04.16; Tue, 19 Jul 2022 08:04:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="mU/9U99F"; dkim=neutral (no key) header.i=@suse.cz header.b=zQvSlfD9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238417AbiGSOdL (ORCPT + 99 others); Tue, 19 Jul 2022 10:33:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237374AbiGSOcz (ORCPT ); Tue, 19 Jul 2022 10:32:55 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CACA925F7 for ; Tue, 19 Jul 2022 07:21:34 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 277A1371C6; Tue, 19 Jul 2022 14:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1658240493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=faZQzQJp2jSV+DEwY6aFeTWmsrjxRq7qoRQPFl/6u1I=; b=mU/9U99F7Mja/TVNusMso6UJt3JNZfrAwU/m7RuOHjNMYmbM3IMLAFzI3LmljUietyDFHL 4BEypXLVeP3ZK2JnSXi6LG9W6Vbkndyos0ZecvxOXGoBJYDc/DDKgFYbn+PIPbrQmoql4M oyt1Xsv0WZ9IPXaML6It4Gxn4obebKI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1658240493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=faZQzQJp2jSV+DEwY6aFeTWmsrjxRq7qoRQPFl/6u1I=; b=zQvSlfD9IIuBT0QKqTBWrpRvke+MRcO7t/MeI6Uj6DIa6l1OPySi2AcTOnwo9QRXqd+lyH yLjK1WNkYosMYjBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EDA3C13488; Tue, 19 Jul 2022 14:21:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id HBucOOy91mK6cwAAMHmgww (envelope-from ); Tue, 19 Jul 2022 14:21:32 +0000 Message-ID: Date: Tue, 19 Jul 2022 16:21:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 1/3] mm/slub: fix the race between validate_slab and slab_free Content-Language: en-US To: Rongwei Wang , akpm@linux-foundation.org, roman.gushchin@linux.dev, iamjoonsoo.kim@lge.com, rientjes@google.com, penberg@kernel.org, cl@linux.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hyeonggon Yoo <42.hyeyoo@gmail.com> References: <20220529081535.69275-1-rongwei.wang@linux.alibaba.com> <69462916-2d1c-dd50-2e64-b31c2b61690e@suse.cz> <5344e023-29f0-9285-a402-19e2a556dbb0@linux.alibaba.com> From: Vlastimil Babka In-Reply-To: <5344e023-29f0-9285-a402-19e2a556dbb0@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/19/22 16:15, Rongwei Wang wrote: > ... >> + >> +    slab_unlock(slab, &flags2); >> +    spin_unlock_irqrestore(&n->list_lock, flags); >> +    if (!ret) >> +        slab_fix(s, "Object at 0x%p not freed", object); >> +    if (slab_to_discard) { >> +        stat(s, FREE_SLAB); >> +        discard_slab(s, slab); >> +    } >> + >> +    return ret; >> +} > I had test this patch, and it indeed deal with the bug that I described. Thanks. > Though I am also has prepared this part of code, your code is ok to me. Aha, feel free to post your version, maybe it's simpler? We can compare.