Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp322181ybx; Wed, 6 Nov 2019 00:56:48 -0800 (PST) X-Google-Smtp-Source: APXvYqzmryBZKoo0ec5A6OFdMnnXTaoSFVZzSV+F+WHdsCgGeYoKr4bZXotx1lPOqv2Ru2te8arI X-Received: by 2002:a17:906:c801:: with SMTP id cx1mr34235155ejb.266.1573030608339; Wed, 06 Nov 2019 00:56:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573030608; cv=none; d=google.com; s=arc-20160816; b=wWByDa48ztC4vGeWKJ16GPioZvz7Vc9YcDU4EYmPDgDSjgFLeuBGl3VaATD40QlbAL sDIxRX+j+25zxNpPfkJSENdjEjN3LRBUnXCXbEXbiJp7TrEDgvfULTRhUvoxMJWHrhfp HA4S4MxJ5Nlb+XoYfZPPUFFao11adcFkuwh+XLY/HP2Q24I4bHgHIxj+C51vZSqc619P +ceZ1ST4HUJJSqFfauUEUOJzPBmDXwa1ukSqX83o8tZtymPNasxJiXFaqfmqKRND5ZyG C6EiImBTTBEGq/8WnKXrbDebNvXe3+T4yJ6hACiR7Mh3ZVuMvOsDyeaPeAC1NcWJ7aF/ 3RTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Eq4WA4EPy7zXoA1XETHdeFkE9cpjva/4WjeU29iF2Gc=; b=hZKLEBZNwMWWLKapsg3cIpUSdk0u99Uw0tqaYGBRkxggbgAhdVE5SM84fVWcOSR6WT 700JKck1qUFPSeCpaVT9jZxQ6wIHUL/709/6bbplgv0wLqu0L+G/Qo1lfI7Oj4nBtS9y ukfTanXqd4Kf0mVvU5ACopWSl1rLViFctkQ7eUHqP9z6vUcY05a024GahFZ35gH9XXoW ol+TeOnLImuAuDpM5sRQ9nijrTVJXR+byt/EZ2OjtH3RP2n40Odd+N29oj56k1yhrsxH fzabtVgY4wV3dcSvhwN7lqyrwnoHg9ZN8RqewNcx0nFNesuVJcy1uJUAtV+NEUtumWe/ h2sA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a40si11580546eda.86.2019.11.06.00.56.24; Wed, 06 Nov 2019 00:56:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731385AbfKFIzf (ORCPT + 99 others); Wed, 6 Nov 2019 03:55:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:55186 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726830AbfKFIze (ORCPT ); Wed, 6 Nov 2019 03:55:34 -0500 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 07C3AABBD; Wed, 6 Nov 2019 08:55:32 +0000 (UTC) Subject: Re: [PATCH v2 6/8] mm: prevent get_user_pages() from overflowing page refcount To: Ajay Kaher , "gregkh@linuxfoundation.org" Cc: "torvalds@linux-foundation.org" , "punit.agrawal@arm.com" , "akpm@linux-foundation.org" , "kirill.shutemov@linux.intel.com" , "willy@infradead.org" , "will.deacon@arm.com" , "mszeredi@redhat.com" , "stable@vger.kernel.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Srivatsa Bhat , "srivatsa@csail.mit.edu" , Alexey Makhalov , Srinidhi Rao , Vikash Bansal , Anish Swaminathan , Vasavi Sirnapalli , Steven Rostedt , "stable@kernel.org" , Ben Hutchings References: <1570581863-12090-1-git-send-email-akaher@vmware.com> <1570581863-12090-7-git-send-email-akaher@vmware.com> <0E5175FB-7058-4211-9AA4-9D5E2F6A30B9@vmware.com> From: Vlastimil Babka Message-ID: <35d74931-2c18-00ff-7622-522a79be9103@suse.cz> Date: Wed, 6 Nov 2019 09:55:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <0E5175FB-7058-4211-9AA4-9D5E2F6A30B9@vmware.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/25/19 8:18 AM, Ajay Kaher wrote: > On 17/10/19, 9:58 PM, "Ajay Kaher" wrote: > >> > This seems to have the same issue as the 4.9 stable version [1], in not >> > touching the arch-specific gup.c variants. >> > >> > [1] >> > https://lore.kernel.org/lkml/6650323f-dbc9-f069-000b-f6b0f941a065@suse.cz/ >> >> Thanks Vlastimil for highlighting this here. >> >> Yes, arch-specific gup.c variants also need to handle not only for 4.4.y, >> however it should be handled till 4.19.y. I believe it's better to start >> from 4.19.y and then backport those changes till 4.4.y. >> >> Affected areas of gup.c (where page->count have been used) are: >> #1: get_page() used in these files and this is safe as >> it's defined in mm.h (here it's already taken care of) >> #2: get_head_page_multiple() has following: >> VM_BUG_ON_PAGE(page_count(page) == 0, page); >> Need to change this to: >> VM_BUG_ON_PAGE(page_ref_zero_or_close_to_overflow(page), page); >> #3: Some of the files have used page_cache_get_speculative(), >> page_cache_add_speculative() with combination of compound_head(), >> this scenario needs to be handled as it was handled here: >> https://lore.kernel.org/stable/1570581863-12090-7-git-send-email-akaher@vmware.com/ >> >> Please share with me any suggestions or patches if you have already >> worked on this. >> >> Could we handle arch-specific gup.c in different patch sets and >> let these patches to merge to 4.4.y? > > Vlastimil, please suggest if it's fine to merge these patches to 4.4.y I'm not sure if it makes much sense to merge them without the arch-specific gup support, when we're aware that it's missing. > and handle arch-specific gup.c in different patch sets starts from 4.19.y, Actually arch-specific gup.c were removed in 4.13, so it's enough to start from 4.9.y, which I'm going to finally look into. > then backport all the way to 4.4.y. > > Greg, any suggestion from your side. > >> - Ajay > > > >