Yu Kuai
077a403354
block: don't allow a disk link holder to itself
...
After creating a dm device, then user can reload such dm with itself,
and dead loop will be triggered because dm keep looking up to itself.
Test procedures:
1) dmsetup create test --table "xxx sda", assume dm-0 is created
2) dmsetup suspend test
3) dmsetup reload test --table "xxx dm-0"
4) dmsetup resume test
Test result:
BUG: TASK stack guard page was hit at 00000000736a261f (stack is 000000008d12c88d..00000000c8dd82d5)
stack guard page: 0000 [#1 ] PREEMPT SMP
CPU: 29 PID: 946 Comm: systemd-udevd Not tainted 6.1.0-rc3-next-20221101-00006-g17640ca3b0ee #1295
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.fc31 04/01/2014
RIP: 0010:dm_prepare_ioctl+0xf/0x1e0
Code: da 48 83 05 4a 7c 99 0b 01 41 89 c4 eb cd e8 b8 1f 40 00 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 57 48 83 05 a1 5a 99 0b 01 <41> 56 49 89 d6 41 55 4c 8d af 90 02 00 00 9
RSP: 0018:ffffc90002090000 EFLAGS: 00010206
RAX: ffff8881049d6800 RBX: ffff88817e589000 RCX: 0000000000000000
RDX: ffffc90002090010 RSI: ffffc9000209001c RDI: ffff88817e589000
RBP: 00000000484a101d R08: 0000000000000000 R09: 0000000000000007
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000005331
R13: 0000000000005331 R14: 0000000000000000 R15: 0000000000000000
FS: 00007fddf9609200(0000) GS:ffff889fbfd40000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffc9000208fff8 CR3: 0000000179043000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
dm_blk_ioctl+0x50/0x1c0
? dm_prepare_ioctl+0xe0/0x1e0
dm_blk_ioctl+0x88/0x1c0
dm_blk_ioctl+0x88/0x1c0
......(a lot of same lines)
dm_blk_ioctl+0x88/0x1c0
dm_blk_ioctl+0x88/0x1c0
blkdev_ioctl+0x184/0x3e0
__x64_sys_ioctl+0xa3/0x110
do_syscall_64+0x35/0x80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fddf7306577
Code: b3 66 90 48 8b 05 11 89 2c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e1 88 8
RSP: 002b:00007ffd0b2ec318 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00005634ef478320 RCX: 00007fddf7306577
RDX: 0000000000000000 RSI: 0000000000005331 RDI: 0000000000000007
RBP: 0000000000000007 R08: 00005634ef4843e0 R09: 0000000000000080
R10: 00007fddf75cfb38 R11: 0000000000000246 R12: 00000000030d4000
R13: 0000000000000000 R14: 0000000000000000 R15: 00005634ef48b800
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:dm_prepare_ioctl+0xf/0x1e0
Code: da 48 83 05 4a 7c 99 0b 01 41 89 c4 eb cd e8 b8 1f 40 00 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 57 48 83 05 a1 5a 99 0b 01 <41> 56 49 89 d6 41 55 4c 8d af 90 02 00 00 9
RSP: 0018:ffffc90002090000 EFLAGS: 00010206
RAX: ffff8881049d6800 RBX: ffff88817e589000 RCX: 0000000000000000
RDX: ffffc90002090010 RSI: ffffc9000209001c RDI: ffff88817e589000
RBP: 00000000484a101d R08: 0000000000000000 R09: 0000000000000007
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000005331
R13: 0000000000005331 R14: 0000000000000000 R15: 0000000000000000
FS: 00007fddf9609200(0000) GS:ffff889fbfd40000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffc9000208fff8 CR3: 0000000179043000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Kernel panic - not syncing: Fatal exception in interrupt
Kernel Offset: disabled
---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
Fix the problem by forbidding a disk to create link to itself.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20221115141054.1051801-11-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-11-16 15:19:56 -07:00
..
2022-09-03 11:29:03 -06:00
2022-04-23 07:15:26 -06:00
2022-09-11 19:47:12 -05:00
2022-11-01 20:10:55 -06:00
2022-11-09 12:42:26 -07:00
2022-11-01 20:10:55 -06:00
2022-11-01 20:10:55 -06:00
2022-08-02 21:08:53 -06:00
2022-11-16 09:44:26 -07:00
2022-08-26 10:57:41 -10:00
2021-03-05 11:32:15 -07:00
2022-07-14 12:14:30 -06:00
2022-09-27 11:50:05 -06:00
2022-09-26 19:09:31 -06:00
2022-11-02 08:35:34 -06:00
2022-10-11 17:42:58 -06:00
2022-02-28 06:40:23 -07:00
2021-11-29 06:38:51 -07:00
2022-02-28 06:40:23 -07:00
2022-02-28 06:40:23 -07:00
2022-09-30 07:49:09 -06:00
2022-06-29 08:36:46 -06:00
2021-11-29 06:38:51 -07:00
2022-06-27 06:29:12 -06:00
2022-10-23 18:59:17 -06:00
2022-11-01 09:12:24 -06:00
2022-09-26 19:09:31 -06:00
2022-09-26 19:09:31 -06:00
2022-09-15 00:25:17 -06:00
2022-11-09 11:29:21 -07:00
2022-10-25 13:41:20 -06:00
2022-08-22 10:07:53 -06:00
2022-07-06 06:46:26 -06:00
2022-10-07 09:19:14 -07:00
2022-06-17 07:31:05 -06:00
2022-08-22 10:07:53 -06:00
2022-08-22 10:07:53 -06:00
2022-11-01 09:12:24 -06:00
2021-11-29 06:41:29 -07:00
2022-06-28 11:32:42 -06:00
2022-09-12 00:10:34 -06:00
2022-06-27 06:29:12 -06:00
2022-08-22 10:07:53 -06:00
2022-11-10 11:18:09 -07:00
2022-11-02 08:35:34 -06:00
2021-12-22 23:38:29 -05:00
2021-02-22 06:33:48 -07:00
2022-07-12 14:38:52 -06:00
2022-09-21 19:50:53 -06:00
2022-10-25 13:41:17 -06:00
2021-12-14 17:23:05 -07:00
2021-12-14 17:23:05 -07:00
2022-11-02 08:35:34 -06:00
2022-09-26 19:17:28 -06:00
2022-09-26 19:17:28 -06:00
2020-07-31 16:29:47 -06:00
2022-10-23 18:59:17 -06:00
2022-10-23 18:59:17 -06:00
2022-09-29 07:45:47 -06:00
2022-11-02 08:35:34 -06:00
2022-08-02 17:22:54 -06:00
2022-10-25 08:25:10 -06:00
2022-06-21 21:22:51 -04:00
2022-02-02 07:49:59 -07:00
2022-11-07 07:21:45 -07:00
2022-10-23 18:59:17 -06:00
2022-11-16 11:32:53 -07:00
2022-11-16 15:19:56 -07:00
2022-11-16 15:19:56 -07:00
2022-07-06 06:46:26 -06:00
2022-06-27 06:29:12 -06:00
2022-06-29 08:35:57 -06:00
2021-12-16 10:59:02 -07:00
2022-07-14 12:14:30 -06:00
2022-05-02 14:06:20 -06:00
2022-07-14 12:14:30 -06:00
2022-08-22 07:52:51 -06:00
2022-08-22 07:52:51 -06:00
2022-03-07 12:48:35 -07:00