bcachefs
bcachefs copied to clipboard
KASAN: vmalloc-out-of-bounds in bch2_trans_init+0x422/0x4c0
(On commit 1a54de93)
When initialising a new filesystem formatted with bcachefs format --acl --encrypted --discard /dev/nvme0n1p3
we hit a write-out-of-bounds that kills the mount and leaves the device in an unusable state:
[ 5051.620909] bcachefs (nvme0n1p3): initializing new filesystem
[ 5051.697326] bcachefs (nvme0n1p3): going read-write
[ 5053.062059] ================================================================================
[ 5053.062065] UBSAN: shift-out-of-bounds in /build/linux-unstable-46gnVV/linux-unstable-5.12.0+bcachefs.git20210621.1a54de93/fs/bcachefs/bkey.c:634:31
[ 5053.062082] shift exponent 64 is too large for 64-bit type 'long long unsigned int'
[ 5053.062085] CPU: 4 PID: 31716 Comm: bch-reclaim/nvm Tainted: P O 5.12.0+bcachefs.git20210621.1a54de93-1-debug #2-Ubuntu
[ 5053.062089] Hardware name: Dell Inc. XPS 15 9575/0C32VW, BIOS 1.7.1 07/07/2019
[ 5053.062091] Call Trace:
[ 5053.062094] dump_stack+0x9c/0xcf
[ 5053.062100] ubsan_epilogue+0x5/0x40
[ 5053.062103] __ubsan_handle_shift_out_of_bounds.cold+0x61/0xe9
[ 5053.062107] bch2_bkey_format_validate.cold+0x2c/0x95 [bcachefs]
[ 5053.062160] ? do_raw_spin_unlock+0x30/0x1f0
[ 5053.062164] validate_bset.constprop.0+0xfb2/0x24f0 [bcachefs]
[ 5053.062203] ? bch2_btree_node_alloc_replacement+0x2bd/0x3f0 [bcachefs]
[ 5053.062242] ? btree_split+0x1f1/0x1a50 [bcachefs]
[ 5053.062280] ? bch2_btree_split_leaf+0x191/0x8c0 [bcachefs]
[ 5053.062317] ? bch2_trans_commit_error+0x1fe/0xb60 [bcachefs]
[ 5053.062354] ? __bch2_trans_commit+0xe56/0x1dc0 [bcachefs]
[ 5053.062391] ? btree_node_sort+0x1580/0x1580 [bcachefs]
[ 5053.062428] ? bch2_extent_crc_pack+0x610/0x610 [bcachefs]
[ 5053.062470] ? extent_entry_is_crc.isra.0+0x20/0x20 [bcachefs]
[ 5053.062510] ? kthread+0x35f/0x430
[ 5053.062513] ? extent_ptr_invalid.constprop.0+0x2a/0x430 [bcachefs]
[ 5053.062552] ? bch2_bkey_ptrs_invalid+0x339/0xaa0 [bcachefs]
[ 5053.062593] ? do_raw_spin_lock+0x125/0x270
[ 5053.062596] ? bch2_extent_to_text+0x10/0x10 [bcachefs]
[ 5053.062636] ? rmqueue_pcplist.constprop.0+0x430/0x430
[ 5053.062639] ? kernel_init_free_pages+0xc7/0x1c0
[ 5053.062643] ? bch2_btree_ptr_v2_invalid+0x1b1/0x240 [bcachefs]
[ 5053.062683] ? bch2_btree_ptr_invalid+0x120/0x120 [bcachefs]
[ 5053.062723] ? bch2_bkey_invalid+0x15f/0x1a0 [bcachefs]
[ 5053.062758] ? __bch2_bkey_invalid+0x480/0x480 [bcachefs]
[ 5053.062794] validate_bset_for_write+0x88/0xb0 [bcachefs]
[ 5053.062831] __bch2_btree_node_write+0x1a2b/0x2630 [bcachefs]
[ 5053.062881] ? bch2_btree_write_error_work+0xf0/0xf0 [bcachefs]
[ 5053.062920] ? __build_rw_aux_tree+0x117/0x720 [bcachefs]
[ 5053.062959] ? bset_aux_tree_verify+0x16e/0x2e0 [bcachefs]
[ 5053.062997] ? bch2_btree_build_aux_trees+0xb9/0x230 [bcachefs]
[ 5053.063036] bch2_btree_node_write+0x98/0x1a0 [bcachefs]
[ 5053.063082] btree_split+0xe07/0x1a50 [bcachefs]
[ 5053.063124] ? btree_iter_set_search_pos+0x373/0x10f0 [bcachefs]
[ 5053.063164] bch2_btree_split_leaf+0x191/0x8c0 [bcachefs]
[ 5053.063204] ? bch2_btree_iter_verify+0xd1/0x1e0 [bcachefs]
[ 5053.063243] ? btree_iter_up_until_good_node+0x920/0x920 [bcachefs]
[ 5053.063282] bch2_trans_commit_error+0x1fe/0xb60 [bcachefs]
[ 5053.063323] ? btree_key_cache_flush_pos+0x42c/0x8b0 [bcachefs]
[ 5053.063363] ? maybe_do_btree_merge+0x490/0x490 [bcachefs]
[ 5053.063402] ? btree_iter_set_search_pos+0x373/0x10f0 [bcachefs]
[ 5053.063442] ? memmove+0x39/0x60
[ 5053.063446] ? bch2_btree_trans_verify_locks+0xf1/0x220 [bcachefs]
[ 5053.063485] __bch2_trans_commit+0xe56/0x1dc0 [bcachefs]
[ 5053.063526] ? bch2_btree_add_journal_pin+0x120/0x120 [bcachefs]
[ 5053.063566] ? __bch2_btree_iter_traverse+0x6c/0xc0 [bcachefs]
[ 5053.063605] ? bch2_btree_iter_traverse+0x1ff/0x2b0 [bcachefs]
[ 5053.063645] btree_key_cache_flush_pos+0x42c/0x8b0 [bcachefs]
[ 5053.063685] ? bch2_journal_preres_put+0x350/0x350 [bcachefs]
[ 5053.063723] ? mutex_lock+0xa1/0xf0
[ 5053.063728] bch2_btree_key_cache_journal_flush+0x236/0x290 [bcachefs]
[ 5053.063767] ? btree_key_cache_flush_pos+0x8b0/0x8b0 [bcachefs]
[ 5053.063806] ? _raw_spin_unlock_irqrestore+0xe/0x30
[ 5053.063811] ? bch2_btree_key_cache_journal_flush+0x218/0x290 [bcachefs]
[ 5053.063850] ? rwlock_bug.part.0+0x90/0x90
[ 5053.063853] ? rwlock_bug.part.0+0x90/0x90
[ 5053.063856] journal_flush_pins+0x2e9/0x870 [bcachefs]
[ 5053.063907] ? btree_key_cache_flush_pos+0x8b0/0x8b0 [bcachefs]
[ 5053.063948] __bch2_journal_reclaim+0x410/0x7e0 [bcachefs]
[ 5053.063999] bch2_journal_reclaim_thread+0x2d3/0x7b0 [bcachefs]
[ 5053.064049] ? __bch2_journal_reclaim+0x7e0/0x7e0 [bcachefs]
[ 5053.064097] ? do_raw_spin_unlock+0x55/0x1f0
[ 5053.064100] ? __kthread_parkme+0xcb/0x1b0
[ 5053.064103] ? __bch2_journal_reclaim+0x7e0/0x7e0 [bcachefs]
[ 5053.064151] kthread+0x35f/0x430
[ 5053.064154] ? __kthread_bind_mask+0x90/0x90
[ 5053.064157] ret_from_fork+0x22/0x30
[ 5053.064172] ================================================================================
[ 5053.377277] ------------[ cut here ]------------
[ 5053.377281] kernel BUG at fs/bcachefs/btree_update_leaf.c:1026!
[ 5053.377289] invalid opcode: 0000 [#1] SMP KASAN PTI
[ 5053.377293] CPU: 6 PID: 31708 Comm: mount Tainted: P O 5.12.0+bcachefs.git20210621.1a54de93-1-debug #2-Ubuntu
[ 5053.377298] Hardware name: Dell Inc. XPS 15 9575/0C32VW, BIOS 1.7.1 07/07/2019
[ 5053.377300] RIP: 0010:bch2_trans_update+0xae4/0x11f0 [bcachefs]
[ 5053.377347] Code: 44 0f b6 44 24 18 4c 8b 54 24 10 44 3a 43 06 0f 97 c2 0f 92 c0 38 c2 74 13 44 0f b6 f8 0f b6 d2 41 29 d7 e9 a2 f8 ff ff 0f 0b <0f> 0b 48 b8 00 00 00 00 00 fc ff df 48 8d 7b 08 48 89 fa 48 c1 ea
[ 5053.377351] RSP: 0018:ffffc90003787050 EFLAGS: 00010202
[ 5053.377355] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 1ffff920006f0e5b
[ 5053.377357] RDX: ffffc90003787740 RSI: 0000000000000004 RDI: ffff88824add0054
[ 5053.377360] RBP: ffff88824add0000 R08: 0000000000000000 R09: ffff88824add0054
[ 5053.377362] R10: dffffc0000000000 R11: ffffc90003787290 R12: ffffc90003787740
[ 5053.377364] R13: ffff88824add0000 R14: ffffc90003787290 R15: 0000000000000000
[ 5053.377366] FS: 00007f7809442800(0000) GS:ffff888450180000(0000) knlGS:0000000000000000
[ 5053.377369] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 5053.377372] CR2: 00007f108443e003 CR3: 00000002dba12001 CR4: 00000000003706e0
[ 5053.377374] Call Trace:
[ 5053.377377] ? bch2_btree_iter_prev_slot+0x470/0x470 [bcachefs]
[ 5053.377417] ? memory_failure_queue_kick+0x80/0x80
[ 5053.377423] ? extent_handle_overwrites+0x23e0/0x23e0 [bcachefs]
[ 5053.377462] ? kfree+0xc9/0x550
[ 5053.377465] ? chacha_block_generic+0x97/0x260
[ 5053.377470] __bch2_btree_insert+0x180/0x210 [bcachefs]
[ 5053.377509] ? bch2_trans_update+0x11f0/0x11f0 [bcachefs]
[ 5053.377546] ? bch2_trans_init+0x1fe/0x4c0 [bcachefs]
[ 5053.377584] bch2_btree_insert+0xb7/0x150 [bcachefs]
[ 5053.377622] ? __bch2_btree_insert+0x210/0x210 [bcachefs]
[ 5053.377660] ? bch2_btree_insert+0x94/0x150 [bcachefs]
[ 5053.377697] ? bch2_get_next_online_dev.constprop.0+0x20a/0x21c [bcachefs]
[ 5053.377749] bch2_fs_initialize+0x50a/0x88c [bcachefs]
[ 5053.377797] ? bch2_fs_recovery.cold+0x927/0x927 [bcachefs]
[ 5053.377843] ? deref_stack_reg+0xe6/0x160
[ 5053.377847] ? bch2_mount+0xba3/0x1200 [bcachefs]
[ 5053.377894] ? orc_find.part.0+0x1c0/0x320
[ 5053.377898] ? deref_stack_reg+0x160/0x160
[ 5053.377901] ? idr_get_free+0x205/0x860
[ 5053.377905] ? node_tag_clear+0x8a/0x1d0
[ 5053.377908] ? idr_alloc_u32+0x17b/0x290
[ 5053.377911] ? __fprop_inc_percpu_max+0xf0/0xf0
[ 5053.377914] ? enable_ptr_key_workfn+0x20/0x20
[ 5053.377918] ? put_dec+0x90/0x90
[ 5053.377921] ? bch2_sb_replicas_to_cpu_replicas+0x1b0/0x1b0 [bcachefs]
[ 5053.377971] ? memmove+0x39/0x60
[ 5053.377974] ? __bch2_sb_field_resize+0x13f/0x340 [bcachefs]
[ 5053.378023] ? __copy_super+0x617/0x7e0 [bcachefs]
[ 5053.378071] ? bch2_recalc_capacity+0x468/0xab0 [bcachefs]
[ 5053.378105] ? __closure_wake_up+0x25/0x4e0
[ 5053.378110] bch2_fs_start+0x7f8/0x11f0 [bcachefs]
[ 5053.378157] ? bch2_dev_attach_bdev+0x297/0x410 [bcachefs]
[ 5053.378205] bch2_fs_open+0x706/0x950 [bcachefs]
[ 5053.378251] ? rwlock_bug.part.0+0x90/0x90
[ 5053.378255] ? rwlock_bug.part.0+0x90/0x90
[ 5053.378258] ? bch2_dev_lookup+0x240/0x240 [bcachefs]
[ 5053.378303] ? memory_failure_queue_kick+0x80/0x80
[ 5053.378307] ? slab_free_freelist_hook+0x61/0x180
[ 5053.378311] ? bch2_noset_super+0x10/0x10 [bcachefs]
[ 5053.378356] ? kfree+0xc9/0x550
[ 5053.378358] ? free_percpu.part.0+0x106/0x330
[ 5053.378362] ? sget+0x191/0x4c0
[ 5053.378366] bch2_mount+0xba4/0x1200 [bcachefs]
[ 5053.378410] ? bch2_lookup+0x180/0x180 [bcachefs]
[ 5053.378451] ? apparmor_getprocattr+0x2b0/0x2b0
[ 5053.378455] ? vfs_parse_fs_string+0xd7/0x130
[ 5053.378460] ? vfs_parse_fs_param+0x200/0x200
[ 5053.378463] ? bch2_lookup+0x180/0x180 [bcachefs]
[ 5053.378504] legacy_get_tree+0xf5/0x1e0
[ 5053.378508] vfs_get_tree+0x84/0x2c0
[ 5053.378511] do_new_mount+0x1a1/0x220
[ 5053.378515] path_mount+0x2aa/0xb20
[ 5053.378519] ? finish_automount+0x7b0/0x7b0
[ 5053.378522] ? getname_flags.part.0+0x8e/0x450
[ 5053.378526] ? _copy_from_user+0xab/0x100
[ 5053.378530] __x64_sys_mount+0x1fa/0x270
[ 5053.378533] ? path_mount+0xb20/0xb20
[ 5053.378536] ? from_kgid+0xc0/0xc0
[ 5053.378540] do_syscall_64+0x33/0x80
[ 5053.378544] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 5053.378548] RIP: 0033:0x7f780969dd3e
[ 5053.378552] Code: 48 8b 0d 2d 71 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d fa 70 0c 00 f7 d8 64 89 01 48
[ 5053.378554] RSP: 002b:00007ffdbed099b8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
[ 5053.378558] RAX: ffffffffffffffda RBX: 00007f78097cd264 RCX: 00007f780969dd3e
[ 5053.378561] RDX: 000055a0c28d2c60 RSI: 000055a0c28d2ca0 RDI: 000055a0c28d2c80
[ 5053.378563] RBP: 000055a0c28d2a30 R08: 0000000000000000 R09: 000055a0c28d39d0
[ 5053.378565] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
[ 5053.378567] R13: 000055a0c28d2c80 R14: 000055a0c28d2c60 R15: 000055a0c28d2a30
[ 5053.378570] Modules linked in: poly1305_generic libpoly1305 poly1305_x86_64 chacha_generic chacha_x86_64 libchacha bcachefs crc64 ufs qnx4 hfsplus hfs minix ntfs msdos xfs jfs btrfs blake2b_generic xor raid6_pq libcrc32c rfcomm cmac algif_hash algif_skcipher af_alg bnep zfs(PO) ath10k_pci ath10k_core zunicode(PO) zzstd(O) zlua(O) ath zavl(PO) icp(PO) mac80211 zcommon(PO) znvpair(PO) spl(O) x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm cfg80211 mei_hdcp intel_rapl_msr snd_hda_codec_hdmi dell_laptop dell_smm_hwmon btusb snd_hda_codec_realtek btrtl btbcm btintel bluetooth snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec uvcvideo snd_hda_core dell_wmi dell_smbios dcdbas snd_hwdep videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 snd_pcm videobuf2_common videodev rapl intel_cstate snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device input_leds snd_timer serio_raw efi_pstore snd r8153_ecm cdc_ether usbnet
[ 5053.378667] dell_wmi_sysman r8152 wmi_bmof dell_wmi_descriptor intel_wmi_thunderbolt soundcore mc mii libarc4 cdc_acm ecdh_generic ecc hid_multitouch joydev hid_sensor_gyro_3d hid_sensor_magn_3d hid_sensor_accel_3d hid_sensor_custom_intel_hinge mei_me hid_sensor_incl_3d processor_thermal_device hid_sensor_rotation processor_thermal_rfim hid_sensor_trigger industrialio_triggered_buffer kfifo_buf processor_thermal_mbox processor_thermal_rapl hid_sensor_iio_common mei industrialio intel_rapl_common intel_soc_dts_iosf cros_ec_ishtp cros_ec intel_pch_thermal ucsi_acpi typec_ucsi typec soc_button_array int3403_thermal int340x_thermal_zone intel_vbtn mac_hid intel_hid acpi_pad sparse_keymap int3400_thermal acpi_thermal_rel sch_fq_codel msr parport_pc ppdev lp parport ip_tables x_tables autofs4 overlay nls_utf8 isofs nls_iso8859_1 dm_mirror dm_region_hash dm_log uas usb_storage wacom usbhid hid_sensor_custom hid_sensor_hub hid_generic intel_ishtp_loader intel_ishtp_hid mmc_block amdgpu
[ 5053.378747] rtsx_pci_sdmmc i915 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel iommu_v2 crypto_simd gpu_sched cryptd drm_ttm_helper ttm i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec nvme i2c_i801 intel_lpss_pci i2c_smbus rc_core i2c_hid_acpi nvme_core rtsx_pci i2c_hid intel_ish_ipc intel_lpss drm xhci_pci intel_ishtp idma64 xhci_pci_renesas wmi hid video
[ 5053.378789] ---[ end trace a2ae2e623cdd96ca ]---
[ 5054.273076] RIP: 0010:bch2_trans_update+0xae4/0x11f0 [bcachefs]
[ 5054.273138] Code: 44 0f b6 44 24 18 4c 8b 54 24 10 44 3a 43 06 0f 97 c2 0f 92 c0 38 c2 74 13 44 0f b6 f8 0f b6 d2 41 29 d7 e9 a2 f8 ff ff 0f 0b <0f> 0b 48 b8 00 00 00 00 00 fc ff df 48 8d 7b 08 48 89 fa 48 c1 ea
[ 5054.273142] RSP: 0018:ffffc90003787050 EFLAGS: 00010202
[ 5054.273146] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 1ffff920006f0e5b
[ 5054.273149] RDX: ffffc90003787740 RSI: 0000000000000004 RDI: ffff88824add0054
[ 5054.273151] RBP: ffff88824add0000 R08: 0000000000000000 R09: ffff88824add0054
[ 5054.273154] R10: dffffc0000000000 R11: ffffc90003787290 R12: ffffc90003787740
[ 5054.273156] R13: ffff88824add0000 R14: ffffc90003787290 R15: 0000000000000000
[ 5054.273158] FS: 00007f7809442800(0000) GS:ffff888450180000(0000) knlGS:0000000000000000
[ 5054.273161] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 5054.273164] CR2: 00007f108443e003 CR3: 00000002dba12001 CR4: 00000000003706e0
[ 5054.375133] ==================================================================
[ 5054.375140] BUG: KASAN: vmalloc-out-of-bounds in bch2_trans_init+0x422/0x4c0 [bcachefs]
[ 5054.375213] Write of size 8 at addr ffffc900037872a0 by task bch-reclaim/nvm/31716
[ 5054.375219] CPU: 6 PID: 31716 Comm: bch-reclaim/nvm Tainted: P D O 5.12.0+bcachefs.git20210621.1a54de93-1-debug #2-Ubuntu
[ 5054.375223] Hardware name: Dell Inc. XPS 15 9575/0C32VW, BIOS 1.7.1 07/07/2019
[ 5054.375225] Call Trace:
[ 5054.375229] dump_stack+0x9c/0xcf
[ 5054.375234] print_address_description.constprop.0+0x16/0xa0
[ 5054.375239] ? bch2_trans_init+0x422/0x4c0 [bcachefs]
[ 5054.375278] __kasan_report.cold+0x37/0x80
[ 5054.375283] ? bch2_trans_init+0x422/0x4c0 [bcachefs]
[ 5054.375321] kasan_report+0x38/0x50
[ 5054.375324] bch2_trans_init+0x422/0x4c0 [bcachefs]
[ 5054.375362] ? six_lock_read+0x11d/0x180
[ 5054.375366] bch2_btree_key_cache_journal_flush+0x218/0x290 [bcachefs]
[ 5054.375404] ? btree_key_cache_flush_pos+0x8b0/0x8b0 [bcachefs]
[ 5054.375451] ? bch2_btree_key_cache_journal_flush+0x218/0x290 [bcachefs]
[ 5054.375509] ? rwlock_bug.part.0+0x90/0x90
[ 5054.375512] ? rwlock_bug.part.0+0x90/0x90
[ 5054.375516] journal_flush_pins+0x2e9/0x870 [bcachefs]
[ 5054.375564] ? btree_key_cache_flush_pos+0x8b0/0x8b0 [bcachefs]
[ 5054.375603] __bch2_journal_reclaim+0x410/0x7e0 [bcachefs]
[ 5054.375651] bch2_journal_reclaim_thread+0x2d3/0x7b0 [bcachefs]
[ 5054.375697] ? __bch2_journal_reclaim+0x7e0/0x7e0 [bcachefs]
[ 5054.375743] ? do_raw_spin_unlock+0x55/0x1f0
[ 5054.375746] ? __kthread_parkme+0xcb/0x1b0
[ 5054.375749] ? __bch2_journal_reclaim+0x7e0/0x7e0 [bcachefs]
[ 5054.375794] kthread+0x35f/0x430
[ 5054.375797] ? __kthread_bind_mask+0x90/0x90
[ 5054.375800] ret_from_fork+0x22/0x30
[ 5054.375808] Memory state around the buggy address:
[ 5054.375811] ffffc90003787180: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
[ 5054.375813] ffffc90003787200: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
[ 5054.375816] >ffffc90003787280: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
[ 5054.375817] ^
[ 5054.375820] ffffc90003787300: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
[ 5054.375822] ffffc90003787380: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
[ 5054.375824] ==================================================================
[ 5054.375828] BUG: unable to handle page fault for address: ffffc900037872a0
[ 5054.375830] #PF: supervisor write access in kernel mode
[ 5054.375833] #PF: error_code(0x0002) - not-present page
[ 5054.375836] PGD 100000067 P4D 100000067 PUD 100ab1067 PMD 11abfd067 PTE 0
[ 5054.375844] Oops: 0002 [#2] SMP KASAN PTI
[ 5054.375847] CPU: 6 PID: 31716 Comm: bch-reclaim/nvm Tainted: P B D O 5.12.0+bcachefs.git20210621.1a54de93-1-debug #2-Ubuntu
[ 5054.375850] Hardware name: Dell Inc. XPS 15 9575/0C32VW, BIOS 1.7.1 07/07/2019
[ 5054.375852] RIP: 0010:bch2_trans_init+0x242/0x4c0 [bcachefs]
[ 5054.375892] Code: 00 4c 8b ad 78 2f 00 00 48 b8 00 00 00 00 00 fc ff df 49 8d 7d 08 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 de 01 00 00 4c 89 e2 <4d> 89 65 08 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 80 3c 02 00
[ 5054.375895] RSP: 0018:ffffc90003df7aa8 EFLAGS: 00010282
[ 5054.375898] RAX: 0000000000000001 RBX: ffffc90003df7b68 RCX: ffffffff9f50d865
[ 5054.375901] RDX: ffffc90003df7b70 RSI: 0000000000000004 RDI: ffffffffa32bede0
[ 5054.375903] RBP: ffff888384040000 R08: 0000000000000000 R09: ffffffffa32bede3
[ 5054.375905] R10: fffffbfff4657dbc R11: 0000000000000001 R12: ffffc90003df7b70
[ 5054.375907] R13: ffffc90003787298 R14: ffff888384042f78 R15: ffff888384042f38
[ 5054.375910] FS: 0000000000000000(0000) GS:ffff888450180000(0000) knlGS:0000000000000000
[ 5054.375913] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 5054.375915] CR2: ffffc900037872a0 CR3: 000000041c21a005 CR4: 00000000003706e0
[ 5054.375917] Call Trace:
[ 5054.375919] ? six_lock_read+0x11d/0x180
[ 5054.375923] bch2_btree_key_cache_journal_flush+0x218/0x290 [bcachefs]
[ 5054.375962] ? btree_key_cache_flush_pos+0x8b0/0x8b0 [bcachefs]
[ 5054.376000] ? bch2_btree_key_cache_journal_flush+0x218/0x290 [bcachefs]
[ 5054.376037] ? rwlock_bug.part.0+0x90/0x90
[ 5054.376040] ? rwlock_bug.part.0+0x90/0x90
[ 5054.376043] journal_flush_pins+0x2e9/0x870 [bcachefs]
[ 5054.376090] ? btree_key_cache_flush_pos+0x8b0/0x8b0 [bcachefs]
[ 5054.376128] __bch2_journal_reclaim+0x410/0x7e0 [bcachefs]
[ 5054.376176] bch2_journal_reclaim_thread+0x2d3/0x7b0 [bcachefs]
[ 5054.376221] ? __bch2_journal_reclaim+0x7e0/0x7e0 [bcachefs]
[ 5054.376266] ? do_raw_spin_unlock+0x55/0x1f0
[ 5054.376269] ? __kthread_parkme+0xcb/0x1b0
[ 5054.376272] ? __bch2_journal_reclaim+0x7e0/0x7e0 [bcachefs]
[ 5054.376316] kthread+0x35f/0x430
[ 5054.376319] ? __kthread_bind_mask+0x90/0x90
[ 5054.376322] ret_from_fork+0x22/0x30
[ 5054.376326] Modules linked in: poly1305_generic libpoly1305 poly1305_x86_64 chacha_generic chacha_x86_64 libchacha bcachefs crc64 ufs qnx4 hfsplus hfs minix ntfs msdos xfs jfs btrfs blake2b_generic xor raid6_pq libcrc32c rfcomm cmac algif_hash algif_skcipher af_alg bnep zfs(PO) ath10k_pci ath10k_core zunicode(PO) zzstd(O) zlua(O) ath zavl(PO) icp(PO) mac80211 zcommon(PO) znvpair(PO) spl(O) x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm cfg80211 mei_hdcp intel_rapl_msr snd_hda_codec_hdmi dell_laptop dell_smm_hwmon btusb snd_hda_codec_realtek btrtl btbcm btintel bluetooth snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec uvcvideo snd_hda_core dell_wmi dell_smbios dcdbas snd_hwdep videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 snd_pcm videobuf2_common videodev rapl intel_cstate snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device input_leds snd_timer serio_raw efi_pstore snd r8153_ecm cdc_ether usbnet
[ 5054.376423] dell_wmi_sysman r8152 wmi_bmof dell_wmi_descriptor intel_wmi_thunderbolt soundcore mc mii libarc4 cdc_acm ecdh_generic ecc hid_multitouch joydev hid_sensor_gyro_3d hid_sensor_magn_3d hid_sensor_accel_3d hid_sensor_custom_intel_hinge mei_me hid_sensor_incl_3d processor_thermal_device hid_sensor_rotation processor_thermal_rfim hid_sensor_trigger industrialio_triggered_buffer kfifo_buf processor_thermal_mbox processor_thermal_rapl hid_sensor_iio_common mei industrialio intel_rapl_common intel_soc_dts_iosf cros_ec_ishtp cros_ec intel_pch_thermal ucsi_acpi typec_ucsi typec soc_button_array int3403_thermal int340x_thermal_zone intel_vbtn mac_hid intel_hid acpi_pad sparse_keymap int3400_thermal acpi_thermal_rel sch_fq_codel msr parport_pc ppdev lp parport ip_tables x_tables autofs4 overlay nls_utf8 isofs nls_iso8859_1 dm_mirror dm_region_hash dm_log uas usb_storage wacom usbhid hid_sensor_custom hid_sensor_hub hid_generic intel_ishtp_loader intel_ishtp_hid mmc_block amdgpu
[ 5054.376504] rtsx_pci_sdmmc i915 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel iommu_v2 crypto_simd gpu_sched cryptd drm_ttm_helper ttm i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec nvme i2c_i801 intel_lpss_pci i2c_smbus rc_core i2c_hid_acpi nvme_core rtsx_pci i2c_hid intel_ish_ipc intel_lpss drm xhci_pci intel_ishtp idma64 xhci_pci_renesas wmi hid video
[ 5054.376546] CR2: ffffc900037872a0
[ 5054.376549] ---[ end trace a2ae2e623cdd96cb ]---
[ 5055.274451] RIP: 0010:bch2_trans_update+0xae4/0x11f0 [bcachefs]
[ 5055.274564] Code: 44 0f b6 44 24 18 4c 8b 54 24 10 44 3a 43 06 0f 97 c2 0f 92 c0 38 c2 74 13 44 0f b6 f8 0f b6 d2 41 29 d7 e9 a2 f8 ff ff 0f 0b <0f> 0b 48 b8 00 00 00 00 00 fc ff df 48 8d 7b 08 48 89 fa 48 c1 ea
[ 5055.274571] RSP: 0018:ffffc90003787050 EFLAGS: 00010202
[ 5055.274577] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 1ffff920006f0e5b
[ 5055.274582] RDX: ffffc90003787740 RSI: 0000000000000004 RDI: ffff88824add0054
[ 5055.274587] RBP: ffff88824add0000 R08: 0000000000000000 R09: ffff88824add0054
[ 5055.274591] R10: dffffc0000000000 R11: ffffc90003787290 R12: ffffc90003787740
[ 5055.274594] R13: ffff88824add0000 R14: ffffc90003787290 R15: 0000000000000000
[ 5055.274597] FS: 0000000000000000(0000) GS:ffff888450180000(0000) knlGS:0000000000000000
[ 5055.274601] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 5055.274604] CR2: ffffc900037872a0 CR3: 000000010ca66003 CR4: 00000000003706e0
[ 5055.274608] BUG: sleeping function called from invalid context at include/linux/percpu-rwsem.h:49
[ 5055.274612] in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 31716, name: bch-reclaim/nvm
[ 5055.274617] CPU: 6 PID: 31716 Comm: bch-reclaim/nvm Tainted: P B D O 5.12.0+bcachefs.git20210621.1a54de93-1-debug #2-Ubuntu
[ 5055.274624] Hardware name: Dell Inc. XPS 15 9575/0C32VW, BIOS 1.7.1 07/07/2019
[ 5055.274628] Call Trace:
[ 5055.274633] dump_stack+0x9c/0xcf
[ 5055.274642] ___might_sleep.cold+0x131/0x160
[ 5055.274650] exit_signals+0x21/0x5a0
[ 5055.274657] do_exit+0x1f1/0xba0
[ 5055.274662] ? __kthread_parkme+0xcb/0x1b0
[ 5055.274667] ? exit_mm+0x540/0x540
[ 5055.274672] ? kthread+0x35f/0x430
[ 5055.274677] rewind_stack_do_exit+0x17/0x20
[ 5055.274684] RIP: 0000:0x0
[ 5055.274692] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[ 5055.274696] RSP: 0000:0000000000000000 EFLAGS: 00000000 ORIG_RAX: 0000000000000000
[ 5055.274702] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[ 5055.274707] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[ 5055.274710] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
[ 5055.274715] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 5055.274718] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Aha! With some playing, it looks like the kernel BUG at fs/bcachefs/btree_update_leaf.c:1026
is triggered for filesystems using encryption but not --no_passphrase
.