Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2408247pxb; Sat, 7 Nov 2020 22:48:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8Q/hwU1roBgI4oDtFkjvx36hDzk5I7AK731irx8Clxpi8nTlz1LT8kE0uFUWhF+MOzH0P X-Received: by 2002:a17:906:3daa:: with SMTP id y10mr9540306ejh.23.1604818137634; Sat, 07 Nov 2020 22:48:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604818137; cv=none; d=google.com; s=arc-20160816; b=CCEiIetbFLupJGV/eeXcElXzcuo98yWVq2g3YUGw0V9jpl6VsejHj6cgvFG6DHOz5o iRfwqPK0frXh2fin3OweCaj5nIyG4ga7jO8tvD+QmR/pHycP3eip4+Gdnn/7W9HS1deE qvLrIEjXSzLnOw2frT5nIl53RJUmVUmtUCWa2oJLQVzQk7BezLFWWu5ljGIt5LsKwt8m Suaev5h4+Oay3r92spsLNUsoBI3eD8qA5kwOHKJA9aJUaCFZErQTu1lgo9DC+l3p/qDn LjNybq6cIrhJ6KmP+138AE3i5K5+IwkZyrExrviFyDBRhniPByGmRj3meujR9w8HPU7C qo7Q== 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=ef5q5YkEkiFTTVKfsLCD0jIDVCcw3FDwtTP4tD14pyo=; b=JnamfCfSBs9/Sgwc8vZJeC74DWxE+6lJ2VBBfW1c4qrxWMBzr37yKzC/Eso7zY9j3c HBIV0tQ1Hx32UJI5ZjhfA6iEDGWJ0cZ3x1Otz5utynGOBC+V9m5rZ9RckSn4CKxfp440 LFwcixx+IeSrRHF7UrBGxXgcSvB5VRCB/6uUwxueLzTjy1C52jxNup7baIOS4IrBxZ9A KInpoFkdOY086axro8IJE2OdZDK1kLGJa4gULfmrhDK/llEppOBORAwGsdqM9ubStRS5 1L5e4ElCNwopZ9lyVswhtYukzkSCXEy06bZ1NgT0oy/I3R4v8jVqPLZseQCI359Z5Cxk cbFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zn3IjVoQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cc21si5147650edb.123.2020.11.07.22.48.34; Sat, 07 Nov 2020 22:48:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zn3IjVoQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727298AbgKHGrF (ORCPT + 99 others); Sun, 8 Nov 2020 01:47:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:35636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbgKHGrF (ORCPT ); Sun, 8 Nov 2020 01:47:05 -0500 Received: from kernel.org (unknown [77.125.7.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B63A220719; Sun, 8 Nov 2020 06:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604818025; bh=mSqVcQ8slXzC2i6VD6wDGlN++XNR5+LGAMb54T1BS5s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zn3IjVoQ2CLJctHTVTmfZ/b93Vd+KT/XEXtBCyhjf2o9lZWOJfnlScUK5otkSwcVC 2DuFY9I1Zn2xGr9VD94afAIUuXDmDk8kxZDBJtoFmvlNITj6pbsYqoifhIFtpUIjXN mLiJ5RaAb9koMK5IBbNK/JHzppagIt+wtTDld1Oo= Date: Sun, 8 Nov 2020 08:46:59 +0200 From: Mike Rapoport To: Stefan Agner Cc: minchan@kernel.org, ngupta@vflare.org, sergey.senozhatsky.work@gmail.com, akpm@linux-foundation.org, sjenning@linux.vnet.ibm.com, gregkh@linuxfoundation.org, arnd@arndb.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/zsmalloc: include sparsemem.h for MAX_PHYSMEM_BITS Message-ID: <20201108064659.GD301837@kernel.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 07, 2020 at 04:22:06PM +0100, Stefan Agner wrote: > Most architectures define MAX_PHYSMEM_BITS in asm/sparsemem.h and don't > include it in asm/pgtable.h. Include asm/sparsemem.h directly to get > the MAX_PHYSMEM_BITS define on all architectures. > > This fixes a crash when accessing zram on 32-bit ARM platform with LPAE and > more than 4GB of memory: > Unable to handle kernel NULL pointer dereference at virtual address 00000000 > pgd = a27bd01c > [00000000] *pgd=236a0003, *pmd=1ffa64003 > Internal error: Oops: 207 [#1] SMP ARM > Modules linked in: mdio_bcm_unimac(+) brcmfmac cfg80211 brcmutil raspberrypi_hwmon hci_uart crc32_arm_ce bcm2711_thermal phy_generic genet > CPU: 0 PID: 123 Comm: mkfs.ext4 Not tainted 5.9.6 #1 > Hardware name: BCM2711 > PC is at zs_map_object+0x94/0x338 > LR is at zram_bvec_rw.constprop.0+0x330/0xa64 > pc : [] lr : [] psr: 60000013 > sp : e376bbe0 ip : 00000000 fp : c1e2921c > r10: 00000002 r9 : c1dda730 r8 : 00000000 > r7 : e8ff7a00 r6 : 00000000 r5 : 02f9ffa0 r4 : e3710000 > r3 : 000fdffe r2 : c1e0ce80 r1 : ebf979a0 r0 : 00000000 > Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user > Control: 30c5383d Table: 235c2a80 DAC: fffffffd > Process mkfs.ext4 (pid: 123, stack limit = 0x495a22e6) > Stack: (0xe376bbe0 to 0xe376c000) > ... > [] (zs_map_object) from [] (zram_bvec_rw.constprop.0+0x330/0xa64) > [] (zram_bvec_rw.constprop.0) from [] (zram_submit_bio+0x1a4/0x40c) > [] (zram_submit_bio) from [] (submit_bio_noacct+0xd0/0x3c8) > [] (submit_bio_noacct) from [] (submit_bio+0x4c/0x190) > [] (submit_bio) from [] (submit_bh_wbc+0x188/0x1b8) > [] (submit_bh_wbc) from [] (__block_write_full_page+0x340/0x5e4) > [] (__block_write_full_page) from [] (block_write_full_page+0x128/0x170) > [] (block_write_full_page) from [] (__writepage+0x14/0x68) > [] (__writepage) from [] (write_cache_pages+0x1bc/0x494) > [] (write_cache_pages) from [] (generic_writepages+0x58/0x8c) > [] (generic_writepages) from [] (do_writepages+0x48/0xec) > [] (do_writepages) from [] (__filemap_fdatawrite_range+0xf0/0x128) > [] (__filemap_fdatawrite_range) from [] (file_write_and_wait_range+0x48/0x98) > [] (file_write_and_wait_range) from [] (blkdev_fsync+0x1c/0x44) > [] (blkdev_fsync) from [] (do_fsync+0x3c/0x70) > [] (do_fsync) from [] (__sys_trace_return+0x0/0x2c) > Exception stack(0xe376bfa8 to 0xe376bff0) > bfa0: 0003d2e0 b6f7b6f0 00000003 00046e40 00001000 00000000 > bfc0: 0003d2e0 b6f7b6f0 00000000 00000076 00000000 00000000 befcbb20 befcbb28 > bfe0: b6f4e060 befcbad8 b6f23e0c b6dc4a80 > Code: e5927000 e0050391 e0871005 e5918018 (e5983000) > > Fixes: 61989a80fb3a ("staging: zsmalloc: zsmalloc memory allocation library") > Signed-off-by: Stefan Agner > --- > mm/zsmalloc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c > index c36fdff9a371..260bd48aacd0 100644 > --- a/mm/zsmalloc.c > +++ b/mm/zsmalloc.c > @@ -40,6 +40,7 @@ > #include > #include > #include > +#include asm/sparsemem.h is not available on some architectures. It's better to use linux/mmzone.h instead. > #include > #include > #include > -- > 2.29.1 > > -- Sincerely yours, Mike.