From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02764D2127D for ; Thu, 17 Oct 2024 11:01:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:CC:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qzkWqNr6Zah8fHLn9UTsESMYx5WWXc0P676Bj/YsVmA=; b=v8+9vUmqP3ehpgrKg8Cbmv7WUn AIDs+BXgHxcwrWBLnqJULI9dsuldC9b5f5UKndErWR69RDcdPj+h/I6g95mdHqNJwX82SURr5xiki 11c8IUK7mpVk/4iQ9WDcyTFpCttpvGhXGaprnCHch9Kp366hRN1h13OkeOVhTkV2o0i1HV5DOGhNN wXBvIQif0jbc+iobUje6VOJ2YYGc2UnwHDFUCAln98zBR/rQljloYeYQkKATpUCujtraEt6LrZyof +gGEgpvbKC/ceAaovMroh3mlKn+r9Sr+wpdEpJyFNdfy+gvQ48cNds1xyfvfCw09i8BM7N18kCokO PcUzOX/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1OFJ-0000000EZ2u-1buP; Thu, 17 Oct 2024 11:00:45 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1NcK-0000000EV3c-2nkc for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 10:20:33 +0000 Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49H9sYET027926; Thu, 17 Oct 2024 12:19:55 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= qzkWqNr6Zah8fHLn9UTsESMYx5WWXc0P676Bj/YsVmA=; b=G8S+ypOriCAWBjdh DlKopcoQbmo2a9XHGHUNeiB1ISAbpfvzrycH46M3wv11dMvfApP4kI+AU3+O9Sqs p0Bznpfv38UTVLw1AOD30FgAWDzwwnW4BjmRuuyhFquuY/Vw12RFtl2xpVA51APs gfX/pOPUavTPlnX1QI6hR/7cFY8tqoCiFDooH6WfVVNQ/x6gSinpTVUc8Eb8OD2E jyqK+6rZKb8kVyFPafvJadJoxV46kVm/stVcG3HhB0ZiA+NrgIVmDVKhNXHvj29H 1/rY8rsEE+qgHjqKOHVKsJzJwJmOPfJdo706Uto97LLr5dW5jRZ2iDOqI9FUHiXw O9hwmQ== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 427gex81y0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Oct 2024 12:19:53 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 9F96740047; Thu, 17 Oct 2024 12:18:41 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id CFA63279E69; Thu, 17 Oct 2024 12:17:28 +0200 (CEST) Received: from [10.48.86.107] (10.48.86.107) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 17 Oct 2024 12:17:28 +0200 Message-ID: <16e45f70-d1d6-4cca-95b0-24d3959e50be@foss.st.com> Date: Thu, 17 Oct 2024 12:17:27 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/2] ARM: entry: Do a dummy read from VMAP shadow To: Linus Walleij , Russell King , Kees Cook , AngeloGioacchino Del Regno , Mark Brown , Mark Rutland , Ard Biesheuvel CC: Antonio Borneo , , , References: <20241016-arm-kasan-vmalloc-crash-v2-0-0a52fd086eef@linaro.org> <20241016-arm-kasan-vmalloc-crash-v2-2-0a52fd086eef@linaro.org> Content-Language: en-US From: Clement LE GOFFIC In-Reply-To: <20241016-arm-kasan-vmalloc-crash-v2-2-0a52fd086eef@linaro.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.48.86.107] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_032029_260995_AAE9B40C X-CRM114-Status: GOOD ( 17.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 10/16/24 21:15, Linus Walleij wrote: > When switching task, in addition to a dummy read from the new > VMAP stack, also do a dummy read from the VMAP stack's > corresponding KASAN shadow memory to sync things up in > the new MM context. > > Cc: stable@vger.kernel.org > Fixes: a1c510d0adc6 ("ARM: implement support for vmap'ed stacks") > Link: https://lore.kernel.org/linux-arm-kernel/a1a1d062-f3a2-4d05-9836-3b098de9db6d@foss.st.com/ > Reported-by: Clement LE GOFFIC > Suggested-by: Ard Biesheuvel > Signed-off-by: Linus Walleij > --- > arch/arm/kernel/entry-armv.S | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S > index 1dfae1af8e31..12a4040a04ff 100644 > --- a/arch/arm/kernel/entry-armv.S > +++ b/arch/arm/kernel/entry-armv.S > @@ -25,6 +25,7 @@ > #include > #include > #include > +#include > > #include "entry-header.S" > #include > @@ -561,6 +562,13 @@ ENTRY(__switch_to) > @ entries covering the vmalloc region. > @ > ldr r2, [ip] > +#ifdef CONFIG_KASAN_VMALLOC > + @ Also dummy read from the KASAN shadow memory for the new stack if we > + @ are using KASAN > + mov_l r2, KASAN_SHADOW_OFFSET > + add r2, ip, lsr #KASAN_SHADOW_SCALE_SHIFT Hello Linus, While ARM TRM says that if Rd is the same of Rn then it can be omitted, such syntax causes error on my build. Looking around for such syntax in the kernel, this line should be : add r2, r2, ip, lsr #KASAN_SHADOW_SCALE_SHIFT Regards, Clement