From nobody Fri Apr 19 10:17:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1631143256; cv=none; d=zohomail.com; s=zohoarc; b=R+4ffA/KcKW4h1JKbd/yIFxNrF7MQe8JOyj0mFy4qFvpnZ1QO+tL+9YVJ4yRpgoY7Mz/Y/G8K3X7Td4xwqUprPt05kFKOdNuKGH8ysOPfVu5/HqvI6pEjsnSiob2GZl9uf/7Dsvcze1S8FlJoKg6R/EP6eInDI35CotLLIa0gGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631143256; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=p6u3sclI6JBi/0aQ8m/8uYmNWK6u/Efc+CTX33mwcn4=; b=iC5C5ZZsGVyggnMt9bbQY5MHAK+VtlMIdIZMT7TRsOOLgnRp78hfTeAfySxfD4LypgPtpdq7zcKROPAioN85fPlkTfRStInC258WxMsveuQD3LQfVlaIh+JDDnGKmXrJZhbVJvOaBkFkKfB9KUJ9NjAMcSuxTCs51MTTvWKO2mw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 163114325621574.99791664479176; Wed, 8 Sep 2021 16:20:56 -0700 (PDT) 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-589-MZZ-qxOFOLWRAjV0NLueKg-1; Wed, 08 Sep 2021 19:20:51 -0400 Received: by mail-wm1-f71.google.com with SMTP id u1-20020a05600c210100b002e74fc5af71so11864wml.1 for ; Wed, 08 Sep 2021 16:20:51 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (21.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.21]) by smtp.gmail.com with ESMTPSA id c3sm30713wrd.34.2021.09.08.16.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 16:20:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631143255; 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=p6u3sclI6JBi/0aQ8m/8uYmNWK6u/Efc+CTX33mwcn4=; b=UAbntxhNMDLfhVBJUanQ/nbNFX8SsAgORd8PabEo0ooHKj4cGHZLtZJV1Ap4C+4U+v4W1m 9JXqOZLnbflNIhvAsLodB2QDw6saRyC5xk4oXokL4grrM0ug0kgsIlLCH43ermB775L6GW OxaKR8ypL7bHx7uyTyNf2AXNhuX1iS8= X-MC-Unique: MZZ-qxOFOLWRAjV0NLueKg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p6u3sclI6JBi/0aQ8m/8uYmNWK6u/Efc+CTX33mwcn4=; b=JQVj9YY0KENh5y/iQZFT+JxtYtwhp1KvMrWchCY9Mu2kcRoSi6a2GTo9pQEaQJ3nbz dT0QEfXXO58WyK0S9s1FXk0fwYV+Fm4uD6OJJ17SuUIkMvZg/fyn3NlAFQNSzw0tOBMv MrBxFcI3XJFlbCeJv3JNQiUuycRePxH6MhZI5O5rOzyrE+/2VLALWnwlADCdfC9opnTs 4uwl9efo38MeHxhQ+jKuX85QqPyMrLel95RKWWZpQg7jra3EWCDiJUAo6FGisAZbgeZq vHD75Z13jsF/RZ3rjB+c4aVolo4UlhzYdzpmbcO0hrLb9vwBeOI64MupycBiMVZD9ynO /YhA== X-Gm-Message-State: AOAM530GlyOwa215BALf2CA77vLP34NILW+yy5pz1OY5EcN9WPFjYziW +XtT4zdGpLjJTnPpt/be1IUT51D2ihlFzyFQMeaNS5CUfN9vdCz1z4f5vzM7StRWojmxRtUVTbY wefwGQokVRIW7EA== X-Received: by 2002:adf:fb8d:: with SMTP id a13mr108058wrr.164.1631143250629; Wed, 08 Sep 2021 16:20:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrh/n5wSnZqfaTQvrzl6IJ2DKh1pSXkkHEuOdKtVrOvCH+TWDpEiwg1GoyEgBtyhNoco5QeA== X-Received: by 2002:adf:fb8d:: with SMTP id a13mr108055wrr.164.1631143250497; Wed, 08 Sep 2021 16:20:50 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Prasad J Pandit , "Michael S. Tsirkin" , Markus Armbruster , Paolo Bonzini , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eric Blake , Richard Henderson , qemu-block@nongnu.org, Peter Maydell , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 05/10] block/null: Mark 'read-zeroes=off' option as unsafe Date: Thu, 9 Sep 2021 01:20:19 +0200 Message-Id: <20210908232024.2399215-6-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210908232024.2399215-1-philmd@redhat.com> References: <20210908232024.2399215-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1631143256687100002 See commit b317006a3f1 ("docs/secure-coding-practices: Describe how to use 'null-co' block driver") for rationale. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/null.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/null.c b/block/null.c index cc9b1d4ea72..11e428f3cc2 100644 --- a/block/null.c +++ b/block/null.c @@ -99,6 +99,13 @@ static int null_file_open(BlockDriverState *bs, QDict *o= ptions, int flags, return ret; } =20 +static bool null_taints_security_policy(BlockDriverState *bs) +{ + BDRVNullState *s =3D bs->opaque; + + return !s->read_zeroes; +} + static int64_t null_getlength(BlockDriverState *bs) { BDRVNullState *s =3D bs->opaque; @@ -283,6 +290,7 @@ static BlockDriver bdrv_null_co =3D { .bdrv_parse_filename =3D null_co_parse_filename, .bdrv_getlength =3D null_getlength, .bdrv_get_allocated_file_size =3D null_allocated_file_size, + .bdrv_taints_security_policy =3D null_taints_security_policy, =20 .bdrv_co_preadv =3D null_co_preadv, .bdrv_co_pwritev =3D null_co_pwritev, --=20 2.31.1