Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp46170pxa; Fri, 21 Aug 2020 00:16:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzp6EWJ4q8zw5DUn925tWWt072GcDnTMBQO6a0OarmCejE8Idrk3RfnN3XhY4l5aLd4ETwA X-Received: by 2002:a17:906:a109:: with SMTP id t9mr1734011ejy.134.1597994208807; Fri, 21 Aug 2020 00:16:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597994208; cv=none; d=google.com; s=arc-20160816; b=lYrFlQlS7pV05hKrT/IPRK0lUy26MsqtoJofI10jXk+WIZ0Y5ArDIWjyUfFopFOhQp 2xlo9+sCjiIFGXzahETdl3SJK8nYPFTe2YGxmRZ7MSJnOnLUxXjFPtA7mL/SMZnmpf3b 7TgkMRIWRtx1KQr8Mv2kXS6q3yzutYnzmt+o+djT7ePPTYES27Iy+YZ0EQ2J/CHTrHn2 tJ+yPf53xXk6xaEkLca7kDwCDXmz0cF67CIgz+PrI01BgNZTollfEHq7RF2DGRkxUjgy UhjrslXnEUYkWzAeLWcaznwVwtW7qIBJ3tBt+KObCIElS5LfB+SEvVZ+oiM668WMO1KR sJ6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:message-id; bh=SWI2ZwVl1lAmHLcWnBcPMLHsziz8861kxOgfnLQyJiU=; b=HAtHNuexsqPeIf2ElrWL4aWyj+35vvRgLzKt4MC8HrnzkcEbt3Tv5PBrxWgKyXHJ43 t28K69Ns6sW7baAxHbzX1QuAv1ePIZIMdad8Qfy4+/uhfjFfvG60dDznTRV2vr2dSwEP nyrwXiM69PRRIgTrhRz9/ehKSGjSe6IZTAgETlTQNuakkrKStUU94w9agHenh8BAkeVj IDxS7EnYyKD+tne1HeCvs3S5927Hz2HaMbaUiJoFYfJQ6rKxEIVzR6M4h1S2GG34Iqyz xVw2ratalLz+vXBWL65duzQO3VN4OZQepuB7RPJIqTRBw1b4BB+osiUiZQaJPAbMBDsR C3lg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lt7si641567ejb.272.2020.08.21.00.16.25; Fri, 21 Aug 2020 00:16:48 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727075AbgHUHP3 (ORCPT + 99 others); Fri, 21 Aug 2020 03:15:29 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:9122 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726119AbgHUHP3 (ORCPT ); Fri, 21 Aug 2020 03:15:29 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4BXt8F5Xvcz9tym5; Fri, 21 Aug 2020 09:15:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id O0PyNLgBqKj0; Fri, 21 Aug 2020 09:15:25 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4BXt8F4c1Vz9tym4; Fri, 21 Aug 2020 09:15:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A286A8B8AD; Fri, 21 Aug 2020 09:15:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id xvEEdfAwWWmE; Fri, 21 Aug 2020 09:15:26 +0200 (CEST) Received: from po17688vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 3C6518B8A2; Fri, 21 Aug 2020 09:15:26 +0200 (CEST) Received: by po17688vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 0403765CFE; Fri, 21 Aug 2020 07:15:25 +0000 (UTC) Message-Id: <09fc73fe9c7423c6b4cf93f93df9bb0ed8eefab5.1597994047.git.christophe.leroy@csgroup.eu> From: Christophe Leroy Subject: [PATCH] powerpc/32s: Fix module loading failure when VMALLOC_END is over 0xf0000000 To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , schwab@linux-m68k.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Fri, 21 Aug 2020 07:15:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In is_module_segment(), when VMALLOC_END is over 0xf0000000, ALIGN(VMALLOC_END, SZ_256M) has value 0. In that case, addr >= ALIGN(VMALLOC_END, SZ_256M) is always true then is_module_segment() always returns false. Use (ALIGN(VMALLOC_END, SZ_256M) - 1) which will have value 0xffffffff and will be suitable for the comparison. Reported-by: Andreas Schwab Signed-off-by: Christophe Leroy Fixes: c49643319715 ("powerpc/32s: Only leave NX unset on segments used for modules") --- arch/powerpc/mm/book3s32/mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/mm/book3s32/mmu.c b/arch/powerpc/mm/book3s32/mmu.c index 82ae9e06a773..d426eaf76bb0 100644 --- a/arch/powerpc/mm/book3s32/mmu.c +++ b/arch/powerpc/mm/book3s32/mmu.c @@ -194,12 +194,12 @@ static bool is_module_segment(unsigned long addr) #ifdef MODULES_VADDR if (addr < ALIGN_DOWN(MODULES_VADDR, SZ_256M)) return false; - if (addr >= ALIGN(MODULES_END, SZ_256M)) + if (addr > ALIGN(MODULES_END, SZ_256M) - 1) return false; #else if (addr < ALIGN_DOWN(VMALLOC_START, SZ_256M)) return false; - if (addr >= ALIGN(VMALLOC_END, SZ_256M)) + if (addr > ALIGN(VMALLOC_END, SZ_256M) - 1) return false; #endif return true; -- 2.25.0