Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2957772ybi; Mon, 1 Jul 2019 23:13:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwx8+6+G+ZfGOYlI77LXunWyT8VW4oDVljA7V/Q7XsVDqLVOgTM8FxgFZgZK0Nwp/4Mnx4+ X-Received: by 2002:a17:90a:8d0c:: with SMTP id c12mr3529952pjo.140.1562048038809; Mon, 01 Jul 2019 23:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562048038; cv=none; d=google.com; s=arc-20160816; b=T/vGHSz3jlRNtNa/nyBu0hXHIkAOLSuzbcStLqtWwc4rUxBPfaOzj+wYAn+qjkKi5q vrfNK1WcEuzzU9NfMUhxgKFA19MeM63XocHYwt2T9gQjCmTLu8VKxeeAwsczvVB2i8rk 7knPRgik8dNxWbOe3HO1LF+EKsMB8HpifE3p7gmQ8L5sgHO3NwYuIsAeSY8Y5DHcC3t1 Er8m9/3VUjj54JCcS1htZ4yOV6W+/Vgz9FVH4d9GeQY3ZdaFodeFT7uzQwdfmjvlZ1TL jZMg/0A4hySMkhbGE143tCbfZs/geHVfX5lshCajbz3qq7LS7IKOHF0tnhi2nLINnW1a lp3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Pjll8d+trKGUGefXv3u5NQRPmJ/1KTeJUJJu1x1l4hU=; b=kkq2NSLfz5JfYfYuB+obuM0LD+oaBOkE6U0LDHQXr+0B1dTIFyzzn6/qypXjyDe+po RPO9tNOMYpJLGVO/R8/0vny7mj9OQYaBsEGdcEOyA37azAYBhwpZZsNTCaB77gVVnljf UaAcK/uDKaPjLhMNU6WuDTWGVDIQcgp34y43M6l4gOls4QuwSTMdw4h6Fkgt2rGfiAfM stJwGNBqAYB2gFKHdPPf1lX4u45LhJydPoG3d9dGuC+7Nc+cMzN4omoUviJVMa/5rNPp 0iw+fskozpIErcuZ5WgdSQpLheJEgFwbUf+DlbKWOwBHUQmDoL9XFFls4arBElLkDqnO 3Asg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si12093950plu.126.2019.07.01.23.13.43; Mon, 01 Jul 2019 23:13:58 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725991AbfGBGNO (ORCPT + 99 others); Tue, 2 Jul 2019 02:13:14 -0400 Received: from mx2.suse.de ([195.135.220.15]:37360 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725775AbfGBGNO (ORCPT ); Tue, 2 Jul 2019 02:13:14 -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 9A75CB008; Tue, 2 Jul 2019 06:13:12 +0000 (UTC) Date: Tue, 2 Jul 2019 08:13:10 +0200 From: Michal Hocko To: Alastair D'Silva Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Andrew Morton , Pavel Tatashin , Oscar Salvador , Mike Rapoport , Baoquan He , Wei Yang , Logan Gunthorpe , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 1/3] mm: Trigger bug on if a section is not found in __section_nr Message-ID: <20190702061310.GA978@dhcp22.suse.cz> References: <20190626061124.16013-1-alastair@au1.ibm.com> <20190626061124.16013-2-alastair@au1.ibm.com> <20190626062113.GF17798@dhcp22.suse.cz> <20190626065751.GK17798@dhcp22.suse.cz> <20190627080724.GK17798@dhcp22.suse.cz> <833b9675bc363342827cb8f7c76ebb911f7f960d.camel@d-silva.org> <20190701104658.GA6549@dhcp22.suse.cz> <7f0ac9250e6fe6318aaf0685be56b121a978ce1b.camel@d-silva.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7f0ac9250e6fe6318aaf0685be56b121a978ce1b.camel@d-silva.org> 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 Tue 02-07-19 14:13:25, Alastair D'Silva wrote: > On Mon, 2019-07-01 at 12:46 +0200, Michal Hocko wrote: > > On Fri 28-06-19 10:46:28, Alastair D'Silva wrote: > > [...] > > > Given that there is already a VM_BUG_ON in the code, how do you > > > feel > > > about broadening the scope from 'VM_BUG_ON(!root)' to > > > 'VM_BUG_ON(!root > > > > > (root_nr == NR_SECTION_ROOTS))'? > > > > As far as I understand the existing VM_BUG_ON will hit when the > > mem_section tree gets corrupted. This is a different situation to an > > incorrect section given so I wouldn't really mix those two. And I > > still > > do not see much point to protect from unexpected input parameter as > > this > > is internal function as already pointed out. > > > > Hi Michael, > > I was able to hit this problem as the system firmware had assigned the > prototype pmem device an address range above the 128TB limit that we > originally supported. This has since been lifted to 2PB with patch > 4ffe713b7587b14695c9bec26a000fc88ef54895. > > As it stands, we cannot move this range lower as the high bits are > dictated by the location the card is connected. > > Since the physical address of the memory is not controlled by the > kernel, I believe we should catch (or at least make it easy to debug) > the sitution where external firmware allocates physical addresses > beyond that which the kernel supports. Just make it clear, I am not against a sanitization. I am objecting to put it into __section_nr because this is way too late. As already explained, you already must have a bogus mem_section object in hand. Why cannot you add a sanity check right there when the memory is added? Either when the section is registered or even sooner in arch_add_memory. -- Michal Hocko SUSE Labs