From patchwork Tue Oct 15 21:37:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13837345 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 A16F7D20683 for ; Tue, 15 Oct 2024 22:45:48 +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: Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=o1N4AEo67AJDxg5isYDTUU408W1MiStgBZrCEl+upAQ=; b=Ik2rpShkWSZEwP NNpwETrIGJkTFE6lO2S6rQ4y6zzo2t6K5hgWKXaJO48W/OzWsGTJqi3gO+DDdRIOESSyB0K0szafb BwDxrT693DbRw/7r8CGj3fy7oznmjIT2GbmcCFqji4FusG7Aav2CsBbscrM0noowjBviA2SiIndgx UL9F1ONdgMA0AZVkJ6PoR3JjUEK13z7Vk+u1wksmeeP7ue9+Y+CHlyWPfYyEEg7P8HkANjKMVy5d+ /wg94IDL0JQu3cXk6snIoXJs6ux+XSPEA60VqXWMtGAx6iiSc9n3LlM7pmWyGPi4s0keTlrucP0Um 9nUAk9GmQtikWgFq7B/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0qIL-00000009pvG-1lsE; Tue, 15 Oct 2024 22:45:37 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t0pET-00000009g9W-0vnl for linux-arm-kernel@lists.infradead.org; Tue, 15 Oct 2024 21:37:36 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-539eb97f26aso3561265e87.2 for ; Tue, 15 Oct 2024 14:37:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729028251; x=1729633051; darn=lists.infradead.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=o1N4AEo67AJDxg5isYDTUU408W1MiStgBZrCEl+upAQ=; b=QEiLFTidtKE6PSJgJcATBFZgUC39kzTPLzU7tNJlb17vUANjHSa2i+S1MZQQCD0aH2 mjrPkDzbDLF80FntcQUORZenn9zZVcvqcT57qjiw1Nm6YNznc4yDt22xlN3Dpbv2rUz4 TXMu5GymWj6ST9C6EDV2EOqdoh8SzNsOFTo/ObCMkejS9TmTHEgTmWEwN9Q6n54fFD8V 1AI82SEuj0sViJfQSLanH+1wtg6dCRLhnzpAbbhKyDoxEd6cl0XeD1n0rgHHjtF8MbMR WVJTTPLaSKvT5Epa1/xMvIp3agxGY7PCi3jAaVqbLQ0gytHg2BJIMouPlR9S4+ld8O5Q Oljg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729028251; x=1729633051; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=o1N4AEo67AJDxg5isYDTUU408W1MiStgBZrCEl+upAQ=; b=UAwvChUVKlZZFOLj4y8dG+yHrzsjbe92Mv3kla6PGQWrzsWIxPNQdMBi6WQeKA6lfY gy/5XGKw/X/5LWnUJdYF+fLvmChIof7vv0UakbcnhVfyED6EsG/OTwUAuIj9xQa0Jc6u wC/yA1eNGN2OLvNeVQ0G6SLVA4FbxEt8l0PBdsKg0VQEgWl3l7fgKrpXWhwryNYme9Ce d26nlZr7xtF/VqgYVP73SPd634cDnpoi2mOFUOkVHFYcVnVRIiiWW6dh7ONiNSDEi5se okK0bDFVUt6sCns2BGesMowYJjgN2OXrHh6HhC/iEmflOYrlfyTWAi5fCYSc0fvhJUS9 RM6w== X-Forwarded-Encrypted: i=1; AJvYcCUWHnMOtF7ZXkk0ztfVoObi490AG/zRPCSlQwkcBg0IoVufMMr4Q3uhJs9wv+muObbkooQCwKWLM7ZcW0o9kqiN@lists.infradead.org X-Gm-Message-State: AOJu0YzkNl8zMf4SbQZGb5m2oNiYp8RClgpoNtevpqpbezvOEnTeW8X1 Bf5xoX6/ZMZqghJA9rwRe6Y+yx6zx50FzhzNEpG3wrpPto9NVOSQTiSDQvZOuYg= X-Google-Smtp-Source: AGHT+IHrmYVh2s1M1vR8j11JDmsNmTewokj7TjNFd15E6BqGO2sG9UYvH4yAw5v0dpTqUPBHFsORUQ== X-Received: by 2002:a05:6512:3d23:b0:539:d428:fbf2 with SMTP id 2adb3069b0e04-539da3c58f6mr8166447e87.13.1729028250720; Tue, 15 Oct 2024 14:37:30 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539ffff39a7sm258959e87.164.2024.10.15.14.37.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 14:37:30 -0700 (PDT) From: Linus Walleij Subject: [PATCH 0/2] Fix KASAN crash when using KASAN_VMALLOC Date: Tue, 15 Oct 2024 23:37:13 +0200 Message-Id: <20241015-arm-kasan-vmalloc-crash-v1-0-dbb23592ca83@linaro.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAIngDmcC/x3MQQqDQAxA0atI1gaMzLTQqxQXcYwaqmNJQATx7 g4u3+L/E1xMxeFTnWCyq+uWC6iuIM2cJ0EdiqFt2kANRWRb8cfOGfeVl2VLmIx9xjH1Q6RArxD fUOq/yajHc/5213UDvZs472kAAAA= 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-20241015_143733_457635_E3197277 X-CRM114-Status: GOOD ( 11.14 ) 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 This problem reported by Clement LE GOFFIC manifest when using CONFIG_KASAN_IN_VMALLOC and VMAP_STACK: https://lore.kernel.org/linux-arm-kernel/a1a1d062-f3a2-4d05-9836-3b098de9db6d@foss.st.com/ After some analysis it seems we are missing to sync the VMALLOC shadow memory in top level PGD to all CPUs. Add some code to perform this sync, and the bug appears to go away. As suggested by Ard, also perform a dummy read from the shadow memory of the new VMAP_STACK in the low level assembly. Signed-off-by: Linus Walleij --- Linus Walleij (2): ARM: ioremap: Flush PGDs for VMALLOC shadow ARM: entry: Do a dummy read from VMAP shadow arch/arm/kernel/entry-armv.S | 8 ++++++++ arch/arm/mm/ioremap.c | 7 +++++++ 2 files changed, 15 insertions(+) --- base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc change-id: 20241015-arm-kasan-vmalloc-crash-fcbd51416457 Best regards,