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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02129C433E0 for ; Fri, 5 Mar 2021 17:13:11 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 954D8650A5 for ; Fri, 5 Mar 2021 17:13:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 954D8650A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To:From:Date: 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=wkMkVMReAw2nrB3oN9xtDwOnFh3NzW26tsPEh2X58a8=; b=ecKM546wM8fTkmml52a95unURy bstmQkknQUdBUCBebZTJ+BH9fO48yN5+OJtbchOICcokmrevPzxrtiiFj8ATWzSijuWfocEf5lVg5 /ojWJOSyMUNw2Pybl01K5peKdC4lGcQl9Oo/84QuVQNadKYWjGUGVi7aWP/hDjcOXogK0TREZpCyl qHWmhf2+4bCty+NV1k4IGt8ZrMYBXZoTk5FL4m2Tj2+JVBvv4nBQirTL7D2B7JY7LFqO2uiLjxqCM eqIQK8NCsHDCiVjyl48pzyOMtoKR+OhdN2q75xePqRtEtk5Y9G4re4Ra0q0420ZiyAw5NAn7AETQk hDaXv3yA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lIDyz-00FkAB-Mc; Fri, 05 Mar 2021 17:11:21 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lIDyt-00Fk8M-5O for linux-arm-kernel@lists.infradead.org; Fri, 05 Mar 2021 17:11:17 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 75B666509A; Fri, 5 Mar 2021 17:11:11 +0000 (UTC) Date: Fri, 5 Mar 2021 17:11:08 +0000 From: Catalin Marinas To: Andrey Konovalov Cc: linux-arm-kernel@lists.infradead.org, Vincenzo Frascino , kasan-dev@googlegroups.com, Will Deacon Subject: arm64 KASAN_HW_TAGS panic on non-MTE hardware on 5.12-rc1 Message-ID: <20210305171108.GD23855@arm.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210305_171115_658462_F92E32EA X-CRM114-Status: UNSURE ( 7.67 ) X-CRM114-Notice: Please train this message. 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Andrey, Enabling CONFIG_KASAN_HW_TAGS and running the resulting kernel on non-MTE hardware panics with an undefined STG instruction from mte_set_mem_tag_range(): ./scripts/faddr2line vmlinux kasan_unpoison_task_stack+0x18/0x40 kasan_unpoison_task_stack+0x18/0x40: mte_set_mem_tag_range at arch/arm64/include/asm/mte-kasan.h:71 (inlined by) mte_set_mem_tag_range at arch/arm64/include/asm/mte-kasan.h:56 (inlined by) kasan_unpoison at mm/kasan/kasan.h:363 (inlined by) kasan_unpoison_task_stack at mm/kasan/common.c:72 The full trace: ------------[ cut here ]------------ kernel BUG at arch/arm64/kernel/traps.c:406! Internal error: Oops - BUG: 0 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 5.12.0-rc1-00002-ge76afd1d69f3-dirty #2 pstate: 00000085 (nzcv daIf -PAN -UAO -TCO BTYPE=--) pc : do_undefinstr+0x2c8/0x2e8 lr : do_undefinstr+0x2d4/0x2e8 sp : ffffc07baeaa3cf0 x29: ffffc07baeaa3cf0 x28: ffffc07baeab3280 x27: ffffc07baeaa9a00 x26: ffffc07baeaa7000 x25: ffffc07baeab3964 x24: ffffc07baeaa9c00 x23: 0000000040000085 x22: ffffc07baed7f0e0 x21: 00000000d9200800 x20: ffffc07baeab3280 x19: ffffc07baeaa3d80 x18: 0000000000000200 x17: 000000000000000b x16: 0000000000007fff x15: 00000000ffffffff x14: 0000000000000000 x13: 0000000000000048 x12: ffffc07baeab3280 x11: ffff64d0ffc00294 x10: 0000000000000000 x9 : 0000000000000000 x8 : 00000000389fd980 x7 : ffff64d0ffbde5b8 x6 : 0000000000000000 x5 : ffff64d0ffb99880 x4 : ffffc07baeab5710 x3 : ffffc07baed7f0f0 x2 : 0000000000000000 x1 : ffffc07baeab3280 x0 : 0000000040000085 Call trace: do_undefinstr+0x2c8/0x2e8 el1_undef+0x30/0x50 el1_sync_handler+0x8c/0xc8 el1_sync+0x70/0x100 kasan_unpoison_task_stack+0x18/0x40 sched_init+0x390/0x3f0 start_kernel+0x2cc/0x540 0x0 Code: 17ffff8a f9401bf7 17ffffc8 f9001bf7 (d4210000) random: get_random_bytes called from print_oops_end_marker+0x2c/0x68 with crng_init=0 ---[ end trace c881f708bdfe36c8 ]--- If MTE is not available, I thought we should not end up calling the MTE backend but it seems that kasan expects the backend to skip the undefined instructions. Does kasan fall back to sw_tags if hw_tags are not available or it just disables kasan altogether? -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel