From patchwork Fri Jun 19 14:32:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 191265 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp703440ilo; Fri, 19 Jun 2020 09:53:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuEB04O8V5qTl788kN9dNcPCjxmpxCKseGeOYeV+itjt61QjpDhlhiM7yAz2BBHeGWNY1r X-Received: by 2002:a50:ec0f:: with SMTP id g15mr4326460edr.359.1592585608231; Fri, 19 Jun 2020 09:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592585608; cv=none; d=google.com; s=arc-20160816; b=HmVT8rA/pd6otTIj3irxLd6UZWcZsACVZiOG7+JJodfUQowvWDxZMRPQn3EZTg+dDY 1ikuEghVO97Ky2GbtVYlXvCe7v4/vgbTYddtDfSRGrFFWrCA7Ia0I2e0qCV+hu9PMOKL FIbjfzfo+8zmgd7gCjb1aZFuvsWlNDW2+iZp9Sl9k0gCEqzeqFoBDyvkLy7Zz/F/DJdu m0sfsmg/1mgJTHUHNUhLnAPIC1qn9OOHBOxOefeTkme5wWYaEjdDddkqE4vQmHETK5IR byg5F1Fa8RLK9TObCptkH9zw8sm0LsL0m/KVClSYPEj0/eDcuqY1Nvvwjy5SHRF9V783 kX7Q== 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=63cbowxDmFoeXqQ0hwtHKQ2qpY0I692WlyES34LhfUA=; b=mZOC3kj43a2tDkW3jm99ioexiGWA9DWE9fsn2zURonZD3XYjFYoGmZtBSwKN4JpkSR TtbdAOMLcYmVJb4Drwfz5uXUSY3UvZu22YSSECPLxFSpOOzzi0+9BbqMWTzfuk/GS0Cj p5aMTROGmoVMhe0DWG9kxJmjF5cTu5zfo3l/gEfSCUfiFL0VKeZuMRP2Fgm1EcNaAH8Q 3ylJ/iyvl5Uai0e7lc9evFHDL8U7jIrbSRD9o1Fklntv1o4xbRt+AMVjw3QwPhmhebE4 6HsRwkHIQ1u1Dy8hThShz3OZH0Inn13qU0+U+aLF1xyc8XeFp95cey6clb+rImfFapTc jA/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kfln0Cwo; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 q22si4496092edb.325.2020.06.19.09.53.28; Fri, 19 Jun 2020 09:53:28 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=kfln0Cwo; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387720AbgFSOhZ (ORCPT + 15 others); Fri, 19 Jun 2020 10:37:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:54192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387710AbgFSOhX (ORCPT ); Fri, 19 Jun 2020 10:37:23 -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 A6D2421527; Fri, 19 Jun 2020 14:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592577443; bh=FdpUTESJ9f6tKR31I9XJPxlSZiptBJC8TU1UArWeeCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kfln0CwobEvuC3+rk2bOyNf1NjqPcXVOuSVhmfu63GqizOlw3JzK3np7hRoYFvHDe 3iRIUZ6qYW1l9r+d4yc/4hSqw4fC+84kq3cOnyzHjR9N56Yg82OV+MdNwONVp18gVx vpE167h9Wxah6UZ7Sad76iDIrXmzVRvcjTw3zip8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Florian Fainelli , Linus Walleij , Russell King , Sasha Levin Subject: [PATCH 4.4 052/101] ARM: 8978/1: mm: make act_mm() respect THREAD_SIZE Date: Fri, 19 Jun 2020 16:32:41 +0200 Message-Id: <20200619141616.787994343@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141614.001544111@linuxfoundation.org> References: <20200619141614.001544111@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Walleij [ Upstream commit e1de94380af588bdf6ad6f0cc1f75004c35bc096 ] Recent work with KASan exposed the folling hard-coded bitmask in arch/arm/mm/proc-macros.S: bic rd, sp, #8128 bic rd, rd, #63 This forms the bitmask 0x1FFF that is coinciding with (PAGE_SIZE << THREAD_SIZE_ORDER) - 1, this code was assuming that THREAD_SIZE is always 8K (8192). As KASan was increasing THREAD_SIZE_ORDER to 2, I ran into this bug. Fix it by this little oneline suggested by Ard: bic rd, sp, #(THREAD_SIZE - 1) & ~63 Where THREAD_SIZE is defined using THREAD_SIZE_ORDER. We have to also include since the THREAD_SIZE expands to use the _AC() macro. Cc: Ard Biesheuvel Cc: Florian Fainelli Suggested-by: Ard Biesheuvel Signed-off-by: Linus Walleij Signed-off-by: Russell King Signed-off-by: Sasha Levin --- arch/arm/mm/proc-macros.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S index e6bfdcc381f8..1da55d34f4d6 100644 --- a/arch/arm/mm/proc-macros.S +++ b/arch/arm/mm/proc-macros.S @@ -4,6 +4,7 @@ * VMA_VM_FLAGS * VM_EXEC */ +#include #include #include @@ -30,7 +31,7 @@ * act_mm - get current->active_mm */ .macro act_mm, rd - bic \rd, sp, #8128 + bic \rd, sp, #(THREAD_SIZE - 1) & ~63 bic \rd, \rd, #63 ldr \rd, [\rd, #TI_TASK] ldr \rd, [\rd, #TSK_ACTIVE_MM]