From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id A9B028045D for ; Tue, 20 Oct 2026 07:54:15 +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 69K7qvH9032489; Tue, 20 Oct 2026 10:52:59 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69K7qvH9032489 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="g3PQj4Pq" Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69K7qvaI032481 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 20 Oct 2026 10:52:57 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69K7qvaI032481 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-48df5b058ddso1918412f8f.0 for ; Tue, 20 Oct 2026 00:52:57 -0700 (PDT) X-Gm-Message-State: AFq9FYIg/3/jTuY6d4dmZw8hVi1XhVei6yQKMHgr5Gnviy1Cxkclakkm ZFY2/oytt3lOZXW1mk3imY166mxUo5ex+YcEGsBQompe4HfAUv0yJ806mWQgthWb+HZ7btzrWLS AGOj8ELa+kZMy/slKl2Dhm7+cx4z3vmKf0R9vTw83rMRt7cJ5ZFxiAw== X-Gm-Gg: AYBFou0KLl1OEikWN0AU7Or3kMmFtNrGYn1Xz94EniWJvlRFyhps1qc800YqjreF2Ry P5JFGU5XzlpTwy60NhK7xuYrApHV1fKWJlwPYPPQZoS4QJwTY3yY+iNeSuAJ+gxCZgh3Enf1Kj/ vqFGYYfavvzlG0O0WoXDiMvgA3u/3uWZ9X1acFYFpUcNQr8hHmq9M22dlxIwinKYrKruIJI2eYQ Rt6A6780Wl/snkMf7MWHFFtuWaFfvZjIUV9GcyNhShh8U/DJUZUQCGZ0Ni55qmxISg7BB/hsUXl b7l7uxtW3dBcY2fFl6Spb4VEp0CjEyp65LBjqWh2Et/MvKpR9nL1V3Au8GxF88/IC9Fw9mrjH1Q i/g5mfYV4va86WjlPnHyOByE6Smg6 X-Received: by 2002:adf:f8c2:0:b0:48d:fbf4:895e with SMTP id ffacd0b85a97d-48e07fb31demr13715492f8f.11.1792482776986; Tue, 20 Oct 2026 00:52:56 -0700 (PDT) X-Received: by 2002:adf:f8c2:0:b0:48d:fbf4:895e with SMTP id ffacd0b85a97d-48e07fb31demr13715378f8f.11.1792482775447; Tue, 20 Oct 2026 00:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1792482775; cv=none; d=google.com; s=arc-20260327; b=IqcO1xsE6fJCBsyF6vv9VFT6dRN9cI4FkG8IpfuZUSzX6Z0dlxK18nCytF8/aK4lEf dpx2o47PBLUaR2uZQ6Z/oLrFvaaCgRoSxVRduq2WifIPIMnM24YAbBHhK2PdMsxlQxDE Gfve5PfPKuSWdTek7vX0D80x5x5FOrS1vawpslWYkRZYNvUeXc3tcGCwnugfA3x1nrN/ O/AZ/5k2Pd9kjpkTL9E+kTsJB8IVrRmQsIL46JDEPwPywxLQ1ckKracR7ExwFsZOc7G/ TC/JA40lQ7afqJ/Au0z1ugQNK+vNsvggN9wYEJptSHWYCqk3AT/ITmuN5PF5E1o0RAIu 5ofA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=9QJ1iB2LLCgieFPiXQJyfWEFOZGNcWSQ81nJIb/LHRI=; fh=G2JGoeUCR4a/A0TH0K3bHnuxqhe+kjaX7a5tGdksR6A=; b=B/t4c6ynWZFKejjpeKauFI5w7lBx6Xyu3BBEJtSPRhQB/69y7P0+ELzmeFd9epA5yq thHkX6hCGeNX7tPf7l79U9QjlHHGdyOxXJWPT9w+TxH7ImZEbgJgdOMYrYrp/r5zcQBG JMmt+0kj7Ljqx2C2+P6jgdYdFTIzphTSLJVBuOk+xdIzCEgCRtNks7BKGGcBz3xZq5/8 BVBz5PkuuMsrbz5VN7+mGs5sZqGwXkC6vLifqvWWASlt4Qd7cJJ57rrzU6y0Z42Vry/K Czh1HwcG/MMOGX+ANQ/KwdsiO/dNL+14wcvfEr86JolSyA1O5uj5hX0ZJBxtFevAq94S GDXQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=g3PQj4Pq; spf=pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=alexander.ivanov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-48e1d84f088si3247352f8f.439.2026.10.20.00.52.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2026 00:52:55 -0700 (PDT) Received-SPF: pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=g3PQj4Pq; spf=pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=alexander.ivanov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=9QJ1iB2LLCgieFPiXQJyfWEFOZGNcWSQ81nJIb/LHRI=; b=g3PQj4PqQRyw uAlyS1+dC2rmTyx2kQaxKtznUKIJMHcHL6AfeT3LMqFNOryA0riCLVfhgKHJwyt/2HtQ2+KnDFYez A0Ojjn3ecK4Cmoh32Hhd5DVx/0KRKOtK0U8TLAgTLItqBV4ivm8B870jK4KjRpCLmmJXeicO5i5qC xHPj9UHe0EqPl5a+f/j5ntZpod1VCR7wlOpd/yf5miwzFEy2WXb76tjmpvFAobmZbKppel19qB2dQ lW0I9AG8Kuy3VP5IPBUg6N8g3YJjrV4xUp7zcVC8VfUyCiL7YxYWc/A+WzzybU6FWiq9bVEqcg+0l jtTFPkuutEpsiKaZSNIfyQ==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=sky) by relay.virtuozzo.com with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1xJ4av-0061pL-0q; Tue, 20 Oct 2026 09:52:45 +0200 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Date: Tue, 20 Oct 2026 09:52:43 +0200 Message-ID: <20261020075243.1283345-1-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v2] dm table: don't inherit live table's type for request-based tables 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 A request-based table without devices inherits the live table's type in dm_table_determine_type(). Since commit 6936c12cf809 ("dm table: fix 'all_blk_mq' inconsistency when an empty table is loaded") this includes bio-based types, although the inheritance was meant to pick a variant of the request-based type, and only one is left now. So a request-based table loaded over a bio-based device becomes bio-based, which its target cannot serve. dm-qcow2 and dm-ploop open their images by fd and never call dm_get_device(). Loaded over a bio-based device they have no ->map, and the first bio calls a NULL ->map from __map_bio(): BUG: kernel NULL pointer dereference, address: 0000000000000000 RIP: 0010:0x0 __map_bio+0x197/0x1c0 [dm_mod] dm_split_and_process_bio+0x1ad/0x740 [dm_mod] A multipath table with no paths and the default rq queue_mode keeps m->queue_mode request-based while the table is bio-based. Its per_io_data_size is sized for a request, so the first bio overruns its per-bio data in multipath_map_bio(): BUG: KASAN: slab-out-of-bounds in multipath_map_bio+0x376/0x380 __map_bio+0x433/0x4f0 dm_submit_bio+0x48a/0x1620 Removing the device then kicks the requeue list of a bio-based queue from multipath_presuspend() and corrupts memory: WARNING: CPU: 4 PID: 345054 at kernel/workqueue.c:2498 __queue_delayed_work+0xf1/0x130 kblockd_mod_delayed_work_on+0x1b/0x30 dm_table_presuspend_targets+0x3d/0x60 [dm_mod] __dm_destroy+0x19f/0x1d0 [dm_mod] Oops: general protection fault, probably for non-canonical address 0xd352851d5c47d388 Drop the inheritance. table_load() then rejects such a table with "can't change device type", as it does for request-based tables with devices. https://virtuozzo.atlassian.net/browse/VSTOR-150573 Signed-off-by: Alexander Ivanov --- drivers/md/dm-table.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 954bbc338bce..e306eb51b592 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -983,16 +983,8 @@ static int dm_table_determine_type(struct dm_table *t) return -EINVAL; } - if (list_empty(devices)) { - int srcu_idx; - struct dm_table *live_table = dm_get_live_table(t->md, &srcu_idx); - - /* inherit live table's type */ - if (live_table) - t->type = live_table->type; - dm_put_live_table(t->md, srcu_idx); + if (list_empty(devices)) return 0; - } ti = dm_table_get_target(t, 0); if (ti->max_io_len) { -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel