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 304D1D2A542 for ; Wed, 16 Oct 2024 19:20:07 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TASGgpeqvDoWRp9bCNSBz84rkKz0n7oKXi0ntrW73xw=; b=1+42t475RNElF+o4HTy96ugz9X 5PkutRc7NLBmpnUea+7aPmRv4MmkNH2v61mewxnJ1U8yIQfAkdjZsPxtiZd0n0Y8EF6oHKtk1uOSB wi9mzbSCmv6idif11XJbh1ZsjQlI4Qyh6ZfEkYqfTHmdoDlsChPKwpORpTSb1kU7bAk1NGBCYPS9Q QixDWQXo+VNsKVHwDJFxDjN/EdF1UWZq5VBWnP7EUt3D3WxdsvAIbtqScLow4ewuVph0j/3JV33GM Ieth+uaktaSoBc5+oU+w+CESHXsxbrPL7QcQUV3agtMEdFtJg5T3iQKYzoPwCu6CrUUpNmL5ha+V9 BSwuCagA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t19Ym-0000000Cmov-3qEB; Wed, 16 Oct 2024 19:19:52 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t19Ua-0000000CmVn-0RCi for linux-arm-kernel@lists.infradead.org; Wed, 16 Oct 2024 19:15:33 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-539e59dadebso251670e87.0 for ; Wed, 16 Oct 2024 12:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729106130; x=1729710930; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=TASGgpeqvDoWRp9bCNSBz84rkKz0n7oKXi0ntrW73xw=; b=HObPTi5btO1ITDqGiX9lTcSdkTXIaSL3s+yHZIvnNUMnCg55TaQ61QoB3RgGrkEuiW UWQUGASzX+u22YthuKlLopxFNKDDQEHpx3Zgc+eSqytSJNYDIKPWbOwx4zxTn0FG387B rFDZHbp5E/t3plXkmk5LYPAUNhvP487SfUXwWcp2DMrFHahEG/kYLHH9bbIVYPlVRgBN dKCwUTopaJNdFTh9MGOim9T7HQllJbWEmftzJ8rRDhYzT8/3M9Lcb3J2k/TRkAw0pBAZ 87ViNGrelD4HTrs3dfmSJnHzTU9n0GXx9x5+viipWcec5K1DJsOMxfnLM0lc9C9rcika X/Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729106130; x=1729710930; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TASGgpeqvDoWRp9bCNSBz84rkKz0n7oKXi0ntrW73xw=; b=MPeiNHBMYJfNyGlJqykT3MKbdDSLqUJQE3iGDog3/uvLjheZ9cfsLPsmCIxt/U2cIV Q9f2bAPczdA7P4uBGdEvRC7oBOi9GA6HsI/d+z5EoDI7I6pBCCFdA4s8sYgUUkZJaLQE X6t1QxMIq4h7KJwMOTb80DtMT/aDRuNKPOCQ0LGFXB8c8fWxNp71pfJ1D86rjYWXaQDP 0mLvcdtJ7JkvxFnT+QHZKG5tbT6Tgln26Hj2g+SYS0X5xtDYw2mck37wxpjjMWRY9pqJ 1RGTTpM5pw7e1QJ/XRkFubSMB+5TXaaCZ0pkzm+VtO2pwPB7qUrxH9Gwmay47hvbnCbb lPQw== X-Forwarded-Encrypted: i=1; AJvYcCVAbEbKvl1hEHWG4Cj4nS2gl9SWHLQvXedvNmPYlJmCyA8fw3IFwuVC65gmaj9t8zc5ZhTtCe0Y9tS7gOncjmXP@lists.infradead.org X-Gm-Message-State: AOJu0Yy60hgMSs4kMLfSKmKQ/9Kk7L9HLlPiGqnsIsUD6XOPRKTTy5hx YbPtowkSQ6JORiDjUcos4FYJ8xyVGZ/9VasFj/vv8y1nz1QwdP72ZdiVwI7uKJE= X-Google-Smtp-Source: AGHT+IHJIhURp5o49jHsNM2fP6AbvkviSOdVbGAki0cvkWbV9Y7hCwBSZOjEXY//vAhJFLxSwJVh/w== X-Received: by 2002:a05:6512:3f2a:b0:539:96a1:e4cf with SMTP id 2adb3069b0e04-53a03f34f5emr3050137e87.32.1729106130458; Wed, 16 Oct 2024 12:15:30 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53a00013cffsm531184e87.278.2024.10.16.12.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 12:15:28 -0700 (PDT) From: Linus Walleij Date: Wed, 16 Oct 2024 21:15:22 +0200 Subject: [PATCH v2 2/2] ARM: entry: Do a dummy read from VMAP shadow MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20241016-arm-kasan-vmalloc-crash-v2-2-0a52fd086eef@linaro.org> References: <20241016-arm-kasan-vmalloc-crash-v2-0-0a52fd086eef@linaro.org> In-Reply-To: <20241016-arm-kasan-vmalloc-crash-v2-0-0a52fd086eef@linaro.org> To: Clement LE GOFFIC , Russell King , Kees Cook , AngeloGioacchino Del Regno , Mark Brown , Mark Rutland , Ard Biesheuvel Cc: Antonio Borneo , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Linus Walleij , stable@vger.kernel.org X-Mailer: b4 0.14.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_121532_151932_99F80779 X-CRM114-Status: GOOD ( 13.04 ) 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 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 + ldr r2, [r2] +#endif #endif @ When CONFIG_THREAD_INFO_IN_TASK=n, the update of SP itself is what -- 2.46.2