Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp358118pxb; Tue, 15 Feb 2022 15:19:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+MEFbB34yj3ZI13O12LPQDrkDxbwJhCetEUUBR6HZnavOvFdPT1SxFqsQCSgf4iLnqQwD X-Received: by 2002:a17:906:facf:b0:6cd:ed0e:ed7 with SMTP id lu15-20020a170906facf00b006cded0e0ed7mr250670ejb.376.1644967146523; Tue, 15 Feb 2022 15:19:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644967146; cv=none; d=google.com; s=arc-20160816; b=XNZeYn+GW3KaHiPY5+IL+UN2Bxu3aOEB83NX14VPqtzEVnt3mXuiNd29Ivzvoi+ldP QFbvWxFUSmlq8a+qN6xZLSajpAYSGf+tChsH6qNmfshA1bsSbKkMMOUBS7Yj8FWu8fJ1 4MaR1CwGGdIwKBFRrqqCTFOJn3fjZFX++dlx7Lgw9aqSgGCmlxJGGwC05kvayFVf1zlw 3FU5pjwi4hKvW3vrbyUNVDhf8VG/42rOye3c+XgwnhcSyaFLd7hCBnXjDlpqE4mAP0k1 oPS+GnSc34mHQZwmSwJ2HaUQFilduuJ1OFEfbDtVhqa3t4TZS0SVma88Lbjz3jGMI1cB 2flQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SusZ2Nn0UF1cMWphj1PKY7wujcVBC8OwT9Ti8njPVmQ=; b=bo5GvEOqzI1A2/cGQmF7jEKqxDgSE3dOmSeNomcUBAAW/hTat1hwpta3rE8jLerZg2 2Xbj/1J4Fiu3Nmret+nITlyd5SjhztaIM74EFn/AV4hX0+hWPYDtU0qY1Kfy+UVbYRuu 2bj5VOH777GBbCSCPUJbmtNgk6aKm+HFPvc4Sb9SGDVlmKjlyXgj2/a2KONkCDJCNMsM M480+jkta155fgEQZkuj2k+NubZkOOaIhm6FYhPbefxRer87ytrOBZ7cOVojL8pWCkp1 h5RoUNL8rN69oexZdOn7EyYY0nJQGGC0KGKGT6xyzfVLN8G0tcBJq5f2Ojws+E2o68s8 Q1WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=JtFMbVxT; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u7si21529107eju.755.2022.02.15.15.18.43; Tue, 15 Feb 2022 15:19:06 -0800 (PST) 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.com header.s=susede1 header.b=JtFMbVxT; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243984AbiBOUFl (ORCPT + 99 others); Tue, 15 Feb 2022 15:05:41 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:54848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239220AbiBOUFj (ORCPT ); Tue, 15 Feb 2022 15:05:39 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 058BF88789 for ; Tue, 15 Feb 2022 12:05:27 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 4319A1F37B; Tue, 15 Feb 2022 20:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1644955526; h=from:from:reply-to: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=SusZ2Nn0UF1cMWphj1PKY7wujcVBC8OwT9Ti8njPVmQ=; b=JtFMbVxT7bbNnkh2qV56nxXV4fJNroicIZgWuWLCPFiDu4ubhJ2fofzVsJhHmRXipQKjXB Ixve3P7JbYHQOYirWM2QmIYfBk16A8yiTmjLb+6QKfGetsui+dlSD2FKESTl3tYDubccAd oqLLtUfD4IqdiX/hhFVC06weJdOPnKM= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 76125A3B83; Tue, 15 Feb 2022 20:05:25 +0000 (UTC) Date: Tue, 15 Feb 2022 21:05:25 +0100 From: Michal Hocko To: Suren Baghdasaryan Cc: akpm@linux-foundation.org, ccross@google.com, sumit.semwal@linaro.org, dave.hansen@intel.com, keescook@chromium.org, willy@infradead.org, kirill.shutemov@linux.intel.com, vbabka@suse.cz, hannes@cmpxchg.org, ebiederm@xmission.com, brauner@kernel.org, legion@kernel.org, ran.xiaokai@zte.com.cn, sashal@kernel.org, chris.hyser@oracle.com, dave@stgolabs.net, pcc@google.com, caoxiaofeng@yulong.com, david@redhat.com, gorcunov@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com, syzbot+aa7b3d4b35f9dc46a366@syzkaller.appspotmail.com Subject: Re: [PATCH v3 1/1] mm: fix use-after-free when anon vma name is used after vma is freed Message-ID: References: <20220211013032.623763-1-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 One thing I was considering is to check agains ref counte overflo (a deep process chain with many vmas could grow really high. ref_count interface doesn't provide any easy way to check for overflows as far as I could see from a quick glance so I gave up there but the logic would be really straightforward. We just create a new anon_vma_name with the same content and use it when duplicating if the usage grow really (arbitrarily) high. -- Michal Hocko SUSE Labs