From patchwork Sat Nov 7 15:22:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 11889029 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D514C14C0 for ; Sat, 7 Nov 2020 15:22:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5B6FD20888 for ; Sat, 7 Nov 2020 15:22:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=agner.ch header.i=@agner.ch header.b="J8u/fVKn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B6FD20888 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2F9986B0036; Sat, 7 Nov 2020 10:22:11 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2AA676B005D; Sat, 7 Nov 2020 10:22:11 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1989F6B0068; Sat, 7 Nov 2020 10:22:11 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0161.hostedemail.com [216.40.44.161]) by kanga.kvack.org (Postfix) with ESMTP id E28696B0036 for ; Sat, 7 Nov 2020 10:22:10 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8331B1EE6 for ; Sat, 7 Nov 2020 15:22:10 +0000 (UTC) X-FDA: 77457988020.07.egg06_58057b0272dc Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 6A3E81803F9AE for ; Sat, 7 Nov 2020 15:22:10 +0000 (UTC) X-Spam-Summary: 1,0,0,fde5a2d274a6663b,d41d8cd98f00b204,stefan@agner.ch,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1431:1437:1515:1534:1543:1711:1730:1747:1777:1792:1981:2194:2199:2393:2559:2562:3138:3139:3140:3141:3142:3165:3354:3865:3866:3867:3868:3870:3871:3872:4250:4321:4605:5007:6117:6119:6261:6630:6653:7903:8784:9163:10004:10903:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:12986:13161:13229:13870:13894:14096:14181:14394:14721:21080:21451:21611:21627:21795:30003:30012:30029:30051:30054:30056,0,RBL:178.209.48.109:@agner.ch:.lbl8.mailshell.net-64.100.201.201 62.2.60.100;04yrdj8qynuxyi8z5fthrzfez4y9bopubj1dbtyco1hpj1f7za8np88z81suhqt.ppyidc5jzgyn15rxbfey8rzq7frakhoruj6rd9pimz9tfb9zqnxkh3zgau47wbo.q-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:69,LUA_SUMMARY:none X-HE-Tag: egg06_58057b0272dc X-Filterd-Recvd-Size: 4974 Received: from mail.kmu-office.ch (mail.kmu-office.ch [178.209.48.109]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Sat, 7 Nov 2020 15:22:09 +0000 (UTC) Received: from allenwind.lan (unknown [IPv6:2a02:169:3df5::979]) by mail.kmu-office.ch (Postfix) with ESMTPSA id CA9895C1FF5; Sat, 7 Nov 2020 16:22:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1604762527; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=90S2HQuQxNPuGlnJbbsFbCfJWrpfhbx3HtSCJ9DUcsk=; b=J8u/fVKnCRmBm6g2eyDZ4IoD9jRbuQ1cSOo/4+y4oF6CdQMDQYyIyz66O/E9TBZ201dbrI hx/qlEbsd0km1/uwjn8EcDEpfbav4vOIjRO8ela1kwgC3KEPMtyPhQ4bYFViPbv9uxJHjR EJ5/yYwgpVm2E4dWlT3/zMihAeSgfvk= From: Stefan Agner To: minchan@kernel.org, ngupta@vflare.org, sergey.senozhatsky.work@gmail.com Cc: akpm@linux-foundation.org, sjenning@linux.vnet.ibm.com, gregkh@linuxfoundation.org, arnd@arndb.de, stefan@agner.ch, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm/zsmalloc: include sparsemem.h for MAX_PHYSMEM_BITS Date: Sat, 7 Nov 2020 16:22:06 +0100 Message-Id: X-Mailer: git-send-email 2.29.1 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Signed-off-by: Minchan Kim --- 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 #include #include #include