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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 8C76BC4332F for ; Thu, 14 Dec 2023 15:34:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.654651.1021802 (Exim 4.92) (envelope-from ) id 1rDnib-0007mY-6P; Thu, 14 Dec 2023 15:33:45 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 654651.1021802; Thu, 14 Dec 2023 15:33:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rDnib-0007mR-3h; Thu, 14 Dec 2023 15:33:45 +0000 Received: by outflank-mailman (input) for mailman id 654651; Thu, 14 Dec 2023 15:33:44 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rDnia-0007lZ-2K for xen-devel@lists.xenproject.org; Thu, 14 Dec 2023 15:33:44 +0000 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [2a00:1450:4864:20::632]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 28f82abb-9a96-11ee-9b0f-b553b5be7939; Thu, 14 Dec 2023 16:33:42 +0100 (CET) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a1c7b20f895so956699066b.2 for ; Thu, 14 Dec 2023 07:33:42 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id qo14-20020a170907874e00b00a1f6737be65sm9265180ejc.82.2023.12.14.07.33.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Dec 2023 07:33:41 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 28f82abb-9a96-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1702568022; x=1703172822; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=PaiBT7+fp6FlmEVHn3Lwy3NhSgvZTPm/0hnA0Wc4po4=; b=csE4QHwEo86Isq5+HfU1yXOeCRDrKEmgGyJT88Gk4rHniF4CprGKnEGmTcA66CrV4r bgnXB3GbvKLS8U8BqSM9n4VLWGDhVprMww63NPphnhGOROUMPIYX6y4NdLcbvhxMInZv p06IKVqltiu77e+MNF33hW4230ObxRUiRhn0dCD6t4UKh9J6IGFXvdXvWoHU6bQIkWlY meKZ1bRJyYD5lny9NTj1U8JDyOitmiaIwyWTcOTIOKqWIFzE4G06X2BTu3GqmNmBh/+P 2+CIOJxByqNYABTn4SN6tyqnyc2X7dOZLECkd96enogP3O4Do1V6TwbnS6IJOlGopbe4 pSgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702568022; x=1703172822; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PaiBT7+fp6FlmEVHn3Lwy3NhSgvZTPm/0hnA0Wc4po4=; b=Q5KAkYDFoKyrG04oQf8L77t+FliRuZUuQJ3/kkeYpx+droHCaBKA0xb/AOYKVIuzr5 JvbNH7gbUayhItLe0TBGdcdjQoBWNIdiRdzCGNUhiwv9wBp3taA6brc+KvvHH73yPPpg ni2ycAg33Ojt2hOQaMZz/iVYATp7OwdOQE8ZWAyNFZSIXvKhC7xsLuOA2rWYNHRMLBZt 4W996WwWqPRNjJB4NYsRGPPZdqc0QYX4fC4DIz1qP2HQ2pLSZ1GwJLMrWGdLXw2mj06A 48R4e3MdYWJ9wn3Q6JYXaj15pg8H+ZsFTtNc24gUTGxrQK8LRKkVzVTuAI9nnM1YhApv bnyA== X-Gm-Message-State: AOJu0YzEZxP8qUmDZqMfaDw/C6KiEYrFDYLibISuUuNWTcKtFQAqwHRu 24vZGH5neuyATxeJ97rUPROi X-Google-Smtp-Source: AGHT+IEA2ZB8oCmS0UyPuXtT9LtMJgx4A5LGRfb0bMuZ3idSbPrNcTmxUJuMqvs8/z4al8h2hyfKXA== X-Received: by 2002:a17:907:868d:b0:a19:a1ba:8ccb with SMTP id qa13-20020a170907868d00b00a19a1ba8ccbmr5424992ejc.105.1702568021765; Thu, 14 Dec 2023 07:33:41 -0800 (PST) Message-ID: <414cc532-727c-478e-a565-1f2d6510ffee@suse.com> Date: Thu, 14 Dec 2023 16:33:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/4] xen/x86: introduce self modifying code test Content-Language: en-US To: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Cc: Wei Liu , Anthony PERARD , Juergen Gross , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , xen-devel@lists.xenproject.org References: <20231214101719.18770-1-roger.pau@citrix.com> <20231214101719.18770-3-roger.pau@citrix.com> <6226aa5e-c87f-48bf-b793-96aa04498c5e@suse.com> <31cb367f-1a20-4ced-8f6f-aeab69f7c4fb@suse.com> From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/B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FVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 14.12.2023 16:28, Roger Pau Monné wrote: > On Thu, Dec 14, 2023 at 02:57:11PM +0100, Jan Beulich wrote: >> On 14.12.2023 14:47, Roger Pau Monné wrote: >>> On Thu, Dec 14, 2023 at 12:55:22PM +0100, Jan Beulich wrote: >>>> On 14.12.2023 11:17, Roger Pau Monne wrote: >>>>> --- a/xen/arch/x86/setup.c >>>>> +++ b/xen/arch/x86/setup.c >>>>> @@ -58,6 +58,7 @@ >>>>> #include >>>>> #include >>>>> #include >>>>> +#include >>>>> >>>>> /* opt_nosmp: If true, secondary processors are ignored. */ >>>>> static bool __initdata opt_nosmp; >>>>> @@ -1951,6 +1952,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p) >>>>> >>>>> alternative_branches(); >>>>> >>>>> + test_smoc(XEN_SYSCTL_TEST_SMOC_ALL, NULL); >>>> >>>> I realize I'm at risk of causing scope creep, but I'd still like to at >>>> least ask: As further self-tests are added, we likely don't want to >>>> alter __start_xen() every time. Should there perhaps better be a wrapper >>>> (going forward: multiple ones, depending on the time tests want invoking), >>>> together with a Kconfig control to allow suppressing all of these tests in >>>> at least release builds? >>> >>> Right now I only had in mind that livepatch related tests won't be >>> executed as part of the call in __start_xen(), but all the other ones >>> would, and hence wasn't expecting the code to change from the form in >>> the next patch. >> >> Well, I was thinking of there more stuff appearing in test/, not self- >> modifying-code related, and hence needing further test_*() alongside. >> test_smoc(). > > Oh, I see. I think it might be best to introduce such wrapper when we > have at least 2 different self tests? Otherwise it would be weird IMO > to have another function (ie: execute_self_tests()?) that's just a > wrapper around test_smoc(). That's precisely why I said "risk of causing scope creep, but I'd still like to at least ask". I'm okay-ish, as long as it's clear that this way more code churn may happen down the road. Same ... >>>>> --- a/xen/common/kernel.c >>>>> +++ b/xen/common/kernel.c >>>>> @@ -386,13 +386,14 @@ char *print_tainted(char *str) >>>>> { >>>>> if ( tainted ) >>>>> { >>>>> - snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c%c%c", >>>>> + snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c%c%c%c", >>>>> tainted & TAINT_MACHINE_INSECURE ? 'I' : ' ', >>>>> tainted & TAINT_MACHINE_CHECK ? 'M' : ' ', >>>>> tainted & TAINT_SYNC_CONSOLE ? 'C' : ' ', >>>>> tainted & TAINT_ERROR_INJECT ? 'E' : ' ', >>>>> tainted & TAINT_HVM_FEP ? 'H' : ' ', >>>>> - tainted & TAINT_CPU_OUT_OF_SPEC ? 'S' : ' '); >>>>> + tainted & TAINT_CPU_OUT_OF_SPEC ? 'S' : ' ', >>>>> + tainted & TAINT_ERROR_SMOC ? 'A' : ' '); >>>> >>>> How well is this going to scale as other selftests are added? IOW should >>>> this taint really be self-modifying-code-specific? >>> >>> I'm afraid I'm not sure I'm following. Would you instead like to make >>> the taint per-test selectable? >> >> The other way around actually: Taint generally for failed selftests, >> not just for the self-modifying-code one (which ends up being the only >> one right now). > > So the suggestion would be to use TAINT_ERROR_SELFTEST instead of > TAINT_ERROR_SMOC? I can do that, but it might also be more > appropriate when there are more self tests. ... here - of course we can also rename later. Jan