From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id BDBAB81377 for ; Mon, 9 Nov 2026 19:07:41 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6A9J6T8p002879; Mon, 9 Nov 2026 22:06:30 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6A9J6T8p002879 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1794251192; bh=Pw7XWWCHfwEBZNBYr+ooRmyckc+MdVVVRqqR8rP3ntY=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=gA29qXSARkfWS9AlN8LaRWp3TBpn/SuXdC9904GpiU1XIODKJtp5mmG7O7D85POd6 X1CPMnTwXRI+9SPkXqBtFBLkpk/Tcdj3R22shLvBrNmwp8AhEOAD7qPV7rbvYBt/Xn DxfKoY8ZvI3mpySpT5p5VZ7Bz1NmiY5o5CFMRM/bo2pnJOtxoTQ97M5EwBSRSB8Q00 eGQp2muLD4c5Uwp16BNUVbtEkK9hKPGDsUs13XoXpSxjqeKqk65tn/UE2SBHZ4Vt5R 5KsOPoBqFYnLidKYS19FROMne/A5OnZ3B25ZM5b4YwE/3VG0DpjmihkLDTFtMr0Feu 2iR0kip3dEcYw== Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6A9J6DaD002850 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 9 Nov 2026 22:06:13 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6A9J6DaD002850 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="WaQyOLwM" Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-49187ad6a72so847113f8f.0 for ; Mon, 09 Nov 2026 11:06:13 -0800 (PST) X-Gm-Message-State: APuU4Z+zTUIBcs7ogj2gIT7QlMaVzWk6SzLF8icxM1O7IaJPO8zlIaA5 L2rAafwDemPe0ferVztdSCd68cPRvg+QU1nMX3cN+7zda+/r4sCOe5G2/IGztV1+lBruhsSo5TM 4/6bJI0BE0mjfS+V63R1xq0kgoe9n5beWt3ElimeCc5Kht1dJznlUzg== X-Gm-Gg: AYBFou2yhyCFQqBU67p90vnSyXjVQV/rKdX6f+njgorfNy0AO+8YokcUVuqi0BFv6Uz VMoiGxHqJUjlVJz72BPR05PTs9+5OL0k46vHu7n+iCccRdgFwb5fp3tLc6K1zORrZzjxucLYDka TwZj9OkQwuoiMaSFiuXpF8c96M9tpNlpYjA54r3DAJud4eqY6RPvb26pwJAO6HqPD2Sb82pNrz3 I55xvA632QZK2A2yZUbBh2BKUTmnBIgE597IfZ3agQE9QOWJUSc7R2JWZztfSkI6NdPAViUaI+M Ral7DW8uUg== X-Received: by 2002:a05:6000:2485:b0:48c:4553:790b with SMTP id ffacd0b85a97d-498308b9ce1mr568682f8f.48.1794251173376; Mon, 09 Nov 2026 11:06:13 -0800 (PST) X-Received: by 2002:a05:6000:2485:b0:48c:4553:790b with SMTP id ffacd0b85a97d-498308b9ce1mr568652f8f.48.1794251172944; Mon, 09 Nov 2026 11:06:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794251172; cv=none; d=google.com; s=arc-20260327; b=iordZdae59xs2pHlIta51wlJIUAm9OBStqYzt504jEcWj9J+6AXuJTGx51kNSELHsl dWOa9HfUygs71k3dYyuHmmwg5fKNgT10KySDGYJX83be4t9wUuFyppeh5/geXF9ESADO DHTrpTCZMZQeLC7KGtPmjgJVm8n6pxV5rb9HEPW2DWqWdLQ9RLuO/4AVY5s7tZ7jpuPP vzg8/Kz5qcBKbEuOVUwY9f/HjczGNtd0lpeCN8pekgI4QTZJTZbWrLQ9GjLzX0n+9PK/ tHVjr16Sat0sQxLgYYHpIGS7SY/4nbYVdMitT3dg4fFiDKw4nN9ZRJFWQXeXpiu/MLT3 73Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=QFrPen7q9moxbCFRT9MhjreWJiyc9gkRZpPkG7E1fSI=; fh=LUVQCdF3j0nWkqybXIUUvDalO2P4EK/c3ur9yogw5Ic=; b=Y9Vo6tvTytBNH5sW1ys9FScZokr/1fbJgJBtPV37VmO4rNZ8r9A4VKKq8PwPGn+BbW 6Tbkb2ovt/AtDxz6QXTuHxhpRkpcfJsUhmM/Ce3zH+Ylwt/dXkOD74OqEUjj11o/Z+U9 f18ix5jAAikdRutNHAWd4fk1MNFKRGnN3kHshRp+DjOUmhbt5eADXHykNLAUUE52Rkdi eSwjfdEMDk7qDFXy8PdJNT8nfITDmjzvUmUsw/bCqZlgRnEn95Dh3Cs9LLyfnaoOHwD5 5EfwOr0be70yyaDDfx/xgZbGVvOOi2240Vuma+3AosT0VogEvzC5TC7UDPqku+lliIM6 Jf3w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=WaQyOLwM; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:dcbf:4b53:b63f:3b41 as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-498350a2c7asor49667f8f.4.2026.11.09.11.06.12 for (Google Transport Security); Mon, 09 Nov 2026 11:06:12 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:dcbf:4b53:b63f:3b41 as permitted sender) client-ip=2a06:5b06:b600:300:dcbf:4b53:b63f:3b41; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=WaQyOLwM; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:dcbf:4b53:b63f:3b41 as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1794251172; x=1794855972; darn=openvz.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:content-type; bh=QFrPen7q9moxbCFRT9MhjreWJiyc9gkRZpPkG7E1fSI=; b=WaQyOLwMRJFxKZ7vCe0x9PgxmW4/uyCqvt8KNIf1x+C6JCZcqkw9l4n1J1btWBVIOb HF/N4ftaUjxVor/iZKiqQmKzFhohKZLZ9GldwAViWGVQJRCU4AZE1Cl90Ho0J6zV5VBc delKdmnRr5P+yZsFv94GfOJWJxDwl3L/KWMIXDo2JbrfapHjJ+h1pIhaHVXF8OTE9n6F PMKqbyQ6b9pKtm7mz5hU1E9oQk2z+R1BIGtoYk3RW41EyajN2mEvUZXvu+HaOr1y6jjH 8C+4a73oz/J0rHgsAdxC/VWeQJoUwJdZ6+9pbrbAhCm10+u7XyZnfD74CEIeWTCjQg48 ztSg== X-Received: by 2002:a05:600c:620b:b0:4a2:d:5ccc with SMTP id 5b1f17b1804b1-4ba0233674cmr3205255e9.10.1794251172400; Mon, 09 Nov 2026 11:06:12 -0800 (PST) Received: from athena.sw.ru ([2a06:5b06:b600:300:dcbf:4b53:b63f:3b41]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01fba476sm10162755e9.2.2026.11.09.11.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2026 11:06:12 -0800 (PST) From: "Denis V. Lunev" To: khorenko@virtuozzo.com, andrey.zhadchenko@virtuozzo.com Date: Mon, 9 Nov 2026 20:06:04 +0100 Message-ID: <20261109190604.1850504-4-den@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261109190604.1850504-1-den@openvz.org> References: <20261109190604.1850504-1-den@openvz.org> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 3/3] dm-ploop: fail writes to a read-only device X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org From: Denis V. Lunev bio_check_ro() only warns about a write to a read-only disk and lets it through, and ploop_clone_and_map() passes it on into the mapping code as on a writable device. Such a write comes from a device stacked on top, e.g. the partition device that partprobe creates over a ploop device; a userspace write to the ploop device itself gets EPERM. Userspace opens the deltas of a read-only table read-only, but the data of a pio goes to the file through f_op->write_iter() directly, which does not check FMODE_WRITE, so it reaches the image. Allocating a cluster punches or zeroes it with vfs_fallocate(), which does, and fails with EBADF, so part of such a write fails with an I/O error and the rest changes the read-only image. Kill write requests of a read-only table in ploop_clone_and_map(), as dm-qcow2 does since commit 409d7e697578 ("drivers/md/dm-qcow2: fail writes to a read-only table"). The write fails at once with an I/O error and the image stays untouched. Flushes still pass. https://virtuozzo.atlassian.net/browse/VSTOR-154096 Reported-by: Denis Genov Feature: dm-ploop: ploop target driver Signed-off-by: Denis V. Lunev --- drivers/md/dm-ploop-map.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c index b49281691a01..f4b6606127b4 100644 --- a/drivers/md/dm-ploop-map.c +++ b/drivers/md/dm-ploop-map.c @@ -2653,6 +2653,9 @@ int ploop_clone_and_map(struct dm_target *ti, struct request *rq, return DM_MAPIO_KILL; } + if (op_is_write(req_op(rq)) && ploop_is_ro(ploop)) + return DM_MAPIO_KILL; + if (blk_rq_bytes(rq) && ploop_rq_valid(ploop, rq) < 0) return DM_MAPIO_KILL; -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel