Skip to content

DLPX-91810 Merge conflict in linux-kernel-gcp #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from

Conversation

manoj-joseph
Copy link

Problem

Seb: I think we have a problem with the kernel repos this morning (all except the gcp repo, which wasn't touched). It looks like upstream was merged into develop instead of having had our patch sets rebased on top of upstream (starting with the @@DELPHIX_PATCHSET_START@@ commit).

Solution

Started with upstreams/develop and cherry-picked our patches with git cherry-pick bad90fed665350913c2181f159b82550af9c9c1b^..7587a1ff58290616e30fb7abc3d212ba2bf17d79.
After that, we are left with the following.

delphix@mj-build:~/linux-kernel-gcp$ git log -17 --abbrev-commit --oneline 
ec783f8ce521 (HEAD -> merge-3) DLPX-87970 Move Delphix annotations to linux-pkg to reduce merge conflicts (#32)
7511137859c6 DLPX-87710 upgrade from 6.0.16.0 to 15.0.0.0 failed because disk quota error (#30)
b3cc5d969781 DLPX-87344 Fix kernel merge conflict with upstream
8b618123020c DLPX-86675 Disk quota exceeded when unpacking an upgrade image (#28)
f122663a5447 DLPX-86177 Azure Accelerated networking broken because Mellanox drivers absent in kernel (#27)
7fe8651b34e7 DLPX-84906 Disable frame buffer drivers (#26)
f1476afbb8ae DLPX-84985 target: iscsi: fix deadlock in the iSCSI login code (#23)
183dd9926ed8 DLPX-84907 CVE-2022-3628 (#22)
bd5767c76755 DLPX-84469 Users unable to connect to CIFS mounts (#21)
7ceb7e857353 DLPX-83701 Make function mnt_add_count() traceable (#18)
7297788fe029 DLPX-83697 iscsi target login should wait until tx/rx threads have properly started
39d4a1eedb29 DLPX-83442 Disable various kernel modules which we don't use (#14)
9ec9b11ddd11 DLPX-72065 Aborted iSCSI command never completes after LUN reset (#4)
d89a72e4c8f7 DLPX-71852 iSCSI: journal flooded with "Unable to locate Target IQN" messages (#2)
4f0bf935990b @@DELPHIX_PATCHSET_START@@
145b221b3e20 (tag: Ubuntu-gcp-5.15-5.15.0-1065.73_20.04.1, origin/upstreams/develop, upstreams-develop) UBUNTU: Ubuntu-gcp-5.15-5.15.0-1065.73~20.04.1
7b93ac97f528 UBUNTU: link-to-tracker: update tracking bug
delphix@mj-build:~/linux-kernel-gcp$ 

Delphix User and others added 18 commits August 1, 2024 16:33
This is a placeholder commit to separate the Ubuntu kernel source and
our patches. Used by kernel_merge_with_upstream() in the linux-pkg repo.
The checks in nfsd_file_acquire() and nfsd_file_put() that directly
invoke filecache garbage collection are intended to keep cache
occupancy between a low- and high-watermark. The reason to limit the
capacity of the filecache is to keep filecache lookups reasonably
fast.

However, invoking garbage collection at those points has some
undesirable negative impacts. Files that are held open by NFSv4
clients often push the occupancy of the filecache over these
watermarks. At that point:

- Every call to nfsd_file_acquire() and nfsd_file_put() results in
  an LRU walk. This has the same effect on lookup latency as long
  chains in the hash table.
- Garbage collection will then run on every nfsd thread, causing a
  lot of unnecessary lock contention.
- Limiting cache capacity pushes out files used only by NFSv3
  clients, which are the type of files the filecache is supposed to
  help.

To address those negative impacts, remove the direct calls to the
garbage collector.
@manoj-joseph
Copy link
Author

Force pushed to develop.

delphix@mj-build:~/linux-kernel-gcp$ git log -20 --abbrev-commit --oneline 
ec783f8ce521 (HEAD -> merge-3) DLPX-87970 Move Delphix annotations to linux-pkg to reduce merge conflicts (#32)
7511137859c6 DLPX-87710 upgrade from 6.0.16.0 to 15.0.0.0 failed because disk quota error (#30)
b3cc5d969781 DLPX-87344 Fix kernel merge conflict with upstream
8b618123020c DLPX-86675 Disk quota exceeded when unpacking an upgrade image (#28)
f122663a5447 DLPX-86177 Azure Accelerated networking broken because Mellanox drivers absent in kernel (#27)
7fe8651b34e7 DLPX-84906 Disable frame buffer drivers (#26)
f1476afbb8ae DLPX-84985 target: iscsi: fix deadlock in the iSCSI login code (#23)
183dd9926ed8 DLPX-84907 CVE-2022-3628 (#22)
bd5767c76755 DLPX-84469 Users unable to connect to CIFS mounts (#21)
7ceb7e857353 DLPX-83701 Make function mnt_add_count() traceable (#18)
7297788fe029 DLPX-83697 iscsi target login should wait until tx/rx threads have properly started
39d4a1eedb29 DLPX-83442 Disable various kernel modules which we don't use (#14)
9ec9b11ddd11 DLPX-72065 Aborted iSCSI command never completes after LUN reset (#4)
d89a72e4c8f7 DLPX-71852 iSCSI: journal flooded with "Unable to locate Target IQN" messages (#2)
4f0bf935990b @@DELPHIX_PATCHSET_START@@
145b221b3e20 (tag: Ubuntu-gcp-5.15-5.15.0-1065.73_20.04.1, origin/upstreams/develop, upstreams-develop) UBUNTU: Ubuntu-gcp-5.15-5.15.0-1065.73~20.04.1
7b93ac97f528 UBUNTU: link-to-tracker: update tracking bug
bd853531bd1c UBUNTU: Start new release
411dabdf7c51 UBUNTU: Ubuntu-gcp-5.15-5.15.0-1064.72~20.04.2
fa47e10c8a40 UBUNTU: [Packaging] debian.gcp-5.15/dkms-versions -- update from kernel-versions (main/2024.06.10)
delphix@mj-build:~/linux-kernel-gcp$ git push --force origin merge-3:develop
Enumerating objects: 131, done.
Counting objects: 100% (131/131), done.
Delta compression using up to 2 threads
Compressing objects: 100% (69/69), done.
Writing objects: 100% (102/102), 14.03 KiB | 4.68 MiB/s, done.
Total 102 (delta 73), reused 43 (delta 29)
remote: Resolving deltas: 100% (73/73), completed with 27 local objects.
remote: Bypassed rule violations for refs/heads/develop:
remote: 
remote: - Changes must be made through a pull request.
remote: 
remote: - 2 of 2 required status checks are expected.
remote: 
remote: 
remote: GitHub found 2 vulnerabilities on delphix/linux-kernel-gcp's default branch (2 moderate). To find out more, visit:
remote:      https://github.com/delphix/linux-kernel-gcp/security/dependabot
remote: 
To https://github.com/delphix/linux-kernel-gcp.git
 + 7587a1ff5829...ec783f8ce521 merge-3 -> develop (forced update)
delphix@mj-build:~/linux-kernel-gcp$ 

delphix-devops-bot pushed a commit that referenced this pull request Apr 27, 2025
BugLink: https://bugs.launchpad.net/bugs/2097298

[ Upstream commit fcede1f ]

Our syzkaller report a following UAF for v6.6:

BUG: KASAN: slab-use-after-free in bfq_init_rq+0x175d/0x17a0 block/bfq-iosched.c:6958
Read of size 8 at addr ffff8881b57147d8 by task fsstress/232726

CPU: 2 PID: 232726 Comm: fsstress Not tainted 6.6.0-g3629d1885222 #39
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x91/0xf0 lib/dump_stack.c:106
 print_address_description.constprop.0+0x66/0x300 mm/kasan/report.c:364
 print_report+0x3e/0x70 mm/kasan/report.c:475
 kasan_report+0xb8/0xf0 mm/kasan/report.c:588
 hlist_add_head include/linux/list.h:1023 [inline]
 bfq_init_rq+0x175d/0x17a0 block/bfq-iosched.c:6958
 bfq_insert_request.isra.0+0xe8/0xa20 block/bfq-iosched.c:6271
 bfq_insert_requests+0x27f/0x390 block/bfq-iosched.c:6323
 blk_mq_insert_request+0x290/0x8f0 block/blk-mq.c:2660
 blk_mq_submit_bio+0x1021/0x15e0 block/blk-mq.c:3143
 __submit_bio+0xa0/0x6b0 block/blk-core.c:639
 __submit_bio_noacct_mq block/blk-core.c:718 [inline]
 submit_bio_noacct_nocheck+0x5b7/0x810 block/blk-core.c:747
 submit_bio_noacct+0xca0/0x1990 block/blk-core.c:847
 __ext4_read_bh fs/ext4/super.c:205 [inline]
 ext4_read_bh+0x15e/0x2e0 fs/ext4/super.c:230
 __read_extent_tree_block+0x304/0x6f0 fs/ext4/extents.c:567
 ext4_find_extent+0x479/0xd20 fs/ext4/extents.c:947
 ext4_ext_map_blocks+0x1a3/0x2680 fs/ext4/extents.c:4182
 ext4_map_blocks+0x929/0x15a0 fs/ext4/inode.c:660
 ext4_iomap_begin_report+0x298/0x480 fs/ext4/inode.c:3569
 iomap_iter+0x3dd/0x1010 fs/iomap/iter.c:91
 iomap_fiemap+0x1f4/0x360 fs/iomap/fiemap.c:80
 ext4_fiemap+0x181/0x210 fs/ext4/extents.c:5051
 ioctl_fiemap.isra.0+0x1b4/0x290 fs/ioctl.c:220
 do_vfs_ioctl+0x31c/0x11a0 fs/ioctl.c:811
 __do_sys_ioctl fs/ioctl.c:869 [inline]
 __se_sys_ioctl+0xae/0x190 fs/ioctl.c:857
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x70/0x120 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x78/0xe2

Allocated by task 232719:
 kasan_save_stack+0x22/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 __kasan_slab_alloc+0x87/0x90 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:188 [inline]
 slab_post_alloc_hook mm/slab.h:768 [inline]
 slab_alloc_node mm/slub.c:3492 [inline]
 kmem_cache_alloc_node+0x1b8/0x6f0 mm/slub.c:3537
 bfq_get_queue+0x215/0x1f00 block/bfq-iosched.c:5869
 bfq_get_bfqq_handle_split+0x167/0x5f0 block/bfq-iosched.c:6776
 bfq_init_rq+0x13a4/0x17a0 block/bfq-iosched.c:6938
 bfq_insert_request.isra.0+0xe8/0xa20 block/bfq-iosched.c:6271
 bfq_insert_requests+0x27f/0x390 block/bfq-iosched.c:6323
 blk_mq_insert_request+0x290/0x8f0 block/blk-mq.c:2660
 blk_mq_submit_bio+0x1021/0x15e0 block/blk-mq.c:3143
 __submit_bio+0xa0/0x6b0 block/blk-core.c:639
 __submit_bio_noacct_mq block/blk-core.c:718 [inline]
 submit_bio_noacct_nocheck+0x5b7/0x810 block/blk-core.c:747
 submit_bio_noacct+0xca0/0x1990 block/blk-core.c:847
 __ext4_read_bh fs/ext4/super.c:205 [inline]
 ext4_read_bh_nowait+0x15a/0x240 fs/ext4/super.c:217
 ext4_read_bh_lock+0xac/0xd0 fs/ext4/super.c:242
 ext4_bread_batch+0x268/0x500 fs/ext4/inode.c:958
 __ext4_find_entry+0x448/0x10f0 fs/ext4/namei.c:1671
 ext4_lookup_entry fs/ext4/namei.c:1774 [inline]
 ext4_lookup.part.0+0x359/0x6f0 fs/ext4/namei.c:1842
 ext4_lookup+0x72/0x90 fs/ext4/namei.c:1839
 __lookup_slow+0x257/0x480 fs/namei.c:1696
 lookup_slow fs/namei.c:1713 [inline]
 walk_component+0x454/0x5c0 fs/namei.c:2004
 link_path_walk.part.0+0x773/0xda0 fs/namei.c:2331
 link_path_walk fs/namei.c:3826 [inline]
 path_openat+0x1b9/0x520 fs/namei.c:3826
 do_filp_open+0x1b7/0x400 fs/namei.c:3857
 do_sys_openat2+0x5dc/0x6e0 fs/open.c:1428
 do_sys_open fs/open.c:1443 [inline]
 __do_sys_openat fs/open.c:1459 [inline]
 __se_sys_openat fs/open.c:1454 [inline]
 __x64_sys_openat+0x148/0x200 fs/open.c:1454
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x70/0x120 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x78/0xe2

Freed by task 232726:
 kasan_save_stack+0x22/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 kasan_save_free_info+0x2b/0x50 mm/kasan/generic.c:522
 ____kasan_slab_free mm/kasan/common.c:236 [inline]
 __kasan_slab_free+0x12a/0x1b0 mm/kasan/common.c:244
 kasan_slab_free include/linux/kasan.h:164 [inline]
 slab_free_hook mm/slub.c:1827 [inline]
 slab_free_freelist_hook mm/slub.c:1853 [inline]
 slab_free mm/slub.c:3820 [inline]
 kmem_cache_free+0x110/0x760 mm/slub.c:3842
 bfq_put_queue+0x6a7/0xfb0 block/bfq-iosched.c:5428
 bfq_forget_entity block/bfq-wf2q.c:634 [inline]
 bfq_put_idle_entity+0x142/0x240 block/bfq-wf2q.c:645
 bfq_forget_idle+0x189/0x1e0 block/bfq-wf2q.c:671
 bfq_update_vtime block/bfq-wf2q.c:1280 [inline]
 __bfq_lookup_next_entity block/bfq-wf2q.c:1374 [inline]
 bfq_lookup_next_entity+0x350/0x480 block/bfq-wf2q.c:1433
 bfq_update_next_in_service+0x1c0/0x4f0 block/bfq-wf2q.c:128
 bfq_deactivate_entity+0x10a/0x240 block/bfq-wf2q.c:1188
 bfq_deactivate_bfqq block/bfq-wf2q.c:1592 [inline]
 bfq_del_bfqq_busy+0x2e8/0xad0 block/bfq-wf2q.c:1659
 bfq_release_process_ref+0x1cc/0x220 block/bfq-iosched.c:3139
 bfq_split_bfqq+0x481/0xdf0 block/bfq-iosched.c:6754
 bfq_init_rq+0xf29/0x17a0 block/bfq-iosched.c:6934
 bfq_insert_request.isra.0+0xe8/0xa20 block/bfq-iosched.c:6271
 bfq_insert_requests+0x27f/0x390 block/bfq-iosched.c:6323
 blk_mq_insert_request+0x290/0x8f0 block/blk-mq.c:2660
 blk_mq_submit_bio+0x1021/0x15e0 block/blk-mq.c:3143
 __submit_bio+0xa0/0x6b0 block/blk-core.c:639
 __submit_bio_noacct_mq block/blk-core.c:718 [inline]
 submit_bio_noacct_nocheck+0x5b7/0x810 block/blk-core.c:747
 submit_bio_noacct+0xca0/0x1990 block/blk-core.c:847
 __ext4_read_bh fs/ext4/super.c:205 [inline]
 ext4_read_bh+0x15e/0x2e0 fs/ext4/super.c:230
 __read_extent_tree_block+0x304/0x6f0 fs/ext4/extents.c:567
 ext4_find_extent+0x479/0xd20 fs/ext4/extents.c:947
 ext4_ext_map_blocks+0x1a3/0x2680 fs/ext4/extents.c:4182
 ext4_map_blocks+0x929/0x15a0 fs/ext4/inode.c:660
 ext4_iomap_begin_report+0x298/0x480 fs/ext4/inode.c:3569
 iomap_iter+0x3dd/0x1010 fs/iomap/iter.c:91
 iomap_fiemap+0x1f4/0x360 fs/iomap/fiemap.c:80
 ext4_fiemap+0x181/0x210 fs/ext4/extents.c:5051
 ioctl_fiemap.isra.0+0x1b4/0x290 fs/ioctl.c:220
 do_vfs_ioctl+0x31c/0x11a0 fs/ioctl.c:811
 __do_sys_ioctl fs/ioctl.c:869 [inline]
 __se_sys_ioctl+0xae/0x190 fs/ioctl.c:857
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x70/0x120 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x78/0xe2

commit 1ba0403 ("block, bfq: fix uaf for accessing waker_bfqq after
splitting") fix the problem that if waker_bfqq is in the merge chain,
and current is the only procress, waker_bfqq can be freed from
bfq_split_bfqq(). However, the case that waker_bfqq is not in the merge
chain is missed, and if the procress reference of waker_bfqq is 0,
waker_bfqq can be freed as well.

Fix the problem by checking procress reference if waker_bfqq is not in
the merge_chain.

Fixes: 1ba0403 ("block, bfq: fix uaf for accessing waker_bfqq after splitting")
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20250108084148.1549973-1-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Noah Wager <noah.wager@canonical.com>
Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

7 participants