Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1800929ima; Thu, 25 Oct 2018 05:17:50 -0700 (PDT) X-Google-Smtp-Source: AJdET5eoLgYJF/lXxiK+vrTb6SWVZXVx0vG9Ak4wTxKa7HAWAwDHsLqwd025o70DmlmxXq51bn3+ X-Received: by 2002:a17:902:e201:: with SMTP id ce1-v6mr1263126plb.47.1540469870091; Thu, 25 Oct 2018 05:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540469870; cv=none; d=google.com; s=arc-20160816; b=HzY/Xggd+A1kpMoo9zZ+ANIYsNh+AG8m7kb5INkckdnzl78bdDWdhcCKI0oelr+e6h QQqVckRHRYquAxYe2Yvh9dudY0GUbDOieGqRl0olzopx1y+M9dJy/TsVkSkLA3+SMt4t 9AlME0iVbNV/cr6dkFkrZoR4L/1gmTzbMe8XrCqmiYLBN1wQ2q2bgNhcf5ehPE3sA9il DMBusB6JWxFbbStVVsE6PUE4fsyhV0TRzFQhIkeq4wwaxtXXtJe6xqGu+d+3CVOviuGP I29xwIep9xALsM2hJrh5Jx83aAYGzhyq9pLc7+9QbL8J9NT/LhKSoZkZaGI0Zrei7qqr iy9w== 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:dkim-signature; bh=KqIGekJpw9cG2hQa6zjbOurEgyS91jisgXcI+lcalpg=; b=F9HoPVkz+RTTE1wIgHCiTBGMS41zDlTYdidc6UoBb1JhCXhlfW9m6irT3ZuXZipZFy AWPzjrkDfiPdtagcUc0qyNwOebP66UfKIzZb6HaY5ZPS/Q14Idbn4fG/mO9J0vqbzPEM wDO8OUCrtvZfdwIYHI0H8d9Uodw5RtPOpI84HjuZdDAFC8DCdJjv+g7X3OJIpzjfwhEE EZi7PFFN0Q5MXrta7qFhacVvEalaA8EYJjCfa959CyF+cE5AVJjpX09qhHS64PM+79x+ jCnCRas8HWdl7c2eO864CoThHT6avyNEUnCRvMAY+qn1kTX7qSWARi3w0RFIS6CVtsU1 m2RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b="T/I+3LVi"; 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=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r28-v6si2560695pgm.300.2018.10.25.05.17.16; Thu, 25 Oct 2018 05:17:49 -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; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b="T/I+3LVi"; 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=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727394AbeJYUcw (ORCPT + 99 others); Thu, 25 Oct 2018 16:32:52 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:58968 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727208AbeJYUcw (ORCPT ); Thu, 25 Oct 2018 16:32:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=KqIGekJpw9cG2hQa6zjbOurEgyS91jisgXcI+lcalpg=; b=T/I+3LViEvCKCvYIECwd3GcVt WAA+DvXulhesOO3+ES0Z3OY/MPF3+FYbwQWM8JPW9PZPytpCkitOrNZg2K9rzbQDkXh43XEQ7nr5o 25PRU6sSJ+pu5mWZCsQUwoGYswwjute3FPmuoT7tvBSm/xrOzMwsC0Ij+a26qqE75Q03U=; Received: from n2100.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:4f86]:35120) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1gFeJI-0007Ux-6f; Thu, 25 Oct 2018 13:00:20 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.90_1) (envelope-from ) id 1gFeJ9-0006AZ-5d; Thu, 25 Oct 2018 13:00:12 +0100 Date: Thu, 25 Oct 2018 13:00:06 +0100 From: Russell King - ARM Linux To: Rafael David Tinoco Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, Mark Brown , Sergey Senozhatsky , Nitin Gupta , Minchan Kim Subject: Re: [PATCH 1/2] mm/zsmalloc.c: check encoded object value overflow for PAE Message-ID: <20181025120006.GY30658@n2100.armlinux.org.uk> References: <20181025012745.20884-1-rafael.tinoco@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181025012745.20884-1-rafael.tinoco@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 24, 2018 at 10:27:44PM -0300, Rafael David Tinoco wrote: > On 32-bit systems, zsmalloc uses HIGHMEM and, when PAE is enabled, the > physical frame number might be so big that zsmalloc obj encoding (to > location) will break IF architecture does not re-define > MAX_PHYSMEM_BITS, causing: I think there's a deeper problem here - a misunderstanding of what MAX_PHYSMEM_BITS is. MAX_PHYSMEM_BITS is a definition for sparsemem, and is only visible when sparsemem is enabled. When sparsemem is disabled, asm/sparsemem.h is not included (and should not be included) which means there is no MAX_PHYSMEM_BITS definition. I don't think zsmalloc.c should be (ab)using MAX_PHYSMEM_BITS, and your description above makes it sound like you expect it to always be defined. If we want to have a definition for this, we shouldn't be playing fragile games like: #ifndef MAX_POSSIBLE_PHYSMEM_BITS #ifdef MAX_PHYSMEM_BITS #define MAX_POSSIBLE_PHYSMEM_BITS MAX_PHYSMEM_BITS #else /* * If this definition of MAX_PHYSMEM_BITS is used, OBJ_INDEX_BITS will just * be PAGE_SHIFT */ #define MAX_POSSIBLE_PHYSMEM_BITS BITS_PER_LONG #endif #endif but instead insist that MAX_PHYSMEM_BITS is defined _everywhere_. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up