From patchwork Mon Mar 11 19:12:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779427 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1689921wrt; Mon, 11 Mar 2024 12:21:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWip2H0qf5wDWUudewBpWU+erSfCpkpZOolyzQGkDiOno3X+kF2Fnz9SH1pTAnLlSl+Legu2QJ/LiAcHUc5/dx+ X-Google-Smtp-Source: AGHT+IGcOfEx7iuOIzkMbjkvpGwRyJ0AjW/23tTP5NCjomDc01L4cI+9icCu9vc2q3e/cLEPg4xH X-Received: by 2002:a05:622a:245:b0:42e:ed9a:5d6a with SMTP id c5-20020a05622a024500b0042eed9a5d6amr9395067qtx.16.1710184881265; Mon, 11 Mar 2024 12:21:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184881; cv=none; d=google.com; s=arc-20160816; b=iWFEwZsQ1X+jk7j/Dt7YxR1oK3NBW7BlMiyXSO4RRejlKwwY4761HLDXYU67o5N/dk fQLCzrw1FKNJE8r4h7wrPduMXuczpK7v1hW0h+RHgI1ySAgEv7guPPQ7IHAmLdXqxa9+ ErXyjVcx8v+djT4I3dC6puSzDK+Geiz458frawPtyOY3hGgiCFIhas0LpLEla9xt3i7z +SIPMHVyMhtrhFG9GCsTzKiZbN18+xIoU4K2SwJGzGAu8i2KXWT6uf1xnrZp2g/7XO0/ 5nMwkVd1I2BrCNi2452hKyjYpn8Z9tk6q2X9hbZ4/8rwnUruh0LZ1uX8UKDg+wJvpCDH yeUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1PPP7DyUJzXO4PyrnSnzaFZyN1tK2CNOu4AL56ymsAo=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=XFWL6L/VD/vyhJ9V2QMqchqcvd3WeYdw8j9LLFvGQLIXaJqDvxtuyRTYMnZ1Rr0+bw OtzseHUei573Au/1kOqDHb1cn5DzZ7Tfyk41/javjXn/6muYS/Rh6t1Y/zVVeKDwM8Jm U1AXOkqEHTHcCcMnu26VbaTamk0pJp++YxCG7G1WsEhNCmTxftc1lwN3jVM0upITd7dC WaqlUxWapq0dE94gVX7MZv6uvyaftSM7SSzSxwKlZY/Rwn1LoSpKUTNU1G979fDpgHPN cPwyrNFLdfQEGRkHJDgKW/0N0RztOWvEOsncdaXHFpQuKubop73kAZrrEhtrH3Bt2DHA aWMA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HDTqPu9o; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p16-20020a05622a00d000b0042f213973a5si6065658qtw.318.2024.03.11.12.21.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:21:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HDTqPu9o; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl9o-0006rf-9x; Mon, 11 Mar 2024 15:17:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjl50-0003OV-6x for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:02 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4u-0000ND-QH for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:54 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-41312232c7aso24406005e9.0 for ; Mon, 11 Mar 2024 12:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184369; x=1710789169; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1PPP7DyUJzXO4PyrnSnzaFZyN1tK2CNOu4AL56ymsAo=; b=HDTqPu9ovDVjIGpoeSYbnvY6g98dg07KWVRKs/iaLxEB7yCOYHfzjyCmAhDFW33J/b FXC7ZnofxnsBtQ+PbbQHDvfZS+OY1abhZwIzPlgamYI6P6o+cqJsg38FHZbuOXFWqnGM 3tZZFORt/0f50zyssS2VxT5dzJQUixSk1STuKGIYdTLBrXOvniQ1VX/hqLUQaYbBZzGj 1OqSVsugZEeGPjvmNaEdVArVmMQNU/0AKZFjWFdWZ0AkXdELOakxy25UCSAjXpi0/491 zg8oTgASWTSXFU8pKlLfSqkuE1FSNQeN9DbidRmiAY+1OPlgesD1+jG/T/vWvJzobeyc zIaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184369; x=1710789169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1PPP7DyUJzXO4PyrnSnzaFZyN1tK2CNOu4AL56ymsAo=; b=bNIM+VkJ52+Base+AvKuZjWV9RMO56r418xanu3/Q11AtUjDozeoWFipGa+Cd/maIk cEEap2sHOcKSAwWKPSHgHyectTstQcHQNOPk84nMGRHP12whbiZkf+IIw+RH0nXh45RY Tl+kKwgL5U47maxcVCI9X67rkMAbCdoU103JWd2KMhcouonJBjz2wDBfjxoy9iY8F3Xn ZSV0Nxg2hnRYQCtNLNZfxnEm0hSQ7ut2O3fsVaVzIBClEgJ1jJWVSzmjJIGlJ4KXjv6e ZPdEWO4SyHjFNdEpTG+h/ExGuui1b8htdH6jhA6rsu3f/Kw4wnqICf9bnmNtjqZIeQpK /m1g== X-Gm-Message-State: AOJu0YzYBr5yEEfYy0SkYFwrIpbwK48SJc0U5KkGoGmn0XrzDaxwzqRZ XSITPna5dWN+6pgzriUgSQ9QMiifU03F2IznFVD46zN0Lclgn+Y14ba8S+YFeQfNlQEmMOn1P9t 4 X-Received: by 2002:a05:600c:4f50:b0:412:ee33:db93 with SMTP id m16-20020a05600c4f5000b00412ee33db93mr7013109wmq.3.1710184369331; Mon, 11 Mar 2024 12:12:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/20] contrib/elf2dmp: Use lduw_le_p() to read PDB Date: Mon, 11 Mar 2024 19:12:35 +0000 Message-Id: <20240311191241.4177990-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki The relevant value may be unaligned and is little-endian. Signed-off-by: Akihiko Odaki Tested-by: Viktor Prutyanov Reviewed-by: Philippe Mathieu-Daudé Message-id: 20240307-elf2dmp-v4-13-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/pdb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c index 1c505142518..492aca4434c 100644 --- a/contrib/elf2dmp/pdb.c +++ b/contrib/elf2dmp/pdb.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qemu/bswap.h" #include "pdb.h" #include "err.h" @@ -186,7 +187,7 @@ static bool pdb_init_symbols(struct pdb_reader *r) r->symbols = symbols; - r->segments = *(uint16_t *)((const char *)symbols + sizeof(PDB_SYMBOLS) + + r->segments = lduw_le_p((const char *)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size + symbols->offset_size + symbols->hash_size + symbols->srcmodule_size + symbols->pdbimport_size + symbols->unknown2_size +