Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp90538rbb; Fri, 23 Feb 2024 12:52:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWQtt+jhPBZ32w5DlL1gp7YyotS+3vjJoJz79LWaHX+wQG6BWHzRSiggjZEN2KtYt7qYVDDM+7zdE9JeL2WPq7/oNUrOmCzNGEpj1HKYw== X-Google-Smtp-Source: AGHT+IHNF+e7K0XJveKwG/9ha5qT4J8JR6l44HR34kzrl/DiewCCGDQWXaMkP87p9QZCw7+C7axN X-Received: by 2002:a17:906:2b88:b0:a3f:2e6f:800e with SMTP id m8-20020a1709062b8800b00a3f2e6f800emr534944ejg.24.1708721552305; Fri, 23 Feb 2024 12:52:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708721552; cv=pass; d=google.com; s=arc-20160816; b=s//s/LmGYE4IKa4H3/PAz+XYisD8PD90JUjlGC5r1hZaOhm9grGZT6Oe9itU/t7WGv C5AJqeTnJQGbQWRvxX6s0XJQL7QVxUQBRFttl+WSsHNWd/yxeBzbTT2jWDV1MFz8CVRw 1e9rXhc/WW5wOZiLkXGVsBb4UbK7/EDhKr+NbCTnuvLJCqf6fOoDxludVVH7YRx+mB1X dPjW+lYkpvI6cjnK8RwA6PW5zF9R1L8dWA91mC2oe2lVqrq4o6QWwpFOTHScQwKymYOI lHqW6kY1UcYvo8md1oOGImQy+RjcdCCQjNRhGn6szGkdCoX1fI3yVY7ttKUuw8wbPWAd 3aSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DZFUId5D6Zx4OkxIlS4Mif4jzjgXqjVeTqx6P4vEy08=; fh=OoGrspFFO9Oh6CAw75VO3PgcdRCQRB3Pnj7k1iDenB0=; b=iULC/9291lUM9z//fQSH8UsJNsku6BPLTEUK2sb7PjPNQS0otOZugQJQyNPNJxyA7z JI9NEszvFDlx+d1/U/RsXebtkA3iRy2J0jYUQ8XWCR/QH3aJ2eHVr/b5F8ey9x8DHIYj c15RtnCb5Mq8MpHZzmFl8qAJb5rCSk6+cqyI7eIJU4GTOe+hB7XQVw1+f3YW2kXWfb9i 3XIl1rGmO+JfanDbzkPyl9XQ4r3595Sh46Yud5FDaytm1Dq1wSZIgoT/LYw/drDW529p ND0by4EAyzNTDHKnRM+TcqIhB9v08IruCbMw83BlayK6gSdyudskATs1SQDI2cwvgFxt CkXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tum.de header.s=tu-postout21 header.b=glkraDI2; arc=pass (i=1 spf=pass spfdomain=tum.de dkim=pass dkdomain=tum.de dmarc=pass fromdomain=tum.de); spf=pass (google.com: domain of linux-kernel+bounces-79144-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79144-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tum.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dc5-20020a170906c7c500b00a3e61a1938esi5606160ejb.681.2024.02.23.12.52.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 12:52:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79144-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@tum.de header.s=tu-postout21 header.b=glkraDI2; arc=pass (i=1 spf=pass spfdomain=tum.de dkim=pass dkdomain=tum.de dmarc=pass fromdomain=tum.de); spf=pass (google.com: domain of linux-kernel+bounces-79144-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79144-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tum.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DEF861F23558 for ; Fri, 23 Feb 2024 20:52:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14DE81474C1; Fri, 23 Feb 2024 20:52:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tum.de header.i=@tum.de header.b="glkraDI2" Received: from postout1.mail.lrz.de (postout1.mail.lrz.de [129.187.255.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3F7D143C7B; Fri, 23 Feb 2024 20:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=129.187.255.137 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708721542; cv=none; b=pNEfkIqIy5AVVdXmnzBFpU6guQuGndSZ3gjT7k0r22munQpyB4DLIsyOBgxXH572sRibhsyCHcP0uPKkG8hrgAePwcQ1dFy//gGiNhxtEkQL5mDODwkVG5VdzPWa8Zl+sbsdiEoCIk4cb3i3bV0bTEQ5wDUqZ3oZvDhRyWdhxVw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708721542; c=relaxed/simple; bh=X2Ai3VLTUPX8J6sGlUtCyH2/JCyRJ5egDX0GMxQeImg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=n5PXtQstjn1bhsn1rKCIARQbnkDqxVD0xHrCZlGLt3+E3435F1gLKrkU0UlhdoYQS6keqZKzBlV3y1ZW8p6iAJHMJ6NPtEySzlbPaKz34/3GEA+8Nt+cXHT5cWxwqBHiBiFdzBxXKmPLZ9JSddvmpTXBz/i5y9PjNjnmzpYjjp8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=tum.de; spf=pass smtp.mailfrom=tum.de; dkim=pass (2048-bit key) header.d=tum.de header.i=@tum.de header.b=glkraDI2; arc=none smtp.client-ip=129.187.255.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=tum.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tum.de Received: from lxmhs51.srv.lrz.de (localhost [127.0.0.1]) by postout1.mail.lrz.de (Postfix) with ESMTP id 4ThMdX2XzVzyd5; Fri, 23 Feb 2024 21:52:16 +0100 (CET) Authentication-Results: postout.lrz.de (amavisd-new); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=tum.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tum.de; h= in-reply-to:content-transfer-encoding:content-disposition :content-type:content-type:mime-version:references:message-id :subject:subject:from:from:date:date:received:received; s= tu-postout21; t=1708721535; bh=X2Ai3VLTUPX8J6sGlUtCyH2/JCyRJ5egD X0GMxQeImg=; b=glkraDI20d/PkHdSOMkhZ1Cyo8fyNgApNhHI2dm47TQoQz/gk Ks5P9govjSJ072vBXE7fKiieMHy/zZcm7Aa2w2Xh2hxCerB8DV5qisPanmUVwqWl CVxpw1yujNrr5H+8H9by40mkIXUHE/UB2RtudZnwsAoqOfvXAqcyyboC0kJkYZfq eVm1pzgMspeyK+OrVYIpmQl4eQQ55I/SFJF+Ug2ZUai9qTSpG8zuJjfJ08mmISEJ zjUE1Gbz4wyBgMQZRWF1jS8/7reaw0leCW35OTYsuRdPne4NW+wKExp656QZihXL UzEgvI0T/ksqhnihwa7Ozr1fZGjeRTJ4lJ55Q== X-Virus-Scanned: by amavisd-new at lrz.de in lxmhs51.srv.lrz.de X-Spam-Flag: NO X-Spam-Score: -2.881 X-Spam-Level: Received: from postout1.mail.lrz.de ([127.0.0.1]) by lxmhs51.srv.lrz.de (lxmhs51.srv.lrz.de [127.0.0.1]) (amavisd-new, port 20024) with LMTP id jD_XKX9Z62Rv; Fri, 23 Feb 2024 21:52:15 +0100 (CET) Received: from pine (unknown [IPv6:2001:a61:2510:5501:544b:4b32:4119:3827]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by postout1.mail.lrz.de (Postfix) with ESMTPSA id 4ThMdW0lTtzyd7; Fri, 23 Feb 2024 21:52:15 +0100 (CET) Date: Fri, 23 Feb 2024 21:52:09 +0100 From: Paul =?utf-8?Q?Heidekr=C3=BCger?= To: David Gow Cc: Brendan Higgins , Mark Brown , Shuah Khan , "open list:KERNEL UNIT TESTING FRAMEWORK (KUnit)" , "open list:KERNEL UNIT TESTING FRAMEWORK (KUnit)" , open list Subject: Re: [PATCH RFC] kunit: tool: add 'mte=on' qemu arg on arm64 Message-ID: References: <20240214124131.990872-1-paul.heidekrueger@tum.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On 20.02.2024 08:46, David Gow wrote: > On Wed, 14 Feb 2024 at 20:41, Paul Heidekrüger wrote: > > > > Hi! > > > > I was running some KASan tests with kunit.py recently and noticed that > > when KASan is run in hw tags mode, we manually have to add the required > > `mte=on` option to kunit_tool's qemu invocation, as the tests will > > otherwise crash. > > > > To make life easier, I was looking into ways for kunit.py to recognise > > when MTE support was required and set the option automatically. > > > > All solutions I could come up with for having kunit_tool conditionally > > pass `mte=on` to qemu, either entailed duplicate code or required > > parsing of kernel's config file again. I was working under the > > assumption that only after configuring the kernel we would know whether > > the 'mte=on' option was necessary, as CONFIG_ARM64_MTE is not visible > > before. > > > > Only afterwads did I realise that the qemu arm64 config that kunit_tool > > falls back on, uses the `virt` machine, which supports MTE in any case. > > So, could it be as easy as just adding the `mte=on` option to > > kunit_tool's arm64 config? Would this be a welcome addition? > > > > What do you think? > > > > Many thanks, > > Paul > > > > Signed-off-by: Paul Heidekrüger > > --- > > I think this is fine. I'd be a little bit concerned if this were only > supported in newer qemu versions, but it seems to go back to 6.2, so > should be okay. I think it's better to just enable it unconditionally > by default rather than trying to parse the config. > > The KASAN tests seemed to work fine with HW tags in my testing here. I > do wonder if there's a way to make the tests skip themselves if MTE > isn't available: is there a way of doing a runtime check for this? Huh, interesting. Even though "mte=on" isn't set on your side? I get the following output without the MTE patch. ➜ ./tools/testing/kunit/kunit.py run --kunitconfig=mm/kasan/.kunitconfig --arch=arm64 [14:08:11] Configuring KUnit Kernel ... [14:08:11] Building KUnit Kernel ... Populating config with: $ make ARCH=arm64 O=.kunit olddefconfig Building with: $ make ARCH=arm64 O=.kunit --jobs=8 [14:08:23] Starting KUnit Kernel (1/1)... [14:08:23] ============================================================ Running tests with: $ qemu-system-aarch64 -nodefaults -m 1024 -kernel .kunit/arch/arm64/boot/Image.gz -append 'kunit.enable=1 console=ttyAMA0 kunit_shutdown=reboot' -no-reboot -nographic -serial stdio -machine virt -cpu max,pauth-impdef=on [14:08:23] kasan: test: Can't run KASAN tests with KASAN disabled [14:08:23] # kasan: # failed to initialize (-1) [14:08:23] [FAILED] kasan [14:08:23] ============================================================ [14:08:23] Testing complete. Ran 1 tests: failed: 1 [14:08:24] Elapsed time: 12.374s total, 0.001s configuring, 11.937s building, 0.382s running Where the mentioned .kunitconfig has the following options set for KASan. CONFIG_KUNIT=y CONFIG_KUNIT_ALL_TESTS=n CONFIG_FTRACE=y CONFIG_STACK_TRACER=y CONFIG_KASAN=y CONFIG_KASAN_HW_TAGS=y CONFIG_KASAN_KUNIT_TEST=y With the MTE patch from my previous email, everything works just fine. Based on that, do you have a guess why it's working for you and why it isn't for me? > Regardless, this is: > Reviewed-by: David Gow Thanks! I'll be sending a non-RFC patch shortly. Many thanks, Paul