Message ID | 20241021-arm-kasan-vmalloc-crash-v4-2-837d1294344f@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 4E791D15DA5 for <linux-arm-kernel@archiver.kernel.org>; Mon, 21 Oct 2024 14:54:34 +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=o4FvxagpzjxZSStnbXoR4/Vp7sTpyCwQgUO0IG3vegk=; b=ZCvnaKcEfrZBvtQ6oYug+W/8aA 3L95jT80Y3AUqQZoXmcidr1fBczTYu1b3RklI6rR9KMtIlMY84luBLxWh/DjayBbsxG0Nid82V+hJ FMggyAG7AcPkBg4t0VZJ/9MsOUpa4+GqeUnHeTVhatDpxK/CJGLxkMa+mF4Yh2QUCuV0BktIvlbee x95ZyC2V9x/48SmYhZFuWn5Qkl9ObkMWscu9lt348S+45gW8G312HP+LaeNaIZDpoAvZ59ePKhjnF iw17B7o2Ralg2cYk9EMq7sk049464O6YEcAyIsnMcT4mZcLMDwP4FzhWjMGDktiWVv3GpO8bzCt3a VwvFcFcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2tna-00000007gO1-1TQI; Mon, 21 Oct 2024 14:54:22 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2s40-00000007MIU-0RdY for linux-arm-kernel@bombadil.infradead.org; Mon, 21 Oct 2024 13:03:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=o4FvxagpzjxZSStnbXoR4/Vp7sTpyCwQgUO0IG3vegk=; b=nx+hHptQPWKayPQwixp6i2tMzL 0SkSlwiYaIHI7dYQ0q+9kC/oyw0di9bT/7rYbDqOV+ZC2Y5stH4xAA10Q7bg2TSo6y8WX/PKBl8jM A3KXto+Q74kMVTzp2u2r86EWiOUwMF+aCTjI8+q6uYeZt8UlD1v+VJOL5xJN8ZaHS76MyuIgakeEv nXs91+PlywYqcP4WJFC1CJLEJ1P1j6x1NpvD+lsDENoyGDQW49Iri4PtXGtJ5O987svyj9YUEqqqM DfIIfckkq30IuWxCSc+TAtqFISAg1MHX/1J5e7UsL1/FMnMlNdGUftsg3DqVVn+YJFTg2Ua7wA6ZO CPJm1XWg==; Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2s3v-00000007wY1-2p3Y for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 13:03:10 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2fb49510250so40974611fa.0 for <linux-arm-kernel@lists.infradead.org>; Mon, 21 Oct 2024 06:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729515784; x=1730120584; 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=o4FvxagpzjxZSStnbXoR4/Vp7sTpyCwQgUO0IG3vegk=; b=naCrwlfEAwFSKBvpov9HnbTub8ozHtLXSzmjc8i/u8nbGbsglZ+KaKAflTGJfr3ul+ 3HwYYEF2bx27SsxMeMg8ATl07mBNZhp2XpIjEOu50KRg4lFacpXgNkGdJ39F99D5iJG2 2JpT/BOWkz0tdl9nmyCOD7RnBjcGdjGcKDGaMbXgYlw24KAqdjIsXjtU4C3C27ONKUJ4 z1y7sVrO7xHwiC1ITm7SOJFrqaXSa1clVYO6W3IWkImfA+Tb93PQ3OJC95CymY3B7QLL wdSMa/zubBV0T3hlLiLgKFep25pujXtgAJ8I4LYg/VrWMsts85mQNHvASXhXSd4Po7b+ /d9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729515784; x=1730120584; 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=o4FvxagpzjxZSStnbXoR4/Vp7sTpyCwQgUO0IG3vegk=; b=g74nMANu/wFG77sBYmcmkJ7vdI0J4TlCv2/W4ZuXF1lOihoowWSh0eiHdxbIATV4fi dKBJ+7vqOdH8lxsVYKD0ae6cU4w3luyDS63ziyj8Ge73CLoItYAoAQw/Fvftc41qTxCo nfp+IiaogbIFjjdVbblJuD4zS8hltN1dgRk4Vgbo8BxhbftbSxD3L2EJp4FosDz5DSi2 D6Jgo+tSMs3owqKOlCJtMAnI8OliUldUX503Wuq0oD//ySzmYUPqZ/OC2HmGUmKRc7SA S31hhPl/FvaNt+jGbhNdFEqY7iru0ZjPi8b91GJPY6YCY1WPgLiWv4bcyQT/i+SurBCN xdxg== X-Forwarded-Encrypted: i=1; AJvYcCUAF1Fe/54AZ3pLsVXYu4jC1PPT9sUJqqpb59pkE6vWZVkREXDdH4sbyHVphtN8Ak5tvIytXIs/8LjRDxQwqIJY@lists.infradead.org X-Gm-Message-State: AOJu0YyJLDXrSG7iaSd4RXBL27MaRbRXh6SEbMgv8Xta2j0lzdTD/dlL gprfsab2c4szz7I9G4bO91M1wib0k5/olaVCbbR9TGfTlr+/GsmEjo4jeXnCJRw= X-Google-Smtp-Source: AGHT+IFl2tqDkCWdClLbm+iio4vewFwLEcLXVPL3QhXNtJlFjMyJiepzyeePilHFMrPomCUvBO3Mgw== X-Received: by 2002:a2e:a585:0:b0:2fb:5014:f093 with SMTP id 38308e7fff4ca-2fb83226829mr47866501fa.44.1729515784392; Mon, 21 Oct 2024 06:03:04 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fb9ae24d51sm4808351fa.130.2024.10.21.06.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 06:03:03 -0700 (PDT) From: Linus Walleij <linus.walleij@linaro.org> Date: Mon, 21 Oct 2024 15:02:59 +0200 Subject: [PATCH v4 2/3] 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: <20241021-arm-kasan-vmalloc-crash-v4-2-837d1294344f@linaro.org> References: <20241021-arm-kasan-vmalloc-crash-v4-0-837d1294344f@linaro.org> In-Reply-To: <20241021-arm-kasan-vmalloc-crash-v4-0-837d1294344f@linaro.org> To: Clement LE GOFFIC <clement.legoffic@foss.st.com>, Russell King <linux@armlinux.org.uk>, Melon Liu <melon1335@163.com>, Kees Cook <kees@kernel.org>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Mark Brown <broonie@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Ard Biesheuvel <ardb@kernel.org> Cc: Antonio Borneo <antonio.borneo@foss.st.com>, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Linus Walleij <linus.walleij@linaro.org>, 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-20241021_140307_865385_86CB5A1F X-CRM114-Status: GOOD ( 13.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
Fix KASAN crash when using KASAN_VMALLOC
|
expand
|
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 1dfae1af8e31..ef6a657c8d13 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -25,6 +25,7 @@ #include <asm/tls.h> #include <asm/system_info.h> #include <asm/uaccess-asm.h> +#include <asm/kasan_def.h> #include "entry-header.S" #include <asm/probes.h> @@ -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, 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
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 <clement.legoffic@foss.st.com> Suggested-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- arch/arm/kernel/entry-armv.S | 8 ++++++++ 1 file changed, 8 insertions(+)