From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.181 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796202922; b=WS7o2lA7G9DE+jhXB/hiP2CkJhrWYTtqGOHOnbOAd5YSIy+NactFkXOE0/kNKMHKVwDv MPOb0ggAPEYQHG1l6dnx6GjkFwdc83daS5UUEbbDimnUTdJYDDAOvnsehvw8VE9Xm8y8l eLA873ggzcZLJaq9wErr8X8/+nag8/thgBE1dVyelAJbWfIdqZGRn7hYQ9YOBSK1+BGva lLp1+oskvTWpF8P0G3j5gxa88/rQao8o7wvGaFyuqvQlPm8gGaH/8B/mri3aS1SgAVOjG FagPNylGRtBs0tjy3vdXI4zeLaQX0ceg3P7TFhHJOcREIo/7ZpyQuVpOe1o6nuhLbCw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796202922; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=todIBpFyOS3OoAmzi6bFOhy9k0vI6WZIfcjXT/8rt50=; b=FtCyeSWLhoIZzZGcX5KQzt/QconnZCn/hVQRhj2vHPa3wKwt0OH8z0Z7S96VRIDfnAfW u0dexff11H2ob6K0gqGtTcxh0o2lNxWEHlVaYwAgNfDN6LRc6RX/zMznJLEt6vH9edSnh xxNeA3poRVKXxxJFH3F7Ix6XGfJyoPoxm0z6sYM413uBALHmyTmx5j9epBXI0n9nZDsnj lmlqHKLJcXIAk4s0EOfJPXMaVdtmCBd4taaQnn8yr19me+PMaLqy+n8a8QN8QDo4MtDOP h5xpiod3OpJebTHQaZ4A9YdtdpjXFEltlQrZ11EZPvdVlbArUHPQnt3E6VpFf99O4+g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="Fk/x9yFM"; arc=none smtp.remote-ip=209.85.210.181 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83984606A329 for ; Wed, 2 Dec 2026 09:15:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 83984606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Fk/x9yFM Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-8a07b5f2795so1061389b3a.2 for ; Wed, 02 Dec 2026 01:15:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796202922; x=1796807722; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=todIBpFyOS3OoAmzi6bFOhy9k0vI6WZIfcjXT/8rt50=; b=Fk/x9yFM9CaQheigiTA07YmTkIhalzqE3U+fpTxTJ7NZmYdFms7qpU4Mm+B1HoJXqR M+BR4nSb/6Z5AE4v8tkGyC1+hRpFKgcqzBsbRJSpKdLWuTvfLKp8WdjLei3cOtD2F22+ lAFooYx+IqEgKLRBCBvd414C7n4p+pRZHGIhiyCNvKhxCKJ+nwP6bX5it8GSxDlB00Em MilK2oFqsEwoygss+XIWhUby0FIBxtD6f45KnfoD5Zts9nByLCkOXrDyNDAMPYeSpQpV UyjaSxZM6COPZly+29wSO5xu/VeVmWyWr5Il+C/qA23RFE6YcGQSL3/nlGCqZ1DKITI/ h10w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796202922; x=1796807722; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=todIBpFyOS3OoAmzi6bFOhy9k0vI6WZIfcjXT/8rt50=; b=kZ/0x3hsA4QT3A3DEXIRcSMcqannk+PfiOQYo5GT1gwnQTse8lKtom3UNpwyq9F+kk d71sXQyD57GCZHWhmwvrfhend8owSWInrGsIj7nKlWB3Wbfa4090Dy2GrrfPjWh3aKw/ u2J51dsSYc5PM1m7DTEcXb+y3lVUv/PM3gY5xarIUGgXBLVqtPV5FieFUFR7Q2Qa2a+E yAJy1yiCZwr4nQCaxxAScMQKS0eLLmG5DZU6bxK3l9Nb3o4A6erh5hDvroXMMegbLnj5 on52gX8FyA6xp9yxzYuvZGo3tavfjnVDu5A1Yc9bh39WZB5LqpC6HfgMWxloafFCxyQL MqGQ== X-Gm-Message-State: APuU4Z/jNeBsS6PmYHe2OcUjWUfCX3tx9N4XOVi+6CciV1ifnM7vBOSg 8eMMTHtYwpZWGZrOw57YutEW5PZNGDzj9FmzwtGyTcY/Tara6oYGUjFQ X-Gm-Gg: AZFdTZdl+3iTLlC4Ars3r2K+n7CpvbmWvx0OxdwnsOvH9Y95EUlDSjzL4N9OuN6cZ6P a9XX2ch6yF4PNQRQuExwqalpsk738rm7TPmk1R/HY+AI79BDLlv1BK4lyrGEO2uFq43BUdoVJ9r wRnRio851YhAG2Z7khSEGpk85cSTlp0E5rfW3thFIrVE1pZ/TMBBagU4EX8lhgRJW3ESMtVtsGS iqQWsIMbRAr8EX3yCJEVspijiPZ7oCyPZFiFlYSdj2e0a4FKCaZoU83CvvFFYZ+wZ10J1iLAn2v LRq8Jof7AZSNgTzKyIeqjK8JtkbBGSZYX11C6f20MgQCdAfTpiDfIWYXnx+3loXwtchjodbe7Ov 1tK+7DHEJKnlIoRP9h10WvBcVQrQ0h5CzzrBco+jpD9IkveD7soMTFl/wNAbMmL1D4niNji3lME F9UJFqwRMQElFfVMbPMWWMxq+Ce9rxoHpTmJWZSgAV65X2r5u6qZpQF6XtsEitDgS08mUR2WKV+ H1AxHw5vw5jbrOC4zk5nhT3Fhm7Wnm8u4/zDka5saY0mEEWLy8hoSZxyGQ/ZKRWBVij+eCzAe7H sfExnSCUEC669dOqMYyDq0MF4oFmIYEnP5Irc+Xo1VCxPQjP3zDPX5hQzfEnNTMAE9kbSf7T X-Received: by 2002:a17:903:32ca:b0:2e9:5c29:9955 with SMTP id d9443c01a7336-2f03f1e871amr657542705ad.4.1796202921704; Wed, 02 Dec 2026 01:15:21 -0800 (PST) Received: from security.datascience.hku.hk ([175.159.181.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f070a12491sm174572085ad.8.2026.12.02.01.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 01:15:21 -0800 (PST) From: Yu Junzhe To: Jens Axboe , Alasdair Kergon , Mike Snitzer , Mikulas Patocka , Benjamin Marzinski Cc: linux-block@vger.kernel.org, dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [BUG] blk_update_request: NULL integrity complete_fn on loop via dm-crypt integrity:none Date: Wed, 2 Dec 2026 09:15:17 +0000 Message-ID: <20261202091517.367-1-junzheyu1@gmail.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hello, I am reporting a NULL-pointer dereference in blk_update_request() on a successful REQ_INTEGRITY read. The request flag is set by dm-crypt "integrity::none" and the request completes on a loop queue that never registered an integrity profile. Summary ======= On 6.6, blk_update_request() does: if (blk_integrity_rq(req) && req_op(req) == REQ_OP_READ && error == BLK_STS_OK) req->q->integrity.profile->complete_fn(req, nr_bytes); blk_integrity_rq() tests only rq->cmd_flags & REQ_INTEGRITY. The same unguarded call is in blk_complete_request(). dm-crypt "integrity:16:none" sets on_disk_tag_size. crypt_integrity_ctr(), which requires an underlying DM-DIF-EXT-TAG profile, runs only for AEAD or an integrity IV, so "none" loads on a plain loop device. On a read, kcryptd_io_read() clones the bio onto that loop device and dm_crypt_integrity_io_alloc() calls bio_integrity_alloc(), which sets REQ_INTEGRITY. Loop never calls blk_integrity_register(), so q->integrity.profile is NULL and the completion faults at offset 0x18. Affected ======== Same PoC (loop + dm-crypt integrity:16:none + read), KASAN, 2026-11-30: - Crashes: 6.6.163, 6.1.193, 5.15.226, 5.10.275 (RIP in blk_update_request, KASAN range [0x18-0x1f], profile pointer 0) - Does not crash: 7.4-rc5, 6.18.65, 6.12.119 (crypt table loads, 32 reads return, no oops) - First seen on 6.6.144 (campaign crash 7b701911f170e96193541cff13ccd4729c7fc5b6) - v6.11 removed struct blk_integrity_profile (e9f5f44ad372 "block: remove the blk_integrity_profile structure"). On 6.12 and later, integrity:N:none also leaves tuple_size at 0, so the read is not tagged REQ_INTEGRITY. - Files: block/blk-mq.c, drivers/md/dm-crypt.c - Config: CONFIG_BLK_DEV_INTEGRITY=y, CONFIG_DM_CRYPT=y, CONFIG_BLK_DEV_LOOP=y - Needs CAP_SYS_ADMIN Crash excerpt (packaged PoC, Linux 6.6.163 #1, ksoftirqd) ========================================================== KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f] CPU: 1 PID: 21 Comm: ksoftirqd/1 Not tainted 6.6.163 #1 RIP: 0010:blk_update_request+0xa5d/0x1190 Call Trace: blk_mq_end_request blk_complete_reqs handle_softirqs run_ksoftirqd A self-contained reproducer creates a loop device, loads one dm-crypt table ("aes-cbc-plain … integrity:16:none") over it, and preads the mapped device. I can send the Docker/QEMU package or test a patch. Thanks, Yu Junzhe FuzzAnything