Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2090808ybp; Thu, 10 Oct 2019 02:02:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIWvY8xcX3ZJwhY2rHeFbtsUgSIHvaHQE92GafJrGpQfbaFatUuKvvDdSSdhqR6+g5SWRA X-Received: by 2002:a50:ce06:: with SMTP id y6mr7090240edi.259.1570698126201; Thu, 10 Oct 2019 02:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570698126; cv=none; d=google.com; s=arc-20160816; b=SnEgVALeaiRNb1dsR92za2QYx4AKtJNb/xuN8PCGQbPrboQHkxaGSqEhXj1q2NkCRa jajYm9snXt2TZxH8pWQXFZYeHl8+Fp8ZqM9kotddmRvYjlviZrMPvLFjQ1LcYsQ8rl0Q kdI8MMvA55AOHER7Gq2pmTkuxhyiVlrDSSHR1y4Cb4rAh63WRWXqdzHtFC2x1sj9JwbW srCtiB+ugfZdGCTMo74EdS/vBZW70wIN/fz0oW+MlaBdtx4DGUllpwOVNROM5VDOqJu6 TbIdVcU0rWY/Ss4bsrZTIgHUwXKxkbSOcwwofTMF3CUY2Omr6f6WBtXafFKq1NzpeNYw MNGQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=awj3Fx4HFG8H4p7xmFTkPQ52+sjSg+b27wpe3d6scZI=; b=OCQSmgxJuauYnTyqbn3DttrXJr3kIlLEYkRPWNb1DLUC5ipOO+UBVsKsZPctjsVAJw KRj0u9mydG27HrJnW33389y+2+2RWnAw/2JTo2wCpYgp8KiWaHDRUgFj9wu1q8ryci6S +Dh4ewiN3RVj2U/NdIJTz7eNrF6G0j5inveltFE2s8/khwSm7ISPUQU5Ys8Ecu4uDzEk 76EQj+FZBX74CIEShU+mVA9frOPNrQ2UGzavvCo7vDqro1ZiAawx1l96KpBQjIP/X5MQ npt0l/wrECZ6lYsUGSOdI2ZQiNE+M/mojZfgdoBpQVph6tnSghWfEz78RgKkmLQiReDC 1SYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="1WhQgIj/"; 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 j21si2853397edr.376.2019.10.10.02.01.42; Thu, 10 Oct 2019 02:02:06 -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=pass header.i=@kernel.org header.s=default header.b="1WhQgIj/"; 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 S2388311AbfJJJBi (ORCPT + 99 others); Thu, 10 Oct 2019 05:01:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:45708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388296AbfJJIlT (ORCPT ); Thu, 10 Oct 2019 04:41:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 A28F521D7A; Thu, 10 Oct 2019 08:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570696879; bh=CGfWLHfDS5/I7M2lr6cE4KD8mzrZscQTZT50x3qj0yc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1WhQgIj/1bwX9FidizXpkT1B9+DAsRsQXdhu1RoGzF50eUyxcUecdGvnbkv7o5Jc/ iNBJ78IPEL02VDzIIN8BhHAOPx5xDbuuA9US3fm/Dycyn+JNk00Pc+2p4eYsbF2OUo uCpa2yYXB+mFQ+6u4NPUaoDPi1uhTX2OtGZYWM/4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Erhard F." , Christophe Leroy , Michael Ellerman Subject: [PATCH 5.3 031/148] powerpc/kasan: Fix shadow area set up for modules. Date: Thu, 10 Oct 2019 10:34:52 +0200 Message-Id: <20191010083613.034078157@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy commit 663c0c9496a69f80011205ba3194049bcafd681d upstream. When loading modules, from time to time an Oops is encountered during the init of shadow area for globals. This is due to the last page not always being mapped depending on the exact distance between the start and the end of the shadow area and the alignment with the page addresses. Fix this by aligning the starting address with the page address. Fixes: 2edb16efc899 ("powerpc/32: Add KASAN support") Cc: stable@vger.kernel.org # v5.2+ Reported-by: Erhard F. Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/4f887e9b77d0d725cbb52035c7ece485c1c5fc14.1565361881.git.christophe.leroy@c-s.fr Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/mm/kasan/kasan_init_32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/powerpc/mm/kasan/kasan_init_32.c +++ b/arch/powerpc/mm/kasan/kasan_init_32.c @@ -87,7 +87,7 @@ static int __ref kasan_init_region(void if (!slab_is_available()) block = memblock_alloc(k_end - k_start, PAGE_SIZE); - for (k_cur = k_start; k_cur < k_end; k_cur += PAGE_SIZE) { + for (k_cur = k_start & PAGE_MASK; k_cur < k_end; k_cur += PAGE_SIZE) { pmd_t *pmd = pmd_offset(pud_offset(pgd_offset_k(k_cur), k_cur), k_cur); void *va = block ? block + k_cur - k_start : kasan_get_one_page(); pte_t pte = pfn_pte(PHYS_PFN(__pa(va)), PAGE_KERNEL);