From patchwork Tue Mar 31 14:57:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 185118 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp3781146ilr; Tue, 31 Mar 2020 07:57:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtX33FTIZrqWN8fAq8JjNUflGAi7nbNABgazu0m2VBC00OLBvY8z62sx2uUWG0WfIZTUcJl X-Received: by 2002:a37:a597:: with SMTP id o145mr4572292qke.106.1585666669724; Tue, 31 Mar 2020 07:57:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585666669; cv=none; d=google.com; s=arc-20160816; b=0lwLS3wA0hDMxzPSwzxfvCVP0aKvXbfFFizf5r5IABUTFuO83YohLtEFi4wwQvNamn Velw/xWs4HY44GXhguOtY5LgU8mkelY5zTdmACxBOjzYlR9kuqzuDlt2M+SsANHkfRwB Q7gHsLFThX4V54SDF49bPjRznIDARm57P+aUb0imCGdIsKdWyuXMBIhS3JGDmdkNMfaL V+AWEvAnJe338gJ238DM0ngzzza+CeKSGYMd90hdHHYtPVSwCJppwyb1yYvo//cp2UZf 8NWkG+r+Z4tlyF2JOwRibxm/iS3qrH0eQG3kElyR0xJbL2D+rN8SEdk16bGrQzvKJvsE xa+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :content-transfer-encoding:in-reply-to:mime-version:references :message-id:subject:to:from:date:dkim-signature; bh=3H/VwsSTTvhtpNg2QmTT6j5ZuTBdZBFJCOku4RulJDk=; b=0PK1GEzAbK7oVjwLzHXLBDHMmpcu5Gk8niYLXMidElGJ6yPTl+GcgxZ5ZAeB19AdM6 rJpDT1arN2DCWyqjuyF2ZGkYxn4jzvP5fTK7M9cs/oVWPum81G0pBwvptLOyDmUZIUp5 iqy1kL4eIqyS2muXIulDM7I4xnz+I3KSqkaCuFUCDiUBZo1q3mYWGkTxE3XgJXM1YFVw 8ik8tQR3J62CUF4Sb9ZVq3ItXxkbsuemarhxF2tJImAypE8TTNI5fCYQiWM9j3faZpQJ yw3AOTDSyrhCqvrlK228Jjrd6Hdam7cjk5bwFjd+oc54wBEJJ6+0cK4OSY+CCoFANx7t /9Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=cziBRy+u; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l40si7279328qve.137.2020.03.31.07.57.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Mar 2020 07:57:49 -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=fail header.i=@redhat.com header.s=mimecast20190719 header.b=cziBRy+u; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:39584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIKr-0000ky-6p for patch@linaro.org; Tue, 31 Mar 2020 10:57:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56471) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIKU-0000By-Mi for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIKT-0005G4-K7 for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:26 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:23365 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJIKT-0005Fj-FR for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585666645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3H/VwsSTTvhtpNg2QmTT6j5ZuTBdZBFJCOku4RulJDk=; b=cziBRy+uqQHgTbEl1vZ1oD0CcDACXQNLgOpzegKU/ejqJVXuWVJ2ZztA8K/LJpuG/wdWO8 EvGLHIEBezLpqAS2p5jEXWzeVdhGYc60OIJG0BHjueX8b8UNhpqgoS1hSjvPIRB7QbBfEM h1s2WMzJcgsGuI7Mw/SEAz89KVRNc2Q= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-290-B_AKgg2nPpyJNTrOcIntFQ-1; Tue, 31 Mar 2020 10:57:23 -0400 X-MC-Unique: B_AKgg2nPpyJNTrOcIntFQ-1 Received: by mail-wm1-f71.google.com with SMTP id f9so796422wme.7 for ; Tue, 31 Mar 2020 07:57:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=x+B8mYBE9cPql6HF4nADxpZb0302JvKpESQBouHDOpE=; b=NoZDlS/LCntetufih4v95kytRnVRCKgK9BRaBYbd4chcW9DwxfyL408RQGTpAXmJg+ /PsNEgV1cbC8xfeUVwWLV3pB6+z4OntkkX6WjW0zvcnyJmI31mkDiqj4+MJ7d+BZ1hew r5UQ/CbjXuXxa/XKKViB3lse1itJOZrGECit+4L6FQBY3+sQOtw2yUl/NfGpZQlpMhOX YRd0f+NoSt3F2Lxx5Flih0039Ob6bQYUw2NDQtWIPEyS//lzTeS8yPIZ2DZ0s3vp/Wqg 0704KD9V5MXyuDw9YX/qiKo1Gl4X9o7scveXuWM74RK5cicE7IBXJJ7bXcUtk6DL9Lac gD/Q== X-Gm-Message-State: ANhLgQ1vUMLa8NnPQrQn6FMKJkvbpAvMT43bXuCo+rfVMqx92ApbSCFt bhrs2Wv9/s21rwdoCMNzZNixR2do20nJBZ2+VNCDEwgiqpiZUCKbgwNbAh/G2LQsrLMMdPP3519 mo1jworN6EFFIvew= X-Received: by 2002:a1c:80d3:: with SMTP id b202mr3849892wmd.8.1585666638938; Tue, 31 Mar 2020 07:57:18 -0700 (PDT) X-Received: by 2002:a1c:80d3:: with SMTP id b202mr3849882wmd.8.1585666638768; Tue, 31 Mar 2020 07:57:18 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id b7sm25930878wrn.67.2020.03.31.07.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 07:57:18 -0700 (PDT) Date: Tue, 31 Mar 2020 10:57:16 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 07/10] hw/i386/amd_iommu.c: Fix corruption of log events passed to guest Message-ID: <20200331145631.135630-8-mst@redhat.com> References: <20200331145631.135630-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200331145631.135630-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 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: Peter Maydell , Eduardo Habkost , qemu-stable@nongnu.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell In the function amdvi_log_event(), we write an event log buffer entry into guest ram, whose contents are passed to the function via the "uint64_t *evt" argument. Unfortunately, a spurious '&' in the call to dma_memory_write() meant that instead of writing the event to the guest we would write the literal value of the pointer, plus whatever was in the following 8 bytes on the stack. This error was spotted by Coverity. Fix the bug by removing the '&'. Fixes: CID 1421945 Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Message-Id: <20200326105349.24588-1-peter.maydell@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/amd_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- MST diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index b1175e52c7..fd75cae024 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -181,7 +181,7 @@ static void amdvi_log_event(AMDVIState *s, uint64_t *evt) } if (dma_memory_write(&address_space_memory, s->evtlog + s->evtlog_tail, - &evt, AMDVI_EVENT_LEN)) { + evt, AMDVI_EVENT_LEN)) { trace_amdvi_evntlog_fail(s->evtlog, s->evtlog_tail); }