From nobody Mon Feb 9 18:56:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1655461884; cv=none; d=zohomail.com; s=zohoarc; b=KUBOKeVOFiQe5Lo/T5HdhMtCixEiQCtkO7l62oGRzTcJ2QFiSrypIJFgHTNWEW46rfAFC8QNbG41gqKP+i2d5ZnLLrAKGRPzTo0ysnUnFCPMxvT58vfIra/Qq60RNWmOl5EipkLPSkTp2PAxBvyeXzCWXR6nKzTsju9tZQlM2mo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655461884; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=YulpAZhbVg6y+ee/fL/9bL7V1W2kdnst8Vz1P9ePPw0=; b=AVCjE5juIckbvKGY4mUVhkx+LLzlbuqJHGSJJzvr+iXsyqoQo4d/RSBYGmRTNV3wOvzWzPxSMLlo7ByQY9hM2oIphUW1n5Q3/J3SILocuZKGuP/QEJfjmnq1dkGj9To5AV+ZenixEGLj4yqRCQgWtCMe2cDih/Z32/f/3thPLH8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1655461884001160.15412791280744; Fri, 17 Jun 2022 03:31:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.351268.577856 (Exim 4.92) (envelope-from ) id 1o29FS-0003ah-IF; Fri, 17 Jun 2022 10:30:42 +0000 Received: by outflank-mailman (output) from mailman id 351268.577856; Fri, 17 Jun 2022 10:30:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o29FS-0003aa-F7; Fri, 17 Jun 2022 10:30:42 +0000 Received: by outflank-mailman (input) for mailman id 351268; Fri, 17 Jun 2022 10:30:41 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o29FR-0003aU-12 for xen-devel@lists.xenproject.org; Fri, 17 Jun 2022 10:30:41 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o29FQ-0000GD-Nm; Fri, 17 Jun 2022 10:30:40 +0000 Received: from 54-240-197-232.amazon.com ([54.240.197.232] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o29FQ-0003sg-DK; Fri, 17 Jun 2022 10:30:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:Cc:To:From; bh=YulpAZhbVg6y+ee/fL/9bL7V1W2kdnst8Vz1P9ePPw0=; b=yf+iJk yI71j1TcQ4ladswWyndbvQfuGP+BeLRZoU4udUHEybiof1cl2Fr/+byepGeDvJasr+2dCKEBnxxBu DPB6qIORYjKdpEdJFJiyXbOStaI0yFq+dN7RFbQlrGIzeveTqzSRllFMOKZj0kJQtXhSRv74V1xNH 5FsmH/+gdpQ=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, jgross@suse.com, oleksandr_tyshchenko@epam.com, linux-kernel@vger.kernel.org, Julien Grall Subject: [PATCH] x86/xen: Remove undefined behavior in setup_features() Date: Fri, 17 Jun 2022 11:30:37 +0100 Message-Id: <20220617103037.57828-1-julien@xen.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1655461886201100001 Content-Type: text/plain; charset="utf-8" From: Julien Grall 1 << 31 is undefined. So switch to 1U << 31. Fixes: 5ead97c84fa7 ("xen: Core Xen implementation") Signed-off-by: Julien Grall Reviewed-by: Juergen Gross --- This was actually caught because I wasn't able to boot Linux 5.18 and onwards when built with GCC 7.3 and UBSAN enabled. There was no message but instead an early crash because the instruction "cli was used too early. This issue has always been there but it only shows after Linux switched from C89 to C11. --- drivers/xen/features.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/features.c b/drivers/xen/features.c index 7b591443833c..87f1828d40d5 100644 --- a/drivers/xen/features.c +++ b/drivers/xen/features.c @@ -42,7 +42,7 @@ void xen_setup_features(void) if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0) break; for (j =3D 0; j < 32; j++) - xen_features[i * 32 + j] =3D !!(fi.submap & 1<