From nobody Tue Feb 10 01:00:08 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615028593; cv=none; d=zohomail.com; s=zohoarc; b=UjW8Uxx+IfUS1C0s00oDoSt/KznEUZtdicqDI+y9rXo5fdGa/pd+QG2YhL6ZY5jAK/qQkLihf4RICZtOwhC3zn6pyKwY9dovDRKDzXNMQtQmwzsxAp290U11EIvKUJGDqVvPfHmP+VVmz1SAFDTtIDyn32leedQfSTAWIGlwdlM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615028593; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EW+RazKmnfzV3iFKv1E/1XtA1W8hxsl/EMoQcnNU61o=; b=lvJZlowkwTc7sDooXOjUZqQpF9srqGCl5Q1yAhq0fcxVZ9Vy7RmFqgF6PMHj/QDYM7CX2kYePt3+d15U89NXOZfLs6A5/nOQTIVz8sMa6sBwCIifYAFHS+J5ftExubYLyWN4zuSyis2tnt6ha0OHOCdXF60R25ooH+BSbHsIB/8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615028593635398.0578947694481; Sat, 6 Mar 2021 03:03:13 -0800 (PST) Received: from localhost ([::1]:35678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIUiG-000196-Df for importer@patchew.org; Sat, 06 Mar 2021 06:03:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIUZs-0005tp-HL for qemu-devel@nongnu.org; Sat, 06 Mar 2021 05:54:32 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:40001) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIUZr-00088D-2X for qemu-devel@nongnu.org; Sat, 06 Mar 2021 05:54:32 -0500 Received: by mail-wr1-x434.google.com with SMTP id l11so1808961wrp.7 for ; Sat, 06 Mar 2021 02:54:30 -0800 (PST) Received: from avogadro.redhat.com ([93.56.170.5]) by smtp.gmail.com with ESMTPSA id i26sm9326472wmb.18.2021.03.06.02.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 02:54:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EW+RazKmnfzV3iFKv1E/1XtA1W8hxsl/EMoQcnNU61o=; b=gN2tJF5Z2uVdSrzhhORbAVxyS+T87fLG79E4z998KIqAfOz8vTDLHhQCQ0yBnuCs09 SI7zEX90ju6Z4TYPfyLXKBd0VbR3XxHSeK1gsfQVypLYYZ/tNelyrzjghLM/NrphaRw5 k9FOrSaZtamPpSEghzI7dT1B/L5DSFwe+zQxspuaT6wA5kiNAncr68x6VsKolEnD1nVl FKVF1JDNOZptaCNtnx+nMN8xTgB4diTFxcHDzcRXqOpnkRgTM/41UigaFPIe9zxgzXlZ yY3ZdAs8cCZi9waeKYbISIVfGt+bFhGqikFjNIT7Ft1sGg/fhYeu5PS21KjdFuLQmlkD 6Dqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=EW+RazKmnfzV3iFKv1E/1XtA1W8hxsl/EMoQcnNU61o=; b=Y8/MimhetxNIzN+cYo7ZC3f8VdsRNUypYSe9HkBg9Ia8Bo9+0iRxG0Zs4MRv6wYDV4 +FWVoO1i9ysRbtQ8lfrxvYtKsO+FqD5yGI5rYk4strbcPqRZzDGldftRTE+mQbrXFnFw UaVO3884785B0e5d+Ca2W12X2lG1r3ouE7N+EQk7Rw4Ggj9VoY8RySExzdphqktjqHki PN/M44R3Gs7phNPEO3uE9GI+FBBC6G4n0OFi1H3NTB/9I59Y8Zmnxx8laSx5uU6HRowD FcbOG66NS3MGFtDcciWHHfHM2v9rjSo9zAapCjhb2KAkQ5dfRkzgYq/MNvUeE1QQ84Uv Iwnw== X-Gm-Message-State: AOAM530bpe9AwkdBpfovXpEHI1k9XfRtARd4tGc603F82HawDtBcBqy3 c2tIOCaH2BOGdZpnfI2DFF9eep2DkVQ= X-Google-Smtp-Source: ABdhPJzW6engqE3cQ5Gl8gWdXKgG4YHg+OexuY7hTYh4BW2oxQNn3grqtQafjmiIeLT6V2cKRfdFhQ== X-Received: by 2002:adf:f905:: with SMTP id b5mr13141765wrr.129.1615028069872; Sat, 06 Mar 2021 02:54:29 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 10/23] elf_ops: correct loading of 32 bit PVH kernel Date: Sat, 6 Mar 2021 11:54:06 +0100 Message-Id: <20210306105419.110503-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210306105419.110503-1-pbonzini@redhat.com> References: <20210306105419.110503-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: David Edmondson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: David Edmondson Because sizeof(struct elf64_note) =3D=3D 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=C3=A9 Reviewed-by: Stefano Garzarella Message-Id: <20210302090315.3031492-2-david.edmondson@oracle.com> Signed-off-by: Paolo Bonzini --- 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 =3D glue(get_elf_note_type, SZ)(nhdr, file_size, ph->p_al= ign, *(uint64_t *)translate_opaq= ue); if (nhdr !=3D NULL) { - bool is64 =3D - sizeof(struct elf_note) =3D=3D sizeof(struct elf64_not= e); - elf_note_fn((void *)nhdr, (void *)&ph->p_align, is64); + elf_note_fn((void *)nhdr, (void *)&ph->p_align, SZ =3D=3D = 64); } data =3D NULL; } --=20 2.29.2