Message ID | 20240830185345.3696027-1-kbusch@meta.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | blk-mq: set the nr_integrity_segments from bio | expand |
Hello, kernel test robot noticed "Oops:general_protection_fault,probably_for_non-canonical_address#:#[##]PREEMPT_KASAN_PTI" on: commit: d39ca28939760f793e6f4029f4269caef0885771 ("[PATCH] blk-mq: set the nr_integrity_segments from bio") url: https://github.com/intel-lab-lkp/linux/commits/Keith-Busch/blk-mq-set-the-nr_integrity_segments-from-bio/20240831-025504 base: https://git.kernel.org/cgit/linux/kernel/git/axboe/linux-block.git for-next patch link: https://lore.kernel.org/all/20240830185345.3696027-1-kbusch@meta.com/ patch subject: [PATCH] blk-mq: set the nr_integrity_segments from bio in testcase: boot compiler: gcc-12 test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G (please refer to attached dmesg/kmsg for entire log/backtrace) +------------------------------------------------------------------------------------------+------------+------------+ | | 81c0619ef2 | d39ca28939 | +------------------------------------------------------------------------------------------+------------+------------+ | boot_successes | 24 | 0 | | boot_failures | 0 | 24 | | Oops:general_protection_fault,probably_for_non-canonical_address#:#[##]PREEMPT_KASAN_PTI | 0 | 24 | | KASAN:null-ptr-deref_in_range[#-#] | 0 | 24 | | RIP:blk_rq_count_integrity_sg | 0 | 24 | | Kernel_panic-not_syncing:Fatal_exception | 0 | 24 | +------------------------------------------------------------------------------------------+------------+------------+ If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <oliver.sang@intel.com> | Closes: https://lore.kernel.org/oe-lkp/202409031022.47173965-lkp@intel.com [ 13.866675][ T10] Floppy drive(s): fd0 is 2.88M AMI BIOS [ 13.883660][ T10] FDC 0 is a S82078B [ 13.915762][ T1] brd: module loaded [ 13.934459][ T1] loop: module loaded [ 13.975366][ T1] zram: Added device: zram0 [ 13.980204][ T1] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000002: 0000 [#1] PREEMPT KASAN PTI [ 13.980294][ T1] KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017] [ 13.980294][ T1] CPU: 0 UID: 0 PID: 1 Comm: swapper Not tainted 6.11.0-rc5-00104-gd39ca2893976 #1 [ 13.980294][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 [ 13.980294][ T1] RIP: 0010:blk_rq_count_integrity_sg (kbuild/src/consumer/block/blk-integrity.c:35 (discriminator 9)) [ 13.980294][ T1] Code: 24 10 41 89 fb 48 8d 79 60 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 b5 03 00 00 4c 8b 61 60 49 8d 7c 24 10 48 89 fa 48 c1 ea 03 <0f> b6 14 02 84 d2 74 09 80 fa 03 0f 8e cf 04 00 00 45 8b 74 24 10 All code ======== 0: 24 10 and $0x10,%al 2: 41 89 fb mov %edi,%r11d 5: 48 8d 79 60 lea 0x60(%rcx),%rdi 9: 48 89 fa mov %rdi,%rdx c: 48 c1 ea 03 shr $0x3,%rdx 10: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) 14: 0f 85 b5 03 00 00 jne 0x3cf 1a: 4c 8b 61 60 mov 0x60(%rcx),%r12 1e: 49 8d 7c 24 10 lea 0x10(%r12),%rdi 23: 48 89 fa mov %rdi,%rdx 26: 48 c1 ea 03 shr $0x3,%rdx 2a:* 0f b6 14 02 movzbl (%rdx,%rax,1),%edx <-- trapping instruction 2e: 84 d2 test %dl,%dl 30: 74 09 je 0x3b 32: 80 fa 03 cmp $0x3,%dl 35: 0f 8e cf 04 00 00 jle 0x50a 3b: 45 8b 74 24 10 mov 0x10(%r12),%r14d Code starting with the faulting instruction =========================================== 0: 0f b6 14 02 movzbl (%rdx,%rax,1),%edx 4: 84 d2 test %dl,%dl 6: 74 09 je 0x11 8: 80 fa 03 cmp $0x3,%dl b: 0f 8e cf 04 00 00 jle 0x4e0 11: 45 8b 74 24 10 mov 0x10(%r12),%r14d [ 13.980294][ T1] RSP: 0000:ffffc9000001f048 EFLAGS: 00010202 [ 13.980294][ T1] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffff88813c415200 [ 13.980294][ T1] RDX: 0000000000000002 RSI: ffffed1027ae1c3e RDI: 0000000000000010 [ 13.980294][ T1] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 [ 13.980294][ T1] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 13.980294][ T1] R13: 0000000000000000 R14: ffff88813d70e0e0 R15: 0000000000000000 [ 13.980294][ T1] FS: 0000000000000000(0000) GS:ffffffff87797000(0000) knlGS:0000000000000000 [ 13.980294][ T1] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 13.980294][ T1] CR2: ffff88843ffff000 CR3: 000000000776c000 CR4: 00000000000406f0 [ 13.980294][ T1] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 13.980294][ T1] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 13.980294][ T1] Call Trace: [ 13.980294][ T1] <TASK> [ 13.980294][ T1] ? die_addr (kbuild/src/consumer/arch/x86/kernel/dumpstack.c:421 kbuild/src/consumer/arch/x86/kernel/dumpstack.c:460) [ 13.980294][ T1] ? exc_general_protection (kbuild/src/consumer/arch/x86/kernel/traps.c:702 kbuild/src/consumer/arch/x86/kernel/traps.c:644) [ 13.980294][ T1] ? asm_exc_general_protection (kbuild/src/consumer/arch/x86/include/asm/idtentry.h:617) [ 13.980294][ T1] ? blk_rq_count_integrity_sg (kbuild/src/consumer/block/blk-integrity.c:35 (discriminator 9)) The kernel config and materials to reproduce are available at: https://download.01.org/0day-ci/archive/20240903/202409031022.47173965-lkp@intel.com
diff --git a/block/blk-mq.c b/block/blk-mq.c index 36abbaefe3874..56bcb599d8660 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2546,6 +2546,9 @@ static void blk_mq_bio_to_request(struct request *rq, struct bio *bio, rq->__sector = bio->bi_iter.bi_sector; rq->write_hint = bio->bi_write_hint; blk_rq_bio_prep(rq, bio, nr_segs); +#if defined(CONFIG_BLK_DEV_INTEGRITY) + rq->nr_integrity_segments = blk_rq_count_integrity_sg(rq->q, bio); +#endif /* This can't fail, since GFP_NOIO includes __GFP_DIRECT_RECLAIM. */ err = blk_crypto_rq_bio_prep(rq, bio, GFP_NOIO);