Message ID | 20240404191339.5688-5-philmd@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:adf:f001:0:b0:33e:7753:30bd with SMTP id j1csp995197wro; Thu, 4 Apr 2024 12:14:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXLGH+bYJ7whq4FNcROnv4mRO1QcB6ieQ3tN0mXfaatTAm9f0BS/Q7LdBW5cq57LAu6xPh9C5cIjUqEnP/iZ9t7 X-Google-Smtp-Source: AGHT+IFo3X3DKJKVUX8z/0kqdYR793KrReyjdtJqI8L0vQSkTuwGRCXE+7XBV0vW0ZuY2KyTVWYQ X-Received: by 2002:a05:6122:4f06:b0:4cd:20ea:35aa with SMTP id gh6-20020a0561224f0600b004cd20ea35aamr3402325vkb.8.1712258091767; Thu, 04 Apr 2024 12:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712258091; cv=none; d=google.com; s=arc-20160816; b=gJ5XTwuM7tZZVVB5pkyw+NkMTvZThZY5pNf0KyaCrDyRKe46nusxzPtqMBHeQRMnh2 qr8DzA0xTPDGXasHLKyLOu4loIIrD9QYHScL2Wj4rzXk5Wf2pa8sXVQlLChQsDxE+tni 7ZVJGC5Y7kkUSGKjwN1qGbzNs/ZiwaPdUmiaadZyMbpVn2oVGAgo1nW6J2NlfjqXUxXk BNSj33yBqzPf5gGYXQ94HoY97WYfT6MU3igvSx+rLlFqHC7B4Sy/kVgO7LrRQrvqCSQM ent9mF3Ng6C8mWBL9RgW/xlQiXikCWLewl9Boas8+RbahH1lufYL9Zy3yanNDhOCwv4Y a8+g== 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:cc:to :from:dkim-signature; bh=Akez/1J4Qb6iNF6NCgcGNV+l9m0ULLqhTgwyXKIYR5w=; fh=9uSWsK+3HWzkSmIThICfK1QNuLn7pkGruVB859YNre8=; b=JoPZBg0YvO+8wrOB5UbsfZEIWoHxUhqMluz6Q4f+1aBieCWq9uQFQIbXenl4ns/pyV pdagTxKRhLpQF044VNNF+DM+fBX82JGudQ7PFKBNtp7TIZp9UYXVF1f20MiSz+v0+T2O qm2DZPmxUzDt7dl4ycCkO1lzHnVSrVGt9ba9zGObkm061a1ZrjjNNRFKyzbaSSk8pUoN zj+p+IDt4mmcl8f6udvJG26pMt+j66MJ1rcU0Zf2YF/O4etzCCcA5+Ph8pMmLp3eZFmQ rgIR8lbVGmZsyctSK8+UZXHkfLvZUvEToxZna6uFYmXyyiOFN59IPT82W5dZpcEHIXc6 KLAg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=biuIz3Lb; 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: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l10-20020a0cc20a000000b006993dd2418csi76997qvh.371.2024.04.04.12.14.50 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Apr 2024 12:14:51 -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=biuIz3Lb; 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 <qemu-devel-bounces@nongnu.org>) id 1rsSXJ-000660-Vw; Thu, 04 Apr 2024 15:14:10 -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 <philmd@linaro.org>) id 1rsSXJ-00065q-FN for qemu-devel@nongnu.org; Thu, 04 Apr 2024 15:14:09 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1rsSXH-0005bK-VU for qemu-devel@nongnu.org; Thu, 04 Apr 2024 15:14:09 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-56829f41f81so1939197a12.2 for <qemu-devel@nongnu.org>; Thu, 04 Apr 2024 12:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712258046; x=1712862846; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Akez/1J4Qb6iNF6NCgcGNV+l9m0ULLqhTgwyXKIYR5w=; b=biuIz3Lb7k3OiGzK1KJnKEVvgp+6unv2z7LZBcXfRlR9x+vzOju/3IAtritJhOANW/ sMTxr9CYV2tTYf/ndxx/+FfOXxWyN0OPdXi/n7XjtV+EF2KcZ2gf4XF5dV1UKgFGOVxq JWtLIFgFhHAzTddAvDYXmreSD5q4R8A8QzPcUJLe0JwEqvePypnzoHx4ht8RE6MGcjuq kjy25UM8nEmuFyft0zHNku1X0rcv5A+QO+9a/KtNTC5Rq1bABwC6/3Bx3IKyEnz6JmZ8 x+Rg4PuHap5WcN78KUDmGJWP1i7eEN2e+lKLJgqI7DIuQE3HyQVKGmVRKolLkI6I7g7r W4pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712258046; x=1712862846; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Akez/1J4Qb6iNF6NCgcGNV+l9m0ULLqhTgwyXKIYR5w=; b=EY0GoxafG6E+tn+ivC/4F3gnpFLoMIOr2vtj6VkufET2SkYZrLHmRUxEDxKxnsDKRX lMDqHduZyiJU1hiruKe1j1hL/YOSJfgHoM9NtFrdEy16upkwdIjo0KwqhFV8ie9jeOz3 BfJli2tdoayo3pFp4NXZ4sF2Omi1OA91ixP6ysAXgH1wXQwm39D1OgpUTrXsY8XK5cFH k5G9XymdQqzprCtSNxAK4/cTS2Rh3V3DgcIa3IZM+gMDWY4ZHyYqigLipv9+3Ih/+BwH Gp8tlBPRKKK/tdCaZ8oiqT/O9Kza/4RC/IlH6dbu5ppZp/N3M6b75LV7RDkNZ++UvPr9 n2rw== X-Gm-Message-State: AOJu0Yzr8qYQ5cd1bSZ99wpP38ZAWK3Hm6WT8v+ddr5++dSfE+s32HkQ gdeAbKhDsavdcgDe1LDuBIUUXY2F15NQy2Ba2ttFrrvHznQCHqAhuBcH+s4y34QXsIa6xq0HmGd 3 X-Received: by 2002:a17:906:ca04:b0:a4e:8508:d807 with SMTP id jt4-20020a170906ca0400b00a4e8508d807mr2252811ejb.0.1712258046324; Thu, 04 Apr 2024 12:14:06 -0700 (PDT) Received: from m1x-phil.lan ([176.187.216.111]) by smtp.gmail.com with ESMTPSA id l3-20020a1709067d4300b00a466af74ef2sm9352805ejp.2.2024.04.04.12.14.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 04 Apr 2024 12:14:05 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann <kraxel@redhat.com>, Amit Shah <amit@kernel.org>, "Michael S. Tsirkin" <mst@redhat.com>, Alexander Bulekov <alxndr@bu.edu>, "Gonglei (Arei)" <arei.gonglei@huawei.com>, =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= <marcandre.lureau@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Mauro Matteo Cascella <mcascell@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>, qemu-stable@nongnu.org Subject: [PATCH-for-9.0 4/4] hw/virtio/virtio-crypto: Protect from DMA re-entrancy bugs Date: Thu, 4 Apr 2024 21:13:39 +0200 Message-ID: <20240404191339.5688-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240404191339.5688-1-philmd@linaro.org> References: <20240404191339.5688-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=philmd@linaro.org; helo=mail-ed1-x52b.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 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org |
Series |
hw/virtio: Protect from more DMA re-entrancy bugs
|
expand
|
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index fe1313f2ad..ac1b67d1fb 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -1080,8 +1080,8 @@ static void virtio_crypto_device_realize(DeviceState *dev, Error **errp) vcrypto->vqs[i].dataq = virtio_add_queue(vdev, 1024, virtio_crypto_handle_dataq_bh); vcrypto->vqs[i].dataq_bh = - qemu_bh_new_guarded(virtio_crypto_dataq_bh, &vcrypto->vqs[i], - &dev->mem_reentrancy_guard); + virtio_bh_new_guarded(vdev, virtio_crypto_dataq_bh, + &vcrypto->vqs[i]); vcrypto->vqs[i].vcrypto = vcrypto; }
Replace qemu_bh_new_guarded() by virtio_bh_new_guarded() so the bus and device use the same guard. Otherwise the DMA-reentrancy protection can be bypassed. Cc: qemu-stable@nongnu.org Suggested-by: Alexander Bulekov <alxndr@bu.edu> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/virtio/virtio-crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)