From patchwork Tue Mar 2 09:03:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12111247 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=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham 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 CBC09C433E6 for ; Tue, 2 Mar 2021 09:06:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 32C0A6146D for ; Tue, 2 Mar 2021 09:06:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32C0A6146D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lH0zE-0000hk-2T for qemu-devel@archiver.kernel.org; Tue, 02 Mar 2021 04:06:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:32790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lH0wZ-0006vT-Pu for qemu-devel@nongnu.org; Tue, 02 Mar 2021 04:03:51 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:57474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lH0wY-0007GG-0a for qemu-devel@nongnu.org; Tue, 02 Mar 2021 04:03:51 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1228xh1X104771; Tue, 2 Mar 2021 09:03:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=E5gWsRRi4hJJ1K33+RTqX6vbF34BL22NtXlwsD69b4Q=; b=uR6QhADz1fEizsDOVIBXEDekkI3fE1dPfNKPB+MJ2UA8zjh/Zikw5BSewhoBJLzhmsYj ZFUBRnWgAEaxER2hNuGnD29h9uTXFT6ZAdRMnAqHdiWHM41yBw0XNumqRPNubzQ0T2k8 0dnvFE5oQ/FfsXWkMPsfYBSPqjqnr0jnI/alpJTJGn8hZZ0K/F4QcdJFiJBONSARcNqS lgnFspKkFuTyjCLUgMrVQY+B1YAeqTt4n/6j1EPcLfF/AiAx7+IO36KW9gxAFP57wfc0 ZkdvtROqnoJM9HVXUkKhJzOoVJw2bpYALLFOEwO2x38NiRKpLIdeQ/Bl5ouyoii0R7Fj oQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 371hhc05en-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Mar 2021 09:03:26 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12290wIs007521; Tue, 2 Mar 2021 09:03:25 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2043.outbound.protection.outlook.com [104.47.66.43]) by userp3030.oracle.com with ESMTP id 37000wpt4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Mar 2021 09:03:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NiymEC4Us/kKc+3i/aTOdumJD+l+wfHiB609ilC3dq5TX3+2EMrOdJP8RBlIN7hHU1JOImSfIAz+JfI7BV+XsxuNEKcpMzVc11/qJLLQSpZOb4vtByaafV1bgBMfai+A4Bs1BlJYsbLVbHTdHjSBN4JpuHXz5aiusk7uAyAflA8f+FLjx4a8twHMtqCaEBLgoSCUBYyjba7BDlYvRkeoLKM4msZotD4H+UU6uqKXQ/QZ6/cxRsiwKmVk6TIGzQYNapowx/Rv7jIx+QeYkEILIB/872XqRmyYDnI+aIGQNSFhLTrY3cD1ImDWFOFet20YYCACNCgSjAwtTioiJqmOwQ== 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-SenderADCheck; bh=E5gWsRRi4hJJ1K33+RTqX6vbF34BL22NtXlwsD69b4Q=; b=QpbE2IiAYNkplZoRiaWazH6zf/sUfRBUDUPPCHa0k7lYp4DyNm2135Vpw3ZyVYmnKkkMe0K1z+Hi2WgxI1Y7aHAk71jS6pvRNzfQV1qnwV7Z9XVaJ1Do0YxKBDzOHdJ6R6mnUbRUgnRwOY14627hsDR2SlsgHiXU9bUfRdsy4jS/ficiovPfz7F9JE+wjy6jS1XFATHrjYd/FTQ0xN7tFGFZM91qLobdq+PZ067bKqkJUGbv0Lu9pSebeyxTHAV75eVP4qeKvTzUTFJrDp3/RAph5Kluxb21JO7Z9k9C/6uve/KgJytCtjls5w0MvtSsVpaIho0n3745IYbTX8aiYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E5gWsRRi4hJJ1K33+RTqX6vbF34BL22NtXlwsD69b4Q=; b=ALaJ75E2xHx3jVnxrp3ek64U7cxnpX8tTwoMV1OV9q014IPwGlCKW5U6vVAxMZdr//1n3sL5vqc3NbebCgAJxFGQy//PBZYj78RgHgdvRC82iNWwpS+cSTn+NSWf95NEtw/U7EQ2PD1vboQolpqpvCmGbcC7pxf5GLoKoM4zqzU= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) by DM6PR10MB4396.namprd10.prod.outlook.com (2603:10b6:5:21e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.23; Tue, 2 Mar 2021 09:03:23 +0000 Received: from DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::f871:5965:2081:3934]) by DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::f871:5965:2081:3934%5]) with mapi id 15.20.3890.029; Tue, 2 Mar 2021 09:03:23 +0000 From: David Edmondson To: qemu-devel@nongnu.org Subject: [PATCH 1/2] elf_ops: correct loading of 32 bit PVH kernel Date: Tue, 2 Mar 2021 09:03:14 +0000 Message-Id: <20210302090315.3031492-2-david.edmondson@oracle.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210302090315.3031492-1-david.edmondson@oracle.com> References: <20210302090315.3031492-1-david.edmondson@oracle.com> X-Originating-IP: [2001:8b0:bb71:7140:64::1] X-ClientProxiedBy: LO2P265CA0159.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::27) To DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from disaster-area.hh.sledj.net (2001:8b0:bb71:7140:64::1) by LO2P265CA0159.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20 via Frontend Transport; Tue, 2 Mar 2021 09:03:22 +0000 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 63051dbd; Tue, 2 Mar 2021 09:03:16 +0000 (UTC) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 880afb92-1765-4190-1a3e-08d8dd5a0898 X-MS-TrafficTypeDiagnostic: DM6PR10MB4396: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iAM+14xc0tXFpzYtsIZ6bH1oALelIQ2zDIDejH25DydjjKoNHBDDCXJ/V1bRBvbZ/CTIOcvMYefqys/qgNjx9G5uz7MSMDPEKATvD7Gcx3iHZdaXr5ElF0eCdVAFaILKLK5TNIIw8+49nKDGFsrlf+1Vu/nlW+Gr1ABQO0f+k3mvNQr7qwpkPaC0MyLAWBWpjQ7lge4a9WO5WginsgfC+ubvVk5P5RCtvu1abD4UHnK2L2UPpEYcX5GylE7cgaKffHBsSuf6YeCxopFv1Vy8MHNx8n1BbsirQd18MMlI4D3DlC1Hv8DKzjp/vw1GlJCDMAkR78F2DKc5M8OGgdrUtKr2llr+daBALy9N/3bsRIhB16aCfVR9TuOA3TmlzUTTV22BiST4yIA5p9QKqPfN+aKWrefyAznRdlTVGoIUTvO/ubobJVFe5PvTe5B6LksmB0zuUEyqoejDuxPwcje+aQbF56IDqvWSmxlHjxZj6+nyq3dVIqUmRHOJNmkyaZdXt+4uE0JEKLc4nR78+KOV9A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3148.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(346002)(376002)(136003)(39860400002)(396003)(6916009)(44832011)(66556008)(2906002)(4326008)(5660300002)(66476007)(52116002)(66946007)(83380400001)(2616005)(36756003)(107886003)(8936002)(8676002)(478600001)(186003)(1076003)(54906003)(86362001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: aUOmDyzycXD4CKQgi3+is9RJncnXDGOzWVjONi3l2VQc1x31/WILSaG+KZcG2hj/ePd0ln53n6deXLKfhhqVpdwBn9gvHCglHbIHxInIEfDxT0QT1jimzdPUHMqxD3xSNpLwGlsd1rHH9KRGmVwbHDZc5GRc9do5dkC8tEAmpARMLncpscs2LxNNJ2TwTl8BhY5/3D+njZXJ4BX1zOFW832WIAab3BAMrqIQAQhUAFHwN/HEW7pD/ARy1bRQKyvOU1o9PjvEjJ1+Js4iF4uintqasrCvcqBEF5nkyUa/Othx1CKHp2ZudpK4Y3/MAab6u22EtkOs/tVzdFXYgsIAIzLrgrHSk3eAX3YnhmoSdZvAAphOOl3f0R5BfYp4piAaqVnMPyKjqEnDh+8GnbCRnC3L1tjgP3wIFdYBPdCaAOYxMVG+a2Um0uL/S57DLLNe+FJ0gUHLCRJG3+XV6JIuk2s6x0gtGmwn3Y5IhmVKuM9GtGQFU6ndgB6yY2sIPmmGYAsrnSu1QsIbiXvRS2MM/wHbHzyXQXANnuwUL29HqQGFeUdLqO1j0/O6JhvaDHoL84A4KsiitRNnoYO4WuTU+gUdofTG0+BIjdt8uJRreMhfYq4FJsRWbck4i+116D8jC6Wou0EGe6svHqGqTC1hL9Zw6spEVCRPlpdN9hmooi3tcHbRM+Ie4fuesB2F+ic+Zffh1snbliEfe+9dS07lS87XPDTpVwpqtr207UPtjodFZwqRO7Hqkbz3UUGZQkme2KinYxePCzGauWXFUuw/bq8k/2k44Ag9MU59NlAEkFjRdcbS+xY1iBNEem/AEYkYhJGONMmwWWh0lMlaf7PISiIbJ8JM/kU8mv5ExSNMT8MlezovPAjQJVXNtPGdXha3irljP1fDmThBm+OFtpnCxCIHVdS58gZ9FdenfRDxn1sMF/+XFKAnWempMQEcadL8xSAdsKPR46ETlTGLwv0sUxzQsKA99J3iLDMTYuf3c8a3Qy/UWje/RKIhcbSBFVudB76ZfVkolQcfy9kmgWl9wbTArszPghYPjEojwpDuuHbpZMuoHvNL6MszNIPHVwSMHgiZG6ScGNcc6uKGUCccP2jBgS7v7Hv69jbBCp1oU5ts8nmgUwqoYhHBtJFViieAl9eIE+2V0MLrT36n0m7BG8o4XlPdQhetEmhKkANyw577DZa8DNp7f98AE8L9lgUoeiTkWWwHxgJze6UFk30jr0AdQuVQzO1mOIMZgr/z6n1h3C7EzVfZJhoUI5M6tRS982lGRb2DqkMzk4hxGHaSTh+V86HBbBX0KkzI3vEHMlYM9ZRYnI8p/UG2L7vm5HTCzrzu70YKqnViGGl+TIjkKg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 880afb92-1765-4190-1a3e-08d8dd5a0898 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3148.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2021 09:03:23.5925 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: swiYjuPutrQhFGeGRNdhB9clr9+U8QdKwv/9I18s9iQ70yZ0XTxTgc0tOcGb0tuxkf53qG1AzzFoXdRkt8TUaLqpPNakEPQ8ENCsWiuWAHI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4396 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9910 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103020075 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9910 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 malwarescore=0 mlxlogscore=999 spamscore=0 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103020075 Received-SPF: pass client-ip=156.151.31.86; envelope-from=david.edmondson@oracle.com; helo=userp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , Richard Henderson , David Edmondson , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Because sizeof(struct elf64_note) == sizeof(struct elf32_note), attempting to use the size of the currently defined struct elf_note as a discriminator for whether the object being loaded is 64 bit in load_elf() fails. Instead, take advantage of the existing glue parameter SZ, which is defined as 32 or 64 in the respective variants of load_elf(). Fixes: 696aa04c84c6 ("elf-ops.h: Add get_elf_note_type()") Signed-off-by: David Edmondson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefano Garzarella Reviewed-by: Alex Bennée --- include/hw/elf_ops.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h index 8e8436831d..78409ab34a 100644 --- a/include/hw/elf_ops.h +++ b/include/hw/elf_ops.h @@ -598,9 +598,7 @@ static int glue(load_elf, SZ)(const char *name, int fd, nhdr = glue(get_elf_note_type, SZ)(nhdr, file_size, ph->p_align, *(uint64_t *)translate_opaque); if (nhdr != NULL) { - bool is64 = - sizeof(struct elf_note) == sizeof(struct elf64_note); - elf_note_fn((void *)nhdr, (void *)&ph->p_align, is64); + elf_note_fn((void *)nhdr, (void *)&ph->p_align, SZ == 64); } data = NULL; } From patchwork Tue Mar 2 09:03:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12111245 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=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham 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 68F75C433E6 for ; Tue, 2 Mar 2021 09:06:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 C927164F19 for ; Tue, 2 Mar 2021 09:06:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C927164F19 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:32986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lH0yl-0008Cu-Im for qemu-devel@archiver.kernel.org; Tue, 02 Mar 2021 04:06:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lH0wL-0006fH-2n for qemu-devel@nongnu.org; Tue, 02 Mar 2021 04:03:37 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:57482) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lH0wF-0007Gt-QD for qemu-devel@nongnu.org; Tue, 02 Mar 2021 04:03:36 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1228xcYc104709; Tue, 2 Mar 2021 09:03:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=AlXIK9APKU/syzIjh8bSVrYyPkdedAfZWamMWxD5N+c=; b=swg0f/Uc6tlpDZHIXjKWLA7ImzOiPdRY4Dr5RcQL7ooBtrjSRw2n+Jw/MxMLCiWSmQJ8 /LJBkoDgWDfU5mSpr26WscePJvujnNTWk6+Bz1hpBLNkgLXEzRKBhR3xOk9FUyXhubZy zEQWUyXtpQUOUOMRDLiqTmlWGmLmK1St+52E7Pof0Ao0aNalyCPazL3j4ZRUqFJNvnUt /Tcl78JV12Y0VuccEZuYzc34IQupZSOT858hKOMtlFt2jUG2V2/XXgLbfHcFE2L8GBvD hDK0+BW2XCImuYUROx3J8KV9hrGFg0nGrA3sZDT7/sHyu7disZvWZje8nBD8g52z7PY0 Ow== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 371hhc05eq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Mar 2021 09:03:26 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12290wIu007521; Tue, 2 Mar 2021 09:03:26 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2043.outbound.protection.outlook.com [104.47.66.43]) by userp3030.oracle.com with ESMTP id 37000wpt4s-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Mar 2021 09:03:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YFhS8QO05o0zG0h7cT/UwAdVGBnj8MykTkM+ABWqCwc3eNpFNy43qFhli5ks2qdv/LNlGY+1S+Yldpf59Ii4rdoI78Cynr+diMrHF/tdPlMu2VhcW365DikxiyWsLShT4jACvp7NJdYoBE2demdaS+YzmH8/+maFtQEj1sIFfnM7Vw9DokC+U6w3VP7BygXqTCZm08JKqE39j5FYKW/fDdhJKdQ82qPKIUzbKFsO/7O3/l6xdOmhmeLkiRCpno9738OYrCnVF94obzOm1yyUildeZUrChS/WfVYfV0l54ctO8r8j3acsWYt2D3CQV2PaZKjcs2ZcWWSN5rdjz5V1jg== 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-SenderADCheck; bh=AlXIK9APKU/syzIjh8bSVrYyPkdedAfZWamMWxD5N+c=; b=dthen9s1d92S5kHnoFdPS1QdSVWeY1P9obzONAHfPhcgaCoQTUYgT6nUSY0I9F6R4OuK1t8UDpwhGjuq5WSMRth7EUmGy8/aflctXypnWtNB/HKf4xPp9x0BeuEynjG5tOikSkafyt6WM5VCnJVyrKK5f+zW7DVtoT8Po7Pa9C4+d01HA+67RldO80kHbCdLkhxXN8blAGC2vS5hsMUeg+zxUUfuTf1QRhZAhixO2eQZknuepqEKl9kxnins6FjwRQ8ft3e9I0tD51kXZw3cz4cwVLVsn1S6WbE/vOFl39WQ/G9UzvpXwOoowf6Z+ymAsS67vx8Wgm5n7DrTaFdCVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AlXIK9APKU/syzIjh8bSVrYyPkdedAfZWamMWxD5N+c=; b=oiwIyhXb7h9/CszrvRsxvH/Mj0ZXvrpTnIq+fe3i4rbd8g/JA7guRWBUnTBWQ01XX0gVjVyQbiJZ/fPgd5SsMDmID+My2pm/R3BUtEI4biiQfAP7JCN75mHfYN4pwSMYaQO7H9OZWuI7DaE36GXrlqDpJNcGH+/kPoVHMFppWgc= Authentication-Results: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=oracle.com; Received: from DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) by DM6PR10MB4396.namprd10.prod.outlook.com (2603:10b6:5:21e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.23; Tue, 2 Mar 2021 09:03:24 +0000 Received: from DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::f871:5965:2081:3934]) by DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::f871:5965:2081:3934%5]) with mapi id 15.20.3890.029; Tue, 2 Mar 2021 09:03:24 +0000 From: David Edmondson To: qemu-devel@nongnu.org Subject: [PATCH 2/2] x86/pvh: extract only 4 bytes of start address for 32 bit kernels Date: Tue, 2 Mar 2021 09:03:15 +0000 Message-Id: <20210302090315.3031492-3-david.edmondson@oracle.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210302090315.3031492-1-david.edmondson@oracle.com> References: <20210302090315.3031492-1-david.edmondson@oracle.com> X-Originating-IP: [2001:8b0:bb71:7140:64::1] X-ClientProxiedBy: LO2P265CA0392.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::20) To DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from disaster-area.hh.sledj.net (2001:8b0:bb71:7140:64::1) by LO2P265CA0392.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.25 via Frontend Transport; Tue, 2 Mar 2021 09:03:22 +0000 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 1d74e9c9; Tue, 2 Mar 2021 09:03:16 +0000 (UTC) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 68db5130-9395-413c-87ad-08d8dd5a08c7 X-MS-TrafficTypeDiagnostic: DM6PR10MB4396: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:462; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6OoOxqQjGppQYDOO5h3UPPdYFyW6TEGkpMsoirVVi/MIdld/XAIZt681RLqfWHICXYhHLsgfXFOV0zKNtipOqlwbqely5+gCFr+jvHl7Fvut8RR0izllkEV6kF2QtkPaPjHo1/XaF9cpN6IR7EEIETCTCihPfR3eVl3bSq3AsXeTGNiKteYlaOmqX/nzIEyu+QEdrC1ZAQhe3gaU9DWtwyP68JOWkZLZriCaoFcB1dMrQz5YqjNAJ3H9tvaTIXufJJUiBSFrxrCOHx6IdRaBwQJUbU0qmUZ3qGCJxG7sHEgm/38bnk3LrPHX2o6PmuWqrIQA5lsFSEU1y8lhp7JHrfe4EL4qwTZMYokYk9sol/wP/Ia82DdL0JnZVgWdz4Oh6Qh0FtS8/pK1AGam5wDdEULOy1GszP6D4ae6jLeenJxiXXdohBIwCY+x93CazusZ9oSu/x1pdIdTmK/usRnfr+yk4CBmqYmTgzlSo/Aei+49ont/sdEpVsCob56O5UV0JDPGgPKAfX0VZqhYbuk/+Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3148.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(346002)(376002)(136003)(39860400002)(396003)(6916009)(44832011)(66556008)(2906002)(4326008)(5660300002)(66476007)(52116002)(66946007)(83380400001)(2616005)(36756003)(107886003)(8936002)(8676002)(478600001)(186003)(1076003)(54906003)(86362001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OjjbbC3s2QG8JksVab+dmzdlTg8ioFyc54dDPYXuTSRKu1CHmYitbFDS5faC78AqyD0/YgO8aLO8fjXuJur3wc51zuZHfagn21slxtsV8H52H/25veC7Ay8R5lPeWzac8NnfPxcn9znW4cJG5lrOHd3W5vbOMtWvTm38OH0s6eVKqNI4/MJ+7Y4O4McEiyX/zPcAd/yKBL1WkeWVwdnbbGo1YDPlXLw8Zm3f63h3dBMvdtrIxB+OOxZ8I2ZLNaeiwMaXIi+qZe8E+nbh5xWuYlIZ10o3Ni38Q98zEr0fWi01CngE1CYM2PHxavuispHTAZtekyh0NEeLmzwEG9QIgpOYLGPIXOZQBg9/F3NfbPiXb2dfCsctnNK8eCgr+HjMBULgO7wze9gJTb+GEhPeeK0ZsYoLdL6RtQg/swYRtDuYDTZt0EGa4xgTZYqajS4WCW32ee0oO+P3poJgmGR9JpCGWllduLFNQUVQlrU0/NEREHHE658rjCs94cDV4vviQkvj4pAkVF6kXwqg94j17xhYxmjRIJl7/pFR2Bzpn2z2iRYfAE8cFLGkyuDVJdQDUYn1VKg8XCCjwJhvVpHTQ0Raxku4m7RmBzVpAGdIn6kiyPjwtkZaY/SpD2cqHyOQ/cljQ2qBMyRIS2xXOchldKf2LWvxAqdcKadyrVb30SFiGf4VcbSLyA8FYu/qKmZcTlft3tf7bYdNyuZf28JfFHGg5O6y8aIvxtof4Ji+BBAgw2A2ULnDFk8nEmI7nhSD77DGEXq+27ctY/5c8DSj63Sy+JqnKcw3Qovmz2EAc9p2R4805rmWH2zOZeQXe8wwOgf14NeR7TjFLDEgo8eGBfCEM1XJAvQjgr3RCISL8F12LTWU/iB7hCxmc/qRJK9LVrtiTti2V42piLbgUTSuzOwuva3hTqldGyLN0AtyyW3DMogAKoNMCS3Gxw2GbKw9CUp/DWr0d/HG4gcnS20QS391oZ4ECs0+x7fuGlKDfT0e3wzCGKe/EEApsMJbUBptLmbwsugMQwrHE2ue9DrSefDEP++2EhCuW8ERB4JU64beGvWi0quBjUBUsqGKSuK3UNROWZxPC7124SScdsR/YCmhf2qDwApBGrVTDDz0Ql0iMxfDPjqiUMp6xZkvz1DA3+t0T6h/fLIB2V6WX3ii4vGHD/mPoikhBSXM5zd7bWEsgti0hCuEwdMNa0MPr4Ah0NlkVTHUMR0a2jLQcQnsfEfOjGvGJqtdUU4yomtB2yXApBem9k/VKSMxrEA9aqMFfG3SNPkJ+qfan3vpJkT+/4hhujqqZPbP4KcMCFVB/UwohAyBkVVD6XNdwQeXRSIizPMsCjxGIYmh/2HGRj0uyw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68db5130-9395-413c-87ad-08d8dd5a08c7 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3148.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2021 09:03:23.9283 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VLtlv0wHBAPzr7AU1T9pphncOQfjnChJ18SL3fwna0QgEzyh6KKyhwsWhu9rKRa75RmykqGHJimNjQQpAS4C6QoPkFf1iMGWJQl1cf07zSE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4396 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9910 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103020075 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9910 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 malwarescore=0 mlxlogscore=999 spamscore=0 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103020075 Received-SPF: pass client-ip=156.151.31.86; envelope-from=david.edmondson@oracle.com; helo=userp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , Richard Henderson , David Edmondson , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" When loading the PVH start address from a 32 bit ELF note, extract only the appropriate number of bytes. Fixes: ab969087da65 ("pvh: Boot uncompressed kernel using direct boot ABI") Signed-off-by: David Edmondson Reviewed-by: Stefano Garzarella --- hw/i386/x86.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 6329f90ef9..7865660e2c 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -690,6 +690,8 @@ static uint64_t read_pvh_start_addr(void *arg1, void *arg2, bool is64) elf_note_data_addr = ((void *)nhdr64) + nhdr_size64 + QEMU_ALIGN_UP(nhdr_namesz, phdr_align); + + pvh_start_addr = *elf_note_data_addr; } else { struct elf32_note *nhdr32 = (struct elf32_note *)arg1; uint32_t nhdr_size32 = sizeof(struct elf32_note); @@ -699,9 +701,9 @@ static uint64_t read_pvh_start_addr(void *arg1, void *arg2, bool is64) elf_note_data_addr = ((void *)nhdr32) + nhdr_size32 + QEMU_ALIGN_UP(nhdr_namesz, phdr_align); - } - pvh_start_addr = *elf_note_data_addr; + pvh_start_addr = *(uint32_t *)elf_note_data_addr; + } return pvh_start_addr; }