From patchwork Wed Nov 22 07:26:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13464162 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 0D6C2C072A2 for ; Wed, 22 Nov 2023 07:27:13 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.638459.994982 (Exim 4.92) (envelope-from ) id 1r5hdW-0006YZ-Rt; Wed, 22 Nov 2023 07:27:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 638459.994982; Wed, 22 Nov 2023 07:27:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5hdW-0006YS-P8; Wed, 22 Nov 2023 07:27:02 +0000 Received: by outflank-mailman (input) for mailman id 638459; Wed, 22 Nov 2023 07:27:01 +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 1r5hdU-0006Y6-Uf for xen-devel@lists.xenproject.org; Wed, 22 Nov 2023 07:27:01 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0619.outbound.protection.outlook.com [2a01:111:f400:fe1f::619]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 856657c8-8908-11ee-9b0e-b553b5be7939; Wed, 22 Nov 2023 08:26:58 +0100 (CET) Received: from DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) by AM9PR04MB7553.eurprd04.prod.outlook.com (2603:10a6:20b:2d5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.18; Wed, 22 Nov 2023 07:26:56 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44%3]) with mapi id 15.20.7025.019; Wed, 22 Nov 2023 07:26:55 +0000 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: 856657c8-8908-11ee-9b0e-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WUuYPJ03XiXAKCeiRU0MDcSZm2gAgpGopnyJxfy7pc8NWlmAKDN971E98bBXuMUl9pPI+6YmJtV8ewPyEGaN0/zDuz3hiCRwo6v5hsO6CPR4gGBId3B7imV+bj6pj7cj2/PCLSdBr7AAMymIRWTnm8/wklN2sxmMq3ufgwYn3SdA0H6jcHsPN4unSZ6ziFeoXgQSa0UHwtsuhQ2+AA116RghgJClcvlkrjZBJZRhksQ0ppFjZ7giMiXPH5guyLmJnMdrS80ke+JIdE2WWyEe2gSme+WSRevHPqvAvJQ+ZY1r078Mdz94EPeg4BqNFRHXmzEhpOvQiPy7DD5TCzj+ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OrRT2d6nhLuczwYoReeGVYFpUDdj/NqW5AyC00HBsBI=; b=iy0C/j7RGg3ub6Wq3VEJHDc3zWHYhDw/Sgof2gDRoeveljYAYae90RClgluGD2szRLSr+xf3xlw07SdNs9hrNTwOTQJHjin3B2VVwHagRB3YkkDnU22AnLCuU7NNr8TLcU+wxtwu0GcM+Do16TothcmUQSaIwLa+7N9CufnVReQlmh1VCT9JB/xFexmBd2fhihaV4wHIoZe1qLRFjpkWzmvH6X2KN1MlS56CKOS/e24Y4jM737lLUNIfWBIn3wUYo4UPKmyqnSxj+9R57egQ1yirxtams1tQPKei94ybt35m188tb3qwIIbfrykOjfy7+bvxm6vhILwE3C3zXC99Og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OrRT2d6nhLuczwYoReeGVYFpUDdj/NqW5AyC00HBsBI=; b=FQLDVYzP1su8Ql6X/GYbBCuHnWbfnqT3g5ifKGumASGYEPiydiVF50zhNSQHfFor3jzSdWYI7n/LqUVnE0o7Grs0wV6yigiXIzch1t/iAxYvcN/mW239rV9vlTDInNZFUrEmXQzkfsVk0BoYirxnI3Q+9oS2hAH8q90u912btYkWO6+VU1mVcqTCdc+IrNKfvP4DiQZCIlTRZPFyOl7/SAjDG7/txEjxsge8E2hrffgLGxhhtukBCLrFdLDp3gZBbp7V1Bk65FDG6gdEUEG0yvdjbNHlMnLptg/bbh6UhDJHFHAmq2TJq9tLonp3dZv2fwwuOFnpRluZz55JDa2YlA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Wed, 22 Nov 2023 08:26:54 +0100 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= From: Jan Beulich Subject: [PATCH] x86emul: deal with decode failure in predicates test Aut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XJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL X-ClientProxiedBy: FR3P281CA0096.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a1::8) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|AM9PR04MB7553:EE_ X-MS-Office365-Filtering-Correlation-Id: e3a53913-a2ee-497e-d2f0-08dbeb2c67e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k+U9sZlIucHCV0VGhDLbB75HU0YcgARzgpVs0ngsL9q+NtrcGYZQ6yalkRpVm2ikREi/fNcdGY+Xzex8QNwJ2YVmCmQkebjRyGbb0gYVtXfgvh8/fgAISHWg541jamVLyvEGusxDvEWSlVK4P6Us32iAyUxJp7hucDbfy2w6UxRHxRES7bGvWVc4vG3Z80BB5h4MPZZ16gDfCvTW0S4pMppX1FgPj4NfDUVA7AS52iF8xm/nJVjDObRqAxbu4ppqaaQ4rAZ1CucdU3HBb10vwdaMN4OQVQTymbihWvqQYwKXXWjBXOc4U+8qLGXY9heVNZnOybvWiRstLNdu/7bfFixIodo3i7o9v1DS2WJRTgnrfqjl+eoGPnSvBT+g/sg45MdqNNsP70ZUMGmRJ1BRazSF07PyR8XVHIOfJqWZYpFKi7iOe1EpxF/uo2ctfpsOwoc4ZM/6/dkkekB3oVVBZsR0MdxPdEsnt8kArNHVsFD4Zef7Sv9vpa0E0fUAf8XgOp4mCsJ0+IxzomFf7BlYdJBfr46OQReX2hbP5f0htL3AEaYYJmCRSdvkIMDT6GFcdRdzv/3cKhZEftmEwbdaSPVRr7DBhZuAMj+BXKYj4tGYh6CeCDLh65jW9EZFZH5rwTd4kSshYkSzmm9TAs+o3g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8790.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(136003)(396003)(346002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(54906003)(316002)(6916009)(66556008)(66946007)(6506007)(4326008)(8676002)(8936002)(6486002)(478600001)(6512007)(2906002)(4744005)(36756003)(41300700001)(38100700002)(31686004)(2616005)(26005)(86362001)(31696002)(66476007)(5660300002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?LBh0yk4zuWxEUa9Vv3OfdQ4abel+?= =?utf-8?q?Yb1LvlVQpBRvcOex/EzSG4Tz7uv5vRu5WOs2ngvgF3SzMpiHnzgtYd+UUSwaWToaC?= =?utf-8?q?lmzpa8ZvbYYE/sGclLGT1clMLsxvYKZVsksGyF8kQKFgFQUrhehxZTWXiB3+b/BqW?= =?utf-8?q?MhQEa8u2vDYpJ8r/ai6qVoI8TLY2a6S6iMigbV32L21piN1OWXDOB7VQaa5t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ihQOVf9He?= =?utf-8?q?4NhCorw8D5cBvsZv6AkP3hH5+gvOtpzYVlqxi9oZG7CGoWk8zqxP3+IUSh0DBzuWR?= =?utf-8?q?wn9zgHyB8p/2M3ct/V4a8z4uubPW+Nx6bVJlQAii3RknAV1tEjsoiM/FbJjmzEeIx?= =?utf-8?q?hZZF6JTkAqjjnoo2XKurEJ9aN6vHVpsgpp6TDhMNAUaIyNKLGnVNULpn6lT/C5dqx?= =?utf-8?q?2Y+G+w/GIYnBdRMus64jT/IIMlxZHwFTCi7l8hVMappDkNBTbh84e8/30pFCLDuPy?= =?utf-8?q?R45J1X3PFkK3t7Rrcm4P747Ewt3EskFabBLF6G5iBc1PPm7i/EgqpY75STgZlOKWF?= =?utf-8?q?VXWjcQGM2OfFw2AXxwTech+4NuF5ejtzL3uANx7lFxK+63FPpKovLYqPicVR3I+Po?= =?utf-8?q?wMR/CDwDwKul8h7A8iOTxj8OQebiOdZNaqwcZnQK2n2Xcy7oMI4XvITQovsvzJd2R?= =?utf-8?q?L34igZsLcjkU?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3a53913-a2ee-497e-d2f0-08dbeb2c67e6 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2023 07:26:55.8555 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: G3xmgb3aRsTFJv+67zLxhx5dOkNtBPUqEcMjpc5y8gUW+EbQlqjgldUVZ0ict+XvyoFAc/SBU3/7YR9PxR/LLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7553 Don't let this end in SEGV, due to the subsequent NULL deref. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- a/tools/tests/x86_emulator/predicates.c +++ b/tools/tests/x86_emulator/predicates.c @@ -2189,6 +2189,13 @@ void do_test(uint8_t *instr, unsigned in { s = x86_decode_insn(ctxt, fetch); + if ( !s ) + { + print_insn(instr, len); + printf(" failed to decode\n"); + return; + } + if ( x86_insn_length(s, ctxt) != len ) { print_insn(instr, len); @@ -2218,6 +2225,13 @@ void do_test(uint8_t *instr, unsigned in s = x86_decode_insn(ctxt, fetch); + if ( !s ) + { + print_insn(instr, len); + printf(" failed to decode\n"); + return; + } + if ( x86_insn_length(s, ctxt) != len ) { print_insn(instr, len);