Bug 216260

Summary: ubifs: Potential AA deadlock in ubifs setxattr for encrypted file
Product: File System Reporter: Zhihao Cheng (chengzhihao1)
Component: OtherAssignee: fs_other
Status: NEW ---    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.19.0-rc7 Subsystem:
Regression: No Bisected commit-id:
Attachments: setup.sh

Description Zhihao Cheng 2022-07-19 04:28:53 UTC
Created attachment 301455 [details]
setup.sh

CONFIG_FS_ENCRYPTION=y  CONFIG_DETECT_HUNG_TASK=y

$ ./setup.sh 1 e

[  102.620871] INFO: task setfattr:1599 blocked for more than 10 seconds.
[  102.625298]       Not tainted 5.19.0-rc7-00001-gb666b6823ce0-dirty #711
[  102.627189] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  102.628732] task:setfattr        state:D stack:    0 pid: 1599 ppid:  1556 flags:0x00000000
[  102.628749] Call Trace:
[  102.628753]  <TASK>
[  102.628776]  __schedule+0x482/0x1060
[  102.629964]  schedule+0x92/0x1a0
[  102.629976]  rwsem_down_read_slowpath+0x287/0x8c0
[  102.629986]  ? _printk+0x5f/0x7d
[  102.629996]  down_read+0x84/0x170
[  102.630585]  ubifs_xattr_get+0xd1/0x370 [ubifs]
[  102.630730]  ubifs_crypt_get_context+0x1f/0x30 [ubifs]
[  102.630791]  fscrypt_get_encryption_info+0x7d/0x1c0
[  102.630802]  ? security_inode_alloc+0x5b/0x120
[  102.630810]  fscrypt_policy_to_inherit+0x56/0xc0
[  102.630817]  fscrypt_prepare_new_inode+0x35/0x160
[  102.630822]  ? current_time+0x53/0xb0
[  102.630830]  ubifs_new_inode+0xcc/0x4b0 [ubifs]
[  102.630873]  ubifs_xattr_set+0x591/0x9f0 [ubifs]
[  102.630915]  ? ubifs_tnc_read_node+0x6b/0x2b0 [ubifs]
[  102.630961]  xattr_set+0x8c/0x3e0 [ubifs]
[  102.631003]  __vfs_setxattr+0x71/0xc0
[  102.631011]  __vfs_setxattr_noperm+0x8d/0x330
[  102.631019]  __vfs_setxattr_locked+0x187/0x1d0
[  102.631026]  vfs_setxattr+0x105/0x270
[  102.631034]  do_setxattr+0x6d/0x110
[  102.631041]  setxattr+0xa0/0xd0
[  102.631049]  ? getname_flags+0x6d/0x330
[  102.631056]  ? putname+0x75/0xa0
[  102.631060]  ? kmem_cache_free+0x1a7/0x690
[  102.631066]  ? preempt_count_add+0x83/0x130
[  102.631074]  ? __mnt_want_write+0xbd/0x120
[  102.631079]  path_setxattr+0x118/0x150
[  102.631087]  __x64_sys_setxattr+0x2f/0x40
[  102.631093]  do_syscall_64+0x35/0x80
[  102.631100]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
[  102.631113] RIP: 0033:0x7f57a4d0b4e9
[  102.631120] RSP: 002b:00007ffd8bb57b18 EFLAGS: 00000246 ORIG_RAX: 00000000000000bc
[  102.631128] RAX: ffffffffffffffda RBX: 00007ffd8bb5947a RCX: 00007f57a4d0b4e9
[  102.631132] RDX: 000055b288004000 RSI: 00007ffd8bb5946a RDI: 00007ffd8bb5947a
[  102.631135] RBP: 00007ffd8bb5946a R08: 0000000000000000 R09: 0000000000000000
[  102.631138] R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000006
[  102.631141] R13: 00007ffd8bb57c60 R14: 0000000000000000 R15: 0000000000000000